@uwdata/vgplot 0.12.0 → 0.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,19 +1,19 @@
1
- var NW=Object.create;var ZI=Object.defineProperty;var OW=Object.getOwnPropertyDescriptor;var RW=Object.getOwnPropertyNames;var DW=Object.getPrototypeOf,LW=Object.prototype.hasOwnProperty;var fC=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Jn=(e,t)=>{for(var r in t)ZI(e,r,{get:t[r],enumerable:!0})},FW=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of RW(t))!LW.call(e,i)&&i!==r&&ZI(e,i,{get:()=>t[i],enumerable:!(n=OW(t,i))||n.enumerable});return e};var CW=(e,t,r)=>(r=e!=null?NW(DW(e)):{},FW(t||!e||!e.__esModule?ZI(r,"default",{value:e,enumerable:!0}):r,e));var jV=fC((rne,zV)=>{"use strict";function Xat(e,t,r,n,i){for(var o=i+1;n<=i;){var s=n+i>>>1,a=e[s],c=r!==void 0?r(a,t):a-t;c>=0?(o=s,i=s-1):n=s+1}return o}function Hat(e,t,r,n,i){for(var o=i+1;n<=i;){var s=n+i>>>1,a=e[s],c=r!==void 0?r(a,t):a-t;c>0?(o=s,i=s-1):n=s+1}return o}function Qat(e,t,r,n,i){for(var o=n-1;n<=i;){var s=n+i>>>1,a=e[s],c=r!==void 0?r(a,t):a-t;c<0?(o=s,n=s+1):i=s-1}return o}function Zat(e,t,r,n,i){for(var o=n-1;n<=i;){var s=n+i>>>1,a=e[s],c=r!==void 0?r(a,t):a-t;c<=0?(o=s,n=s+1):i=s-1}return o}function Kat(e,t,r,n,i){for(;n<=i;){var o=n+i>>>1,s=e[o],a=r!==void 0?r(s,t):s-t;if(a===0)return o;a<=0?n=o+1:i=o-1}return-1}function j0(e,t,r,n,i,o){return typeof r=="function"?o(e,t,r,n===void 0?0:n|0,i===void 0?e.length-1:i|0):o(e,t,void 0,r===void 0?0:r|0,n===void 0?e.length-1:n|0)}zV.exports={ge:function(e,t,r,n,i){return j0(e,t,r,n,i,Xat)},gt:function(e,t,r,n,i){return j0(e,t,r,n,i,Hat)},lt:function(e,t,r,n,i){return j0(e,t,r,n,i,Qat)},le:function(e,t,r,n,i){return j0(e,t,r,n,i,Zat)},eq:function(e,t,r,n,i){return j0(e,t,r,n,i,Kat)}}});var QV=fC((nne,HV)=>{"use strict";var SI=jV(),ep=0,_f=1,vI=2;HV.exports=tct;function s8(e,t,r,n,i){this.mid=e,this.left=t,this.right=r,this.leftPoints=n,this.rightPoints=i,this.count=(t?t.count:0)+(r?r.count:0)+n.length}var q0=s8.prototype;function i8(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 YV(e,t){var r=rp(t);e.mid=r.mid,e.left=r.left,e.right=r.right,e.leftPoints=r.leftPoints,e.rightPoints=r.rightPoints,e.count=r.count}function qV(e,t){var r=e.intervals([]);r.push(t),YV(e,r)}function VV(e,t){var r=e.intervals([]),n=r.indexOf(t);return n<0?ep:(r.splice(n,1),YV(e,r),_f)}q0.intervals=function(e){return e.push.apply(e,this.leftPoints),this.left&&this.left.intervals(e),this.right&&this.right.intervals(e),e};q0.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)?qV(this,e):this.left.insert(e):this.left=rp([e]);else if(e[0]>this.mid)this.right?4*(this.right.count+1)>3*(t+1)?qV(this,e):this.right.insert(e):this.right=rp([e]);else{var r=SI.ge(this.leftPoints,e,a8),n=SI.ge(this.rightPoints,e,c8);this.leftPoints.splice(r,0,e),this.rightPoints.splice(n,0,e)}};q0.remove=function(e){var t=this.count-this.leftPoints;if(e[1]<this.mid){if(!this.left)return ep;var r=this.right?this.right.count:0;if(4*r>3*(t-1))return VV(this,e);var n=this.left.remove(e);return n===vI?(this.left=null,this.count-=1,_f):(n===_f&&(this.count-=1),n)}else if(e[0]>this.mid){if(!this.right)return ep;var i=this.left?this.left.count:0;if(4*i>3*(t-1))return VV(this,e);var n=this.right.remove(e);return n===vI?(this.right=null,this.count-=1,_f):(n===_f&&(this.count-=1),n)}else{if(this.count===1)return this.leftPoints[0]===e?vI:ep;if(this.leftPoints.length===1&&this.leftPoints[0]===e){if(this.left&&this.right){for(var o=this,s=this.left;s.right;)o=s,s=s.right;if(o===this)s.right=this.right;else{var a=this.left,n=this.right;o.count-=s.count,o.right=s.left,s.left=a,s.right=n}i8(this,s),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?i8(this,this.left):i8(this,this.right);return _f}for(var a=SI.ge(this.leftPoints,e,a8);a<this.leftPoints.length&&this.leftPoints[a][0]===e[0];++a)if(this.leftPoints[a]===e){this.count-=1,this.leftPoints.splice(a,1);for(var n=SI.ge(this.rightPoints,e,c8);n<this.rightPoints.length&&this.rightPoints[n][1]===e[1];++n)if(this.rightPoints[n]===e)return this.rightPoints.splice(n,1),_f}return ep}};function WV(e,t,r){for(var n=0;n<e.length&&e[n][0]<=t;++n){var i=r(e[n]);if(i)return i}}function GV(e,t,r){for(var n=e.length-1;n>=0&&e[n][1]>=t;--n){var i=r(e[n]);if(i)return i}}function XV(e,t){for(var r=0;r<e.length;++r){var n=t(e[r]);if(n)return n}}q0.queryPoint=function(e,t){if(e<this.mid){if(this.left){var r=this.left.queryPoint(e,t);if(r)return r}return WV(this.leftPoints,e,t)}else if(e>this.mid){if(this.right){var r=this.right.queryPoint(e,t);if(r)return r}return GV(this.rightPoints,e,t)}else return XV(this.leftPoints,t)};q0.queryInterval=function(e,t,r){if(e<this.mid&&this.left){var n=this.left.queryInterval(e,t,r);if(n)return n}if(t>this.mid&&this.right){var n=this.right.queryInterval(e,t,r);if(n)return n}return t<this.mid?WV(this.leftPoints,t,r):e>this.mid?GV(this.rightPoints,e,r):XV(this.leftPoints,r)};function Jat(e,t){return e-t}function a8(e,t){var r=e[0]-t[0];return r||e[1]-t[1]}function c8(e,t){var r=e[1]-t[1];return r||e[0]-t[0]}function rp(e){if(e.length===0)return null;for(var t=[],r=0;r<e.length;++r)t.push(e[r][0],e[r][1]);t.sort(Jat);for(var n=t[t.length>>1],i=[],o=[],s=[],r=0;r<e.length;++r){var a=e[r];a[1]<n?i.push(a):n<a[0]?o.push(a):s.push(a)}var c=s,l=s.slice();return c.sort(a8),l.sort(c8),new s8(n,rp(i),rp(o),c,l)}function o8(e){this.root=e}var np=o8.prototype;np.insert=function(e){this.root?this.root.insert(e):this.root=new s8(e[0],null,null,[e],[e])};np.remove=function(e){if(this.root){var t=this.root.remove(e);return t===vI&&(this.root=null),t!==ep}return!1};np.queryPoint=function(e,t){if(this.root)return this.root.queryPoint(e,t)};np.queryInterval=function(e,t,r){if(e<=t&&this.root)return this.root.queryInterval(e,t,r)};Object.defineProperty(np,"count",{get:function(){return this.root?this.root.count:0}});Object.defineProperty(np,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}});function tct(e){return!e||e.length===0?new o8(null):new o8(rp(e))}});var dC={};function fp(e,t=!1){let r,n,i=dC;function o(l){r=e(l).catch(()=>{}).finally(()=>{if(n){let{value:u}=n;n=null,o(u)}else r=null})}function s(l){n={event:l}}function a(l){r?s(l):o(l)}function c(l){i!==l&&requestAnimationFrame(()=>{let u=i;i=dC,a(u)}),i=l}return t?c:a}var Bn=class{constructor(t){this._filterBy=t,this._requestUpdate=fp(()=>this.requestQuery(),!0),this._coordinator=null}get coordinator(){return this._coordinator}set coordinator(t){this._coordinator=t}get filterBy(){return this._filterBy}get filterStable(){return!0}fields(){return null}fieldInfo(t){return this}query(t){return null}queryPending(){return this}queryResult(t){return this}queryError(t){return this}requestQuery(t){let r=t||this.query(this.filterBy?.predicate(this));return this._coordinator.requestQuery(this,r)}requestUpdate(){this._requestUpdate()}initialize(){return this._coordinator.initializeClient(this)}update(){return this}};var dp=Uint8Array.of(65,82,82,79,87,49),Ti={V1:0,V2:1,V3:2,V4:3,V5:4};var Ai={NONE:0,Schema:1,DictionaryBatch:2,RecordBatch:3,Tensor:4,SparseTensor:5},j={Dictionary:-1,NONE:0,Null:1,Int:2,Float:3,Binary:4,Utf8:5,Bool:6,Decimal:7,Date:8,Time:9,Timestamp:10,Interval:11,List:12,Struct:13,Union:14,FixedSizeBinary:15,FixedSizeList:16,Map:17,Duration:18,LargeBinary:19,LargeUtf8:20,LargeList:21,RunEndEncoded:22,BinaryView:23,Utf8View:24,ListView:25,LargeListView:26},Mf={HALF:0,SINGLE:1,DOUBLE:2},js={DAY:0,MILLISECOND:1},Tr={SECOND:0,MILLISECOND:1,MICROSECOND:2,NANOSECOND:3},Ei={YEAR_MONTH:0,DAY_TIME:1,MONTH_DAY_NANO:2},qs={Sparse:0,Dense:1};var Nf=Uint8Array,Sx=Uint16Array,Ix=Uint32Array,Tx=BigUint64Array,hp=Int8Array,hC=Int16Array,Pn=Int32Array,ti=BigInt64Array,KI=Float32Array,uc=Float64Array;function pC(e,t){let r=Math.log2(e)-3;return(t?[hp,hC,Pn,ti]:[Nf,Sx,Ix,Tx])[r]}var Ylt=Object.getPrototypeOf(Int8Array);function Of(e,t){let r=0,n=e.length;if(n<=2147483648)do{let i=r+n>>>1;e[i]<=t?r=i+1:n=i}while(r<n);else do{let i=Math.trunc((r+n)/2);e[i]<=t?r=i+1:n=i}while(r<n);return r}function Ax(e,t,r){if(t(e))return e;throw new Error(r(e))}function Un(e,t,r){return t=Array.isArray(t)?t:Object.values(t),Ax(e,n=>t.includes(n),r??(()=>`${e} must be one of ${t}`))}function Ex(e,t){for(let[r,n]of Object.entries(e))if(n===t)return r;return"<Unknown>"}var Vs=e=>`Unsupported data type: "${Ex(j,e)}" (id ${e})`,pp=(e,t,r=!0,n=null)=>({name:e,type:t,nullable:r,metadata:n});function mC(e){return Object.hasOwn(e,"name")&&yC(e.type)}function yC(e){return typeof e?.typeId=="number"}function fc(e,t="",r=!0){return mC(e)?e:pp(t,Ax(e,yC,()=>"Data type expected."),r)}var Mx=(e,t,r=!1,n=-1)=>({typeId:j.Dictionary,id:n,dictionary:e,indices:t||Rf(),ordered:r});var Nx=(e=32,t=!0)=>({typeId:j.Int,bitWidth:Un(e,[8,16,32,64]),signed:t,values:pC(e,t)});var Rf=()=>Nx(32);var JI=(e=2)=>({typeId:j.Float,precision:Un(e,Mf),values:[Sx,KI,uc][e]});var tT=()=>({typeId:j.Binary,offsets:Pn}),Ox=()=>({typeId:j.Utf8,offsets:Pn});var eT=(e,t,r=128)=>({typeId:j.Decimal,precision:e,scale:t,bitWidth:Un(r,[128,256]),values:Tx}),rT=e=>({typeId:j.Date,unit:Un(e,js),values:e===js.DAY?Pn:ti});var nT=(e=Tr.MILLISECOND,t=32)=>({typeId:j.Time,unit:Un(e,Tr),bitWidth:Un(t,[32,64]),values:t===32?Pn:ti});var Rx=(e=Tr.MILLISECOND,t=null)=>({typeId:j.Timestamp,unit:Un(e,Tr),timezone:t,values:ti}),iT=(e=Ei.MONTH_DAY_NANO)=>({typeId:j.Interval,unit:Un(e,Ei),values:e===Ei.MONTH_DAY_NANO?void 0:Pn}),Dx=e=>({typeId:j.List,children:[fc(e)],offsets:Pn}),Lx=e=>({typeId:j.Struct,children:Array.isArray(e)&&mC(e[0])?e:Object.entries(e).map(([t,r])=>pp(t,r))}),oT=(e,t,r,n)=>(r??=t.map((i,o)=>o),{typeId:j.Union,mode:Un(e,qs),typeIds:r,typeMap:r.reduce((i,o,s)=>(i[o]=s,i),{}),children:t.map((i,o)=>fc(i,`_${o}`)),typeIdForValue:n,offsets:Pn}),sT=e=>({typeId:j.FixedSizeBinary,stride:e}),Fx=(e,t)=>({typeId:j.FixedSizeList,stride:t,children:[fc(e)]}),gC=(e,t)=>({typeId:j.Map,keysSorted:e,children:[t],offsets:Pn});var aT=(e=Tr.MILLISECOND)=>({typeId:j.Duration,unit:Un(e,Tr),values:ti}),cT=()=>({typeId:j.LargeBinary,offsets:ti}),lT=()=>({typeId:j.LargeUtf8,offsets:ti}),uT=e=>({typeId:j.LargeList,children:[fc(e)],offsets:ti}),fT=(e,t)=>({typeId:j.RunEndEncoded,children:[Ax(fc(e,"run_ends"),r=>r.type.typeId===j.Int,()=>"Run-ends must have an integer type."),fc(t,"values")]});var dT=e=>({typeId:j.ListView,children:[fc(e,"value")],offsets:Pn}),hT=e=>({typeId:j.LargeListView,children:[fc(e,"value")],offsets:ti});var kW=new uc(2),Cx=kW.buffer,tut=new ti(Cx),eut=new Ix(Cx),rut=new Pn(Cx),nut=new Nf(Cx);function Uo(e){if(e>Number.MAX_SAFE_INTEGER||e<Number.MIN_SAFE_INTEGER)throw Error(`BigInt exceeds integer number representation: ${e}`);return Number(e)}function kx(e,t){return Number(e/t)+Number(e%t)/Number(t)}var Df=e=>BigInt.asUintN(64,e);function bC(e,t){let r=t<<1,n;return BigInt.asIntN(64,e[r+1])<0?(n=Df(~e[r])|Df(~e[r+1])<<64n,n=-(n+1n)):n=e[r]|e[r+1]<<64n,n}function _C(e,t){let r=t<<2,n;return BigInt.asIntN(64,e[r+3])<0?(n=Df(~e[r])|Df(~e[r+1])<<64n|Df(~e[r+2])<<128n|Df(~e[r+3])<<192n,n=-(n+1n)):n=e[r]|e[r+1]<<64n|e[r+2]<<128n|e[r+3]<<192n,n}var PW=new TextDecoder("utf-8"),cut=new TextEncoder;function Lf(e){return PW.decode(e)}var Cl=4;function pT(e,t){return(e[t>>3]&1<<t%8)!==0}function rn(e,t){let r=t+xe(e,t),n=r-xe(e,r),i=$r(e,n);return(o,s,a=null)=>{if(o<i){let c=$r(e,n+o);if(c)return s(e,r+c)}return a}}function eo(e,t){return t}function dc(e,t){return!!UW(e,t)}function UW(e,t){return mp(e,t)<<24>>24}function mp(e,t){return e[t]}function $r(e,t){return $W(e,t)<<16>>16}function $W(e,t){return e[t]|e[t+1]<<8}function xe(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function wC(e,t){return xe(e,t)>>>0}function Ar(e,t){return Uo(BigInt.asIntN(64,BigInt(wC(e,t))+(BigInt(wC(e,t+Cl))<<32n)))}function kl(e,t){let r=t+xe(e,t),n=xe(e,r);return r+=Cl,Lf(e.subarray(r,r+n))}function ei(e,t,r,n){if(!t)return[];let i=t+xe(e,t);return Array.from({length:xe(e,i)},(o,s)=>n(e,i+Cl+s*r))}var mT=Symbol("rowIndex");function yp(e,t){class r{constructor(o){this[mT]=o}toJSON(){return vC(e,t,this[mT])}}let n=r.prototype;for(let i=0;i<e.length;++i){if(Object.hasOwn(n,e[i]))continue;let o=t[i];Object.defineProperty(n,e[i],{get(){return o.at(this[mT])},enumerable:!0})}return i=>new r(i)}function Bx(e,t){return r=>vC(e,t,r)}function vC(e,t,r){let n={};for(let i=0;i<e.length;++i)n[e[i]]=t[i].at(r);return n}function SC(e){return e instanceof hc}var Bl=class{static ArrayType=null;constructor({length:t,nullCount:r,type:n,validity:i,values:o,offsets:s,sizes:a,children:c}){this.length=t,this.nullCount=r,this.type=n,this.validity=i,this.values=o,this.offsets=s,this.sizes=a,this.children=c,(!r||!this.validity)&&(this.at=l=>this.value(l))}get[Symbol.toStringTag](){return"Batch"}at(t){return this.isValid(t)?this.value(t):null}isValid(t){return pT(this.validity,t)}value(t){return this.values[t]}slice(t,r){let n=r-t,i=Array(n);for(let o=0;o<n;++o)i[o]=this.at(t+o);return i}*[Symbol.iterator](){for(let t=0;t<this.length;++t)yield this.at(t)}},hc=class extends Bl{constructor(t){super(t);let{length:r,values:n}=this;this.values=n.subarray(0,r)}slice(t,r){return this.nullCount?super.slice(t,r):this.values.subarray(t,r)}[Symbol.iterator](){return this.nullCount?super[Symbol.iterator]():this.values[Symbol.iterator]()}},gp=class extends Bl{static ArrayType=uc},$e=class extends Bl{static ArrayType=Array},xp=class extends $e{value(t){return null}},$o=class extends gp{value(t){return Uo(this.values[t])}},Px=class extends gp{value(t){let r=this.values[t],n=(r&31744)>>10,i=(r&1023)/1024,o=(-1)**((r&32768)>>15);switch(n){case 31:return o*(i?Number.NaN:1/0);case 0:return o*(i?6103515625e-14*i:0)}return o*2**(n-15)*(1+i)}},Ux=class extends $e{value(t){return pT(this.values,t)}},$x=class extends Bl{constructor(t){super(t);let{bitWidth:r,scale:n}=this.type;this.decimal=r===128?bC:_C,this.scale=10n**BigInt(n)}},zx=class extends $x{static ArrayType=uc;value(t){return kx(this.decimal(this.values,t),this.scale)}},jx=class extends $x{static ArrayType=Array;value(t){return this.decimal(this.values,t)}},bp=class extends $e{constructor(t){super(t),this.source=t}value(t){return new Date(this.source.value(t))}},qx=class extends gp{value(t){return 864e5*this.values[t]}},IC=$o,Vx=class extends $o{value(t){return super.value(t)*1e3}},TC=$o,Yx=class extends $o{value(t){return kx(this.values[t],1000n)}},Wx=class extends $o{value(t){return kx(this.values[t],1000000n)}},Gx=class extends $e{value(t){return this.values.subarray(t<<1,t+1<<1)}},Xx=class extends $e{value(t){let r=this.values,n=t<<4;return Float64Array.of(xe(r,n),xe(r,n+4),Ar(r,n+8))}},AC=({values:e,offsets:t},r)=>e.subarray(t[r],t[r+1]),EC=({values:e,offsets:t},r)=>e.subarray(Uo(t[r]),Uo(t[r+1])),Hx=class extends $e{value(t){return AC(this,t)}},Qx=class extends $e{value(t){return EC(this,t)}},Zx=class extends $e{value(t){return Lf(AC(this,t))}},Kx=class extends $e{value(t){return Lf(EC(this,t))}},Jx=class extends $e{value(t){let r=this.offsets;return this.children[0].slice(r[t],r[t+1])}},tb=class extends $e{value(t){let r=this.offsets;return this.children[0].slice(Uo(r[t]),Uo(r[t+1]))}},eb=class extends $e{value(t){let r=this.offsets[t],n=r+this.sizes[t];return this.children[0].slice(r,n)}},rb=class extends $e{value(t){let r=this.offsets[t],n=r+this.sizes[t];return this.children[0].slice(Uo(r),Uo(n))}},nb=class extends $e{constructor(t){super(t),this.stride=this.type.stride}},ib=class extends nb{value(t){let{stride:r,values:n}=this;return n.subarray(t*r,(t+1)*r)}},ob=class extends nb{value(t){let{children:r,stride:n}=this;return r[0].slice(t*n,(t+1)*n)}};function MC({children:e,offsets:t},r){let[n,i]=e[0].children,o=t[r],s=t[r+1],a=[];for(let c=o;c<s;++c)a.push([n.at(c),i.at(c)]);return a}var sb=class extends $e{value(t){return MC(this,t)}},ab=class extends $e{value(t){return new Map(MC(this,t))}},_p=class extends $e{constructor({typeIds:t,...r}){super(r),this.typeIds=t,this.typeMap=this.type.typeMap}value(t,r=t){let{typeIds:n,children:i,typeMap:o}=this;return i[o[n[t]]].at(r)}},cb=class extends _p{value(t){return super.value(t,this.offsets[t])}},wp=class extends $e{constructor(t,r=Bx){super(t),this.names=this.type.children.map(n=>n.name),this.factory=r(this.names,this.children)}value(t){return this.factory(t)}},lb=class extends wp{constructor(t){super(t,yp)}},ub=class extends $e{value(t){let[{values:r},n]=this.children;return n.at(Of(r,t))}},fb=class extends $e{setDictionary(t){return this.dictionary=t,this.cache=t.cache(),this}value(t){return this.cache[this.key(t)]}key(t){return this.values[t]}},db=class extends $e{constructor({data:t,...r}){super(r),this.data=t}view(t){let{values:r,data:n}=this,i=t<<4,o=i+4,s=r,a=xe(s,i);return a>12&&(o=xe(s,i+12),s=n[xe(s,i+8)]),s.subarray(o,o+a)}},hb=class extends db{value(t){return this.view(t)}},pb=class extends db{value(t){return Lf(this.view(t))}};function yT(e){let t=[];return{add(r){return t.push(r),this},clear:()=>t=[],done:()=>new Pl(t,e)}}var Pl=class{constructor(t,r=t[0]?.type){this.type=r,this.length=t.reduce((o,s)=>o+s.length,0),this.nullCount=t.reduce((o,s)=>o+s.nullCount,0),this.data=t;let n=t.length,i=new Int32Array(n+1);if(n===1){let[o]=t;i[1]=o.length,this.at=s=>o.at(s)}else for(let o=0,s=0;o<n;++o)i[o+1]=s+=t[o].length;this.offsets=i}get[Symbol.toStringTag](){return"Column"}[Symbol.iterator](){let t=this.data;return t.length===1?t[0][Symbol.iterator]():zW(t)}at(t){let{data:r,offsets:n}=this,i=Of(n,t)-1;return r[i]?.at(t-n[i])}get(t){return this.at(t)}toArray(){let{length:t,nullCount:r,data:n}=this,i=!r&&SC(n[0]),o=n.length;if(i&&o===1)return n[0].values;let s=!o||r>0?Array:n[0].constructor.ArrayType??n[0].values.constructor,a=new s(t);return i?jW(a,n):qW(a,n)}cache(){return this._cache??(this._cache=this.toArray())}};function*zW(e){for(let t=0;t<e.length;++t){let r=e[t][Symbol.iterator]();for(let n=r.next();!n.done;n=r.next())yield n.value}}function jW(e,t){for(let r=0,n=0;r<t.length;++r){let{values:i}=t[r];e.set(i,n),n+=i.length}return e}function qW(e,t){let r=-1;for(let n=0;n<t.length;++n){let i=t[n];for(let o=0;o<i.length;++o)e[++r]=i.at(o)}return e}var Ff=class e{constructor(t,r,n=!1){let i=t.fields.map(s=>s.name);this.schema=t,this.names=i,this.children=r,this.factory=n?yp:Bx;let o=[];this.getFactory=s=>o[s]??(o[s]=this.factory(i,r.map(a=>a.data[s])))}get[Symbol.toStringTag](){return"Table"}get numCols(){return this.names.length}get numRows(){return this.children[0]?.length??0}getChildAt(t){return this.children[t]}getChild(t){let r=this.names.findIndex(n=>n===t);return r>-1?this.children[r]:void 0}selectAt(t,r=[]){let{children:n,factory:i,schema:o}=this,{fields:s}=o;return new e({...o,fields:t.map((a,c)=>VW(s[a],r[c]))},t.map(a=>n[a]),i===yp)}select(t,r){let n=this.names,i=t.map(o=>n.indexOf(o));return this.selectAt(i,r)}toColumns(){let{children:t,names:r}=this,n={};return r.forEach((i,o)=>n[i]=t[o]?.toArray()??[]),n}toArray(){let{children:t,getFactory:r,numRows:n}=this,i=t[0]?.data??[],o=Array(n);for(let s=0,a=-1;s<i.length;++s){let c=r(s);for(let l=0;l<i[s].length;++l)o[++a]=c(l)}return o}*[Symbol.iterator](){let{children:t,getFactory:r}=this,n=t[0]?.data??[];for(let i=0;i<n.length;++i){let o=r(i);for(let s=0;s<n[i].length;++s)yield o(s)}}at(t){let{children:r,getFactory:n,numRows:i}=this;if(t<0||t>=i)return null;let[{offsets:o}]=r,s=Of(o,t)-1;return n(s)(t-o[s])}get(t){return this.at(t)}};function VW(e,t){return t!=null&&t!==e.name?{...e,name:t}:e}function vp(e,t={}){let{typeId:r,bitWidth:n,precision:i,unit:o}=e,{useBigInt:s,useDate:a,useDecimalBigInt:c,useMap:l,useProxy:u}=t;switch(r){case j.Null:return xp;case j.Bool:return Ux;case j.Int:case j.Time:case j.Duration:return s||n<64?hc:$o;case j.Float:return i?hc:Px;case j.Date:return NC(o===js.DAY?qx:IC,a&&bp);case j.Timestamp:return NC(o===Tr.SECOND?Vx:o===Tr.MILLISECOND?TC:o===Tr.MICROSECOND?Yx:Wx,a&&bp);case j.Decimal:return c?jx:zx;case j.Interval:return o===Ei.DAY_TIME?Gx:o===Ei.YEAR_MONTH?hc:Xx;case j.FixedSizeBinary:return ib;case j.Utf8:return Zx;case j.LargeUtf8:return Kx;case j.Binary:return Hx;case j.LargeBinary:return Qx;case j.BinaryView:return hb;case j.Utf8View:return pb;case j.List:return Jx;case j.LargeList:return tb;case j.Map:return l?ab:sb;case j.ListView:return eb;case j.LargeListView:return rb;case j.FixedSizeList:return ob;case j.Struct:return u?lb:wp;case j.RunEndEncoded:return ub;case j.Dictionary:return fb;case j.Union:return e.mode?cb:_p}throw new Error(Vs(r))}function NC(e,t){return t?class extends t{constructor(n){super(new e(n))}}:e}function YW(e,t){return{offset:Ar(e,t),metadataLength:xe(e,t+8),bodyLength:Ar(e,t+16)}}function gT(e,t){return ei(e,t,24,YW)}function mb(e,t,r){let n=rn(e,t);if(n(10,eo,0))throw new Error("Record batch compression not implemented");let i=r<Ti.V4?8:0;return{length:n(4,Ar,0),nodes:ei(e,n(6,eo),16,(o,s)=>({length:Ar(o,s),nullCount:Ar(o,s+8)})),regions:ei(e,n(8,eo),16+i,(o,s)=>({offset:Ar(o,s+i),length:Ar(o,s+i+8)})),variadic:ei(e,n(12,eo),8,Ar)}}function OC(e,t,r){let n=rn(e,t);return{id:n(4,Ar,0),data:n(6,(i,o)=>mb(i,o,r)),isDelta:n(8,dc,!1)}}function xT(e,t,r,n){Un(r,j,Vs);let i=rn(e,t);switch(r){case j.Binary:return tT();case j.Utf8:return Ox();case j.LargeBinary:return cT();case j.LargeUtf8:return lT();case j.List:return Dx(n[0]);case j.ListView:return dT(n[0]);case j.LargeList:return uT(n[0]);case j.LargeListView:return hT(n[0]);case j.Struct:return Lx(n);case j.RunEndEncoded:return fT(n[0],n[1]);case j.Int:return Nx(i(4,xe,0),i(6,dc,!1));case j.Float:return JI(i(4,$r,Mf.HALF));case j.Decimal:return eT(i(4,xe,0),i(6,xe,0),i(8,xe,128));case j.Date:return rT(i(4,$r,js.MILLISECOND));case j.Time:return nT(i(4,$r,Tr.MILLISECOND),i(6,xe,32));case j.Timestamp:return Rx(i(4,$r,Tr.SECOND),i(6,kl));case j.Interval:return iT(i(4,$r,Ei.YEAR_MONTH));case j.Duration:return aT(i(4,$r,Tr.MILLISECOND));case j.FixedSizeBinary:return sT(i(4,xe,0));case j.FixedSizeList:return Fx(n[0],i(4,xe,0));case j.Map:return gC(i(4,dc,!1),n[0]);case j.Union:return oT(i(4,$r,qs.Sparse),n,ei(e,i(6,eo),4,xe))}return{typeId:r}}function Sp(e,t){let r=ei(e,t,4,(n,i)=>{let o=rn(n,i);return[o(4,kl),o(6,kl)]});return r.length?new Map(r):null}function yb(e,t,r){let n=rn(e,t);return{version:r,endianness:n(4,$r,0),fields:n(6,WW,[]),metadata:n(8,Sp)}}function WW(e,t){return ei(e,t,4,RC)}function RC(e,t){let r=rn(e,t),n=r(8,mp,j.NONE),i=r(10,eo,0),o=r(12,XW),s=r(14,(c,l)=>GW(c,l)),a=xT(e,i,n,s);return o&&(o.dictionary=a,a=o),{name:r(4,kl),type:a,nullable:r(6,dc,!1),metadata:r(16,Sp)}}function GW(e,t){let r=ei(e,t,4,RC);return r.length?r:null}function XW(e,t){if(!t)return null;let r=rn(e,t);return Mx(null,r(6,HW,Rf()),r(8,dc,!1),r(4,Ar,0))}function HW(e,t){return xT(e,t,j.Int)}var QW=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,ZW=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,KW=e=>`Unsupported message type: ${e} (${Ex(Ai,e)})`;function gb(e,t){let r=xe(e,t)||0;if(t+=Cl,r===-1&&(r=xe(e,t)||0,t+=Cl),r===0)return null;let n=e.subarray(t,t+=r);if(n.byteLength<r)throw new Error(QW(r,n.byteLength));let i=rn(n,0),o=i(4,$r,Ti.V1),s=i(6,mp,Ai.NONE),a=i(8,eo,0),c=i(10,Ar,0),l;if(a){let u=s===Ai.Schema?yb:s===Ai.DictionaryBatch?OC:s===Ai.RecordBatch?mb:null;if(!u)throw new Error(KW(s));if(l=u(n,a,o),c>0){let f=e.subarray(t,t+=c);if(f.byteLength<c)throw new Error(ZW(c,f.byteLength));l.body=f}}return{version:o,type:s,index:t,content:l}}function DC(e){let t=e instanceof ArrayBuffer?new Uint8Array(e):e;return t instanceof Uint8Array&&JW(t)?eG(t):tG(t)}function JW(e){if(!e||e.length<4)return!1;for(let t=0;t<6;++t)if(dp[t]!==e[t])return!1;return!0}function tG(e){let t=[e].flat(),r,n=[],i=[];for(let o of t){if(!(o instanceof Uint8Array))throw new Error("IPC data batch was not a Uint8Array.");let s=0;for(;;){let a=gb(o,s);if(a===null)break;if(s=a.index,!!a.content)switch(a.type){case Ai.Schema:r||(r=a.content);break;case Ai.RecordBatch:n.push(a.content);break;case Ai.DictionaryBatch:i.push(a.content);break}}}return{schema:r,dictionaries:i,records:n,metadata:null}}function eG(e){let t=e.byteLength-(dp.length+4),r=xe(e,t),n=rn(e,t-r),i=n(4,$r,Ti.V1),o=n(8,gT,[]),s=n(10,gT,[]);return{schema:n(6,(a,c)=>yb(a,c,i)),dictionaries:o.map(({offset:a})=>gb(e,a).content),records:s.map(({offset:a})=>gb(e,a).content),metadata:n(12,Sp)}}function _T(e,t){return rG(DC(e),t)}function rG(e,t={}){let{schema:r={fields:[]},dictionaries:n,records:i}=e,{version:o,fields:s}=r,a=new Map,c=iG(t,o,a),l=new Map;nG(r,d=>{let h=d.type;h.typeId===j.Dictionary&&l.set(h.id,h.dictionary)});let u=new Map;for(let d of n){let{id:h,data:p,isDelta:m,body:y}=d,g=l.get(h),x=bT(g,c({...p,body:y}));if(u.has(h)){let b=u.get(h);m||b.clear(),b.add(x)}else{if(m)throw new Error("Delta update can not be first dictionary batch.");u.set(h,yT(g).add(x))}}u.forEach((d,h)=>a.set(h,d.done()));let f=s.map(d=>yT(d.type));for(let d of i){let h=c(d);s.forEach((p,m)=>f[m].add(bT(p.type,h)))}return new Ff(r,f.map(d=>d.done()),t.useProxy)}function nG(e,t){e.fields.forEach(function r(n){t(n),n.type.dictionary?.children?.forEach(r),n.type.children?.forEach(r)})}function iG(e,t,r){let n={version:t,options:e,dictionary:i=>r.get(i)};return i=>{let{length:o,nodes:s,regions:a,variadic:c,body:l}=i,u=-1,f=-1,d=-1;return{...n,length:o,node:()=>s[++u],buffer:h=>{let{length:p,offset:m}=a[++f];return h?new h(l.buffer,l.byteOffset+m,p/h.BYTES_PER_ELEMENT):l.subarray(m,m+p)},variadic:()=>c[++d],visit(h){return h.map(p=>bT(p.type,this))}}}}function bT(e,t){let{typeId:r}=e,{length:n,options:i,node:o,buffer:s,variadic:a,version:c}=t,l=vp(e,i);if(r===j.Null)return new l({length:n,nullCount:n,type:e});let u={...o(),type:e};switch(r){case j.Bool:case j.Int:case j.Time:case j.Duration:case j.Float:case j.Decimal:case j.Date:case j.Timestamp:case j.Interval:case j.FixedSizeBinary:return new l({...u,validity:s(),values:s(e.values)});case j.Utf8:case j.LargeUtf8:case j.Binary:case j.LargeBinary:return new l({...u,validity:s(),offsets:s(e.offsets),values:s()});case j.BinaryView:case j.Utf8View:return new l({...u,validity:s(),values:s(),data:Array.from({length:a()},()=>s())});case j.List:case j.LargeList:case j.Map:return new l({...u,validity:s(),offsets:s(e.offsets),children:t.visit(e.children)});case j.ListView:case j.LargeListView:return new l({...u,validity:s(),offsets:s(e.offsets),sizes:s(e.offsets),children:t.visit(e.children)});case j.FixedSizeList:case j.Struct:return new l({...u,validity:s(),children:t.visit(e.children)});case j.RunEndEncoded:return new l({...u,children:t.visit(e.children)});case j.Dictionary:{let{id:f,indices:d}=e;return new l({...u,validity:s(),values:s(d.values)}).setDictionary(t.dictionary(f))}case j.Union:return c<Ti.V5&&s(),new l({...u,typeIds:s(hp),offsets:e.mode===qs.Sparse?null:s(e.offsets),children:t.visit(e.children)});default:throw new Error(Vs(r))}}var Bft=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;function pc(e){return _T(e,{useDate:!0})}function xb(e="ws://localhost:3000/"){let t=[],r=!1,n=null,i,o={open(){r=!0,c()},close(){for(r=!1,n=null,i=null;t.length;)t.shift().reject("Socket closed")},error(l){if(n){let{reject:u}=n;n=null,c(),u(l)}else console.error("WebSocket error: ",l)},message({data:l}){if(n){let{query:u,resolve:f,reject:d}=n;if(n=null,c(),typeof l=="string"){let h=JSON.parse(l);h.error?d(h.error):f(h)}else if(u.type==="exec")f();else if(u.type==="arrow")f(pc(l));else throw new Error(`Unexpected socket data: ${l}`)}else console.log("WebSocket message: ",l)}};function s(){i=new WebSocket(e),i.binaryType="arraybuffer";for(let l in o)i.addEventListener(l,o[l])}function a(l,u,f){i==null&&s(),t.push({query:l,resolve:u,reject:f}),r&&!n&&c()}function c(){t.length&&(n=t.shift(),i.send(JSON.stringify(n.query)))}return{get connected(){return r},query(l){return new Promise((u,f)=>a(l,u,f))}}}var Cf="COLUMN_REF",bb="COLUMN_PARAM",UC="TABLE_REF",$C="LITERAL",zC="INTERVAL",_b="ORDER_BY",wb="CAST",vb="CASE",Sb="WHEN",Ib="UNARY",jC="UNARY_POSTFIX",Tb="BINARY",Ab="BETWEEN",Eb="NOT_BETWEEN",Mb="LOGICAL_OPERATOR",Nb="IN",Ob="FUNCTION",$l="AGGREGATE",kf="WINDOW",Rb="WINDOW_DEF",Db="WINDOW_FRAME",qC="EXPRESSION",Bf="FRAGMENT",Lb="VERBATIM",Pf="PARAM",VC="WITH_CLAUSE",Fb="SELECT_CLAUSE",Cb="FROM_CLAUSE";var YC="SAMPLE_CLAUSE";var kb="WINDOW_CLAUSE";var Bb="SELECT_QUERY",Pb="DESCRIBE_QUERY",Ub="SET_OPERATION";function nn(e){return e instanceof Je}var Je=class{constructor(t){this.type=t}},Bt=class extends Je{};var zl=class extends Bt{constructor(t){super($C),this.value=t}toString(){return wT(this.value)}};function wT(e){switch(typeof e){case"number":return Number.isFinite(e)?`${e}`:"NULL";case"string":return`'${e.replace("'","''")}'`;case"boolean":return e?"TRUE":"FALSE";default:if(e==null)return"NULL";if(e instanceof Date){let t=+e;if(Number.isNaN(t))return"NULL";let r=e.getUTCFullYear(),n=e.getUTCMonth(),i=e.getUTCDate();return t===Date.UTC(r,n,i)?`DATE '${r}-${n+1}-${i}'`:`epoch_ms(${t})`}else return e instanceof RegExp?`'${e.source}'`:`${e}`}}var ro=class extends Bt{constructor(t){super(Pf),this.param=t}get value(){return this.param.value}toString(){return wT(this.value)}};function vT(e){return e.split(".")}function no(e){return`"${e}"`}function $b(e){return e&&EG(e)?e.slice(1,-1):e}function EG(e){return e[0]==='"'&&e[e.length-1]==='"'}function mc(e){return e instanceof Uf}var Uf=class extends Bt{constructor(t){super(UC),this.table=[t].flat()}get name(){return this.table[this.table.length-1]}toString(){return this.table.map(t=>no(t)).join(".")}};var jl=class extends Bt{constructor(t,r=[]){super(Ob),this.name=t,this.args=r}toString(){let{name:t,args:r}=this;return`${t}(${r.join(", ")})`}};function we(e,...t){return new jl(e,Ip(t).map(qt))}function ee(e,...t){return new Ap(e,Ip(t).map(qt))}function Mi(e,...t){return new ql(new Tp(e,Ip(t).map(qt)))}function $n(e,t=qt){return e.flat().filter(r=>r!=null).map(r=>t(r))}function Ip(e){let t=e.length,r=t;for(;r>0&&e[r-1]===void 0;--r);return r<t?e.slice(0,r):e}function Ni(e){return typeof e=="string"}function Ep(e){return Array.isArray(e)}function io(e){return e&&typeof e.addEventListener=="function"&&e.dynamic!==!1&&"value"in e}var Np=class extends Je{constructor(t,r){super(kb),this.name=t,this.def=r}toString(){return`${no(this.name)} AS ${this.def}`}},ql=class e extends Bt{constructor(t,r=new Vl){super(kf),this.func=t,this.def=r}over(t){return new e(this.func,this.def.over(t))}partitionby(...t){return new e(this.func,this.def.partitionby(...t))}orderby(...t){return new e(this.func,this.def.orderby(...t))}rows(t){return new e(this.func,this.def.rows(t))}range(t){return new e(this.func,this.def.range(t))}toString(){return`${this.func} OVER ${this.def}`}},Tp=class extends jl{constructor(t,r){super(t,r)}},Vl=class extends Je{constructor(t,r,n,i){super(Rb),this.name=t,this.partition=r,this.order=n,this.frame=i}over(t){return Mp(this,{name:t})}partitionby(...t){return Mp(this,{partition:$n(t)})}orderby(...t){return Mp(this,{order:$n(t)})}rows(t){return Mp(this,{frame:new Op(t)})}range(t){return Mp(this,{frame:new Op(t,!0)})}toString(){let{name:t,partition:r,order:n,frame:i}=this,o=t&&no(t),s=[o,r?.length&&`PARTITION BY ${r.join(", ")}`,n?.length&&`ORDER BY ${n.join(", ")}`,i].filter(a=>a);return o&&s.length<2?o:`(${s.join(" ")})`}},Op=class extends Je{constructor(t,r=!1,n=void 0){super(Db),this.extent=io(t)?new ro(t):t,this.range=r,this.exclude=n}toString(){let{range:t,exclude:r,extent:n}=this,i=t?"RANGE":"ROWS",[o,s]=nn(n)?n.value:n,a=WC(o,"PRECEDING"),c=WC(s,"FOLLOWING");return`${i} BETWEEN ${a} AND ${c}${r?` ${r}`:""}`}};function Mp(e,t){return new Vl(t.name??e.name,t.partition??e.partition,t.order??e.order,t.frame??e.frame)}function WC(e,t){return e===0?"CURRENT ROW":Number.isFinite(e)?`${Math.abs(e)} ${t}`:`UNBOUNDED ${t}`}function yc(e){return e instanceof Ws}var Ws=class extends Bt{constructor(t,r){super(t),this.table=r}get column(){return null}toString(){let{column:t,table:r}=this,n=`${r??""}`,i=t==="*"?"*":no(t);return(n?n+".":"")+i}},Rp=class extends Ws{constructor(t,r){super(Cf,r),this.name=t}get column(){return this.name}};var Dp=class extends Ws{constructor(t,r){super(bb,r),this.param=t}get column(){return`${this.param.value}`}};function Gs(e,t){let r=Yl(t);return io(e)?new Dp(new ro(e),r):new Rp(e,r)}var Wl=class extends Bt{constructor(t){super(Lb),this.value=t}toString(){return this.value}};function Er(e){return new zl(e)}function GC(e){return new Wl(e)}function zb(...e){let t=$n(e,String);return t?.length?new Uf(t):void 0}function qt(e){return Ni(e)?MG(e):Xl(e)}function Gl(e){return Ni(e)?GC(e):Xl(e)}function Xl(e){return e instanceof Bt?e:io(e)?new ro(e):Er(e)}function Yl(e){return Ni(e)?NG(e):Ep(e)?zb(e):e}function MG(e){let t=vT(e);return Gs(t.pop(),zb(t))}function NG(e){return zb(vT(e))}function ST(){return new Vl}var Ap=class e extends Bt{constructor(t,r,n,i){super($l),this.name=t,this.args=r,this.isDistinct=n,this.filter=i}distinct(t=!0){return new e(this.name,this.args,t,this.filter)}where(t){return Ni(t)&&(t=Gl(t)),new e(this.name,this.args,this.isDistinct,t)}window(){return new ql(this)}partitionby(...t){return this.window().partitionby(...t)}orderby(...t){return this.window().orderby(...t)}toString(){let{name:t,args:r,isDistinct:n,filter:i}=this,o=n?"DISTINCT ":"",s=r?.length?r.join(", "):"*",a=i?` FILTER (WHERE ${i})`:"";return`${t}(${o}${s})${a}`}},XC=["any_value","approx_count_distinct","approx_quantile","arbitrary","arg_max","arg_max_null","arg_min","arg_min_null","array_agg","avg","bit_and","bit_or","bit_xor","bitstring_agg","bool_and","bool_or","corr","count","covar_pop","covar_samp","entropy","favg","first","fsum","geomean","kurtosis_pop","kurtosis","last","mad","max","max_by","median","min","min_by","mode","product","quantile","quantile_cont","quantile_disc","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_sxx","regr_sxy","regr_syy","regr_slope","reservoir_quantile","skewness","stddev","stddev_pop","stddev_samp","string_agg","sum","variance","var_pop","var_samp"];var jb=class extends Bt{constructor(t,r,n){super(t),this.expr=r,this.extent=n}toSQL(t){let{extent:r,expr:n}=this;return r?`(${n} ${t} ${r[0]} AND ${r[1]})`:""}},Hl=class extends jb{constructor(t,r){super(Ab,t,r)}toString(){return super.toSQL("BETWEEN")}},Lp=class extends jb{constructor(t,r){super(Eb,t,r)}toString(){return super.toSQL("NOT BETWEEN")}};var Fp=class extends Bt{constructor(t,r,n){super(Tb),this.op=t,this.left=r,this.right=n}toString(){return`(${this.left} ${this.op} ${this.right})`}};var $f=class e extends Bt{constructor(t=void 0,r=[],n=void 0){super(vb),this.expr=t,this._when=r,this._else=n}when(t,r){return new e(this.expr,this._when.concat(new zf(qt(t),qt(r))),this._else)}else(t){return new e(this.expr,this._when,qt(t))}toString(){return"CASE "+(this.expr?`${this.expr} `:"")+this._when.join(" ")+(this._else?` ELSE ${this._else}`:"")+" END"}},zf=class extends Je{constructor(t,r){super(Sb),this.when=t,this.then=r}toString(){return`WHEN ${this.when} THEN ${this.then}`}};var Cp=class extends Bt{constructor(t,r){super(wb),this.expr=t,this.cast=r}toString(){return`(${this.expr})::${this.cast}`}};var kp=class extends Bt{constructor(t){super(Bf),this.spans=t}toString(){return this.spans.join("")}};var Bp=class extends Je{constructor(t,r=!1,n=void 0,i=void 0){super(YC),this.size=t,this.perc=r,this.method=n,this.seed=i}toString(){let{size:t,perc:r,method:n,seed:i}=this,o=r?"%":" ROWS",s=i!=null?`, ${i}`:"";return`${t}${o}${n?` (${n}${s})`:""}`}};var Pp=class extends Je{constructor(t,r){super(Fb),this.expr=t,this.alias=r}toString(){let{expr:t,alias:r}=this;return!r||OG(t,r)?`${t}`:`${t} AS ${no(r)}`}};function OG(e,t){return e instanceof Ws&&e.table==null&&e.column===t}var Up=class extends Je{constructor(t,r){super(VC),this.name=t,this.query=r}toString(){return`"${this.name}" AS (${this.query})`}};function qb(e){return e instanceof ft}function gc(e){return e instanceof Zl}function IT(e){return e instanceof $p}var ft=class extends Bt{static select(...t){return new Zl().select(...t)}static from(...t){return new Zl().from(...t)}static with(...t){return new Zl().with(...t)}static union(...t){return new Ql("UNION",t.flat())}static unionAll(...t){return new Ql("UNION ALL",t.flat())}static intersect(...t){return new Ql("INTERSECT",t.flat())}static except(...t){return new Ql("EXCEPT",t.flat())}static describe(t){return new $p(t)}constructor(t){super(t),this._orderby=[],this._limit=void 0,this._offset=void 0,this.cteFor=null}get subqueries(){return[]}clone(){return this}orderby(...t){return this._orderby=this._orderby.concat($n(t)),this}limit(t){return this._limit=Number.isFinite(t)?t:void 0,this}offset(t){return this._offset=Number.isFinite(t)?t:void 0,this}},Zl=class e extends ft{constructor(){super(Bb),this._with=[],this._select=[],this._from=[],this._where=[],this._sample=void 0,this._groupby=[],this._having=[],this._window=[],this._qualify=[]}get subqueries(){let t=this.cteFor||this,n=(t instanceof e?t._with:[]).reduce((o,s)=>(o[s.name]=s.query,o),{}),i=[];return this._from.forEach(({expr:o})=>{if(qb(o))i.push(o);else if(mc(o)){let s=n[o.name];s&&i.push(s)}}),i}clone(){return Object.assign(new e,this)}with(...t){let r=[],n=(i,o)=>{let s=o.clone();s.cteFor=this,r.push(new Up(i,s))};return t.flat().forEach(i=>{if(i!=null)for(let o in i)n(o,i[o])}),this._with=this._with.concat(r),this}select(...t){let r=[],n=(o,s)=>r.push(new Pp(o==null?o:qt(o),$b(s)));t.flat().forEach(o=>{if(o!=null)if(Ni(o))n(o,o);else if(yc(o))n(o,o.column);else if(Ep(o))n(o[1],o[0]);else for(let s in o)n(o[s],s)});let i=new Set(r.map(o=>o.alias));return this._select=this._select.filter(o=>!i.has(o.alias)).concat(r.filter(o=>o.expr)),this}setSelect(...t){return this._select=[],this.select(...t)}distinct(t=!0){return this._distinct=!!t,this}from(...t){let r=[],n=(i,o)=>r.push(new zp(Yl(i),$b(o)));return t.flat().forEach(i=>{if(i!=null)if(Ni(i))n(i,i);else if(mc(i))n(i,i.name);else if(nn(i))n(i);else if(Ep(i))n(i[1],i[0]);else for(let o in i)n(i[o],o)}),this._from=this._from.concat(r),this}setFrom(...t){return this._from=[],this.from(...t)}sample(t,r,n){let i;if(typeof t=="number"){let o=t>0&&t<1,s=o?t*100:Math.floor(t);i=new Bp(s,o,r,n)}else i=t;return this._sample=i,this}where(...t){return this._where=this._where.concat($n(t,Gl)),this}setWhere(...t){return this._where=[],this.where(...t)}groupby(...t){return this._groupby=this._groupby.concat($n(t)),this}setGroupby(...t){return this._groupby=[],this.groupby(...t)}having(...t){return this._having=this._having.concat($n(t,Gl)),this}window(...t){let r=[];return t.flat().forEach(n=>{if(n!=null)for(let i in n)r.push(new Np($b(i),n[i]))}),this._window=this._window.concat(r),this}qualify(...t){return this._qualify=this._qualify.concat($n(t,Gl)),this}toString(){let{_with:t,_select:r,_distinct:n,_from:i,_sample:o,_where:s,_groupby:a,_having:c,_window:l,_qualify:u,_orderby:f,_limit:d,_offset:h}=this,p=[];if(t.length&&p.push(`WITH ${t.join(", ")}`),p.push(`SELECT${n?" DISTINCT":""} ${r.join(", ")}`),i.length&&p.push(`FROM ${i.join(", ")}`),s.length){let m=s.map(String).filter(y=>y).join(" AND ");m&&p.push(`WHERE ${m}`)}if(o&&p.push(`USING SAMPLE ${o}`),a.length&&p.push(`GROUP BY ${a.join(", ")}`),c.length){let m=c.map(String).filter(y=>y).join(" AND ");m&&p.push(`HAVING ${m}`)}if(l.length&&p.push(`WINDOW ${l.join(", ")}`),u.length){let m=u.map(String).filter(y=>y).join(" AND ");m&&p.push(`QUALIFY ${m}`)}return f.length&&p.push(`ORDER BY ${f.join(", ")}`),Number.isFinite(d)&&p.push(`LIMIT ${d}`),Number.isFinite(h)&&p.push(`OFFSET ${h}`),p.join(" ")}},$p=class e extends Je{constructor(t){super(Pb),this.query=t}clone(){return new e(this.query.clone())}toString(){return`DESCRIBE ${this.query}`}},Ql=class e extends ft{constructor(t,r){super(Ub),this.op=t,this.queries=r}get subqueries(){let{queries:t,cteFor:r}=this;return r&&t.forEach(n=>n.cteFor=r),t}clone(){let{op:t,queries:r,...n}=this;return Object.assign(new e(t,r),n)}toString(){let{op:t,queries:r,_orderby:n,_limit:i,_offset:o}=this,s=[r.join(` ${t} `)];return n.length&&s.push(`ORDER BY ${n.join(", ")}`),Number.isFinite(i)&&s.push(`LIMIT ${i}`),Number.isFinite(o)&&s.push(`OFFSET ${o}`),s.join(" ")}};var zp=class extends Je{constructor(t,r){super(Cb),this.expr=t,this.alias=r}toString(){let{expr:t,alias:r}=this,n=qb(t)?`(${t})`:`${t}`;return r&&!(mc(t)&&t.table.join(".")===r)?`${n} AS ${no(r)}`:`${n}`}};var jp=class extends Bt{constructor(t,r){super(Nb),this.expr=t,this.values=r}toString(){return`(${this.expr} IN (${this.values.join(", ")}))`}};var qp=class extends Bt{constructor(t,r=1){super(zC),this.name=t,this.steps=r}toString(){return`INTERVAL ${this.steps} ${this.name}`}};var Vb=class extends Bt{constructor(t,r){super(Mb),this.op=t,this.clauses=r}toString(){let t=this.clauses;return t.length===0?"":t.length===1?`${t[0]}`:`(${t.join(` ${this.op} `)})`}},Vp=class extends Vb{constructor(t){super("AND",t)}},Yp=class extends Vb{constructor(t){super("OR",t)}};var jf=class extends Bt{constructor(t,r,n){super(_b),this.expr=t,this.desc=r,this.nullsFirst=n}toString(){let{expr:t,desc:r,nullsFirst:n}=this;return`${t}${r?" DESC":r===!1?" ASC":""}${n?" NULLS FIRST":n===!1?" NULLS LAST":""}`}};var Yb=class extends Bt{constructor(t,r,n){super(t),this.op=r,this.expr=n}},Wp=class extends Yb{constructor(t,r){super(Ib,t,r)}toString(){return`(${this.op} ${this.expr})`}},Gp=class extends Yb{constructor(t,r){super(jC,t,r)}toString(){return`(${this.expr} ${this.op})`}};function xc(e,t){return ee("arg_max",e,t)}function bc(e,t){return ee("arg_min",e,t)}function TT(e){return ee("array_agg",e)}function Xp(e){return ee("avg",e)}function AT(e,t){return ee("corr",e,t)}function Mr(e){return ee("count",e)}function ET(e,t){return ee("covar_samp",e,t)}function MT(e,t){return ee("covar_pop",e,t)}function NT(e){return ee("entropy",e)}function OT(e){return ee("first",e)}function RT(e){return ee("kurtosis",e)}function DT(e){return ee("mad",e)}function zr(e){return ee("max",e)}function LT(e){return ee("median",e)}function zn(e){return ee("min",e)}function FT(e){return ee("mode",e)}function CT(e){return ee("last",e)}function kT(e){return ee("product",e)}function BT(e,t){return ee("quantile",e,t)}function Hp(e,t){return ee("regr_avgx",e,t)}function PT(e,t){return ee("regr_avgy",e,t)}function Qp(e,t){return ee("regr_count",e,t)}function UT(e,t){return ee("regr_intercept",e,t)}function $T(e,t){return ee("regr_sxx",e,t)}function zT(e,t){return ee("regr_syy",e,t)}function jT(e,t){return ee("regr_slope",e,t)}function qT(e){return ee("skewness",e)}function Zp(e){return ee("stddev",e)}function VT(e){return ee("stddev_pop",e)}function YT(e){return ee("string_agg",e)}function de(e){return ee("sum",e)}function WT(e){return ee("var_samp",e)}function GT(e){return ee("var_pop",e)}function Xs(e,t,r){return e?new $f(void 0,[new zf(qt(e),qt(t))],qt(r)):new $f}function qf(e,t){return new Cp(qt(e),t)}function ve(e){return qf(e,"INTEGER")}function XT(e){return qf(e,"FLOAT")}function Ge(e){return qf(e,"DOUBLE")}function Wb(e,t){return new qp(e,t)}function HT(e){return we("epoch_ms",e)}function QT(e,t,r=1){return we("time_bucket",Wb(t,r),e)}function ZT(e){return we("make_date",2012,we("month",e),1)}function KT(e){let t=qt(e);return we("make_date",2012,we("month",t),we("day",t))}function JT(e){return we("make_date",2012,1,we("day",e))}function tA(...e){return we("greatest",...e)}function Gb(e){return we("exp",e)}function eA(e){return we("log",e)}function Vf(e){return we("ln",e)}function oo(e){return we("sign",e)}function Nr(e){return we("abs",e)}function Hs(e){return we("sqrt",e)}function rA(e){return we("ceil",e)}function Or(e){return we("floor",e)}function Qs(e,t){return we("round",e,t)}function RG(e,t){return new Wp(e,qt(t))}function HC(e,t){return new Gp(e,qt(t))}function jn(e,t,r){return new Fp(e,qt(t),qt(r))}function QC(e,t,r=!1){let n=r?Lp:Hl;return new n(qt(e),t?.map(qt))}function on(...e){return new Vp($n(e))}function Oi(...e){return new Yp($n(e))}function nA(e){return RG("NOT",e)}function Kl(e){return HC("IS NULL",e)}function Ri(e){return HC("IS NOT NULL",e)}function Kp(e,t){return jn("&",e,t)}function te(e,t){return jn("+",e,t)}function It(e,t){return jn("-",e,t)}function Nt(e,t){return jn("*",e,t)}function se(e,t){return jn("/",e,t)}function ir(e,t){return jn("**",e,t)}function iA(e,t){return jn("=",e,t)}function so(e,t){return jn("<>",e,t)}function ze(e,t){return jn("<",e,t)}function Di(e,t){return jn(">",e,t)}function ri(e,t){return jn("<=",e,t)}function oA(e,t){return jn(">=",e,t)}function sA(e,t){return jn("IS DISTINCT FROM",e,t)}function Yf(e,t){return jn("IS NOT DISTINCT FROM",e,t)}function jr(e,t){return QC(e,t,!1)}function aA(e,t){return QC(e,t,!0)}function cA(e,t){return new jp(qt(e),t.map(qt))}function lA(e,t){return new jf(qt(e),!1,t)}function uA(e,t){return new jf(qt(e),!0,t)}function Jp(e){return we("st_asgeojson",e)}function ZC(e){return we("st_x",e)}function KC(e){return we("st_y",e)}function tm(e){return we("st_centroid",e)}function fA(e){return ZC(tm(e))}function dA(e){return KC(tm(e))}function tr(e,...t){return new kp(DG(e,t))}function DG(e,t){let r=[e[0]],n=t.length;for(let i=0,o=0;i<n;){let s=t[i];nn(s)?r[++o]=s:io(s)?r[++o]=new ro(s):r[o]+=Ni(s)?s:Er(s);let a=e[++i];nn(r[o])?r[++o]=a:r[o]+=a}return r.filter(i=>i).map(i=>Ni(i)?new Wl(i):i)}function Xb(e,t,...r){return we(e,t,...Ip(r).map(Xl))}function hA(e,t,r){return Xb("regexp_matches",e,t,r)}function pA(e,t){return Xb("contains",e,t)}function mA(e,t){return Xb("starts_with",e,t)}function yA(e,t){return Xb("ends_with",e,t)}function gA(){return Mi("row_number")}function xA(){return Mi("rank")}function bA(){return Mi("dense_rank")}function _A(){return Mi("percent_rank")}function wA(){return Mi("cume_dist")}function vA(e){return Mi("ntile",e)}function SA(e,t,r){return Mi("lag",e,t,r)}function Wf(e,t,r){return Mi("lead",e,t,r)}function IA(e){return Mi("first_value",e)}function TA(e){return Mi("last_value",e)}function AA(e,t){return Mi("nth_value",e,t)}var Hb={[$l]:["args","filter"],[Ab]:["expr","extent"],[Tb]:["left","right"],[vb]:["expr","_when","_else"],[wb]:["expr"],[bb]:["param","table"],[Cf]:["table"],[Pb]:["query"],[qC]:["node"],[Bf]:["spans"],[Cb]:["expr"],[Ob]:["args"],[Nb]:["expr","values"],[Mb]:["clauses"],[Eb]:["expr","extent"],[_b]:["expr"],[Pf]:["value"],[Fb]:["expr"],[Bb]:["_with","_select","_from","_where","_sample","_groupby","_having","_window","_qualify","_orderby"],[Ub]:["subqueries","_orderby"],[Ib]:["expr"],[Sb]:["when","then"],[kf]:["func","def"],[kb]:["def"],[Rb]:["partition","order","frame"],[Db]:["extent"]};function em(e,t){if(t.has(e))return t.get(e);if(nn(e)){let r=Hb[e.type],n=r?.length??0;for(let i=0;i<n;++i){let o=r[i],s=e[o];if(Array.isArray(s)){let a=s.length;for(let c=0;c<a;++c)s[c]=em(s[c],t)}else s&&(e[o]=em(s,t))}}return e}function zo(e,t){if(!nn(e))return;let r=t(e);if(r)return r;let n=Hb[e.type],i=n?.length??0;for(let o=0;o<i;++o){let s=e[n[o]];if(Array.isArray(s)){let a=s.length;for(let c=0;c<a;++c)if(s[c]&&+zo(s[c],t)<0)return r}else if(s&&+zo(s,t)<0)return-1}}var LG=new RegExp(`^(${XC.join("|")})$`),FG=/(\\'|\\"|"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\w+\()/g;function CG(e){return e.split(FG).some(t=>t.endsWith("(")&&LG.test(t.slice(0,-1)))}function ni(e){let t=0;return zo(e,r=>{switch(r.type){case kf:return-1;case $l:return t|=1,-1;case Bf:case Lb:{let n=`${r}`.toLowerCase(),i=n.indexOf("(select ");return i>=0&&(n=n.slice(0,i)),n.includes(") over ")?-1:CG(n)?(t|=2,-1):1}}}),t}function EA(e){let t=new Set;return zo(e,r=>{r.type===$l&&t.add(r)}),Array.from(t)}function Gf(e){let t={};return zo(e,r=>{r.type===Cf&&(t[r]=r)}),Object.values(t)}function MA(e){let t=new Set;return zo(e,r=>{r.type===Pf&&t.add(r.param)}),Array.from(t)}function _c(e,t,{replace:r=!1,temp:n=!1,view:i=!1}={}){return"CREATE"+(r?" OR REPLACE ":" ")+(n?"TEMP ":"")+(i?"VIEW":"TABLE")+(r?" ":" IF NOT EXISTS ")+e+" AS "+t}function NA(e,{strict:t=!1}={}){return"CREATE SCHEMA "+(t?"":"IF NOT EXISTS ")+e}function OA(e){return`INSTALL ${e}; LOAD ${e}`}function JC(e,{columns:t=Object.keys(e?.[0]||{})}={}){let r=[];if(Array.isArray(t)?(r=t,t=r.reduce((i,o)=>(i[o]=o,i),{})):t&&(r=Object.keys(t)),!r.length)throw new Error("Can not create table from empty column set.");let n=[];for(let i of e){let o=r.map(s=>`${Xl(i[s])} AS "${t[s]}"`);n.push(`(SELECT ${o.join(", ")})`)}return n.join(" UNION ALL ")}function Qb(e,t,r,n={},i={}){let{select:o=["*"],where:s,view:a,temp:c,replace:l,...u}=n,f=kG({...i,...u}),d=`${e}('${r}'${f?", "+f:""})`,h=s?` WHERE ${s}`:"",p=`SELECT ${o.join(", ")} FROM ${d}${h}`;return _c(t,p,{view:a,temp:c,replace:l})}function DA(e,t,r){return Qb("read_csv",e,t,r,{auto_detect:!0,sample_size:-1})}function LA(e,t,r){return Qb("read_json",e,t,r,{auto_detect:!0,format:"auto"})}function FA(e,t,r){return Qb("read_parquet",e,t,r)}function CA(e,t,r={}){let{options:n,...i}=r;if(n){let o=Array.isArray(n)?n.join(", "):typeof n=="string"?n:Object.entries(n).map(([s,a])=>`${s}=${a}`).join(", ");Object.assign(i,{open_options:o.toUpperCase()})}return Qb("st_read",e,t,i)}function kA(e,t,r={}){let{select:n=["*"],...i}=r,o=JC(t),s=n.length===1&&n[0]==="*"?o:`SELECT ${n} FROM ${o}`;return _c(e,s,i)}function kG(e){return Object.entries(e).map(([t,r])=>`${t}=${RA(r)}`).join(", ")}function RA(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=>RA(t)).join(", ")+"]":"{"+Object.entries(e).map(([t,r])=>`'${t}': ${RA(r)}`).join(", ")+"}";default:return e}}function BA(e,t,r,n,i){let o=i?It(r,Ge(e)):It(Ge(e),t),s=r===t?0:n/(r-t);return s?Nt(o,Ge(s)):o}function PA(e,t,r,n,i,o){return e.select({index:te(ve(Or(t)),Nt(ve(Or(r)),i)),...n}).groupby("index",o)}function UA(e,t,r){let n=r?s=>Nt(s,r):s=>s,i=Or(t),o=te(i,1);return ft.from(ft.unionAll(e.clone().select({i:ve(i),w:n(It(o,t))}),e.clone().select({i:ve(o),w:n(It(t,i))}))).select({index:"i",density:de("w")}).groupby("index").having(so("density",0))}function BG(e){return e}function $A(e,t,r,n,i,o){let s=n?g=>Nt(g,n):BG,a=(g,x)=>e.clone().select({xp:t,yp:r,i:g,w:x}),c=(g,x)=>te(g,Nt(x,i)),l=ve(Or(t)),u=ve(Or(r)),f=te(l,1),d=te(u,1),h=It(t,l),p=It(f,t),m=It(r,u),y=It(d,r);return ft.from(ft.unionAll(a(c(l,u),s(Nt(p,y))),a(c(l,d),s(Nt(p,m))),a(c(f,u),s(Nt(h,y))),a(c(f,d),s(Nt(h,m))))).select({index:"i",density:de("w")},o).groupby("index",o).having(so("density",0))}function zA(e,t,r,n,i,o,s=[],a=!0){e.select({x:ve(Or(t)),y:ve(Or(r))});let c=s.concat(n),l=ft.from(e).select(c,{x0:"x",y0:"y",dx:It(Wf("x").over("sw"),"x"),dy:It(Wf("y").over("sw"),"y")}).window({sw:ST().partitionby(c).orderby(lA("x"))}).qualify([Oi(ze("x0",i),ze(te("x0","dx"),i)),Oi(ze("y0",o),ze(te("y0","dy"),o)),Oi(Di("x0",0),Di(te("x0","dx"),0)),Oi(Di("y0",0),Di(te("y0","dy"),0))]),u=ft.select({x:tA(zr(Nr("dx")),zr(Nr("dy")))}).from("pairs"),f=ft.select({i:ve(tr`UNNEST(range((${u})))`)}),d=ft.unionAll(ft.select(c,{x:te("x0","i"),y:te("y0",ve(Qs(se(Nt("i","dy"),"dx"))))}).from("pairs","indices").where([ri(Nr("dy"),Nr("dx")),ze("i",Nr("dx"))]),ft.select(c,{x:te("x0",ve(Qs(se(Nt(Nt(oo("dy"),"i"),"dx"),"dy")))),y:te("y0",Nt(oo("dy"),"i"))}).from("pairs","indices").where([Di(Nr("dy"),Nr("dx")),ze("i",Nr("dy"))]),ft.select(c,{x:"x0",y:"y0"}).from("pairs").where(Kl("dx"))),h=ft.from("raster").select(c,"x","y",a?{w:se(1,Mr().partitionby(["x"].concat(c)))}:null).where([ri(0,"x"),ze("x",i),ri(0,"y"),ze("y",o)]);return ft.with({pairs:l,indices:f,raster:d,points:h}).from("points").select(s,{index:te("x",Nt("y",ve(i))),density:a?de("w"):Mr()}).groupby("index",s)}function jA(e,t,r,n,i=[]){let o=ve(Or(t)),s=a=>ft.from(e).select(a).groupby(o,i);return ft.union(s([{[r]:zn(r),[n]:bc(n,r)},...i]),s([{[r]:zr(r),[n]:xc(n,r)},...i]),s([{[r]:bc(r,n),[n]:zn(n)},...i]),s([{[r]:xc(r,n),[n]:zr(n)},...i])).orderby(i,r)}var Zb=e=>e;function tk(){return{apply:Zb,invert:Zb,sqlApply:qt,sqlInvert:Zb}}function PG({base:e=null}={}){if(e==null||e===Math.E)return{apply:Math.log,invert:Math.exp,sqlApply:t=>Vf(t),sqlInvert:t=>Gb(t)};if(e===10)return{apply:Math.log10,invert:t=>Math.pow(10,t),sqlApply:t=>eA(t),sqlInvert:t=>ir(10,t)};{let t=+e;return{apply:r=>Math.log(r)/Math.log(t),invert:r=>Math.pow(t,r),sqlApply:r=>se(Vf(r),Vf(t)),sqlInvert:r=>ir(t,r)}}}function UG({constant:e=1}={}){let t=+e;return{apply:r=>Math.sign(r)*Math.log1p(Math.abs(r)),invert:r=>Math.sign(r)*Math.exp(Math.abs(r)-t),sqlApply:r=>(r=qt(r),Nt(oo(r),Vf(te(t,Nr(r))))),sqlInvert:r=>Nt(oo(r),It(Gb(Nr(r)),t))}}function $G(){return{apply:e=>Math.sign(e)*Math.sqrt(Math.abs(e)),invert:e=>Math.sign(e)*e*e,sqlApply:e=>(e=qt(e),Nt(oo(e),Hs(Nr(e)))),sqlInvert:e=>Nt(oo(e),ir(e,2))}}function zG({exponent:e=1}={}){let t=+e;return{apply:r=>Math.sign(r)*Math.pow(Math.abs(r),t),invert:r=>Math.sign(r)*Math.pow(Math.abs(r),1/t),sqlApply:r=>(r=qt(r),Nt(oo(r),ir(Nr(r),t))),sqlInvert:r=>Nt(oo(r),ir(Nr(r),se(1,t)))}}function ek(){return{apply:e=>+e,invert:e=>new Date(e),sqlApply:e=>e instanceof Date?Er(+e):qG(e)?Er(+e.value):HT(e),sqlInvert:Zb}}var jG={identity:tk,linear:tk,log:PG,symlog:UG,sqrt:$G,pow:zG,time:ek,utc:ek};function rm(e){let t=jG[e.type];return t?{...e,...t(e)}:null}function qG(e){return e instanceof zl&&e.value instanceof Date}function Kb(e){let t=2166136261;for(let r=0,n=e.length;r<n;++r){let i=e.charCodeAt(r),o=i&65280;o&&(t=rk(t^o>>8)),t=rk(t^i&255)}return VG(t)>>>0}function rk(e){return e+(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24)}function VG(e){return e+=e<<13,e^=e>>>7,e+=e<<3,e^=e>>>17,e+=e<<5,e&4294967295}function ik(e,t,r){switch(e.name){case"count":case"sum":return YG(t,e);case"avg":return WG(t,e);case"arg_max":return GG(t,e);case"arg_min":return XG(t,e);case"variance":case"var_samp":return Jb(t,e,r);case"var_pop":return Jb(t,e,r,!1);case"stddev":case"stddev_samp":return Hs(Jb(t,e,r));case"stddev_pop":return Hs(Jb(t,e,r,!1));case"covar_samp":return t1(t,e,r);case"covar_pop":return t1(t,e,r,!1);case"corr":return nk(t,e,r);case"regr_count":return Xf(t,e).expr;case"regr_avgx":return ck(t,e);case"regr_avgy":return lk(t,e);case"regr_syy":return VA(t,0,e,r);case"regr_sxx":return VA(t,1,e,r);case"regr_sxy":return t1(t,e,r,null);case"regr_slope":return uk(t,e,r);case"regr_intercept":return HG(t,e,r);case"regr_r2":return ir(nk(t,e,r),2);case"max":case"min":case"bit_and":case"bit_or":case"bit_xor":case"bool_and":case"bool_or":case"product":{let n=ok(e);return t[n]=e,tr`${e.name}("${n}")`}default:return null}}function ok(e){return"pre_"+Kb(`${e}`).toString(16)}function gn(e,t,r){let n=r?.filter;n&&(t=t.filter?t.where(on(n,t.filter)):t.where(n));let i=ok(t);return e[i]=t,i}function sk(e,t){let r=gn(e,Mr(t.args[0]),t);return{expr:de(r),name:r}}function YG(e,t){return de(gn(e,t))}function WG(e,t){let r=gn(e,t),{expr:n,name:i}=sk(e,t);return se(de(Nt(r,i)),n)}function GG(e,t){let r=gn(e,t),n=gn(e,zr(t.args[1]),t);return xc(r,n)}function XG(e,t){let r=gn(e,t),n=gn(e,zn(t.args[1]),t);return bc(r,n)}function Jb(e,t,r,n=!0){let i=t.args[0],{expr:o}=sk(e,t),s=It(i,r(i)),a=gn(e,de(ir(s,2)),t),c=gn(e,de(s),t),l=n?It(o,1):o;return se(It(de(a),se(ir(de(c),2),o)),l)}function t1(e,t,r,n=!0){let{expr:i}=Xf(e,t),o=ak(e,t,r),s=nm(e,1,t,r),a=nm(e,0,t,r),c=It(o,se(Nt(s,a),i));return n===null?c:n?se(c,It(i,1)):se(c,i)}function nk(e,t,r){let{expr:n}=Xf(e,t),i=ak(e,t,r),o=qA(e,1,t,r),s=qA(e,0,t,r),a=nm(e,1,t,r),c=nm(e,0,t,r),l=It(o,se(ir(a,2),n)),u=It(s,se(ir(c,2),n));return se(It(i,se(Nt(a,c),n)),Hs(Nt(l,u)))}function Xf(e,t){let[r,n]=t.args,i=gn(e,Qp(r,n),t);return{expr:de(i),name:i}}function nm(e,t,r,n){let i=r.args,o=i[t],s=i[1-t],a=de(It(o,n(o))).where(Ri(s));return de(gn(e,a,r))}function qA(e,t,r,n){let i=r.args,o=i[t],s=i[1-t],a=de(ir(It(o,n(o)),2)).where(Ri(s));return de(gn(e,a,r))}function ak(e,t,r){let[n,i]=t.args,o=de(Nt(It(i,r(i)),It(n,r(n))));return de(gn(e,o,t))}function ck(e,t){let[r,n]=t.args,{expr:i,name:o}=Xf(e,t),s=gn(e,Hp(r,n),t);return se(de(Nt(s,o)),i)}function lk(e,t){let[r,n]=t.args,{expr:i,name:o}=Xf(e,t),s=gn(e,PT(r,n),t);return se(de(Nt(s,o)),i)}function VA(e,t,r,n){let{expr:i}=Xf(e,r),o=nm(e,t,r,n),s=qA(e,t,r,n);return It(s,se(ir(o,2),i))}function uk(e,t,r){let n=t1(e,t,r,null),i=VA(e,1,t,r);return se(n,i)}function HG(e,t,r){let n=ck(e,t),i=lk(e,t),o=uk(e,t,r);return It(i,Nt(o,n))}function fk(e){if(!e.filterStable)return null;let t=e.query();if(!gc(t))return null;let r=e1(t,c=>{let l=c._from[0]?.expr;return mc(l)?l.name:l});if(typeof r!="string")return null;let n=new Map,i={},o={},s=[],a=c=>{let l=c.column,u=e1(t,f=>f._select.find(d=>d.alias===l)?.expr);return tr`(SELECT avg(${u??c}) FROM "${r}")`};for(let{alias:c,expr:l}of t._select){if(ni(l)>1)return null;let u=EA(l);if(u.length===0)s.push(c),i[c]=l;else{for(let f of u){if(f.isDistinct)return null;let d=ik(f,i,a);if(!d)return null;n.set(f,d)}o[c]=em(l,n)}}return n.size?{group:s,preagg:i,output:o}:null}function e1(e,t){let r=e.subqueries;if(gc(e)&&r.length===0)return t(e);let n=e1(r[0],t);for(let i=1;i<r.length;++i){let o=e1(r[i],t);if(o!==void 0&&o!==n)return NaN}return n}var QG={skip:!0,result:null},r1=class{constructor(t,{schema:r="mosaic",enabled:n=!0}={}){this.entries=new Map,this.active=null,this.mc=t,this._schema=r,this._enabled=n}set enabled(t){this._enabled!==t&&(t||this.clear(),this._enabled=t)}get enabled(){return this._enabled}set schema(t){this._schema!==t&&(this.clear(),this._schema=t)}get schema(){return this._schema}dropSchema(){return this.clear(),this.mc.exec(`DROP SCHEMA IF EXISTS "${this.schema}" CASCADE`)}clear(){this.entries.clear(),this.active=null}request(t,r,n){if(!this.enabled)return null;let{entries:i,mc:o,schema:s}=this,{source:a}=n;if(!a||this.active&&(this.active.source!==a&&this.clear(),this.active?.source===null))return null;let{active:c}=this;if(!c&&(this.active=c=ZG(n),c.source===null))return null;if(i.has(t))return i.get(t);let l=fk(t),u;if(!l)u=null;else if(r.skip(t,n))u=QG;else{let f=r.remove(a).predicate(t);u=tX(t.query(f),c,l,s),u.result=o.exec([`CREATE SCHEMA IF NOT EXISTS ${s}`,_c(u.table,u.create,{temp:!1})]),u.result.catch(d=>o.logger().error(d))}return i.set(t,u),u}};function ZG(e){let{source:t,meta:r}=e,n=e.predicate,i=Gf(n).map(f=>f.column),o,s;if(!r||!i)return{source:null,columns:s,predicate:o};let{type:a,scales:c,bin:l,pixelSize:u=1}=r;if(a==="point")o=f=>f,s=Object.fromEntries(i.map(f=>[`${f}`,qt(f)]));else if(a==="interval"&&c){let f=c.map(d=>JG(d,u,l));f.some(d=>!d)||(f.length===1?(o=d=>d?jr("active0",d.extent.map(f[0])):[],s={active0:f[0](n.expr)}):(o=d=>d?on(d.clauses.map((h,p)=>jr(`active${p}`,h.extent.map(f[p])))):[],s=Object.fromEntries(n.clauses.map((d,h)=>[`active${h}`,f[h](d.expr)]))))}return{source:s?t:null,columns:s,predicate:o}}var KG={ceil:rA,round:Qs};function JG(e,t,r){let{type:n,domain:i,range:o,apply:s,sqlApply:a}=rm(e);if(!s)return;let c=KG[`${r}`.toLowerCase()]||Or,l=s(Math.min(...i)),u=s(Math.max(...i)),f=(n==="identity"?1:Math.abs(o[1]-o[0])/(u-l))/t,d=f===1?p=>p:p=>Nt(Ge(f),p),h=l===0?p=>p:p=>It(p,Ge(l));return p=>ve(c(d(h(a(p)))))}function tX(e,t,r,n){let{group:i,output:o,preagg:s}=r,{columns:a}=t,c=e.setSelect({...s,...a}).groupby(Object.keys(a)),[l]=c.subqueries;if(l){let y=Object.values(a).flatMap(g=>Gf(g).map(x=>x.column));eX(l,y)}let u=c._having,f=c._orderby;c._having=[],c._orderby=[];let d=c.toString(),h=(Kb(d)>>>0).toString(16),p=`${n}.preagg_${h}`,m=ft.select(i,o).from(p).groupby(i).having(u).orderby(f);return new YA({table:p,create:d,active:t,select:m})}function eX(e,t){let r=new Set,n=i=>{r.has(i)||(r.add(i),gc(i)&&i._from.length&&i.select(t),i.subqueries.forEach(n))};n(e)}var YA=class{constructor({table:t,create:r,active:n,select:i}){this.table=t,this.create=r,this.result=null,this.active=n,this.select=i,this.skip=!1}query(t){return this.select.clone().where(this.active.predicate(t))}};function WA(e){switch(e){case"BIGINT":case"HUGEINT":case"INTEGER":case"SMALLINT":case"TINYINT":case"UBIGINT":case"UINTEGER":case"USMALLINT":case"UTINYINT":case"DOUBLE":case"FLOAT":case"REAL":return"number";case"DATE":case"TIMESTAMP":case"TIMESTAMPTZ":case"TIMESTAMP WITH TIME ZONE":case"TIME":case"TIMESTAMP_NS":return"date";case"BOOLEAN":return"boolean";case"VARCHAR":case"UUID":case"JSON":return"string";case"ARRAY":case"LIST":return"array";case"BLOB":case"STRUCT":case"MAP":case"GEOMETRY":return"object";default:if(e.startsWith("DECIMAL"))return"number";if(e.startsWith("STRUCT")||e.startsWith("MAP"))return"object";if(e.endsWith("]"))return"array";throw new Error(`Unsupported type: ${e}`)}}var rX="count",nX="nulls",iX="max",oX="min",sX="distinct";var aX={[rX]:Mr,[sX]:e=>Mr(e).distinct(),[iX]:zr,[oX]:zn,[nX]:e=>Mr().where(Kl(e))};function cX(e,t,r){return ft.from(e).select(Array.from(r,n=>({[n]:aX[n](t)})))}async function dk(e,t){return t.length===1&&t[0].column==="*"?uX(e,t[0].table):(await Promise.all(t.map(r=>lX(e,r)))).filter(r=>r)}async function lX(e,{table:t,column:r,stats:n}){let i=ft.from({source:t}).select({column:r}).groupby(r.aggregate?tr`ALL`:[]),[o]=Array.from(await e.query(ft.describe(i))),s={table:t,column:`${r}`,sqlType:o.column_type,type:WA(o.column_type),nullable:o.null==="YES"};if(!(n?.length||n?.size))return s;let[a]=await e.query(cX(t,r,n),{persist:!0});return Object.assign(s,a)}async function uX(e,t){let r=await e.query(`DESCRIBE ${Yl(t)}`);return Array.from(r).map(n=>({table:t,column:n.column_name,sqlType:n.column_type,type:WA(n.column_type),nullable:n.null==="YES"}))}var wc=Object.freeze({pending:Symbol("pending"),ready:Symbol("ready"),error:Symbol("error"),done:Symbol("done")}),Jl=class extends Promise{constructor(){let t,r;super((n,i)=>{t=n,r=i}),this._resolve=t,this._reject=r,this._state=wc.pending,this._value=void 0}fulfill(t){if(this._value!==void 0){if(t!==void 0)throw Error("Promise is ready and fulfill has a provided value");this._resolve(this._value)}else{if(t===void 0)throw Error("Promise is neither ready nor has provided value");this._resolve(t)}return this._state=wc.done,this}ready(t){return this._state=wc.ready,this._value=t,this}reject(t){return this._state=wc.error,this._reject(t),this}get state(){return this._state}};Jl.prototype.constructor=Promise;function n1(){return{debug(...e){},info(...e){},log(...e){},warn(...e){},error(...e){}}}function fX(e){return(typeof requestAnimationFrame<"u"?requestAnimationFrame:typeof setImmediate<"u"?setImmediate:setTimeout)(e)}function hk(e,t){let r=[],n=0;function i(){let o=dX(r,t);r=[],n=0;for(let s of o)pX(s,e),gX(s,t)}return{add(o,s){o.request.type==="arrow"?(n=n||fX(()=>i()),r.push({entry:o,priority:s,index:r.length})):e(o,s)}}}function dX(e,t){let r=[],n=new Map;for(let i of e){let{entry:{request:o}}=i,s=hX(o.query,t);if(!n.has(s)){let a=[];r.push(a),n.set(s,a)}n.get(s).push(i)}return r}function hX(e,t){let r=`${e}`;if(gc(e)&&!t.get(r)){if(e._orderby.length||e._where.length||e._qualify.length||e._having.length)return r;let n=e.clone().setSelect("*"),i=e._groupby;if(i.length){let o={};e._select.forEach(({alias:s,expr:a})=>o[s]=a),n.setGroupby(i.map(s=>yc(s)&&o[s.column]||s))}else e._select.some(o=>ni(o.expr))&&n.setGroupby("ALL");return`${n}`}else return r}function pX(e,t){if(mX(e))t({request:{type:"arrow",cache:!1,query:e.query=yX(e)},result:e.result=new Jl});else for(let{entry:r,priority:n}of e)t(r,n)}function mX(e){if(e.length>1){let t=`${e[0].entry.request.query}`;for(let r=1;r<e.length;++r)if(t!==`${e[r].entry.request.query}`)return!0}return!1}function yX(e){let t=e.maps=[],r=new Map;for(let o of e){let{query:s}=o.entry.request,a=[];t.push(a);for(let{alias:c,expr:l}of s._select){let u=`${l}`;r.has(u)||r.set(u,[`col${r.size}`,l]);let[f]=r.get(u);a.push([f,c])}}let n=e[0].entry.request.query.clone(),i=n._groupby;if(i.length){let o={};e.maps[0].forEach(([s,a])=>o[a]=s),n.setGroupby(i.map(s=>yc(s)&&o[s.column]||s))}return n.setSelect(Array.from(r.values()))}async function gX(e,t){let{maps:r,query:n,result:i}=e;if(!r)return;let o;try{o=await i}catch(a){for(let{entry:c}of e)c.result.reject(a);return}let s=IT(n);e.forEach(({entry:a},c)=>{let{request:l,result:u}=a,f=r[c],d=s&&f?bX(o,f):f?xX(o,f):o;l.cache&&t.set(String(l.query),d),u.fulfill(d)})}function xX(e,t){return e.select(t.map(r=>r[0]),t.map(r=>r[1]))}function bX(e,t){let r=new Map(t),n=[];for(let i of e)r.has(i.column_name)&&n.push({...i,column_name:r.get(i.column_name)});return n}var _X=typeof requestIdleCallback<"u"?requestIdleCallback:setTimeout,pk=()=>({get:()=>{},set:(e,t)=>t,clear:()=>{}});function mk({max:e=1e3,ttl:t=3*60*60*1e3}={}){let r=new Map;function n(){let i=performance.now()-t,o=null,s=1/0;for(let[a,c]of r){let{last:l}=c;l<s&&(o=a,s=l),i>l&&r.delete(a)}o&&r.delete(o)}return{get(i){let o=r.get(i);if(o)return o.last=performance.now(),o.value},set(i,o){return r.set(i,{last:performance.now(),value:o}),r.size>e&&_X(n),o},clear(){r=new Map}}}var i1=class{constructor(t){this.queue=Array.from({length:t},()=>({head:null,tail:null}))}isEmpty(){return this.queue.every(t=>!t.head)}insert(t,r){let n=this.queue[r];if(!n)throw new Error(`Invalid queue priority rank: ${r}`);let i={item:t,next:null};n.head===null?n.head=n.tail=i:n.tail=n.tail.next=i}remove(t){for(let r of this.queue){let{head:n,tail:i}=r;for(let o=null,s=n;s;o=s,s=s.next)t(s.item)&&(s===n?n=s.next:o.next=s.next,s===i&&(i=o||n));r.head=n,r.tail=i}}next(){for(let t of this.queue){let{head:r}=t;if(r!==null)return t.head=r.next,t.tail===r&&(t.tail=null),r.item}}};var jo=Object.freeze({High:0,Normal:1,Low:2}),o1=class{constructor(t=32){this.queue=new i1(3),this.db=null,this.clientCache=null,this._logger=n1(),this._logQueries=!1,this._consolidate=null,this.pendingResults=[],this.maxConcurrentRequests=t,this.pendingExec=!1}next(){if(this.queue.isEmpty()||this.pendingResults.length>this.maxConcurrentRequests||this.pendingExec)return;let{request:t,result:r}=this.queue.next();this.pendingResults.push(r),t.type==="exec"&&(this.pendingExec=!0),this.submit(t,r).finally(()=>{for(;this.pendingResults.length&&this.pendingResults[0].state!==wc.pending;){let n=this.pendingResults.shift();n.state===wc.ready?n.fulfill():n.state===wc.done&&this._logger.warn("Found resolved query in pending results.")}t.type==="exec"&&(this.pendingExec=!1),this.next()})}enqueue(t,r=jo.Normal){this.queue.insert(t,r),this.next()}async submit(t,r){try{let{query:n,type:i,cache:o=!1,options:s}=t,a=n?`${n}`:null;if(o){let f=this.clientCache.get(a);if(f){let d=await f;this._logger.debug("Cache"),r.ready(d);return}}let c=performance.now();this._logQueries&&this._logger.debug("Query",{type:i,sql:a,...s});let l=this.db.query({type:i,sql:a,...s});o&&this.clientCache.set(a,l);let u=await l;o&&this.clientCache.set(a,u),this._logger.debug(`Request: ${(performance.now()-c).toFixed(1)}`),r.ready(i==="exec"?null:u)}catch(n){r.reject(n)}}cache(t){return t!==void 0?this.clientCache=t===!0?mk():t||pk():this.clientCache}logger(t){return t?this._logger=t:this._logger}logQueries(t){return t!==void 0?this._logQueries=!!t:this._logQueries}connector(t){return t?this.db=t:this.db}consolidate(t){t&&!this._consolidate?this._consolidate=hk(this.enqueue.bind(this),this.clientCache):!t&&this._consolidate&&(this._consolidate=null)}request(t,r=jo.Normal){let n=new Jl,i={request:t,result:n};return this._consolidate?this._consolidate.add(i,r):this.enqueue(i,r),n}cancel(t){let r=new Set(t);if(r.size){this.queue.remove(({result:n})=>r.has(n)?(n.reject("Canceled"),!0):!1);for(let n of this.pendingResults)r.has(n)&&n.reject("Canceled")}}clear(){this.queue.remove(({result:t})=>(t.reject("Cleared"),!0));for(let t of this.pendingResults)t.reject("Cleared");this.pendingResults=[]}};var s1;function Li(e){return e?s1=e:s1==null&&(s1=new im),s1}var im=class{constructor(t=xb(),{logger:r=console,manager:n=new o1,cache:i=!0,consolidate:o=!0,preagg:s={}}={}){this.manager=n,this.manager.cache(i),this.manager.consolidate(o),this.databaseConnector(t),this.logger(r),this.clear(),this.preaggregator=new r1(this,s)}clear({clients:t=!0,cache:r=!0}={}){this.manager.clear(),t&&(this.filterGroups?.forEach(n=>n.disconnect()),this.filterGroups=new Map,this.clients?.forEach(n=>this.disconnect(n)),this.clients=new Set),r&&this.manager.cache().clear()}databaseConnector(t){return this.manager.connector(t)}logger(t){return arguments.length&&(this._logger=t||n1(),this.manager.logger(this._logger)),this._logger}cancel(t){this.manager.cancel(t)}exec(t,{priority:r=jo.Normal}={}){return t=Array.isArray(t)?t.filter(n=>n).join(`;
2
- `):t,this.manager.request({type:"exec",query:t},r)}query(t,{type:r="arrow",cache:n=!0,priority:i=jo.Normal,...o}={}){return this.manager.request({type:r,query:t,cache:n,options:o},i)}prefetch(t,r={}){return this.query(t,{...r,cache:!0,priority:jo.Low})}createBundle(t,r,n=jo.Low){let i={name:t,queries:r.map(o=>typeof o=="string"?{sql:o}:o)};return this.manager.request({type:"create-bundle",options:i},n)}loadBundle(t,r=jo.High){let n={name:t};return this.manager.request({type:"load-bundle",options:n},r)}updateClient(t,r,n=jo.Normal){return t.queryPending(),this.query(r,{priority:n}).then(i=>t.queryResult(i).update(),i=>{this._logger.error(i),t.queryError(i)}).catch(i=>this._logger.error(i))}requestQuery(t,r){return this.preaggregator.clear(),r?this.updateClient(t,r):Promise.resolve(t.update())}async connect(t){let{clients:r}=this;if(r.has(t))throw new Error("Client already connected.");r.add(t),t.coordinator=this,this.initializeClient(t),wX(this,t.filterBy,t)}async initializeClient(t){let r=t.fields();return r?.length&&t.fieldInfo(await dk(this,r)),t.requestQuery()}disconnect(t){let{clients:r,filterGroups:n}=this;if(!r.has(t))return;r.delete(t),t.coordinator=null;let i=n.get(t.filterBy);i&&i.clients.delete(t)}};function wX(e,t,r){if(!t)return;let n=e.filterGroups.get(t);if(!n){let i=s=>vX(e,t,s),o=()=>SX(e,t);t.addEventListener("activate",i),t.addEventListener("value",o),n={selection:t,clients:new Set,disconnect(){t.removeEventListener("activate",i),t.removeEventListener("value",o)}},e.filterGroups.set(t,n)}n.clients.add(r)}function vX(e,t,r){let{preaggregator:n,filterGroups:i}=e,{clients:o}=i.get(t);for(let s of o)n.request(s,t,r)}function SX(e,t){let{preaggregator:r,filterGroups:n}=e,{clients:i}=n.get(t),{active:o}=t;return Promise.allSettled(Array.from(i,s=>{let a=r.request(s,t,o),c=a?null:t.predicate(s);if(a?.skip||!a&&!c)return;let l=a?.query(o.predicate)??s.query(c);return e.updateClient(s,l)}))}var a1=class{constructor(){this._callbacks=new Map}addEventListener(t,r){this._callbacks.has(t)||this._callbacks.set(t,{callbacks:new Set,pending:null,queue:new GA}),this._callbacks.get(t).callbacks.add(r)}removeEventListener(t,r){let n=this._callbacks.get(t);n&&n.callbacks.delete(r)}willEmit(t,r){return r}emitQueueFilter(t,r){return null}cancel(t){this._callbacks.get(t)?.queue.clear()}async pending(t){await this._callbacks.get(t)?.pending}emit(t,r){let n=this._callbacks.get(t)||{};if(n.pending)n.queue.enqueue(r,this.emitQueueFilter(t,r));else{let i=this.willEmit(t,r),{callbacks:o,queue:s}=n;if(o?.size){let a=Array.from(o,c=>c(i));n.pending=Promise.allSettled(a).then(()=>{n.pending=null,s.isEmpty()||this.emit(t,s.dequeue())})}}}},GA=class{constructor(){this.clear()}clear(){this.next=null}isEmpty(){return!this.next}enqueue(t,r){let n={value:t};if(r&&this.next){let i=this;for(;i.next;)r(i.next.value)?i=i.next:i.next=i.next.next;i.next=n}else this.next=n}dequeue(){let{next:t}=this;return this.next=t?.next,t?.value}};function om(e,t){return e===t?!1:e instanceof Date&&t instanceof Date?+e!=+t:Array.isArray(e)&&Array.isArray(t)?IX(e,t):!0}function IX(e,t){if(e.length!==t.length)return!0;for(let r=0;r<e.length;++r)if(e[r]!==t[r])return!0;return!1}function or(e){return e instanceof vc}var vc=class e extends a1{constructor(t){super(),this._value=t}static value(t){return new e(t)}static array(t){if(t.some(r=>or(r))){let r=new e,n=()=>{r.update(t.map(i=>or(i)?i.value:i))};return n(),t.forEach(i=>or(i)?i.addEventListener("value",n):0),r}return new e(t)}get value(){return this._value}update(t,{force:r}={}){return om(this._value,t)||r?this.emit("value",t):this.cancel("value"),this}willEmit(t,r){return t==="value"&&(this._value=r),r}};function ii(e){return e instanceof qo}function c1(e,t){return new qo(new l1(e),t&&[t].flat())}var qo=class e extends vc{static intersect({cross:t=!1,empty:r=!1,include:n=[]}={}){return c1({cross:t,empty:r},n)}static union({cross:t=!1,empty:r=!1,include:n=[]}={}){return c1({cross:t,empty:r,union:!0},n)}static single({cross:t=!1,empty:r=!1,include:n=[]}={}){return c1({cross:t,empty:r,single:!0},n)}static crossfilter({empty:t=!1,include:r=[]}={}){return c1({cross:!0,empty:t},r)}constructor(t=new l1,r=[]){if(super([]),this._resolved=this._value,this._resolver=t,this._relay=new Set,Array.isArray(r))for(let n of r)n._relay.add(this)}clone(){let t=new e(this._resolver);return t._value=t._resolved=this._value,t}remove(t){let r=this.clone();return r._value=r._resolved=r._resolver.resolve(this._resolved,{source:t}),r._value.active={source:t},r}get resolver(){return this._resolver}get single(){return this._resolver.single}get clauses(){return super.value}get active(){return this.clauses.active}get value(){return this.active?.value}valueFor(t){return this.clauses.find(r=>r.source===t)?.value}activate(t){this.emit("activate",t),this._relay.forEach(r=>r.activate(t))}update(t){return this._resolved=this._resolver.resolve(this._resolved,t,!0),this._resolved.active=t,this._relay.forEach(r=>r.update(t)),super.update(this._resolved)}willEmit(t,r){return t==="value"?(this._value=r,this.value):r}emitQueueFilter(t,r){return t==="value"?this._resolver.queueFilter(r):null}skip(t,r){return this._resolver.skip(t,r)}predicate(t,r=!1){let{clauses:n}=this,i=r?null:n.active;return this._resolver.predicate(n,i,t)}},l1=class{constructor({union:t,cross:r,single:n,empty:i}={}){this.union=!!t,this.cross=!!r,this.single=!!n,this.empty=!!i}resolve(t,r,n=!1){let{source:i,predicate:o}=r,s=t.filter(c=>i!==c.source),a=this.single?[]:s;return this.single&&n&&s.forEach(c=>c.source?.reset?.()),o&&a.push(r),a}skip(t,r){return this.cross&&r?.clients?.has(t)}predicate(t,r,n){let{empty:i,union:o}=this;if(i&&!t.length)return[Er(!1)];if(this.skip(n,r))return;let s=t.filter(a=>!this.skip(n,a)).map(a=>a.predicate);return o&&s.length>1?Oi(s):s}queueFilter(t){if(this.cross){let r=t.active?.source;return n=>n.active?.source!==r}return null}};function yk(e="http://localhost:3000/"){return{async query(t){let r=fetch(e,{method:"POST",mode:"cors",cache:"no-cache",credentials:"omit",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return t.type==="exec"?r:t.type==="arrow"?pc(await(await r).arrayBuffer()):(await r).json()}}}function xk(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}function Q(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(u){try{l(n.next(u))}catch(f){s(f)}}function c(u){try{l(n.throw(u))}catch(f){s(f)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((n=n.apply(e,t||[])).next())})}function gk(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ut(e){return this instanceof Ut?(this.v=e,this):new Ut(e)}function oi(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(h){return function(p){return Promise.resolve(p).then(h,f)}}function a(h,p){n[h]&&(i[h]=function(m){return new Promise(function(y,g){o.push([h,m,y,g])>1||c(h,m)})},p&&(i[h]=p(i[h])))}function c(h,p){try{l(n[h](p))}catch(m){d(o[0][3],m)}}function l(h){h.value instanceof Ut?Promise.resolve(h.value.v).then(u,f):d(o[0][2],h)}function u(h){c("next",h)}function f(h){c("throw",h)}function d(h,p){h(p),o.shift(),o.length&&c(o[0][0],o[0][1])}}function Hf(e){var t,r;return t={},n("next"),n("throw",function(i){throw i}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(i,o){t[i]=e[i]?function(s){return(r=!r)?{value:Ut(e[i](s)),done:!1}:o?o(s):s}:o}}function ao(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof gk=="function"?gk(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=e[o]&&function(s){return new Promise(function(a,c){s=e[o](s),i(a,c,s.done,s.value)})}}function i(o,s,a,c){Promise.resolve(c).then(function(l){o({value:l,done:a})},s)}}var JA={};Jn(JA,{compareArrayLike:()=>KA,joinUint8Arrays:()=>si,memcpy:()=>cm,rebaseValueOffsets:()=>g1,toArrayBufferView:()=>zt,toArrayBufferViewAsyncIterator:()=>uo,toArrayBufferViewIterator:()=>Yo,toBigInt64Array:()=>y1,toBigUint64Array:()=>LX,toFloat32Array:()=>FX,toFloat32ArrayAsyncIterator:()=>QX,toFloat32ArrayIterator:()=>jX,toFloat64Array:()=>CX,toFloat64ArrayAsyncIterator:()=>ZX,toFloat64ArrayIterator:()=>qX,toInt16Array:()=>OX,toInt16ArrayAsyncIterator:()=>WX,toInt16ArrayIterator:()=>PX,toInt32Array:()=>tu,toInt32ArrayAsyncIterator:()=>GX,toInt32ArrayIterator:()=>UX,toInt8Array:()=>NX,toInt8ArrayAsyncIterator:()=>YX,toInt8ArrayIterator:()=>BX,toUint16Array:()=>RX,toUint16ArrayAsyncIterator:()=>XX,toUint16ArrayIterator:()=>$X,toUint32Array:()=>DX,toUint32ArrayAsyncIterator:()=>HX,toUint32ArrayIterator:()=>zX,toUint8Array:()=>St,toUint8ArrayAsyncIterator:()=>ZA,toUint8ArrayIterator:()=>QA,toUint8ClampedArray:()=>kX,toUint8ClampedArrayAsyncIterator:()=>KX,toUint8ClampedArrayIterator:()=>VX});var TX=new TextDecoder("utf-8"),sm=e=>TX.decode(e),AX=new TextEncoder,Vo=e=>AX.encode(e);var EX=e=>typeof e=="number",bk=e=>typeof e=="boolean",gr=e=>typeof e=="function",xn=e=>e!=null&&Object(e)===e,co=e=>xn(e)&&gr(e.then);var lo=e=>xn(e)&&gr(e[Symbol.iterator]),Fi=e=>xn(e)&&gr(e[Symbol.asyncIterator]),u1=e=>xn(e)&&xn(e.schema);var f1=e=>xn(e)&&"done"in e&&"value"in e;var d1=e=>xn(e)&&gr(e.stat)&&EX(e.fd);var h1=e=>xn(e)&&am(e.body),p1=e=>"_getDOMStream"in e&&"_getNodeStream"in e,_k=e=>xn(e)&&gr(e.abort)&&gr(e.getWriter)&&!p1(e),am=e=>xn(e)&&gr(e.cancel)&&gr(e.getReader)&&!p1(e),wk=e=>xn(e)&&gr(e.end)&&gr(e.write)&&bk(e.writable)&&!p1(e),m1=e=>xn(e)&&gr(e.read)&&gr(e.pipe)&&bk(e.readable)&&!p1(e),vk=e=>xn(e)&&gr(e.clear)&&gr(e.bytes)&&gr(e.position)&&gr(e.setPosition)&&gr(e.capacity)&&gr(e.getBufferIdentifier)&&gr(e.createLong);var HA=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function MX(e){let t=e[0]?[e[0]]:[],r,n,i,o;for(let s,a,c=0,l=0,u=e.length;++c<u;){if(s=t[l],a=e[c],!s||!a||s.buffer!==a.buffer||a.byteOffset<s.byteOffset){a&&(t[++l]=a);continue}if({byteOffset:r,byteLength:i}=s,{byteOffset:n,byteLength:o}=a,r+i<n||n+o<r){a&&(t[++l]=a);continue}t[l]=new Uint8Array(s.buffer,r,n-r+o)}return t}function cm(e,t,r=0,n=t.byteLength){let i=e.byteLength,o=new Uint8Array(e.buffer,e.byteOffset,i),s=new Uint8Array(t.buffer,t.byteOffset,Math.min(n,i));return o.set(s,r),e}function si(e,t){let r=MX(e),n=r.reduce((u,f)=>u+f.byteLength,0),i,o,s,a=0,c=-1,l=Math.min(t||Number.POSITIVE_INFINITY,n);for(let u=r.length;++c<u;){if(i=r[c],o=i.subarray(0,Math.min(i.length,l-a)),l<=a+o.length){o.length<i.length?r[c]=i.subarray(o.length):o.length===i.length&&c++,s?cm(s,o,a):s=o;break}cm(s||(s=new Uint8Array(l)),o,a),a+=o.length}return[s||new Uint8Array(0),r.slice(c),n-(s?s.byteLength:0)]}function zt(e,t){let r=f1(t)?t.value:t;return r instanceof e?e===Uint8Array?new e(r.buffer,r.byteOffset,r.byteLength):r:r?(typeof r=="string"&&(r=Vo(r)),r instanceof ArrayBuffer?new e(r):r instanceof HA?new e(r):vk(r)?zt(e,r.bytes()):ArrayBuffer.isView(r)?r.byteLength<=0?new e(0):new e(r.buffer,r.byteOffset,r.byteLength/e.BYTES_PER_ELEMENT):e.from(r)):new e(0)}var NX=e=>zt(Int8Array,e),OX=e=>zt(Int16Array,e),tu=e=>zt(Int32Array,e),y1=e=>zt(BigInt64Array,e),St=e=>zt(Uint8Array,e),RX=e=>zt(Uint16Array,e),DX=e=>zt(Uint32Array,e),LX=e=>zt(BigUint64Array,e),FX=e=>zt(Float32Array,e),CX=e=>zt(Float64Array,e),kX=e=>zt(Uint8ClampedArray,e),XA=e=>(e.next(),e);function*Yo(e,t){let r=function*(i){yield i},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof HA?r(t):lo(t)?t:r(t);return yield*XA(function*(i){let o=null;do o=i.next(yield zt(e,o));while(!o.done)}(n[Symbol.iterator]())),new e}var BX=e=>Yo(Int8Array,e),PX=e=>Yo(Int16Array,e),UX=e=>Yo(Int32Array,e),QA=e=>Yo(Uint8Array,e),$X=e=>Yo(Uint16Array,e),zX=e=>Yo(Uint32Array,e),jX=e=>Yo(Float32Array,e),qX=e=>Yo(Float64Array,e),VX=e=>Yo(Uint8ClampedArray,e);function uo(e,t){return oi(this,arguments,function*(){if(co(t))return yield Ut(yield Ut(yield*Hf(ao(uo(e,yield Ut(t))))));let n=function(s){return oi(this,arguments,function*(){yield yield Ut(yield Ut(s))})},i=function(s){return oi(this,arguments,function*(){yield Ut(yield*Hf(ao(XA(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 HA?n(t):lo(t)?i(t):Fi(t)?t:n(t);return yield Ut(yield*Hf(ao(XA(function(s){return oi(this,arguments,function*(){let a=null;do a=yield Ut(s.next(yield yield Ut(zt(e,a))));while(!a.done)})}(o[Symbol.asyncIterator]()))))),yield Ut(new e)})}var YX=e=>uo(Int8Array,e),WX=e=>uo(Int16Array,e),GX=e=>uo(Int32Array,e),ZA=e=>uo(Uint8Array,e),XX=e=>uo(Uint16Array,e),HX=e=>uo(Uint32Array,e),QX=e=>uo(Float32Array,e),ZX=e=>uo(Float64Array,e),KX=e=>uo(Uint8ClampedArray,e);function g1(e,t,r){if(e!==0){r=r.slice(0,t);for(let n=-1,i=r.length;++n<i;)r[n]+=e}return r.subarray(0,t)}function KA(e,t){let r=0,n=e.length;if(n!==t.length)return!1;if(n>0)do if(e[r]!==t[r])return!1;while(++r<n);return!0}var qr={fromIterable(e){return x1(JX(e))},fromAsyncIterable(e){return x1(tH(e))},fromDOMStream(e){return x1(eH(e))},fromNodeStream(e){return x1(rH(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')}},x1=e=>(e.next(),e);function*JX(e){let t,r=!1,n=[],i,o,s,a=0;function c(){return o==="peek"?si(n,s)[0]:([i,n,a]=si(n,s),i)}({cmd:o,size:s}=(yield null)||{cmd:"read",size:0});let l=QA(e)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(s-a)?l.next():l.next(s-a),!t&&i.byteLength>0&&(n.push(i),a+=i.byteLength),t||s<=a)do({cmd:o,size:s}=yield c());while(s<a);while(!t)}catch(u){(r=!0)&&typeof l.throw=="function"&&l.throw(u)}finally{r===!1&&typeof l.return=="function"&&l.return(null)}return null}function tH(e){return oi(this,arguments,function*(){let r,n=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?si(i,a)[0]:([o,i,c]=si(i,a),o)}({cmd:s,size:a}=(yield yield Ut(null))||{cmd:"read",size:0});let u=ZA(e)[Symbol.asyncIterator]();try{do if({done:r,value:o}=Number.isNaN(a-c)?yield Ut(u.next()):yield Ut(u.next(a-c)),!r&&o.byteLength>0&&(i.push(o),c+=o.byteLength),r||a<=c)do({cmd:s,size:a}=yield yield Ut(l()));while(a<c);while(!r)}catch(f){(n=!0)&&typeof u.throw=="function"&&(yield Ut(u.throw(f)))}finally{n===!1&&typeof u.return=="function"&&(yield Ut(u.return(new Uint8Array(0))))}return yield Ut(null)})}function eH(e){return oi(this,arguments,function*(){let r=!1,n=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?si(i,a)[0]:([o,i,c]=si(i,a),o)}({cmd:s,size:a}=(yield yield Ut(null))||{cmd:"read",size:0});let u=new eE(e);try{do if({done:r,value:o}=Number.isNaN(a-c)?yield Ut(u.read()):yield Ut(u.read(a-c)),!r&&o.byteLength>0&&(i.push(St(o)),c+=o.byteLength),r||a<=c)do({cmd:s,size:a}=yield yield Ut(l()));while(a<c);while(!r)}catch(f){(n=!0)&&(yield Ut(u.cancel(f)))}finally{n===!1?yield Ut(u.cancel()):e.locked&&u.releaseLock()}return yield Ut(null)})}var eE=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 Q(this,void 0,void 0,function*(){let{reader:r,source:n}=this;r&&(yield r.cancel(t).catch(()=>{})),n&&n.locked&&this.releaseLock()})}read(t){return Q(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};let r=yield this.reader.read();return!r.done&&(r.value=St(r)),r})}},tE=(e,t)=>{let r=i=>n([t,i]),n;return[t,r,new Promise(i=>(n=i)&&e.once(t,r))]};function rH(e){return oi(this,arguments,function*(){let r=[],n="error",i=!1,o=null,s,a,c=0,l=[],u;function f(){return s==="peek"?si(l,a)[0]:([u,l,c]=si(l,a),u)}if({cmd:s,size:a}=(yield yield Ut(null))||{cmd:"read",size:0},e.isTTY)return yield yield Ut(new Uint8Array(0)),yield Ut(null);try{r[0]=tE(e,"end"),r[1]=tE(e,"error");do{if(r[2]=tE(e,"readable"),[n,o]=yield Ut(Promise.race(r.map(h=>h[2]))),n==="error")break;if((i=n==="end")||(Number.isFinite(a-c)?(u=St(e.read(a-c)),u.byteLength<a-c&&(u=St(e.read()))):u=St(e.read()),u.byteLength>0&&(l.push(u),c+=u.byteLength)),i||a<=c)do({cmd:s,size:a}=yield yield Ut(f()));while(a<c)}while(!i)}finally{yield Ut(d(r,n==="error"?o:null))}return yield Ut(null);function d(h,p){return u=l=null,new Promise((m,y)=>{for(let[g,x]of h)e.off(g,x);try{let g=e.destroy;g&&g.call(e,p),p=void 0}catch(g){p=g||p}finally{p!=null?y(p):m()}})}})}var he;(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"})(he||(he={}));var Se;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(Se||(Se={}));var be;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(be||(be={}));var Xe;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(Xe||(Xe={}));var ct;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(ct||(ct={}));var xr;(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"})(xr||(xr={}));var Wo=new Int32Array(2),b1=new Float32Array(Wo.buffer),_1=new Float64Array(Wo.buffer),Qf=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var lm;(function(e){e[e.UTF8_BYTES=1]="UTF8_BYTES",e[e.UTF16_STRING=2]="UTF16_STRING"})(lm||(lm={}));var ai=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 Wo[0]=this.readInt32(t),b1[0]}readFloat64(t){return Wo[Qf?0:1]=this.readInt32(t),Wo[Qf?1:0]=this.readInt32(t+4),_1[0]}writeInt8(t,r){this.bytes_[t]=r}writeUint8(t,r){this.bytes_[t]=r}writeInt16(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8}writeUint16(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8}writeInt32(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8,this.bytes_[t+2]=r>>16,this.bytes_[t+3]=r>>24}writeUint32(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8,this.bytes_[t+2]=r>>16,this.bytes_[t+3]=r>>24}writeInt64(t,r){this.writeInt32(t,Number(BigInt.asIntN(32,r))),this.writeInt32(t+4,Number(BigInt.asIntN(32,r>>BigInt(32))))}writeUint64(t,r){this.writeUint32(t,Number(BigInt.asUintN(32,r))),this.writeUint32(t+4,Number(BigInt.asUintN(32,r>>BigInt(32))))}writeFloat32(t,r){b1[0]=r,this.writeInt32(t,Wo[0])}writeFloat64(t,r){_1[0]=r,this.writeInt32(t,Wo[Qf?0:1]),this.writeInt32(t+4,Wo[Qf?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let r=0;r<4;r++)t+=String.fromCharCode(this.readInt8(this.position_+4+r));return t}__offset(t,r){let n=t-this.readInt32(t);return r<this.readInt16(n)?this.readInt16(n+r):0}__union(t,r){return t.bb_pos=r+this.readInt32(r),t.bb=this,t}__string(t,r){t+=this.readInt32(t);let n=this.readInt32(t);t+=4;let i=this.bytes_.subarray(t,t+n);return r===lm.UTF8_BYTES?i:this.text_decoder_.decode(i)}__union_with_string(t,r){return typeof t=="string"?this.__string(r):this.__union(t,r)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let r=0;r<4;r++)if(t.charCodeAt(r)!=this.readInt8(this.position()+4+r))return!1;return!0}createScalarList(t,r){let n=[];for(let i=0;i<r;++i){let o=t(i);o!==null&&n.push(o)}return n}createObjList(t,r){let n=[];for(let i=0;i<r;++i){let o=t(i);o!==null&&n.push(o.unpack())}return n}};var eu=class e{constructor(t){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let r;t?r=t:r=1024,this.bb=ai.allocate(r),this.space=r}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(t){this.force_defaults=t}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,r){t>this.minalign&&(this.minalign=t);let n=~(this.bb.capacity()-this.space+r)+1&t-1;for(;this.space<n+t+r;){let i=this.bb.capacity();this.bb=e.growByteBuffer(this.bb),this.space+=this.bb.capacity()-i}this.pad(n)}pad(t){for(let r=0;r<t;r++)this.bb.writeInt8(--this.space,0)}writeInt8(t){this.bb.writeInt8(this.space-=1,t)}writeInt16(t){this.bb.writeInt16(this.space-=2,t)}writeInt32(t){this.bb.writeInt32(this.space-=4,t)}writeInt64(t){this.bb.writeInt64(this.space-=8,t)}writeFloat32(t){this.bb.writeFloat32(this.space-=4,t)}writeFloat64(t){this.bb.writeFloat64(this.space-=8,t)}addInt8(t){this.prep(1,0),this.writeInt8(t)}addInt16(t){this.prep(2,0),this.writeInt16(t)}addInt32(t){this.prep(4,0),this.writeInt32(t)}addInt64(t){this.prep(8,0),this.writeInt64(t)}addFloat32(t){this.prep(4,0),this.writeFloat32(t)}addFloat64(t){this.prep(8,0),this.writeFloat64(t)}addFieldInt8(t,r,n){(this.force_defaults||r!=n)&&(this.addInt8(r),this.slot(t))}addFieldInt16(t,r,n){(this.force_defaults||r!=n)&&(this.addInt16(r),this.slot(t))}addFieldInt32(t,r,n){(this.force_defaults||r!=n)&&(this.addInt32(r),this.slot(t))}addFieldInt64(t,r,n){(this.force_defaults||r!==n)&&(this.addInt64(r),this.slot(t))}addFieldFloat32(t,r,n){(this.force_defaults||r!=n)&&(this.addFloat32(r),this.slot(t))}addFieldFloat64(t,r,n){(this.force_defaults||r!=n)&&(this.addFloat64(r),this.slot(t))}addFieldOffset(t,r,n){(this.force_defaults||r!=n)&&(this.addOffset(r),this.slot(t))}addFieldStruct(t,r,n){r!=n&&(this.nested(r),this.slot(t))}nested(t){if(t!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")}slot(t){this.vtable!==null&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){let r=t.capacity();if(r&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");let n=r<<1,i=ai.allocate(n);return i.setPosition(n-r),i.bytes().set(t.bytes(),n-r),i}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let r=0;r<t;r++)this.vtable[r]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let t=this.offset(),r=this.vtable_in_use-1;for(;r>=0&&this.vtable[r]==0;r--);let n=r+1;for(;r>=0;r--)this.addInt16(this.vtable[r]!=0?t-this.vtable[r]:0);let i=2;this.addInt16(t-this.object_start);let o=(n+i)*2;this.addInt16(o);let s=0,a=this.space;t:for(r=0;r<this.vtables.length;r++){let c=this.bb.capacity()-this.vtables[r];if(o==this.bb.readInt16(c)){for(let l=2;l<o;l+=2)if(this.bb.readInt16(a+l)!=this.bb.readInt16(c+l))continue t;s=this.vtables[r];break}}return s?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,s-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,r,n){let i=n?4:0;if(r){let o=r;if(this.prep(this.minalign,8+i),o.length!=4)throw new TypeError("FlatBuffers: file identifier must be length "+4);for(let s=3;s>=0;s--)this.writeInt8(o.charCodeAt(s))}this.prep(this.minalign,4+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,r){this.finish(t,r,!0)}requiredField(t,r){let n=this.bb.capacity()-t,i=n-this.bb.readInt32(n);if(!(r<this.bb.readInt16(i)&&this.bb.readInt16(i+r)!=0))throw new TypeError("FlatBuffers: field "+r+" must be set")}startVector(t,r,n){this.notNested(),this.vector_num_elems=r,this.prep(4,t*r),this.prep(n,t*r)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);let r=this.createString(t);return this.string_maps.set(t,r),r}createString(t){if(t==null)return 0;let r;return t instanceof Uint8Array?r=t:r=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,r.length,1),this.bb.setPosition(this.space-=r.length),this.bb.bytes().set(r,this.space),this.endVector()}createByteVector(t){return t==null?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector())}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){let r=[];for(let n=0;n<t.length;++n){let i=t[n];if(i!==null)r.push(this.createObjectOffset(i));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return r}createStructOffsetList(t,r){return r(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}};var um;(function(e){e[e.BUFFER=0]="BUFFER"})(um||(um={}));var fm;(function(e){e[e.LZ4_FRAME=0]="LZ4_FRAME",e[e.ZSTD=1]="ZSTD"})(fm||(fm={}));var v1=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBodyCompression(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}codec(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):fm.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):um.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,r){t.addFieldInt8(0,r,fm.LZ4_FRAME)}static addMethod(t,r){t.addFieldInt8(1,r,um.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,r,n){return e.startBodyCompression(t),e.addCodec(t,r),e.addMethod(t,n),e.endBodyCompression(t)}};var Zf=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(t,r,n){return t.prep(8,16),t.writeInt64(BigInt(n??0)),t.writeInt64(BigInt(r??0)),t.offset()}};var Kf=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(t,r,n){return t.prep(8,16),t.writeInt64(BigInt(n??0)),t.writeInt64(BigInt(r??0)),t.offset()}};var ci=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsRecordBatch(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}length(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,r){let n=this.bb.__offset(this.bb_pos,6);return n?(r||new Kf).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}nodesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,r){let n=this.bb.__offset(this.bb_pos,8);return n?(r||new Zf).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}buffersLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){let r=this.bb.__offset(this.bb_pos,10);return r?(t||new v1).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}static startRecordBatch(t){t.startObject(4)}static addLength(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addNodes(t,r){t.addFieldOffset(1,r,0)}static startNodesVector(t,r){t.startVector(16,r,8)}static addBuffers(t,r){t.addFieldOffset(2,r,0)}static startBuffersVector(t,r){t.startVector(16,r,8)}static addCompression(t,r){t.addFieldOffset(3,r,0)}static endRecordBatch(t){return t.endObject()}};var Zs=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDictionaryBatch(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new ci).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}isDelta(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startDictionaryBatch(t){t.startObject(3)}static addId(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addData(t,r){t.addFieldOffset(1,r,0)}static addIsDelta(t,r){t.addFieldInt8(2,+r,0)}static endDictionaryBatch(t){return t.endObject()}};var Sc;(function(e){e[e.Little=0]="Little",e[e.Big=1]="Big"})(Sc||(Sc={}));var dm;(function(e){e[e.DenseArray=0]="DenseArray"})(dm||(dm={}));var ho=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsInt(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startInt(t){t.startObject(2)}static addBitWidth(t,r){t.addFieldInt32(0,r,0)}static addIsSigned(t,r){t.addFieldInt8(1,+r,0)}static endInt(t){return t.endObject()}static createInt(t,r,n){return e.startInt(t),e.addBitWidth(t,r),e.addIsSigned(t,n),e.endInt(t)}};var Go=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDictionaryEncoding(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new ho).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}isOrdered(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}dictionaryKind(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):dm.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addIndexType(t,r){t.addFieldOffset(1,r,0)}static addIsOrdered(t,r){t.addFieldInt8(2,+r,0)}static addDictionaryKind(t,r){t.addFieldInt16(3,r,dm.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var br=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsKeyValue(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}key(t){let r=this.bb.__offset(this.bb_pos,4);return r?this.bb.__string(this.bb_pos+r,t):null}value(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.__string(this.bb_pos+r,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,r){t.addFieldOffset(0,r,0)}static addValue(t,r){t.addFieldOffset(1,r,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,r,n){return e.startKeyValue(t),e.addKey(t,r),e.addValue(t,n),e.endKeyValue(t)}};var hm=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBinary(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return e.startBinary(t),e.endBinary(t)}};var pm=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBool(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return e.startBool(t),e.endBool(t)}};var Ic=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDate(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Xe.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,Xe.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,r){return e.startDate(t),e.addUnit(t,r),e.endDate(t)}};var Xo=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDecimal(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,r){t.addFieldInt32(0,r,0)}static addScale(t,r){t.addFieldInt32(1,r,0)}static addBitWidth(t,r){t.addFieldInt32(2,r,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,r,n,i){return e.startDecimal(t),e.addPrecision(t,r),e.addScale(t,n),e.addBitWidth(t,i),e.endDecimal(t)}};var Tc=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDuration(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ct.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,ct.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,r){return e.startDuration(t),e.addUnit(t,r),e.endDuration(t)}};var Ac=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFixedSizeBinary(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,r){t.addFieldInt32(0,r,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,r){return e.startFixedSizeBinary(t),e.addByteWidth(t,r),e.endFixedSizeBinary(t)}};var Ec=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFixedSizeList(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}listSize(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,r){t.addFieldInt32(0,r,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,r){return e.startFixedSizeList(t),e.addListSize(t,r),e.endFixedSizeList(t)}};var Mc=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFloatingPoint(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):be.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,r){t.addFieldInt16(0,r,be.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,r){return e.startFloatingPoint(t),e.addPrecision(t,r),e.endFloatingPoint(t)}};var Nc=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsInterval(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):xr.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,xr.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,r){return e.startInterval(t),e.addUnit(t,r),e.endInterval(t)}};var mm=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsLargeBinary(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return e.startLargeBinary(t),e.endLargeBinary(t)}};var ym=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsLargeUtf8(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return e.startLargeUtf8(t),e.endLargeUtf8(t)}};var gm=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsList(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return e.startList(t),e.endList(t)}};var Oc=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsMap(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let t=this.bb.__offset(this.bb_pos,4);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startMap(t){t.startObject(1)}static addKeysSorted(t,r){t.addFieldInt8(0,+r,0)}static endMap(t){return t.endObject()}static createMap(t,r){return e.startMap(t),e.addKeysSorted(t,r),e.endMap(t)}};var xm=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsNull(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return e.startNull(t),e.endNull(t)}};var bm=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsStruct_(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return e.startStruct_(t),e.endStruct_(t)}};var Ks=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsTime(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ct.MILLISECOND}bitWidth(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,r){t.addFieldInt16(0,r,ct.MILLISECOND)}static addBitWidth(t,r){t.addFieldInt32(1,r,32)}static endTime(t){return t.endObject()}static createTime(t,r,n){return e.startTime(t),e.addUnit(t,r),e.addBitWidth(t,n),e.endTime(t)}};var Js=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsTimestamp(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ct.SECOND}timezone(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.__string(this.bb_pos+r,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,r){t.addFieldInt16(0,r,ct.SECOND)}static addTimezone(t,r){t.addFieldOffset(1,r,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,r,n){return e.startTimestamp(t),e.addUnit(t,r),e.addTimezone(t,n),e.endTimestamp(t)}};var po=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsUnion(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}mode(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Se.Sparse}typeIds(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.readInt32(this.bb.__vector(this.bb_pos+r)+t*4):0}typeIdsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){let t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,r){t.addFieldInt16(0,r,Se.Sparse)}static addTypeIds(t,r){t.addFieldOffset(1,r,0)}static createTypeIdsVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addInt32(r[n]);return t.endVector()}static startTypeIdsVector(t,r){t.startVector(4,r,4)}static endUnion(t){return t.endObject()}static createUnion(t,r,n){return e.startUnion(t),e.addMode(t,r),e.addTypeIds(t,n),e.endUnion(t)}};var _m=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsUtf8(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return e.startUtf8(t),e.endUtf8(t)}};var Ie;(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"})(Ie||(Ie={}));var sn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsField(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}name(t){let r=this.bb.__offset(this.bb_pos,4);return r?this.bb.__string(this.bb_pos+r,t):null}nullable(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):Ie.NONE}type(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.__union(t,this.bb_pos+r):null}dictionary(t){let r=this.bb.__offset(this.bb_pos,12);return r?(t||new Go).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}children(t,r){let n=this.bb.__offset(this.bb_pos,14);return n?(r||new e).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}childrenLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,16);return n?(r||new br).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,r){t.addFieldOffset(0,r,0)}static addNullable(t,r){t.addFieldInt8(1,+r,0)}static addTypeType(t,r){t.addFieldInt8(2,r,Ie.NONE)}static addType(t,r){t.addFieldOffset(3,r,0)}static addDictionary(t,r){t.addFieldOffset(4,r,0)}static addChildren(t,r){t.addFieldOffset(5,r,0)}static createChildrenVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startChildrenVector(t,r){t.startVector(4,r,4)}static addCustomMetadata(t,r){t.addFieldOffset(6,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endField(t){return t.endObject()}};var qn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsSchema(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Sc.Little}fields(t,r){let n=this.bb.__offset(this.bb_pos,6);return n?(r||new sn).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}fieldsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,8);return n?(r||new br).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.readInt64(this.bb.__vector(this.bb_pos+r)+t*8):BigInt(0)}featuresLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,r){t.addFieldInt16(0,r,Sc.Little)}static addFields(t,r){t.addFieldOffset(1,r,0)}static createFieldsVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startFieldsVector(t,r){t.startVector(4,r,4)}static addCustomMetadata(t,r){t.addFieldOffset(2,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static addFeatures(t,r){t.addFieldOffset(3,r,0)}static createFeaturesVector(t,r){t.startVector(8,r.length,8);for(let n=r.length-1;n>=0;n--)t.addInt64(r[n]);return t.endVector()}static startFeaturesVector(t,r){t.startVector(8,r,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,r){t.finish(r)}static finishSizePrefixedSchemaBuffer(t,r){t.finish(r,void 0,!0)}static createSchema(t,r,n,i,o){return e.startSchema(t),e.addEndianness(t,r),e.addFields(t,n),e.addCustomMetadata(t,i),e.addFeatures(t,o),e.endSchema(t)}};var Vt;(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"})(Vt||(Vt={}));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.LargeBinary=19]="LargeBinary",e[e.LargeUtf8=20]="LargeUtf8",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth",e[e.DurationSecond=-27]="DurationSecond",e[e.DurationMillisecond=-28]="DurationMillisecond",e[e.DurationMicrosecond=-29]="DurationMicrosecond",e[e.DurationNanosecond=-30]="DurationNanosecond"})(D||(D={}));var ki;(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(ki||(ki={}));var wE={};Jn(wE,{clampRange:()=>Im,createElementComparator:()=>Fc,wrapIndex:()=>ru});var rE={};Jn(rE,{valueToString:()=>mo});function mo(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=>mo(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,r)=>typeof r=="bigint"?`${r}`:r)}var sE={};Jn(sE,{BN:()=>vm,bigNumToBigInt:()=>Ik,bigNumToNumber:()=>oE,bigNumToString:()=>ed,isArrowBigNumSymbol:()=>Sk});function re(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)}function nE(e,t){return re(e/t)+re(e%t)/re(t)}var Sk=Symbol.for("isArrowBigNum");function yo(e,...t){return t.length===0?Object.setPrototypeOf(zt(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}yo.prototype[Sk]=!0;yo.prototype.toJSON=function(){return`"${ed(this)}"`};yo.prototype.valueOf=function(e){return oE(this,e)};yo.prototype.toString=function(){return ed(this)};yo.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return oE(this);case"string":return ed(this);case"default":return Ik(this)}return ed(this)};function Jf(...e){return yo.apply(this,e)}function td(...e){return yo.apply(this,e)}function wm(...e){return yo.apply(this,e)}Object.setPrototypeOf(Jf.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(td.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(wm.prototype,Object.create(Uint32Array.prototype));Object.assign(Jf.prototype,yo.prototype,{constructor:Jf,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(td.prototype,yo.prototype,{constructor:td,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(wm.prototype,yo.prototype,{constructor:wm,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});var nH=BigInt(4294967296)*BigInt(4294967296),iH=nH-BigInt(1);function oE(e,t){let{buffer:r,byteOffset:n,byteLength:i,signed:o}=e,s=new BigUint64Array(r,n,i/8),a=o&&s.at(-1)&BigInt(1)<<BigInt(63),c=BigInt(0),l=0;if(a){for(let u of s)c|=(u^iH)*(BigInt(1)<<BigInt(64*l++));c*=BigInt(-1),c-=BigInt(1)}else for(let u of s)c|=u*(BigInt(1)<<BigInt(64*l++));if(typeof t=="number"){let u=BigInt(Math.pow(10,t)),f=c/u,d=c%u;return re(f)+re(d)/re(u)}return re(c)}function ed(e){if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return iE(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return iE(e);t=t.slice();let n=1;for(let o=0;o<t.length;o++){let s=t[o],a=~s+n;t[o]=a,n&=s===0?1:0}return`-${iE(t)}`}function Ik(e){return e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:ed(e)}function iE(e){let t="",r=new Uint32Array(2),n=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),i=new Uint32Array((n=new Uint16Array(n).reverse()).buffer),o=-1,s=n.length-1;do{for(r[0]=n[o=0];o<s;)n[o++]=r[1]=r[0]/10,r[0]=(r[0]-r[1]*10<<16)+n[o];n[o]=r[1]=r[0]/10,r[0]=r[0]-r[1]*10,t=`${r[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t??"0"}var vm=class e{static new(t,r){switch(r){case!0:return new Jf(t);case!1:return new td(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new Jf(t)}return t.byteLength===16?new wm(t):new td(t)}static signed(t){return new Jf(t)}static unsigned(t){return new td(t)}static decimal(t){return new wm(t)}constructor(t,r){return e.new(t,r)}};var Tk,Ak,Ek,Mk,Nk,Ok,Rk,Dk,Lk,Fk,Ck,kk,Bk,Pk,Uk,$k,zk,jk,qk,Vk,Yk,Wk,K=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 isLargeBinary(t){return t?.typeId===D.LargeBinary}static isUtf8(t){return t?.typeId===D.Utf8}static isLargeUtf8(t){return t?.typeId===D.LargeUtf8}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===Se.Dense}static isSparseUnion(t){return e.isUnion(t)&&t.mode===Se.Sparse}constructor(t){this.typeId=t}};Tk=Symbol.toStringTag;K[Tk]=(e=>(e.children=null,e.ArrayType=Array,e.OffsetArrayType=Int32Array,e[Symbol.toStringTag]="DataType"))(K.prototype);var bn=class extends K{constructor(){super(D.Null)}toString(){return"Null"}};Ak=Symbol.toStringTag;bn[Ak]=(e=>e[Symbol.toStringTag]="Null")(bn.prototype);var _r=class extends K{constructor(t,r){super(D.Int),this.isSigned=t,this.bitWidth=r}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}};Ek=Symbol.toStringTag;_r[Ek]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(_r.prototype);var S1=class extends _r{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},I1=class extends _r{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},Ho=class extends _r{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},T1=class extends _r{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},A1=class extends _r{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},E1=class extends _r{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},M1=class extends _r{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},N1=class extends _r{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(S1.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(I1.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(Ho.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(T1.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(A1.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(E1.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(M1.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(N1.prototype,"ArrayType",{value:BigUint64Array});var Bi=class extends K{constructor(t){super(D.Float),this.precision=t}get ArrayType(){switch(this.precision){case be.HALF:return Uint16Array;case be.SINGLE:return Float32Array;case be.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};Mk=Symbol.toStringTag;Bi[Mk]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(Bi.prototype);var O1=class extends Bi{constructor(){super(be.HALF)}},R1=class extends Bi{constructor(){super(be.SINGLE)}},D1=class extends Bi{constructor(){super(be.DOUBLE)}};Object.defineProperty(O1.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(R1.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(D1.prototype,"ArrayType",{value:Float64Array});var ta=class extends K{constructor(){super(D.Binary)}toString(){return"Binary"}};Nk=Symbol.toStringTag;ta[Nk]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(ta.prototype);var ea=class extends K{constructor(){super(D.LargeBinary)}toString(){return"LargeBinary"}};Ok=Symbol.toStringTag;ea[Ok]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeBinary"))(ea.prototype);var ra=class extends K{constructor(){super(D.Utf8)}toString(){return"Utf8"}};Rk=Symbol.toStringTag;ra[Rk]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(ra.prototype);var na=class extends K{constructor(){super(D.LargeUtf8)}toString(){return"LargeUtf8"}};Dk=Symbol.toStringTag;na[Dk]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeUtf8"))(na.prototype);var ia=class extends K{constructor(){super(D.Bool)}toString(){return"Bool"}};Lk=Symbol.toStringTag;ia[Lk]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(ia.prototype);var oa=class extends K{constructor(t,r,n=128){super(D.Decimal),this.scale=t,this.precision=r,this.bitWidth=n}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};Fk=Symbol.toStringTag;oa[Fk]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(oa.prototype);var sa=class extends K{constructor(t){super(D.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${Xe[this.unit]}>`}get ArrayType(){return this.unit===Xe.DAY?Int32Array:BigInt64Array}};Ck=Symbol.toStringTag;sa[Ck]=(e=>(e.unit=null,e[Symbol.toStringTag]="Date"))(sa.prototype);var aa=class extends K{constructor(t,r){super(D.Time),this.unit=t,this.bitWidth=r}toString(){return`Time${this.bitWidth}<${ct[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};kk=Symbol.toStringTag;aa[kk]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))(aa.prototype);var ca=class extends K{constructor(t,r){super(D.Timestamp),this.unit=t,this.timezone=r}toString(){return`Timestamp<${ct[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};Bk=Symbol.toStringTag;ca[Bk]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Timestamp"))(ca.prototype);var la=class extends K{constructor(t){super(D.Interval),this.unit=t}toString(){return`Interval<${xr[this.unit]}>`}};Pk=Symbol.toStringTag;la[Pk]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))(la.prototype);var ua=class extends K{constructor(t){super(D.Duration),this.unit=t}toString(){return`Duration<${ct[this.unit]}>`}};Uk=Symbol.toStringTag;ua[Uk]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Duration"))(ua.prototype);var go=class extends K{constructor(t){super(D.List),this.children=[t]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};$k=Symbol.toStringTag;go[$k]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(go.prototype);var Re=class extends K{constructor(t){super(D.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};zk=Symbol.toStringTag;Re[zk]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(Re.prototype);var xo=class extends K{constructor(t,r,n){super(D.Union),this.mode=t,this.children=n,this.typeIds=r=Int32Array.from(r),this.typeIdToChildIndex=r.reduce((i,o,s)=>(i[o]=s)&&i||i,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};jk=Symbol.toStringTag;xo[jk]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(xo.prototype);var fa=class extends K{constructor(t){super(D.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};qk=Symbol.toStringTag;fa[qk]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(fa.prototype);var bo=class extends K{constructor(t,r){super(D.FixedSizeList),this.listSize=t,this.children=[r]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}};Vk=Symbol.toStringTag;bo[Vk]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(bo.prototype);var _o=class extends K{constructor(t,r=!1){var n,i,o;if(super(D.Map),this.children=[t],this.keysSorted=r,t&&(t.name="entries",!((n=t?.type)===null||n===void 0)&&n.children)){let s=(i=t?.type)===null||i===void 0?void 0:i.children[0];s&&(s.name="key");let a=(o=t?.type)===null||o===void 0?void 0:o.children[1];a&&(a.name="value")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};Yk=Symbol.toStringTag;_o[Yk]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(_o.prototype);var oH=(e=>()=>++e)(-1),li=class extends K{constructor(t,r,n,i){super(D.Dictionary),this.indices=r,this.dictionary=t,this.isOrdered=i||!1,this.id=n==null?oH():re(n)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};Wk=Symbol.toStringTag;li[Wk]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(li.prototype);function ui(e){let t=e;switch(e.typeId){case D.Decimal:return e.bitWidth/32;case D.Interval:return 1+t.unit;case D.FixedSizeList:return t.listSize;case D.FixedSizeBinary:return t.byteWidth;default:return 1}}var mt=class{visitMany(t,...r){return t.map((n,i)=>this.visit(n,...r.map(o=>o[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,r=!0){return sH(this,t,r)}getVisitFnByTypeId(t,r=!0){return rd(this,t,r)}visitNull(t,...r){return null}visitBool(t,...r){return null}visitInt(t,...r){return null}visitFloat(t,...r){return null}visitUtf8(t,...r){return null}visitLargeUtf8(t,...r){return null}visitBinary(t,...r){return null}visitLargeBinary(t,...r){return null}visitFixedSizeBinary(t,...r){return null}visitDate(t,...r){return null}visitTimestamp(t,...r){return null}visitTime(t,...r){return null}visitDecimal(t,...r){return null}visitList(t,...r){return null}visitStruct(t,...r){return null}visitUnion(t,...r){return null}visitDictionary(t,...r){return null}visitInterval(t,...r){return null}visitDuration(t,...r){return null}visitFixedSizeList(t,...r){return null}visitMap(t,...r){return null}};function sH(e,t,r=!0){return typeof t=="number"?rd(e,t,r):typeof t=="string"&&t in D?rd(e,D[t],r):t&&t instanceof K?rd(e,Gk(t),r):t?.type&&t.type instanceof K?rd(e,Gk(t.type),r):rd(e,D.NONE,r)}function rd(e,t,r=!0){let n=null;switch(t){case D.Null:n=e.visitNull;break;case D.Bool:n=e.visitBool;break;case D.Int:n=e.visitInt;break;case D.Int8:n=e.visitInt8||e.visitInt;break;case D.Int16:n=e.visitInt16||e.visitInt;break;case D.Int32:n=e.visitInt32||e.visitInt;break;case D.Int64:n=e.visitInt64||e.visitInt;break;case D.Uint8:n=e.visitUint8||e.visitInt;break;case D.Uint16:n=e.visitUint16||e.visitInt;break;case D.Uint32:n=e.visitUint32||e.visitInt;break;case D.Uint64:n=e.visitUint64||e.visitInt;break;case D.Float:n=e.visitFloat;break;case D.Float16:n=e.visitFloat16||e.visitFloat;break;case D.Float32:n=e.visitFloat32||e.visitFloat;break;case D.Float64:n=e.visitFloat64||e.visitFloat;break;case D.Utf8:n=e.visitUtf8;break;case D.LargeUtf8:n=e.visitLargeUtf8;break;case D.Binary:n=e.visitBinary;break;case D.LargeBinary:n=e.visitLargeBinary;break;case D.FixedSizeBinary:n=e.visitFixedSizeBinary;break;case D.Date:n=e.visitDate;break;case D.DateDay:n=e.visitDateDay||e.visitDate;break;case D.DateMillisecond:n=e.visitDateMillisecond||e.visitDate;break;case D.Timestamp:n=e.visitTimestamp;break;case D.TimestampSecond:n=e.visitTimestampSecond||e.visitTimestamp;break;case D.TimestampMillisecond:n=e.visitTimestampMillisecond||e.visitTimestamp;break;case D.TimestampMicrosecond:n=e.visitTimestampMicrosecond||e.visitTimestamp;break;case D.TimestampNanosecond:n=e.visitTimestampNanosecond||e.visitTimestamp;break;case D.Time:n=e.visitTime;break;case D.TimeSecond:n=e.visitTimeSecond||e.visitTime;break;case D.TimeMillisecond:n=e.visitTimeMillisecond||e.visitTime;break;case D.TimeMicrosecond:n=e.visitTimeMicrosecond||e.visitTime;break;case D.TimeNanosecond:n=e.visitTimeNanosecond||e.visitTime;break;case D.Decimal:n=e.visitDecimal;break;case D.List:n=e.visitList;break;case D.Struct:n=e.visitStruct;break;case D.Union:n=e.visitUnion;break;case D.DenseUnion:n=e.visitDenseUnion||e.visitUnion;break;case D.SparseUnion:n=e.visitSparseUnion||e.visitUnion;break;case D.Dictionary:n=e.visitDictionary;break;case D.Interval:n=e.visitInterval;break;case D.IntervalDayTime:n=e.visitIntervalDayTime||e.visitInterval;break;case D.IntervalYearMonth:n=e.visitIntervalYearMonth||e.visitInterval;break;case D.Duration:n=e.visitDuration;break;case D.DurationSecond:n=e.visitDurationSecond||e.visitDuration;break;case D.DurationMillisecond:n=e.visitDurationMillisecond||e.visitDuration;break;case D.DurationMicrosecond:n=e.visitDurationMicrosecond||e.visitDuration;break;case D.DurationNanosecond:n=e.visitDurationNanosecond||e.visitDuration;break;case D.FixedSizeList:n=e.visitFixedSizeList;break;case D.Map:n=e.visitMap;break}if(typeof n=="function")return n;if(!r)return()=>null;throw new Error(`Unrecognized type '${D[t]}'`)}function Gk(e){switch(e.typeId){case D.Null:return D.Null;case D.Int:{let{bitWidth:t,isSigned:r}=e;switch(t){case 8:return r?D.Int8:D.Uint8;case 16:return r?D.Int16:D.Uint16;case 32:return r?D.Int32:D.Uint32;case 64:return r?D.Int64:D.Uint64}return D.Int}case D.Float:switch(e.precision){case be.HALF:return D.Float16;case be.SINGLE:return D.Float32;case be.DOUBLE:return D.Float64}return D.Float;case D.Binary:return D.Binary;case D.LargeBinary:return D.LargeBinary;case D.Utf8:return D.Utf8;case D.LargeUtf8:return D.LargeUtf8;case D.Bool:return D.Bool;case D.Decimal:return D.Decimal;case D.Time:switch(e.unit){case ct.SECOND:return D.TimeSecond;case ct.MILLISECOND:return D.TimeMillisecond;case ct.MICROSECOND:return D.TimeMicrosecond;case ct.NANOSECOND:return D.TimeNanosecond}return D.Time;case D.Timestamp:switch(e.unit){case ct.SECOND:return D.TimestampSecond;case ct.MILLISECOND:return D.TimestampMillisecond;case ct.MICROSECOND:return D.TimestampMicrosecond;case ct.NANOSECOND:return D.TimestampNanosecond}return D.Timestamp;case D.Date:switch(e.unit){case Xe.DAY:return D.DateDay;case Xe.MILLISECOND:return D.DateMillisecond}return D.Date;case D.Interval:switch(e.unit){case xr.DAY_TIME:return D.IntervalDayTime;case xr.YEAR_MONTH:return D.IntervalYearMonth}return D.Interval;case D.Duration:switch(e.unit){case ct.SECOND:return D.DurationSecond;case ct.MILLISECOND:return D.DurationMillisecond;case ct.MICROSECOND:return D.DurationMicrosecond;case ct.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 Se.Dense:return D.DenseUnion;case Se.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]}'`)}mt.prototype.visitInt8=null;mt.prototype.visitInt16=null;mt.prototype.visitInt32=null;mt.prototype.visitInt64=null;mt.prototype.visitUint8=null;mt.prototype.visitUint16=null;mt.prototype.visitUint32=null;mt.prototype.visitUint64=null;mt.prototype.visitFloat16=null;mt.prototype.visitFloat32=null;mt.prototype.visitFloat64=null;mt.prototype.visitDateDay=null;mt.prototype.visitDateMillisecond=null;mt.prototype.visitTimestampSecond=null;mt.prototype.visitTimestampMillisecond=null;mt.prototype.visitTimestampMicrosecond=null;mt.prototype.visitTimestampNanosecond=null;mt.prototype.visitTimeSecond=null;mt.prototype.visitTimeMillisecond=null;mt.prototype.visitTimeMicrosecond=null;mt.prototype.visitTimeNanosecond=null;mt.prototype.visitDenseUnion=null;mt.prototype.visitSparseUnion=null;mt.prototype.visitIntervalDayTime=null;mt.prototype.visitIntervalYearMonth=null;mt.prototype.visitDuration=null;mt.prototype.visitDurationSecond=null;mt.prototype.visitDurationMillisecond=null;mt.prototype.visitDurationMicrosecond=null;mt.prototype.visitDurationNanosecond=null;var aE={};Jn(aE,{float64ToUint16:()=>Sm,uint16ToFloat64:()=>L1});var Xk=new Float64Array(1),nd=new Uint32Array(Xk.buffer);function L1(e){let t=(e&31744)>>10,r=(e&1023)/1024,n=Math.pow(-1,(e&32768)>>15);switch(t){case 31:return n*(r?Number.NaN:1/0);case 0:return n*(r?6103515625e-14*r:0)}return n*Math.pow(2,t-15)*(1+r)}function Sm(e){if(e!==e)return 32256;Xk[0]=e;let t=(nd[1]&2147483648)>>16&65535,r=nd[1]&2146435072,n=0;return r>=1089470464?nd[0]>0?r=31744:(r=(r&2080374784)>>16,n=(nd[1]&1048575)>>10):r<=1056964608?(n=1048576+(nd[1]&1048575),n=1048576+(n<<(r>>20)-998)>>21,r=0):(r=r-1056964608>>10,n=(nd[1]&1048575)+512>>10),t|r|n&65535}var wt=class extends mt{};function Ot(e){return(t,r,n)=>{if(t.setValid(r,n!=null))return e(t,r,n)}}var aH=(e,t,r)=>{e[t]=Math.floor(r/864e5)},Hk=(e,t,r,n)=>{if(r+1<t.length){let i=re(t[r]),o=re(t[r+1]);e.set(n.subarray(0,o-i),i)}},cH=({offset:e,values:t},r,n)=>{let i=e+r;n?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},da=({values:e},t,r)=>{e[t]=r},cE=({values:e},t,r)=>{e[t]=r},Qk=({values:e},t,r)=>{e[t]=Sm(r)},lH=(e,t,r)=>{switch(e.type.precision){case be.HALF:return Qk(e,t,r);case be.SINGLE:case be.DOUBLE:return cE(e,t,r)}},F1=({values:e},t,r)=>{aH(e,t,r.valueOf())},C1=({values:e},t,r)=>{e[t]=BigInt(r)},lE=({stride:e,values:t},r,n)=>{t.set(n.subarray(0,e),e*r)},Zk=({values:e,valueOffsets:t},r,n)=>Hk(e,t,r,n),Kk=({values:e,valueOffsets:t},r,n)=>Hk(e,t,r,Vo(n)),uE=(e,t,r)=>{e.type.unit===Xe.DAY?F1(e,t,r):C1(e,t,r)},k1=({values:e},t,r)=>{e[t]=BigInt(r/1e3)},B1=({values:e},t,r)=>{e[t]=BigInt(r)},P1=({values:e},t,r)=>{e[t]=BigInt(r*1e3)},U1=({values:e},t,r)=>{e[t]=BigInt(r*1e6)},fE=(e,t,r)=>{switch(e.type.unit){case ct.SECOND:return k1(e,t,r);case ct.MILLISECOND:return B1(e,t,r);case ct.MICROSECOND:return P1(e,t,r);case ct.NANOSECOND:return U1(e,t,r)}},$1=({values:e},t,r)=>{e[t]=r},z1=({values:e},t,r)=>{e[t]=r},j1=({values:e},t,r)=>{e[t]=r},q1=({values:e},t,r)=>{e[t]=r},dE=(e,t,r)=>{switch(e.type.unit){case ct.SECOND:return $1(e,t,r);case ct.MILLISECOND:return z1(e,t,r);case ct.MICROSECOND:return j1(e,t,r);case ct.NANOSECOND:return q1(e,t,r)}},hE=({values:e,stride:t},r,n)=>{e.set(n.subarray(0,t),t*r)},uH=(e,t,r)=>{let n=e.children[0],i=e.valueOffsets,o=Vr.getVisitFn(n);if(Array.isArray(r))for(let s=-1,a=i[t],c=i[t+1];a<c;)o(n,a++,r[++s]);else for(let s=-1,a=i[t],c=i[t+1];a<c;)o(n,a++,r.get(++s))},fH=(e,t,r)=>{let n=e.children[0],{valueOffsets:i}=e,o=Vr.getVisitFn(n),{[t]:s,[t+1]:a}=i,c=r instanceof Map?r.entries():Object.entries(r);for(let l of c)if(o(n,s,l),++s>=a)break},dH=(e,t)=>(r,n,i,o)=>n&&r(n,e,t[o]),hH=(e,t)=>(r,n,i,o)=>n&&r(n,e,t.get(o)),pH=(e,t)=>(r,n,i,o)=>n&&r(n,e,t.get(i.name)),mH=(e,t)=>(r,n,i,o)=>n&&r(n,e,t[i.name]),yH=(e,t,r)=>{let n=e.type.children.map(o=>Vr.getVisitFn(o.type)),i=r instanceof Map?pH(t,r):r instanceof Gt?hH(t,r):Array.isArray(r)?dH(t,r):mH(t,r);e.type.children.forEach((o,s)=>i(n[s],e.children[s],o,s))},gH=(e,t,r)=>{e.type.mode===Se.Dense?Jk(e,t,r):tB(e,t,r)},Jk=(e,t,r)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[n];Vr.visit(i,e.valueOffsets[t],r)},tB=(e,t,r)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[n];Vr.visit(i,t,r)},xH=(e,t,r)=>{var n;(n=e.dictionary)===null||n===void 0||n.set(e.values[t],r)},pE=(e,t,r)=>{e.type.unit===xr.DAY_TIME?V1(e,t,r):Y1(e,t,r)},V1=({values:e},t,r)=>{e.set(r.subarray(0,2),2*t)},Y1=({values:e},t,r)=>{e[t]=r[0]*12+r[1]%12},W1=({values:e},t,r)=>{e[t]=r},G1=({values:e},t,r)=>{e[t]=r},X1=({values:e},t,r)=>{e[t]=r},H1=({values:e},t,r)=>{e[t]=r},mE=(e,t,r)=>{switch(e.type.unit){case ct.SECOND:return W1(e,t,r);case ct.MILLISECOND:return G1(e,t,r);case ct.MICROSECOND:return X1(e,t,r);case ct.NANOSECOND:return H1(e,t,r)}},bH=(e,t,r)=>{let{stride:n}=e,i=e.children[0],o=Vr.getVisitFn(i);if(Array.isArray(r))for(let s=-1,a=t*n;++s<n;)o(i,a+s,r[s]);else for(let s=-1,a=t*n;++s<n;)o(i,a+s,r.get(s))};wt.prototype.visitBool=Ot(cH);wt.prototype.visitInt=Ot(da);wt.prototype.visitInt8=Ot(da);wt.prototype.visitInt16=Ot(da);wt.prototype.visitInt32=Ot(da);wt.prototype.visitInt64=Ot(da);wt.prototype.visitUint8=Ot(da);wt.prototype.visitUint16=Ot(da);wt.prototype.visitUint32=Ot(da);wt.prototype.visitUint64=Ot(da);wt.prototype.visitFloat=Ot(lH);wt.prototype.visitFloat16=Ot(Qk);wt.prototype.visitFloat32=Ot(cE);wt.prototype.visitFloat64=Ot(cE);wt.prototype.visitUtf8=Ot(Kk);wt.prototype.visitLargeUtf8=Ot(Kk);wt.prototype.visitBinary=Ot(Zk);wt.prototype.visitLargeBinary=Ot(Zk);wt.prototype.visitFixedSizeBinary=Ot(lE);wt.prototype.visitDate=Ot(uE);wt.prototype.visitDateDay=Ot(F1);wt.prototype.visitDateMillisecond=Ot(C1);wt.prototype.visitTimestamp=Ot(fE);wt.prototype.visitTimestampSecond=Ot(k1);wt.prototype.visitTimestampMillisecond=Ot(B1);wt.prototype.visitTimestampMicrosecond=Ot(P1);wt.prototype.visitTimestampNanosecond=Ot(U1);wt.prototype.visitTime=Ot(dE);wt.prototype.visitTimeSecond=Ot($1);wt.prototype.visitTimeMillisecond=Ot(z1);wt.prototype.visitTimeMicrosecond=Ot(j1);wt.prototype.visitTimeNanosecond=Ot(q1);wt.prototype.visitDecimal=Ot(hE);wt.prototype.visitList=Ot(uH);wt.prototype.visitStruct=Ot(yH);wt.prototype.visitUnion=Ot(gH);wt.prototype.visitDenseUnion=Ot(Jk);wt.prototype.visitSparseUnion=Ot(tB);wt.prototype.visitDictionary=Ot(xH);wt.prototype.visitInterval=Ot(pE);wt.prototype.visitIntervalDayTime=Ot(V1);wt.prototype.visitIntervalYearMonth=Ot(Y1);wt.prototype.visitDuration=Ot(mE);wt.prototype.visitDurationSecond=Ot(W1);wt.prototype.visitDurationMillisecond=Ot(G1);wt.prototype.visitDurationMicrosecond=Ot(X1);wt.prototype.visitDurationNanosecond=Ot(H1);wt.prototype.visitFixedSizeList=Ot(bH);wt.prototype.visitMap=Ot(fH);var Vr=new wt;var wo=Symbol.for("parent"),id=Symbol.for("rowIndex"),Rc=class{constructor(t,r){return this[wo]=t,this[id]=r,new Proxy(this,new gE)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[id],r=this[wo],n=r.type.children,i={};for(let o=-1,s=n.length;++o<s;)i[n[o].name]=sr.visit(r.children[o],t);return i}toString(){return`{${[...this].map(([t,r])=>`${mo(t)}: ${mo(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new yE(this[wo],this[id])}},yE=class{constructor(t,r){this.childIndex=0,this.children=t.children,this.rowIndex=r,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,sr.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(Rc.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[wo]:{writable:!0,enumerable:!1,configurable:!1,value:null},[id]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var gE=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[wo].type.children.map(r=>r.name)}has(t,r){return t[wo].type.children.findIndex(n=>n.name===r)!==-1}getOwnPropertyDescriptor(t,r){if(t[wo].type.children.findIndex(n=>n.name===r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,r){if(Reflect.has(t,r))return t[r];let n=t[wo].type.children.findIndex(i=>i.name===r);if(n!==-1){let i=sr.visit(t[wo].children[n],t[id]);return Reflect.set(t,r,i),i}}set(t,r,n){let i=t[wo].type.children.findIndex(o=>o.name===r);return i!==-1?(Vr.visit(t[wo].children[i],t[id],n),Reflect.set(t,r,n)):Reflect.has(t,r)||typeof r=="symbol"?Reflect.set(t,r,n):!1}};var yt=class extends mt{};function Tt(e){return(t,r)=>t.getValid(r)?e(t,r):null}var _H=(e,t)=>864e5*e[t],wH=(e,t)=>null,eB=(e,t,r)=>{if(r+1>=t.length)return null;let n=re(t[r]),i=re(t[r+1]);return e.subarray(n,i)},vH=({offset:e,values:t},r)=>{let n=e+r;return(t[n>>3]&1<<n%8)!==0},rB=({values:e},t)=>_H(e,t),nB=({values:e},t)=>re(e[t]),Dc=({stride:e,values:t},r)=>t[e*r],SH=({stride:e,values:t},r)=>L1(t[e*r]),iB=({values:e},t)=>e[t],IH=({stride:e,values:t},r)=>t.subarray(e*r,e*(r+1)),oB=({values:e,valueOffsets:t},r)=>eB(e,t,r),sB=({values:e,valueOffsets:t},r)=>{let n=eB(e,t,r);return n!==null?sm(n):null},TH=({values:e},t)=>e[t],AH=({type:e,values:t},r)=>e.precision!==be.HALF?t[r]:L1(t[r]),EH=(e,t)=>e.type.unit===Xe.DAY?rB(e,t):nB(e,t),aB=({values:e},t)=>1e3*re(e[t]),cB=({values:e},t)=>re(e[t]),lB=({values:e},t)=>nE(e[t],BigInt(1e3)),uB=({values:e},t)=>nE(e[t],BigInt(1e6)),MH=(e,t)=>{switch(e.type.unit){case ct.SECOND:return aB(e,t);case ct.MILLISECOND:return cB(e,t);case ct.MICROSECOND:return lB(e,t);case ct.NANOSECOND:return uB(e,t)}},fB=({values:e},t)=>e[t],dB=({values:e},t)=>e[t],hB=({values:e},t)=>e[t],pB=({values:e},t)=>e[t],NH=(e,t)=>{switch(e.type.unit){case ct.SECOND:return fB(e,t);case ct.MILLISECOND:return dB(e,t);case ct.MICROSECOND:return hB(e,t);case ct.NANOSECOND:return pB(e,t)}},OH=({values:e,stride:t},r)=>vm.decimal(e.subarray(t*r,t*(r+1))),RH=(e,t)=>{let{valueOffsets:r,stride:n,children:i}=e,{[t*n]:o,[t*n+1]:s}=r,c=i[0].slice(o,s-o);return new Gt([c])},DH=(e,t)=>{let{valueOffsets:r,children:n}=e,{[t]:i,[t+1]:o}=r,s=n[0];return new Qo(s.slice(i,o-i))},LH=(e,t)=>new Rc(e,t),FH=(e,t)=>e.type.mode===Se.Dense?mB(e,t):yB(e,t),mB=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],n=e.children[r];return sr.visit(n,e.valueOffsets[t])},yB=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],n=e.children[r];return sr.visit(n,t)},CH=(e,t)=>{var r;return(r=e.dictionary)===null||r===void 0?void 0:r.get(e.values[t])},kH=(e,t)=>e.type.unit===xr.DAY_TIME?gB(e,t):xB(e,t),gB=({values:e},t)=>e.subarray(2*t,2*(t+1)),xB=({values:e},t)=>{let r=e[t],n=new Int32Array(2);return n[0]=Math.trunc(r/12),n[1]=Math.trunc(r%12),n},bB=({values:e},t)=>e[t],_B=({values:e},t)=>e[t],wB=({values:e},t)=>e[t],vB=({values:e},t)=>e[t],BH=(e,t)=>{switch(e.type.unit){case ct.SECOND:return bB(e,t);case ct.MILLISECOND:return _B(e,t);case ct.MICROSECOND:return wB(e,t);case ct.NANOSECOND:return vB(e,t)}},PH=(e,t)=>{let{stride:r,children:n}=e,o=n[0].slice(t*r,r);return new Gt([o])};yt.prototype.visitNull=Tt(wH);yt.prototype.visitBool=Tt(vH);yt.prototype.visitInt=Tt(TH);yt.prototype.visitInt8=Tt(Dc);yt.prototype.visitInt16=Tt(Dc);yt.prototype.visitInt32=Tt(Dc);yt.prototype.visitInt64=Tt(iB);yt.prototype.visitUint8=Tt(Dc);yt.prototype.visitUint16=Tt(Dc);yt.prototype.visitUint32=Tt(Dc);yt.prototype.visitUint64=Tt(iB);yt.prototype.visitFloat=Tt(AH);yt.prototype.visitFloat16=Tt(SH);yt.prototype.visitFloat32=Tt(Dc);yt.prototype.visitFloat64=Tt(Dc);yt.prototype.visitUtf8=Tt(sB);yt.prototype.visitLargeUtf8=Tt(sB);yt.prototype.visitBinary=Tt(oB);yt.prototype.visitLargeBinary=Tt(oB);yt.prototype.visitFixedSizeBinary=Tt(IH);yt.prototype.visitDate=Tt(EH);yt.prototype.visitDateDay=Tt(rB);yt.prototype.visitDateMillisecond=Tt(nB);yt.prototype.visitTimestamp=Tt(MH);yt.prototype.visitTimestampSecond=Tt(aB);yt.prototype.visitTimestampMillisecond=Tt(cB);yt.prototype.visitTimestampMicrosecond=Tt(lB);yt.prototype.visitTimestampNanosecond=Tt(uB);yt.prototype.visitTime=Tt(NH);yt.prototype.visitTimeSecond=Tt(fB);yt.prototype.visitTimeMillisecond=Tt(dB);yt.prototype.visitTimeMicrosecond=Tt(hB);yt.prototype.visitTimeNanosecond=Tt(pB);yt.prototype.visitDecimal=Tt(OH);yt.prototype.visitList=Tt(RH);yt.prototype.visitStruct=Tt(LH);yt.prototype.visitUnion=Tt(FH);yt.prototype.visitDenseUnion=Tt(mB);yt.prototype.visitSparseUnion=Tt(yB);yt.prototype.visitDictionary=Tt(CH);yt.prototype.visitInterval=Tt(kH);yt.prototype.visitIntervalDayTime=Tt(gB);yt.prototype.visitIntervalYearMonth=Tt(xB);yt.prototype.visitDuration=Tt(BH);yt.prototype.visitDurationSecond=Tt(bB);yt.prototype.visitDurationMillisecond=Tt(_B);yt.prototype.visitDurationMicrosecond=Tt(wB);yt.prototype.visitDurationNanosecond=Tt(vB);yt.prototype.visitFixedSizeList=Tt(PH);yt.prototype.visitMap=Tt(DH);var sr=new yt;var Lc=Symbol.for("keys"),sd=Symbol.for("vals"),od=Symbol.for("kKeysAsStrings"),xE=Symbol.for("_kKeysAsStrings"),Qo=class{constructor(t){return this[Lc]=new Gt([t.children[0]]).memoize(),this[sd]=t.children[1],new Proxy(this,new _E)}get[od](){return this[xE]||(this[xE]=Array.from(this[Lc].toArray(),String))}[Symbol.iterator](){return new bE(this[Lc],this[sd])}get size(){return this[Lc].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Lc],r=this[sd],n={};for(let i=-1,o=t.length;++i<o;)n[t.get(i)]=sr.visit(r,i);return n}toString(){return`{${[...this].map(([t,r])=>`${mo(t)}: ${mo(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},bE=class{constructor(t,r){this.keys=t,this.vals=r,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){let t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),sr.visit(this.vals,t)]})}},_E=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[od]}has(t,r){return t[od].includes(r)}getOwnPropertyDescriptor(t,r){if(t[od].indexOf(r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,r){if(Reflect.has(t,r))return t[r];let n=t[od].indexOf(r);if(n!==-1){let i=sr.visit(Reflect.get(t,sd),n);return Reflect.set(t,r,i),i}}set(t,r,n){let i=t[od].indexOf(r);return i!==-1?(Vr.visit(Reflect.get(t,sd),i,n),Reflect.set(t,r,n)):Reflect.has(t,r)?Reflect.set(t,r,n):!1}};Object.defineProperties(Qo.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Lc]:{writable:!0,enumerable:!1,configurable:!1,value:null},[sd]:{writable:!0,enumerable:!1,configurable:!1,value:null},[xE]:{writable:!0,enumerable:!1,configurable:!1,value:null}});var SB;function Im(e,t,r,n){let{length:i=0}=e,o=typeof t!="number"?0:t,s=typeof r!="number"?i:r;return o<0&&(o=(o%i+i)%i),s<0&&(s=(s%i+i)%i),s<o&&(SB=o,o=s,s=SB),s>i&&(s=i),n?n(e,o,s):[o,s]}var ru=(e,t)=>e<0?t+e:e,IB=e=>e!==e;function Fc(e){if(typeof e!=="object"||e===null)return IB(e)?IB:r=>r===e;if(e instanceof Date){let r=e.valueOf();return n=>n instanceof Date?n.valueOf()===r:!1}return ArrayBuffer.isView(e)?r=>r?KA(e,r):!1:e instanceof Map?$H(e):Array.isArray(e)?UH(e):e instanceof Gt?zH(e):jH(e,!0)}function UH(e){let t=[];for(let r=-1,n=e.length;++r<n;)t[r]=Fc(e[r]);return Q1(t)}function $H(e){let t=-1,r=[];for(let n of e.values())r[++t]=Fc(n);return Q1(r)}function zH(e){let t=[];for(let r=-1,n=e.length;++r<n;)t[r]=Fc(e.get(r));return Q1(t)}function jH(e,t=!1){let r=Object.keys(e);if(!t&&r.length===0)return()=>!1;let n=[];for(let i=-1,o=r.length;++i<o;)n[i]=Fc(e[r[i]]);return Q1(n,r)}function Q1(e,t){return r=>{if(!r||typeof r!="object")return!1;switch(r.constructor){case Array:return qH(e,r);case Map:return TB(e,r,r.keys());case Qo:case Rc:case Object:case void 0:return TB(e,r,t||Object.keys(r))}return r instanceof Gt?VH(e,r):!1}}function qH(e,t){let r=e.length;if(t.length!==r)return!1;for(let n=-1;++n<r;)if(!e[n](t[n]))return!1;return!0}function VH(e,t){let r=e.length;if(t.length!==r)return!1;for(let n=-1;++n<r;)if(!e[n](t.get(n)))return!1;return!0}function TB(e,t,r){let n=r[Symbol.iterator](),i=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),o=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),s=0,a=e.length,c=o.next(),l=n.next(),u=i.next();for(;s<a&&!l.done&&!u.done&&!c.done&&!(l.value!==u.value||!e[s](c.value));++s,l=n.next(),u=i.next(),c=o.next());return s===a&&l.done&&u.done&&c.done?!0:(n.return&&n.return(),i.return&&i.return(),o.return&&o.return(),!1)}var vE={};Jn(vE,{BitIterator:()=>nu,getBit:()=>AB,getBool:()=>K1,packBools:()=>ou,popcnt_array:()=>EB,popcnt_bit_range:()=>Tm,popcnt_uint32:()=>Z1,setBool:()=>YH,truncateBitmap:()=>iu});function K1(e,t,r,n){return(r&1<<n)!==0}function AB(e,t,r,n){return(r&1<<n)>>n}function YH(e,t,r){return r?!!(e[t>>3]|=1<<t%8)||!0:!(e[t>>3]&=~(1<<t%8))&&!1}function iu(e,t,r){let n=r.byteLength+7&-8;if(e>0||r.byteLength<n){let i=new Uint8Array(n);return i.set(e%8===0?r.subarray(e>>3):ou(new nu(r,e,t,null,K1)).subarray(0,n)),i}return r}function ou(e){let t=[],r=0,n=0,i=0;for(let s of e)s&&(i|=1<<n),++n===8&&(t[r++]=i,i=n=0);(r===0||n>0)&&(t[r++]=i);let o=new Uint8Array(t.length+7&-8);return o.set(t),o}var nu=class{constructor(t,r,n,i,o){this.bytes=t,this.length=n,this.context=i,this.get=o,this.bit=r%8,this.byteIndex=r>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}};function Tm(e,t,r){if(r-t<=0)return 0;if(r-t<8){let o=0;for(let s of new nu(e,t,r-t,e,AB))o+=s;return o}let n=r>>3<<3,i=t+(t%8===0?0:8-t%8);return Tm(e,t,i)+Tm(e,n,r)+EB(e,i>>3,n-i>>3)}function EB(e,t,r){let n=0,i=Math.trunc(t),o=new DataView(e.buffer,e.byteOffset,e.byteLength),s=r===void 0?e.byteLength:i+r;for(;s-i>=4;)n+=Z1(o.getUint32(i)),i+=4;for(;s-i>=2;)n+=Z1(o.getUint16(i)),i+=2;for(;s-i>=1;)n+=Z1(o.getUint8(i)),i+=1;return n}function Z1(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 WH=-1,ae=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 K.isSparseUnion(t)?this.children.some(r=>r.nullable):K.isDenseUnion(t)?this.children.some(r=>r.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0,{valueOffsets:r,values:n,nullBitmap:i,typeIds:o}=this;return r&&(t+=r.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),this.children.reduce((s,a)=>s+a.byteLength,t)}get nullCount(){if(K.isUnion(this.type))return this.children.reduce((n,i)=>n+i.nullCount,0);let t=this._nullCount,r;return t<=WH&&(r=this.nullBitmap)&&(this._nullCount=t=r.length===0?0:this.length-Tm(r,this.offset,this.offset+this.length)),t}constructor(t,r,n,i,o,s=[],a){this.type=t,this.children=s,this.dictionary=a,this.offset=Math.floor(Math.max(r||0,0)),this.length=Math.floor(Math.max(n||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let c;o instanceof e?(this.stride=o.stride,this.values=o.values,this.typeIds=o.typeIds,this.nullBitmap=o.nullBitmap,this.valueOffsets=o.valueOffsets):(this.stride=ui(t),o&&((c=o[0])&&(this.valueOffsets=c),(c=o[1])&&(this.values=c),(c=o[2])&&(this.nullBitmap=c),(c=o[3])&&(this.typeIds=c)))}getValid(t){let{type:r}=this;if(K.isUnion(r)){let n=r,i=this.children[n.typeIdToChildIndex[this.typeIds[t]]],o=n.mode===Se.Dense?this.valueOffsets[t]:t;return i.getValid(o)}if(this.nullable&&this.nullCount>0){let n=this.offset+t;return(this.nullBitmap[n>>3]&1<<n%8)!==0}return!0}setValid(t,r){let n,{type:i}=this;if(K.isUnion(i)){let o=i,s=this.children[o.typeIdToChildIndex[this.typeIds[t]]],a=o.mode===Se.Dense?this.valueOffsets[t]:t;n=s.getValid(a),s.setValid(a,r)}else{let{nullBitmap:o}=this,{offset:s,length:a}=this,c=s+t,l=1<<c%8,u=c>>3;(!o||o.byteLength<=u)&&(o=new Uint8Array((s+a+63&-64)>>3).fill(255),this.nullCount>0?(o.set(iu(s,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:o})):Object.assign(this,{nullBitmap:o,_nullCount:0}));let f=o[u];n=(f&l)!==0,o[u]=r?f|l:f&~l}return n!==!!r&&(this._nullCount=this.nullCount+(r?-1:1)),r}clone(t=this.type,r=this.offset,n=this.length,i=this._nullCount,o=this,s=this.children){return new e(t,r,n,i,o,s,this.dictionary)}slice(t,r){let{stride:n,typeId:i,children:o}=this,s=+(this._nullCount===0)-1,a=i===16?n:1,c=this._sliceBuffers(t,r,n,i);return this.clone(this.type,this.offset+t,r,s,c,o.length===0||this.valueOffsets?o:this._sliceChildren(o,a*t,a*r))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===D.Null)return this.clone(this.type,0,t,0);let{length:r,nullCount:n}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,r>>3);i[r>>3]=(1<<r-(r&-8))-1,n>0&&i.set(iu(this.offset,r,this.nullBitmap),0);let o=this.buffers;return o[ki.VALIDITY]=i,this.clone(this.type,0,t,n+(t-r),o)}_sliceBuffers(t,r,n,i){let o,{buffers:s}=this;return(o=s[ki.TYPE])&&(s[ki.TYPE]=o.subarray(t,t+r)),(o=s[ki.OFFSET])&&(s[ki.OFFSET]=o.subarray(t,t+r+1))||(o=s[ki.DATA])&&(s[ki.DATA]=i===6?o:o.subarray(n*t,n*(t+r))),s}_sliceChildren(t,r,n){return t.map(i=>i.slice(r,n))}};ae.prototype.children=Object.freeze([]);var SE=class e extends mt{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:r,["offset"]:n=0,["length"]:i=0}=t;return new ae(r,n,i,i)}visitBool(t){let{["type"]:r,["offset"]:n=0}=t,i=St(t.nullBitmap),o=zt(r.ArrayType,t.data),{["length"]:s=o.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ae(r,n,s,a,[void 0,o,i])}visitInt(t){let{["type"]:r,["offset"]:n=0}=t,i=St(t.nullBitmap),o=zt(r.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ae(r,n,s,a,[void 0,o,i])}visitFloat(t){let{["type"]:r,["offset"]:n=0}=t,i=St(t.nullBitmap),o=zt(r.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ae(r,n,s,a,[void 0,o,i])}visitUtf8(t){let{["type"]:r,["offset"]:n=0}=t,i=St(t.data),o=St(t.nullBitmap),s=tu(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ae(r,n,a,c,[s,i,o])}visitLargeUtf8(t){let{["type"]:r,["offset"]:n=0}=t,i=St(t.data),o=St(t.nullBitmap),s=y1(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ae(r,n,a,c,[s,i,o])}visitBinary(t){let{["type"]:r,["offset"]:n=0}=t,i=St(t.data),o=St(t.nullBitmap),s=tu(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ae(r,n,a,c,[s,i,o])}visitLargeBinary(t){let{["type"]:r,["offset"]:n=0}=t,i=St(t.data),o=St(t.nullBitmap),s=y1(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ae(r,n,a,c,[s,i,o])}visitFixedSizeBinary(t){let{["type"]:r,["offset"]:n=0}=t,i=St(t.nullBitmap),o=zt(r.ArrayType,t.data),{["length"]:s=o.length/ui(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ae(r,n,s,a,[void 0,o,i])}visitDate(t){let{["type"]:r,["offset"]:n=0}=t,i=St(t.nullBitmap),o=zt(r.ArrayType,t.data),{["length"]:s=o.length/ui(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ae(r,n,s,a,[void 0,o,i])}visitTimestamp(t){let{["type"]:r,["offset"]:n=0}=t,i=St(t.nullBitmap),o=zt(r.ArrayType,t.data),{["length"]:s=o.length/ui(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ae(r,n,s,a,[void 0,o,i])}visitTime(t){let{["type"]:r,["offset"]:n=0}=t,i=St(t.nullBitmap),o=zt(r.ArrayType,t.data),{["length"]:s=o.length/ui(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ae(r,n,s,a,[void 0,o,i])}visitDecimal(t){let{["type"]:r,["offset"]:n=0}=t,i=St(t.nullBitmap),o=zt(r.ArrayType,t.data),{["length"]:s=o.length/ui(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ae(r,n,s,a,[void 0,o,i])}visitList(t){let{["type"]:r,["offset"]:n=0,["child"]:i}=t,o=St(t.nullBitmap),s=tu(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ae(r,n,a,c,[s,void 0,o],[i])}visitStruct(t){let{["type"]:r,["offset"]:n=0,["children"]:i=[]}=t,o=St(t.nullBitmap),{length:s=i.reduce((c,{length:l})=>Math.max(c,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new ae(r,n,s,a,[void 0,void 0,o],i)}visitUnion(t){let{["type"]:r,["offset"]:n=0,["children"]:i=[]}=t,o=zt(r.ArrayType,t.typeIds),{["length"]:s=o.length,["nullCount"]:a=-1}=t;if(K.isSparseUnion(r))return new ae(r,n,s,a,[void 0,void 0,void 0,o],i);let c=tu(t.valueOffsets);return new ae(r,n,s,a,[c,void 0,void 0,o],i)}visitDictionary(t){let{["type"]:r,["offset"]:n=0}=t,i=St(t.nullBitmap),o=zt(r.indices.ArrayType,t.data),{["dictionary"]:s=new Gt([new e().visit({type:r.dictionary})])}=t,{["length"]:a=o.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ae(r,n,a,c,[void 0,o,i],[],s)}visitInterval(t){let{["type"]:r,["offset"]:n=0}=t,i=St(t.nullBitmap),o=zt(r.ArrayType,t.data),{["length"]:s=o.length/ui(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ae(r,n,s,a,[void 0,o,i])}visitDuration(t){let{["type"]:r,["offset"]:n=0}=t,i=St(t.nullBitmap),o=zt(r.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ae(r,n,s,a,[void 0,o,i])}visitFixedSizeList(t){let{["type"]:r,["offset"]:n=0,["child"]:i=new e().visit({type:r.valueType})}=t,o=St(t.nullBitmap),{["length"]:s=i.length/ui(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ae(r,n,s,a,[void 0,void 0,o],[i])}visitMap(t){let{["type"]:r,["offset"]:n=0,["child"]:i=new e().visit({type:r.childType})}=t,o=St(t.nullBitmap),s=tu(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ae(r,n,a,c,[s,void 0,o],[i])}},GH=new SE;function Dt(e){return GH.visit(e)}var Am=class{constructor(t=0,r){this.numChunks=t,this.getChunkIterator=r,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let t=this.chunkIterator.next();if(!t.done)return t;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}};function MB(e){return e.some(t=>t.nullable)}function J1(e){return e.reduce((t,r)=>t+r.nullCount,0)}function t_(e){return e.reduce((t,r,n)=>(t[n+1]=t[n]+r.length,t),new Uint32Array(e.length+1))}function e_(e,t,r,n){let i=[];for(let o=-1,s=e.length;++o<s;){let a=e[o],c=t[o],{length:l}=a;if(c>=n)break;if(r>=c+l)continue;if(c>=r&&c+l<=n){i.push(a);continue}let u=Math.max(0,r-c),f=Math.min(n-c,l);i.push(a.slice(u,f-u))}return i.length===0&&i.push(e[0].slice(0,0)),i}function IE(e,t,r,n){let i=0,o=0,s=t.length-1;do{if(i>=s-1)return r<t[s]?n(e,i,r-t[i]):null;o=i+Math.trunc((s-i)*.5),r<t[o]?s=o:i=o}while(i<s)}function Em(e,t){return e.getValid(t)}function ad(e){function t(r,n,i){return e(r[n],i)}return function(r){let n=this.data;return IE(n,this._offsets,r,t)}}function r_(e){let t;function r(n,i,o){return e(n[i],o,t)}return function(n,i){let o=this.data;t=i;let s=IE(o,this._offsets,n,r);return t=void 0,s}}function n_(e){let t;function r(n,i,o){let s=o,a=0,c=0;for(let l=i-1,u=n.length;++l<u;){let f=n[l];if(~(a=e(f,t,s)))return c+a;s=0,c+=f.length}return-1}return function(n,i){t=n;let o=this.data,s=typeof i!="number"?r(o,0,0):IE(o,this._offsets,i,r);return t=void 0,s}}var gt=class extends mt{};function XH(e,t){return t===null&&e.length>0?0:-1}function HH(e,t){let{nullBitmap:r}=e;if(!r||e.nullCount<=0)return-1;let n=0;for(let i of new nu(r,e.offset+(t||0),e.length,r,K1)){if(!i)return n;++n}return-1}function Lt(e,t,r){if(t===void 0)return-1;if(t===null)switch(e.typeId){case D.Union:break;case D.Dictionary:break;default:return HH(e,r)}let n=sr.getVisitFn(e),i=Fc(t);for(let o=(r||0)-1,s=e.length;++o<s;)if(i(n(e,o)))return o;return-1}function NB(e,t,r){let n=sr.getVisitFn(e),i=Fc(t);for(let o=(r||0)-1,s=e.length;++o<s;)if(i(n(e,o)))return o;return-1}gt.prototype.visitNull=XH;gt.prototype.visitBool=Lt;gt.prototype.visitInt=Lt;gt.prototype.visitInt8=Lt;gt.prototype.visitInt16=Lt;gt.prototype.visitInt32=Lt;gt.prototype.visitInt64=Lt;gt.prototype.visitUint8=Lt;gt.prototype.visitUint16=Lt;gt.prototype.visitUint32=Lt;gt.prototype.visitUint64=Lt;gt.prototype.visitFloat=Lt;gt.prototype.visitFloat16=Lt;gt.prototype.visitFloat32=Lt;gt.prototype.visitFloat64=Lt;gt.prototype.visitUtf8=Lt;gt.prototype.visitLargeUtf8=Lt;gt.prototype.visitBinary=Lt;gt.prototype.visitLargeBinary=Lt;gt.prototype.visitFixedSizeBinary=Lt;gt.prototype.visitDate=Lt;gt.prototype.visitDateDay=Lt;gt.prototype.visitDateMillisecond=Lt;gt.prototype.visitTimestamp=Lt;gt.prototype.visitTimestampSecond=Lt;gt.prototype.visitTimestampMillisecond=Lt;gt.prototype.visitTimestampMicrosecond=Lt;gt.prototype.visitTimestampNanosecond=Lt;gt.prototype.visitTime=Lt;gt.prototype.visitTimeSecond=Lt;gt.prototype.visitTimeMillisecond=Lt;gt.prototype.visitTimeMicrosecond=Lt;gt.prototype.visitTimeNanosecond=Lt;gt.prototype.visitDecimal=Lt;gt.prototype.visitList=Lt;gt.prototype.visitStruct=Lt;gt.prototype.visitUnion=Lt;gt.prototype.visitDenseUnion=NB;gt.prototype.visitSparseUnion=NB;gt.prototype.visitDictionary=Lt;gt.prototype.visitInterval=Lt;gt.prototype.visitIntervalDayTime=Lt;gt.prototype.visitIntervalYearMonth=Lt;gt.prototype.visitDuration=Lt;gt.prototype.visitDurationSecond=Lt;gt.prototype.visitDurationMillisecond=Lt;gt.prototype.visitDurationMicrosecond=Lt;gt.prototype.visitDurationNanosecond=Lt;gt.prototype.visitFixedSizeList=Lt;gt.prototype.visitMap=Lt;var su=new gt;var xt=class extends mt{};function At(e){let{type:t}=e;if(e.nullCount===0&&e.stride===1&&(K.isInt(t)&&t.bitWidth!==64||K.isTime(t)&&t.bitWidth!==64||K.isFloat(t)&&t.precision!==be.HALF))return new Am(e.data.length,n=>{let i=e.data[n];return i.values.subarray(0,i.length)[Symbol.iterator]()});let r=0;return new Am(e.data.length,n=>{let o=e.data[n].length,s=e.slice(r,r+o);return r+=o,new TE(s)})}var TE=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=At;xt.prototype.visitBool=At;xt.prototype.visitInt=At;xt.prototype.visitInt8=At;xt.prototype.visitInt16=At;xt.prototype.visitInt32=At;xt.prototype.visitInt64=At;xt.prototype.visitUint8=At;xt.prototype.visitUint16=At;xt.prototype.visitUint32=At;xt.prototype.visitUint64=At;xt.prototype.visitFloat=At;xt.prototype.visitFloat16=At;xt.prototype.visitFloat32=At;xt.prototype.visitFloat64=At;xt.prototype.visitUtf8=At;xt.prototype.visitLargeUtf8=At;xt.prototype.visitBinary=At;xt.prototype.visitLargeBinary=At;xt.prototype.visitFixedSizeBinary=At;xt.prototype.visitDate=At;xt.prototype.visitDateDay=At;xt.prototype.visitDateMillisecond=At;xt.prototype.visitTimestamp=At;xt.prototype.visitTimestampSecond=At;xt.prototype.visitTimestampMillisecond=At;xt.prototype.visitTimestampMicrosecond=At;xt.prototype.visitTimestampNanosecond=At;xt.prototype.visitTime=At;xt.prototype.visitTimeSecond=At;xt.prototype.visitTimeMillisecond=At;xt.prototype.visitTimeMicrosecond=At;xt.prototype.visitTimeNanosecond=At;xt.prototype.visitDecimal=At;xt.prototype.visitList=At;xt.prototype.visitStruct=At;xt.prototype.visitUnion=At;xt.prototype.visitDenseUnion=At;xt.prototype.visitSparseUnion=At;xt.prototype.visitDictionary=At;xt.prototype.visitInterval=At;xt.prototype.visitIntervalDayTime=At;xt.prototype.visitIntervalYearMonth=At;xt.prototype.visitDuration=At;xt.prototype.visitDurationSecond=At;xt.prototype.visitDurationMillisecond=At;xt.prototype.visitDurationMicrosecond=At;xt.prototype.visitDurationNanosecond=At;xt.prototype.visitFixedSizeList=At;xt.prototype.visitMap=At;var cd=new xt;var OB,RB={},DB={},Gt=class e{constructor(t){var r,n,i;let o=t[0]instanceof e?t.flatMap(a=>a.data):t;if(o.length===0||o.some(a=>!(a instanceof ae)))throw new TypeError("Vector constructor expects an Array of Data instances.");let s=(r=o[0])===null||r===void 0?void 0:r.type;switch(o.length){case 0:this._offsets=[0];break;case 1:{let{get:a,set:c,indexOf:l}=RB[s.typeId],u=o[0];this.isValid=f=>Em(u,f),this.get=f=>a(u,f),this.set=(f,d)=>c(u,f,d),this.indexOf=f=>l(u,f),this._offsets=[0,u.length];break}default:Object.setPrototypeOf(this,DB[s.typeId]),this._offsets=t_(o);break}this.data=o,this.type=s,this.stride=ui(s),this.numChildren=(i=(n=s.children)===null||n===void 0?void 0:n.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,r)=>t+r.byteLength,0)}get nullable(){return MB(this.data)}get nullCount(){return J1(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}at(t){return this.get(ru(t,this.length))}set(t,r){}indexOf(t,r){return-1}includes(t,r){return this.indexOf(t,r)>-1}[Symbol.iterator](){return cd.visit(this)}concat(...t){return new e(this.data.concat(t.flatMap(r=>r.data).flat(Number.POSITIVE_INFINITY)))}slice(t,r){return new e(Im(this,t,r,({data:n,_offsets:i},o,s)=>e_(n,i,o,s)))}toJSON(){return[...this]}toArray(){let{type:t,data:r,length:n,stride:i,ArrayType:o}=this;switch(t.typeId){case D.Int:case D.Float:case D.Decimal:case D.Time:case D.Timestamp:switch(r.length){case 0:return new o;case 1:return r[0].values.subarray(0,n*i);default:return r.reduce((s,{values:a,length:c})=>(s.array.set(a.subarray(0,c*i),s.offset),s.offset+=c*i,s),{array:new o(n*i),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var r;return this.getChildAt((r=this.type.children)===null||r===void 0?void 0:r.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new e(this.data.map(({children:r})=>r[t])):null}get isMemoized(){return K.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(K.isDictionary(this.type)){let t=new i_(this.data[0].dictionary),r=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new e(r)}return new i_(this)}unmemoize(){if(K.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),r=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new e(r)}return this}};OB=Symbol.toStringTag;Gt[OB]=(e=>{e.type=K.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(r=>D[r]).filter(r=>typeof r=="number"&&r!==D.NONE);for(let r of t){let n=sr.getVisitFnByTypeId(r),i=Vr.getVisitFnByTypeId(r),o=su.getVisitFnByTypeId(r);RB[r]={get:n,set:i,indexOf:o},DB[r]=Object.create(e,{isValid:{value:ad(Em)},get:{value:ad(sr.getVisitFnByTypeId(r))},set:{value:r_(Vr.getVisitFnByTypeId(r))},indexOf:{value:n_(su.getVisitFnByTypeId(r))}})}return"Vector"})(Gt.prototype);var i_=class e extends Gt{constructor(t){super(t.data);let r=this.get,n=this.set,i=this.slice,o=new Array(this.length);Object.defineProperty(this,"get",{value(s){let a=o[s];if(a!==void 0)return a;let c=r.call(this,s);return o[s]=c,c}}),Object.defineProperty(this,"set",{value(s,a){n.call(this,s,a),o[s]=a}}),Object.defineProperty(this,"slice",{value:(s,a)=>new e(i.call(this,s,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new Gt(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function LB(e){if(!e||e.length<=0)return function(i){return!0};let t="",r=e.filter(n=>n===n);return r.length>0&&(t=`
1
+ var RW=Object.create;var KI=Object.defineProperty;var DW=Object.getOwnPropertyDescriptor;var LW=Object.getOwnPropertyNames;var FW=Object.getPrototypeOf,CW=Object.prototype.hasOwnProperty;var hC=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Jn=(e,t)=>{for(var r in t)KI(e,r,{get:t[r],enumerable:!0})},kW=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of LW(t))!CW.call(e,i)&&i!==r&&KI(e,i,{get:()=>t[i],enumerable:!(n=DW(t,i))||n.enumerable});return e};var BW=(e,t,r)=>(r=e!=null?RW(FW(e)):{},kW(t||!e||!e.__esModule?KI(r,"default",{value:e,enumerable:!0}):r,e));var VV=hC((ine,qV)=>{"use strict";function Qat(e,t,r,n,i){for(var o=i+1;n<=i;){var s=n+i>>>1,a=e[s],c=r!==void 0?r(a,t):a-t;c>=0?(o=s,i=s-1):n=s+1}return o}function Zat(e,t,r,n,i){for(var o=i+1;n<=i;){var s=n+i>>>1,a=e[s],c=r!==void 0?r(a,t):a-t;c>0?(o=s,i=s-1):n=s+1}return o}function Kat(e,t,r,n,i){for(var o=n-1;n<=i;){var s=n+i>>>1,a=e[s],c=r!==void 0?r(a,t):a-t;c<0?(o=s,n=s+1):i=s-1}return o}function Jat(e,t,r,n,i){for(var o=n-1;n<=i;){var s=n+i>>>1,a=e[s],c=r!==void 0?r(a,t):a-t;c<=0?(o=s,n=s+1):i=s-1}return o}function tct(e,t,r,n,i){for(;n<=i;){var o=n+i>>>1,s=e[o],a=r!==void 0?r(s,t):s-t;if(a===0)return o;a<=0?n=o+1:i=o-1}return-1}function j0(e,t,r,n,i,o){return typeof r=="function"?o(e,t,r,n===void 0?0:n|0,i===void 0?e.length-1:i|0):o(e,t,void 0,r===void 0?0:r|0,n===void 0?e.length-1:n|0)}qV.exports={ge:function(e,t,r,n,i){return j0(e,t,r,n,i,Qat)},gt:function(e,t,r,n,i){return j0(e,t,r,n,i,Zat)},lt:function(e,t,r,n,i){return j0(e,t,r,n,i,Kat)},le:function(e,t,r,n,i){return j0(e,t,r,n,i,Jat)},eq:function(e,t,r,n,i){return j0(e,t,r,n,i,tct)}}});var KV=hC((one,ZV)=>{"use strict";var II=VV(),tp=0,_f=1,SI=2;ZV.exports=rct;function s8(e,t,r,n,i){this.mid=e,this.left=t,this.right=r,this.leftPoints=n,this.rightPoints=i,this.count=(t?t.count:0)+(r?r.count:0)+n.length}var q0=s8.prototype;function i8(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 GV(e,t){var r=ep(t);e.mid=r.mid,e.left=r.left,e.right=r.right,e.leftPoints=r.leftPoints,e.rightPoints=r.rightPoints,e.count=r.count}function YV(e,t){var r=e.intervals([]);r.push(t),GV(e,r)}function WV(e,t){var r=e.intervals([]),n=r.indexOf(t);return n<0?tp:(r.splice(n,1),GV(e,r),_f)}q0.intervals=function(e){return e.push.apply(e,this.leftPoints),this.left&&this.left.intervals(e),this.right&&this.right.intervals(e),e};q0.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)?YV(this,e):this.left.insert(e):this.left=ep([e]);else if(e[0]>this.mid)this.right?4*(this.right.count+1)>3*(t+1)?YV(this,e):this.right.insert(e):this.right=ep([e]);else{var r=II.ge(this.leftPoints,e,a8),n=II.ge(this.rightPoints,e,c8);this.leftPoints.splice(r,0,e),this.rightPoints.splice(n,0,e)}};q0.remove=function(e){var t=this.count-this.leftPoints;if(e[1]<this.mid){if(!this.left)return tp;var r=this.right?this.right.count:0;if(4*r>3*(t-1))return WV(this,e);var n=this.left.remove(e);return n===SI?(this.left=null,this.count-=1,_f):(n===_f&&(this.count-=1),n)}else if(e[0]>this.mid){if(!this.right)return tp;var i=this.left?this.left.count:0;if(4*i>3*(t-1))return WV(this,e);var n=this.right.remove(e);return n===SI?(this.right=null,this.count-=1,_f):(n===_f&&(this.count-=1),n)}else{if(this.count===1)return this.leftPoints[0]===e?SI:tp;if(this.leftPoints.length===1&&this.leftPoints[0]===e){if(this.left&&this.right){for(var o=this,s=this.left;s.right;)o=s,s=s.right;if(o===this)s.right=this.right;else{var a=this.left,n=this.right;o.count-=s.count,o.right=s.left,s.left=a,s.right=n}i8(this,s),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?i8(this,this.left):i8(this,this.right);return _f}for(var a=II.ge(this.leftPoints,e,a8);a<this.leftPoints.length&&this.leftPoints[a][0]===e[0];++a)if(this.leftPoints[a]===e){this.count-=1,this.leftPoints.splice(a,1);for(var n=II.ge(this.rightPoints,e,c8);n<this.rightPoints.length&&this.rightPoints[n][1]===e[1];++n)if(this.rightPoints[n]===e)return this.rightPoints.splice(n,1),_f}return tp}};function XV(e,t,r){for(var n=0;n<e.length&&e[n][0]<=t;++n){var i=r(e[n]);if(i)return i}}function HV(e,t,r){for(var n=e.length-1;n>=0&&e[n][1]>=t;--n){var i=r(e[n]);if(i)return i}}function QV(e,t){for(var r=0;r<e.length;++r){var n=t(e[r]);if(n)return n}}q0.queryPoint=function(e,t){if(e<this.mid){if(this.left){var r=this.left.queryPoint(e,t);if(r)return r}return XV(this.leftPoints,e,t)}else if(e>this.mid){if(this.right){var r=this.right.queryPoint(e,t);if(r)return r}return HV(this.rightPoints,e,t)}else return QV(this.leftPoints,t)};q0.queryInterval=function(e,t,r){if(e<this.mid&&this.left){var n=this.left.queryInterval(e,t,r);if(n)return n}if(t>this.mid&&this.right){var n=this.right.queryInterval(e,t,r);if(n)return n}return t<this.mid?XV(this.leftPoints,t,r):e>this.mid?HV(this.rightPoints,e,r):QV(this.leftPoints,r)};function ect(e,t){return e-t}function a8(e,t){var r=e[0]-t[0];return r||e[1]-t[1]}function c8(e,t){var r=e[1]-t[1];return r||e[0]-t[0]}function ep(e){if(e.length===0)return null;for(var t=[],r=0;r<e.length;++r)t.push(e[r][0],e[r][1]);t.sort(ect);for(var n=t[t.length>>1],i=[],o=[],s=[],r=0;r<e.length;++r){var a=e[r];a[1]<n?i.push(a):n<a[0]?o.push(a):s.push(a)}var c=s,l=s.slice();return c.sort(a8),l.sort(c8),new s8(n,ep(i),ep(o),c,l)}function o8(e){this.root=e}var rp=o8.prototype;rp.insert=function(e){this.root?this.root.insert(e):this.root=new s8(e[0],null,null,[e],[e])};rp.remove=function(e){if(this.root){var t=this.root.remove(e);return t===SI&&(this.root=null),t!==tp}return!1};rp.queryPoint=function(e,t){if(this.root)return this.root.queryPoint(e,t)};rp.queryInterval=function(e,t,r){if(e<=t&&this.root)return this.root.queryInterval(e,t,r)};Object.defineProperty(rp,"count",{get:function(){return this.root?this.root.count:0}});Object.defineProperty(rp,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}});function rct(e){return!e||e.length===0?new o8(null):new o8(ep(e))}});var pC={};function up(e,t=!1){let r,n,i=pC;function o(l){r=e(l).catch(()=>{}).finally(()=>{if(n){let{value:u}=n;n=null,o(u)}else r=null})}function s(l){n={event:l}}function a(l){r?s(l):o(l)}function c(l){i!==l&&requestAnimationFrame(()=>{let u=i;i=pC,a(u)}),i=l}return t?c:a}var Bn=class{constructor(t){this._filterBy=t,this._requestUpdate=up(()=>this.requestQuery(),!0),this._coordinator=null}get coordinator(){return this._coordinator}set coordinator(t){this._coordinator=t}get filterBy(){return this._filterBy}get filterStable(){return!0}fields(){return null}fieldInfo(t){return this}query(t){return null}queryPending(){return this}queryResult(t){return this}queryError(t){return this}requestQuery(t){let r=t||this.query(this.filterBy?.predicate(this));return this._coordinator.requestQuery(this,r)}requestUpdate(){this._requestUpdate()}initialize(){return this._coordinator.initializeClient(this)}update(){return this}};var fp=Uint8Array.of(65,82,82,79,87,49),Ti={V1:0,V2:1,V3:2,V4:3,V5:4};var Ai={NONE:0,Schema:1,DictionaryBatch:2,RecordBatch:3,Tensor:4,SparseTensor:5},j={Dictionary:-1,NONE:0,Null:1,Int:2,Float:3,Binary:4,Utf8:5,Bool:6,Decimal:7,Date:8,Time:9,Timestamp:10,Interval:11,List:12,Struct:13,Union:14,FixedSizeBinary:15,FixedSizeList:16,Map:17,Duration:18,LargeBinary:19,LargeUtf8:20,LargeList:21,RunEndEncoded:22,BinaryView:23,Utf8View:24,ListView:25,LargeListView:26},Mf={HALF:0,SINGLE:1,DOUBLE:2},js={DAY:0,MILLISECOND:1},Tr={SECOND:0,MILLISECOND:1,MICROSECOND:2,NANOSECOND:3},Ei={YEAR_MONTH:0,DAY_TIME:1,MONTH_DAY_NANO:2},qs={Sparse:0,Dense:1};var Nf=Uint8Array,Sx=Uint16Array,Ix=Uint32Array,Tx=BigUint64Array,dp=Int8Array,mC=Int16Array,Pn=Int32Array,ti=BigInt64Array,JI=Float32Array,uc=Float64Array;function yC(e,t){let r=Math.log2(e)-3;return(t?[dp,mC,Pn,ti]:[Nf,Sx,Ix,Tx])[r]}var Glt=Object.getPrototypeOf(Int8Array);function Of(e,t){let r=0,n=e.length;if(n<=2147483648)do{let i=r+n>>>1;e[i]<=t?r=i+1:n=i}while(r<n);else do{let i=Math.trunc((r+n)/2);e[i]<=t?r=i+1:n=i}while(r<n);return r}function Ax(e,t,r){if(t(e))return e;throw new Error(r(e))}function Un(e,t,r){return t=Array.isArray(t)?t:Object.values(t),Ax(e,n=>t.includes(n),r??(()=>`${e} must be one of ${t}`))}function Ex(e,t){for(let[r,n]of Object.entries(e))if(n===t)return r;return"<Unknown>"}var Vs=e=>`Unsupported data type: "${Ex(j,e)}" (id ${e})`,hp=(e,t,r=!0,n=null)=>({name:e,type:t,nullable:r,metadata:n});function gC(e){return Object.hasOwn(e,"name")&&xC(e.type)}function xC(e){return typeof e?.typeId=="number"}function fc(e,t="",r=!0){return gC(e)?e:hp(t,Ax(e,xC,()=>"Data type expected."),r)}var Mx=(e,t,r=!1,n=-1)=>({typeId:j.Dictionary,id:n,dictionary:e,indices:t||Rf(),ordered:r});var Nx=(e=32,t=!0)=>({typeId:j.Int,bitWidth:Un(e,[8,16,32,64]),signed:t,values:yC(e,t)});var Rf=()=>Nx(32);var tT=(e=2)=>({typeId:j.Float,precision:Un(e,Mf),values:[Sx,JI,uc][e]});var eT=()=>({typeId:j.Binary,offsets:Pn}),Ox=()=>({typeId:j.Utf8,offsets:Pn});var rT=(e,t,r=128)=>({typeId:j.Decimal,precision:e,scale:t,bitWidth:Un(r,[128,256]),values:Tx}),nT=e=>({typeId:j.Date,unit:Un(e,js),values:e===js.DAY?Pn:ti});var iT=(e=Tr.MILLISECOND,t=32)=>({typeId:j.Time,unit:Un(e,Tr),bitWidth:Un(t,[32,64]),values:t===32?Pn:ti});var Rx=(e=Tr.MILLISECOND,t=null)=>({typeId:j.Timestamp,unit:Un(e,Tr),timezone:t,values:ti}),oT=(e=Ei.MONTH_DAY_NANO)=>({typeId:j.Interval,unit:Un(e,Ei),values:e===Ei.MONTH_DAY_NANO?void 0:Pn}),Dx=e=>({typeId:j.List,children:[fc(e)],offsets:Pn}),Lx=e=>({typeId:j.Struct,children:Array.isArray(e)&&gC(e[0])?e:Object.entries(e).map(([t,r])=>hp(t,r))}),sT=(e,t,r,n)=>(r??=t.map((i,o)=>o),{typeId:j.Union,mode:Un(e,qs),typeIds:r,typeMap:r.reduce((i,o,s)=>(i[o]=s,i),{}),children:t.map((i,o)=>fc(i,`_${o}`)),typeIdForValue:n,offsets:Pn}),aT=e=>({typeId:j.FixedSizeBinary,stride:e}),Fx=(e,t)=>({typeId:j.FixedSizeList,stride:t,children:[fc(e)]}),bC=(e,t)=>({typeId:j.Map,keysSorted:e,children:[t],offsets:Pn});var cT=(e=Tr.MILLISECOND)=>({typeId:j.Duration,unit:Un(e,Tr),values:ti}),lT=()=>({typeId:j.LargeBinary,offsets:ti}),uT=()=>({typeId:j.LargeUtf8,offsets:ti}),fT=e=>({typeId:j.LargeList,children:[fc(e)],offsets:ti}),dT=(e,t)=>({typeId:j.RunEndEncoded,children:[Ax(fc(e,"run_ends"),r=>r.type.typeId===j.Int,()=>"Run-ends must have an integer type."),fc(t,"values")]});var hT=e=>({typeId:j.ListView,children:[fc(e,"value")],offsets:Pn}),pT=e=>({typeId:j.LargeListView,children:[fc(e,"value")],offsets:ti});var PW=new uc(2),Cx=PW.buffer,rut=new ti(Cx),nut=new Ix(Cx),iut=new Pn(Cx),out=new Nf(Cx);function Uo(e){if(e>Number.MAX_SAFE_INTEGER||e<Number.MIN_SAFE_INTEGER)throw Error(`BigInt exceeds integer number representation: ${e}`);return Number(e)}function kx(e,t){return Number(e/t)+Number(e%t)/Number(t)}var Df=e=>BigInt.asUintN(64,e);function wC(e,t){let r=t<<1,n;return BigInt.asIntN(64,e[r+1])<0?(n=Df(~e[r])|Df(~e[r+1])<<64n,n=-(n+1n)):n=e[r]|e[r+1]<<64n,n}function vC(e,t){let r=t<<2,n;return BigInt.asIntN(64,e[r+3])<0?(n=Df(~e[r])|Df(~e[r+1])<<64n|Df(~e[r+2])<<128n|Df(~e[r+3])<<192n,n=-(n+1n)):n=e[r]|e[r+1]<<64n|e[r+2]<<128n|e[r+3]<<192n,n}var $W=new TextDecoder("utf-8"),uut=new TextEncoder;function Lf(e){return $W.decode(e)}var kl=4;function mT(e,t){return(e[t>>3]&1<<t%8)!==0}function rn(e,t){let r=t+xe(e,t),n=r-xe(e,r),i=$r(e,n);return(o,s,a=null)=>{if(o<i){let c=$r(e,n+o);if(c)return s(e,r+c)}return a}}function eo(e,t){return t}function dc(e,t){return!!zW(e,t)}function zW(e,t){return pp(e,t)<<24>>24}function pp(e,t){return e[t]}function $r(e,t){return jW(e,t)<<16>>16}function jW(e,t){return e[t]|e[t+1]<<8}function xe(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function SC(e,t){return xe(e,t)>>>0}function Ar(e,t){return Uo(BigInt.asIntN(64,BigInt(SC(e,t))+(BigInt(SC(e,t+kl))<<32n)))}function Bl(e,t){let r=t+xe(e,t),n=xe(e,r);return r+=kl,Lf(e.subarray(r,r+n))}function ei(e,t,r,n){if(!t)return[];let i=t+xe(e,t);return Array.from({length:xe(e,i)},(o,s)=>n(e,i+kl+s*r))}var yT=Symbol("rowIndex");function mp(e,t){class r{constructor(o){this[yT]=o}toJSON(){return IC(e,t,this[yT])}}let n=r.prototype;for(let i=0;i<e.length;++i){if(Object.hasOwn(n,e[i]))continue;let o=t[i];Object.defineProperty(n,e[i],{get(){return o.at(this[yT])},enumerable:!0})}return i=>new r(i)}function Bx(e,t){return r=>IC(e,t,r)}function IC(e,t,r){let n={};for(let i=0;i<e.length;++i)n[e[i]]=t[i].at(r);return n}function TC(e){return e instanceof hc}var Pl=class{static ArrayType=null;constructor({length:t,nullCount:r,type:n,validity:i,values:o,offsets:s,sizes:a,children:c}){this.length=t,this.nullCount=r,this.type=n,this.validity=i,this.values=o,this.offsets=s,this.sizes=a,this.children=c,(!r||!this.validity)&&(this.at=l=>this.value(l))}get[Symbol.toStringTag](){return"Batch"}at(t){return this.isValid(t)?this.value(t):null}isValid(t){return mT(this.validity,t)}value(t){return this.values[t]}slice(t,r){let n=r-t,i=Array(n);for(let o=0;o<n;++o)i[o]=this.at(t+o);return i}*[Symbol.iterator](){for(let t=0;t<this.length;++t)yield this.at(t)}},hc=class extends Pl{constructor(t){super(t);let{length:r,values:n}=this;this.values=n.subarray(0,r)}slice(t,r){return this.nullCount?super.slice(t,r):this.values.subarray(t,r)}[Symbol.iterator](){return this.nullCount?super[Symbol.iterator]():this.values[Symbol.iterator]()}},yp=class extends Pl{static ArrayType=uc},$e=class extends Pl{static ArrayType=Array},gp=class extends $e{value(t){return null}},$o=class extends yp{value(t){return Uo(this.values[t])}},Px=class extends yp{value(t){let r=this.values[t],n=(r&31744)>>10,i=(r&1023)/1024,o=(-1)**((r&32768)>>15);switch(n){case 31:return o*(i?Number.NaN:1/0);case 0:return o*(i?6103515625e-14*i:0)}return o*2**(n-15)*(1+i)}},Ux=class extends $e{value(t){return mT(this.values,t)}},$x=class extends Pl{constructor(t){super(t);let{bitWidth:r,scale:n}=this.type;this.decimal=r===128?wC:vC,this.scale=10n**BigInt(n)}},zx=class extends $x{static ArrayType=uc;value(t){return kx(this.decimal(this.values,t),this.scale)}},jx=class extends $x{static ArrayType=Array;value(t){return this.decimal(this.values,t)}},xp=class extends $e{constructor(t){super(t),this.source=t}value(t){return new Date(this.source.value(t))}},qx=class extends yp{value(t){return 864e5*this.values[t]}},AC=$o,Vx=class extends $o{value(t){return super.value(t)*1e3}},EC=$o,Yx=class extends $o{value(t){return kx(this.values[t],1000n)}},Wx=class extends $o{value(t){return kx(this.values[t],1000000n)}},Gx=class extends $e{value(t){return this.values.subarray(t<<1,t+1<<1)}},Xx=class extends $e{value(t){let r=this.values,n=t<<4;return Float64Array.of(xe(r,n),xe(r,n+4),Ar(r,n+8))}},MC=({values:e,offsets:t},r)=>e.subarray(t[r],t[r+1]),NC=({values:e,offsets:t},r)=>e.subarray(Uo(t[r]),Uo(t[r+1])),Hx=class extends $e{value(t){return MC(this,t)}},Qx=class extends $e{value(t){return NC(this,t)}},Zx=class extends $e{value(t){return Lf(MC(this,t))}},Kx=class extends $e{value(t){return Lf(NC(this,t))}},Jx=class extends $e{value(t){let r=this.offsets;return this.children[0].slice(r[t],r[t+1])}},tb=class extends $e{value(t){let r=this.offsets;return this.children[0].slice(Uo(r[t]),Uo(r[t+1]))}},eb=class extends $e{value(t){let r=this.offsets[t],n=r+this.sizes[t];return this.children[0].slice(r,n)}},rb=class extends $e{value(t){let r=this.offsets[t],n=r+this.sizes[t];return this.children[0].slice(Uo(r),Uo(n))}},nb=class extends $e{constructor(t){super(t),this.stride=this.type.stride}},ib=class extends nb{value(t){let{stride:r,values:n}=this;return n.subarray(t*r,(t+1)*r)}},ob=class extends nb{value(t){let{children:r,stride:n}=this;return r[0].slice(t*n,(t+1)*n)}};function OC({children:e,offsets:t},r){let[n,i]=e[0].children,o=t[r],s=t[r+1],a=[];for(let c=o;c<s;++c)a.push([n.at(c),i.at(c)]);return a}var sb=class extends $e{value(t){return OC(this,t)}},ab=class extends $e{value(t){return new Map(OC(this,t))}},bp=class extends $e{constructor({typeIds:t,...r}){super(r),this.typeIds=t,this.typeMap=this.type.typeMap}value(t,r=t){let{typeIds:n,children:i,typeMap:o}=this;return i[o[n[t]]].at(r)}},cb=class extends bp{value(t){return super.value(t,this.offsets[t])}},_p=class extends $e{constructor(t,r=Bx){super(t),this.names=this.type.children.map(n=>n.name),this.factory=r(this.names,this.children)}value(t){return this.factory(t)}},lb=class extends _p{constructor(t){super(t,mp)}},ub=class extends $e{value(t){let[{values:r},n]=this.children;return n.at(Of(r,t))}},fb=class extends $e{setDictionary(t){return this.dictionary=t,this.cache=t.cache(),this}value(t){return this.cache[this.key(t)]}key(t){return this.values[t]}},db=class extends $e{constructor({data:t,...r}){super(r),this.data=t}view(t){let{values:r,data:n}=this,i=t<<4,o=i+4,s=r,a=xe(s,i);return a>12&&(o=xe(s,i+12),s=n[xe(s,i+8)]),s.subarray(o,o+a)}},hb=class extends db{value(t){return this.view(t)}},pb=class extends db{value(t){return Lf(this.view(t))}};function gT(e){let t=[];return{add(r){return t.push(r),this},clear:()=>t=[],done:()=>new Ul(t,e)}}var Ul=class{constructor(t,r=t[0]?.type){this.type=r,this.length=t.reduce((o,s)=>o+s.length,0),this.nullCount=t.reduce((o,s)=>o+s.nullCount,0),this.data=t;let n=t.length,i=new Int32Array(n+1);if(n===1){let[o]=t;i[1]=o.length,this.at=s=>o.at(s)}else for(let o=0,s=0;o<n;++o)i[o+1]=s+=t[o].length;this.offsets=i}get[Symbol.toStringTag](){return"Column"}[Symbol.iterator](){let t=this.data;return t.length===1?t[0][Symbol.iterator]():qW(t)}at(t){let{data:r,offsets:n}=this,i=Of(n,t)-1;return r[i]?.at(t-n[i])}get(t){return this.at(t)}toArray(){let{length:t,nullCount:r,data:n}=this,i=!r&&TC(n[0]),o=n.length;if(i&&o===1)return n[0].values;let s=!o||r>0?Array:n[0].constructor.ArrayType??n[0].values.constructor,a=new s(t);return i?VW(a,n):YW(a,n)}cache(){return this._cache??(this._cache=this.toArray())}};function*qW(e){for(let t=0;t<e.length;++t){let r=e[t][Symbol.iterator]();for(let n=r.next();!n.done;n=r.next())yield n.value}}function VW(e,t){for(let r=0,n=0;r<t.length;++r){let{values:i}=t[r];e.set(i,n),n+=i.length}return e}function YW(e,t){let r=-1;for(let n=0;n<t.length;++n){let i=t[n];for(let o=0;o<i.length;++o)e[++r]=i.at(o)}return e}var Ff=class e{constructor(t,r,n=!1){let i=t.fields.map(s=>s.name);this.schema=t,this.names=i,this.children=r,this.factory=n?mp:Bx;let o=[];this.getFactory=s=>o[s]??(o[s]=this.factory(i,r.map(a=>a.data[s])))}get[Symbol.toStringTag](){return"Table"}get numCols(){return this.names.length}get numRows(){return this.children[0]?.length??0}getChildAt(t){return this.children[t]}getChild(t){let r=this.names.findIndex(n=>n===t);return r>-1?this.children[r]:void 0}selectAt(t,r=[]){let{children:n,factory:i,schema:o}=this,{fields:s}=o;return new e({...o,fields:t.map((a,c)=>WW(s[a],r[c]))},t.map(a=>n[a]),i===mp)}select(t,r){let n=this.names,i=t.map(o=>n.indexOf(o));return this.selectAt(i,r)}toColumns(){let{children:t,names:r}=this,n={};return r.forEach((i,o)=>n[i]=t[o]?.toArray()??[]),n}toArray(){let{children:t,getFactory:r,numRows:n}=this,i=t[0]?.data??[],o=Array(n);for(let s=0,a=-1;s<i.length;++s){let c=r(s);for(let l=0;l<i[s].length;++l)o[++a]=c(l)}return o}*[Symbol.iterator](){let{children:t,getFactory:r}=this,n=t[0]?.data??[];for(let i=0;i<n.length;++i){let o=r(i);for(let s=0;s<n[i].length;++s)yield o(s)}}at(t){let{children:r,getFactory:n,numRows:i}=this;if(t<0||t>=i)return null;let[{offsets:o}]=r,s=Of(o,t)-1;return n(s)(t-o[s])}get(t){return this.at(t)}};function WW(e,t){return t!=null&&t!==e.name?{...e,name:t}:e}function wp(e,t={}){let{typeId:r,bitWidth:n,precision:i,unit:o}=e,{useBigInt:s,useDate:a,useDecimalBigInt:c,useMap:l,useProxy:u}=t;switch(r){case j.Null:return gp;case j.Bool:return Ux;case j.Int:case j.Time:case j.Duration:return s||n<64?hc:$o;case j.Float:return i?hc:Px;case j.Date:return RC(o===js.DAY?qx:AC,a&&xp);case j.Timestamp:return RC(o===Tr.SECOND?Vx:o===Tr.MILLISECOND?EC:o===Tr.MICROSECOND?Yx:Wx,a&&xp);case j.Decimal:return c?jx:zx;case j.Interval:return o===Ei.DAY_TIME?Gx:o===Ei.YEAR_MONTH?hc:Xx;case j.FixedSizeBinary:return ib;case j.Utf8:return Zx;case j.LargeUtf8:return Kx;case j.Binary:return Hx;case j.LargeBinary:return Qx;case j.BinaryView:return hb;case j.Utf8View:return pb;case j.List:return Jx;case j.LargeList:return tb;case j.Map:return l?ab:sb;case j.ListView:return eb;case j.LargeListView:return rb;case j.FixedSizeList:return ob;case j.Struct:return u?lb:_p;case j.RunEndEncoded:return ub;case j.Dictionary:return fb;case j.Union:return e.mode?cb:bp}throw new Error(Vs(r))}function RC(e,t){return t?class extends t{constructor(n){super(new e(n))}}:e}function GW(e,t){return{offset:Ar(e,t),metadataLength:xe(e,t+8),bodyLength:Ar(e,t+16)}}function xT(e,t){return ei(e,t,24,GW)}function mb(e,t,r){let n=rn(e,t);if(n(10,eo,0))throw new Error("Record batch compression not implemented");let i=r<Ti.V4?8:0;return{length:n(4,Ar,0),nodes:ei(e,n(6,eo),16,(o,s)=>({length:Ar(o,s),nullCount:Ar(o,s+8)})),regions:ei(e,n(8,eo),16+i,(o,s)=>({offset:Ar(o,s+i),length:Ar(o,s+i+8)})),variadic:ei(e,n(12,eo),8,Ar)}}function DC(e,t,r){let n=rn(e,t);return{id:n(4,Ar,0),data:n(6,(i,o)=>mb(i,o,r)),isDelta:n(8,dc,!1)}}function bT(e,t,r,n){Un(r,j,Vs);let i=rn(e,t);switch(r){case j.Binary:return eT();case j.Utf8:return Ox();case j.LargeBinary:return lT();case j.LargeUtf8:return uT();case j.List:return Dx(n[0]);case j.ListView:return hT(n[0]);case j.LargeList:return fT(n[0]);case j.LargeListView:return pT(n[0]);case j.Struct:return Lx(n);case j.RunEndEncoded:return dT(n[0],n[1]);case j.Int:return Nx(i(4,xe,0),i(6,dc,!1));case j.Float:return tT(i(4,$r,Mf.HALF));case j.Decimal:return rT(i(4,xe,0),i(6,xe,0),i(8,xe,128));case j.Date:return nT(i(4,$r,js.MILLISECOND));case j.Time:return iT(i(4,$r,Tr.MILLISECOND),i(6,xe,32));case j.Timestamp:return Rx(i(4,$r,Tr.SECOND),i(6,Bl));case j.Interval:return oT(i(4,$r,Ei.YEAR_MONTH));case j.Duration:return cT(i(4,$r,Tr.MILLISECOND));case j.FixedSizeBinary:return aT(i(4,xe,0));case j.FixedSizeList:return Fx(n[0],i(4,xe,0));case j.Map:return bC(i(4,dc,!1),n[0]);case j.Union:return sT(i(4,$r,qs.Sparse),n,ei(e,i(6,eo),4,xe))}return{typeId:r}}function vp(e,t){let r=ei(e,t,4,(n,i)=>{let o=rn(n,i);return[o(4,Bl),o(6,Bl)]});return r.length?new Map(r):null}function yb(e,t,r){let n=rn(e,t);return{version:r,endianness:n(4,$r,0),fields:n(6,XW,[]),metadata:n(8,vp)}}function XW(e,t){return ei(e,t,4,LC)}function LC(e,t){let r=rn(e,t),n=r(8,pp,j.NONE),i=r(10,eo,0),o=r(12,QW),s=r(14,(c,l)=>HW(c,l)),a=bT(e,i,n,s);return o&&(o.dictionary=a,a=o),{name:r(4,Bl),type:a,nullable:r(6,dc,!1),metadata:r(16,vp)}}function HW(e,t){let r=ei(e,t,4,LC);return r.length?r:null}function QW(e,t){if(!t)return null;let r=rn(e,t);return Mx(null,r(6,ZW,Rf()),r(8,dc,!1),r(4,Ar,0))}function ZW(e,t){return bT(e,t,j.Int)}var KW=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,JW=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,tG=e=>`Unsupported message type: ${e} (${Ex(Ai,e)})`;function gb(e,t){let r=xe(e,t)||0;if(t+=kl,r===-1&&(r=xe(e,t)||0,t+=kl),r===0)return null;let n=e.subarray(t,t+=r);if(n.byteLength<r)throw new Error(KW(r,n.byteLength));let i=rn(n,0),o=i(4,$r,Ti.V1),s=i(6,pp,Ai.NONE),a=i(8,eo,0),c=i(10,Ar,0),l;if(a){let u=s===Ai.Schema?yb:s===Ai.DictionaryBatch?DC:s===Ai.RecordBatch?mb:null;if(!u)throw new Error(tG(s));if(l=u(n,a,o),c>0){let f=e.subarray(t,t+=c);if(f.byteLength<c)throw new Error(JW(c,f.byteLength));l.body=f}}return{version:o,type:s,index:t,content:l}}function FC(e){let t=e instanceof ArrayBuffer?new Uint8Array(e):e;return t instanceof Uint8Array&&eG(t)?nG(t):rG(t)}function eG(e){if(!e||e.length<4)return!1;for(let t=0;t<6;++t)if(fp[t]!==e[t])return!1;return!0}function rG(e){let t=[e].flat(),r,n=[],i=[];for(let o of t){if(!(o instanceof Uint8Array))throw new Error("IPC data batch was not a Uint8Array.");let s=0;for(;;){let a=gb(o,s);if(a===null)break;if(s=a.index,!!a.content)switch(a.type){case Ai.Schema:r||(r=a.content);break;case Ai.RecordBatch:n.push(a.content);break;case Ai.DictionaryBatch:i.push(a.content);break}}}return{schema:r,dictionaries:i,records:n,metadata:null}}function nG(e){let t=e.byteLength-(fp.length+4),r=xe(e,t),n=rn(e,t-r),i=n(4,$r,Ti.V1),o=n(8,xT,[]),s=n(10,xT,[]);return{schema:n(6,(a,c)=>yb(a,c,i)),dictionaries:o.map(({offset:a})=>gb(e,a).content),records:s.map(({offset:a})=>gb(e,a).content),metadata:n(12,vp)}}function wT(e,t){return iG(FC(e),t)}function iG(e,t={}){let{schema:r={fields:[]},dictionaries:n,records:i}=e,{version:o,fields:s}=r,a=new Map,c=sG(t,o,a),l=new Map;oG(r,d=>{let h=d.type;h.typeId===j.Dictionary&&l.set(h.id,h.dictionary)});let u=new Map;for(let d of n){let{id:h,data:p,isDelta:m,body:y}=d,g=l.get(h),x=_T(g,c({...p,body:y}));if(u.has(h)){let b=u.get(h);m||b.clear(),b.add(x)}else{if(m)throw new Error("Delta update can not be first dictionary batch.");u.set(h,gT(g).add(x))}}u.forEach((d,h)=>a.set(h,d.done()));let f=s.map(d=>gT(d.type));for(let d of i){let h=c(d);s.forEach((p,m)=>f[m].add(_T(p.type,h)))}return new Ff(r,f.map(d=>d.done()),t.useProxy)}function oG(e,t){e.fields.forEach(function r(n){t(n),n.type.dictionary?.children?.forEach(r),n.type.children?.forEach(r)})}function sG(e,t,r){let n={version:t,options:e,dictionary:i=>r.get(i)};return i=>{let{length:o,nodes:s,regions:a,variadic:c,body:l}=i,u=-1,f=-1,d=-1;return{...n,length:o,node:()=>s[++u],buffer:h=>{let{length:p,offset:m}=a[++f];return h?new h(l.buffer,l.byteOffset+m,p/h.BYTES_PER_ELEMENT):l.subarray(m,m+p)},variadic:()=>c[++d],visit(h){return h.map(p=>_T(p.type,this))}}}}function _T(e,t){let{typeId:r}=e,{length:n,options:i,node:o,buffer:s,variadic:a,version:c}=t,l=wp(e,i);if(r===j.Null)return new l({length:n,nullCount:n,type:e});let u={...o(),type:e};switch(r){case j.Bool:case j.Int:case j.Time:case j.Duration:case j.Float:case j.Decimal:case j.Date:case j.Timestamp:case j.Interval:case j.FixedSizeBinary:return new l({...u,validity:s(),values:s(e.values)});case j.Utf8:case j.LargeUtf8:case j.Binary:case j.LargeBinary:return new l({...u,validity:s(),offsets:s(e.offsets),values:s()});case j.BinaryView:case j.Utf8View:return new l({...u,validity:s(),values:s(),data:Array.from({length:a()},()=>s())});case j.List:case j.LargeList:case j.Map:return new l({...u,validity:s(),offsets:s(e.offsets),children:t.visit(e.children)});case j.ListView:case j.LargeListView:return new l({...u,validity:s(),offsets:s(e.offsets),sizes:s(e.offsets),children:t.visit(e.children)});case j.FixedSizeList:case j.Struct:return new l({...u,validity:s(),children:t.visit(e.children)});case j.RunEndEncoded:return new l({...u,children:t.visit(e.children)});case j.Dictionary:{let{id:f,indices:d}=e;return new l({...u,validity:s(),values:s(d.values)}).setDictionary(t.dictionary(f))}case j.Union:return c<Ti.V5&&s(),new l({...u,typeIds:s(dp),offsets:e.mode===qs.Sparse?null:s(e.offsets),children:t.visit(e.children)});default:throw new Error(Vs(r))}}var Uft=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;function pc(e){return wT(e,{useDate:!0})}function xb(e="ws://localhost:3000/"){let t=[],r=!1,n=null,i,o={open(){r=!0,c()},close(){for(r=!1,n=null,i=null;t.length;)t.shift().reject("Socket closed")},error(l){if(n){let{reject:u}=n;n=null,c(),u(l)}else console.error("WebSocket error: ",l)},message({data:l}){if(n){let{query:u,resolve:f,reject:d}=n;if(n=null,c(),typeof l=="string"){let h=JSON.parse(l);h.error?d(h.error):f(h)}else if(u.type==="exec")f();else if(u.type==="arrow")f(pc(l));else throw new Error(`Unexpected socket data: ${l}`)}else console.log("WebSocket message: ",l)}};function s(){i=new WebSocket(e),i.binaryType="arraybuffer";for(let l in o)i.addEventListener(l,o[l])}function a(l,u,f){i==null&&s(),t.push({query:l,resolve:u,reject:f}),r&&!n&&c()}function c(){t.length&&(n=t.shift(),i.send(JSON.stringify(n.query)))}return{get connected(){return r},query(l){return new Promise((u,f)=>a(l,u,f))}}}var Cf="COLUMN_REF",bb="COLUMN_PARAM",zC="TABLE_REF",jC="LITERAL",qC="INTERVAL",_b="ORDER_BY",wb="CAST",vb="CASE",Sb="WHEN",Ib="UNARY",VC="UNARY_POSTFIX",Tb="BINARY",Ab="BETWEEN",Eb="NOT_BETWEEN",Mb="LOGICAL_OPERATOR",Nb="IN",Ob="FUNCTION",zl="AGGREGATE",kf="WINDOW",Rb="WINDOW_DEF",Db="WINDOW_FRAME",YC="EXPRESSION",Bf="FRAGMENT",Lb="VERBATIM",Pf="PARAM",WC="WITH_CLAUSE",Fb="SELECT_CLAUSE",Cb="FROM_CLAUSE";var GC="SAMPLE_CLAUSE";var kb="WINDOW_CLAUSE";var Bb="SELECT_QUERY",Pb="DESCRIBE_QUERY",Ub="SET_OPERATION";function nn(e){return e instanceof Je}var Je=class{constructor(t){this.type=t}},Bt=class extends Je{};var jl=class extends Bt{constructor(t){super(jC),this.value=t}toString(){return vT(this.value)}};function vT(e){switch(typeof e){case"number":return Number.isFinite(e)?`${e}`:"NULL";case"string":return`'${e.replace("'","''")}'`;case"boolean":return e?"TRUE":"FALSE";default:if(e==null)return"NULL";if(e instanceof Date){let t=+e;if(Number.isNaN(t))return"NULL";let r=e.getUTCFullYear(),n=e.getUTCMonth(),i=e.getUTCDate();return t===Date.UTC(r,n,i)?`DATE '${r}-${n+1}-${i}'`:`epoch_ms(${t})`}else return e instanceof RegExp?`'${e.source}'`:`${e}`}}var ro=class extends Bt{constructor(t){super(Pf),this.param=t}get value(){return this.param.value}toString(){return vT(this.value)}};function ST(e){return e.split(".")}function no(e){return`"${e}"`}function $b(e){return e&&NG(e)?e.slice(1,-1):e}function NG(e){return e[0]==='"'&&e[e.length-1]==='"'}function mc(e){return e instanceof Uf}var Uf=class extends Bt{constructor(t){super(zC),this.table=[t].flat()}get name(){return this.table[this.table.length-1]}toString(){return this.table.map(t=>no(t)).join(".")}};var ql=class extends Bt{constructor(t,r=[]){super(Ob),this.name=t,this.args=r}toString(){let{name:t,args:r}=this;return`${t}(${r.join(", ")})`}};function we(e,...t){return new ql(e,Sp(t).map(qt))}function ee(e,...t){return new Tp(e,Sp(t).map(qt))}function Mi(e,...t){return new Vl(new Ip(e,Sp(t).map(qt)))}function $n(e,t=qt){return e.flat().filter(r=>r!=null).map(r=>t(r))}function Sp(e){let t=e.length,r=t;for(;r>0&&e[r-1]===void 0;--r);return r<t?e.slice(0,r):e}function Ni(e){return typeof e=="string"}function Ap(e){return Array.isArray(e)}function io(e){return e&&typeof e.addEventListener=="function"&&e.dynamic!==!1&&"value"in e}var Mp=class extends Je{constructor(t,r){super(kb),this.name=t,this.def=r}toString(){return`${no(this.name)} AS ${this.def}`}},Vl=class e extends Bt{constructor(t,r=new Yl){super(kf),this.func=t,this.def=r}over(t){return new e(this.func,this.def.over(t))}partitionby(...t){return new e(this.func,this.def.partitionby(...t))}orderby(...t){return new e(this.func,this.def.orderby(...t))}rows(t){return new e(this.func,this.def.rows(t))}range(t){return new e(this.func,this.def.range(t))}toString(){return`${this.func} OVER ${this.def}`}},Ip=class extends ql{constructor(t,r){super(t,r)}},Yl=class extends Je{constructor(t,r,n,i){super(Rb),this.name=t,this.partition=r,this.order=n,this.frame=i}over(t){return Ep(this,{name:t})}partitionby(...t){return Ep(this,{partition:$n(t)})}orderby(...t){return Ep(this,{order:$n(t)})}rows(t){return Ep(this,{frame:new Np(t)})}range(t){return Ep(this,{frame:new Np(t,!0)})}toString(){let{name:t,partition:r,order:n,frame:i}=this,o=t&&no(t),s=[o,r?.length&&`PARTITION BY ${r.join(", ")}`,n?.length&&`ORDER BY ${n.join(", ")}`,i].filter(a=>a);return o&&s.length<2?o:`(${s.join(" ")})`}},Np=class extends Je{constructor(t,r=!1,n=void 0){super(Db),this.extent=io(t)?new ro(t):t,this.range=r,this.exclude=n}toString(){let{range:t,exclude:r,extent:n}=this,i=t?"RANGE":"ROWS",[o,s]=nn(n)?n.value:n,a=XC(o,"PRECEDING"),c=XC(s,"FOLLOWING");return`${i} BETWEEN ${a} AND ${c}${r?` ${r}`:""}`}};function Ep(e,t){return new Yl(t.name??e.name,t.partition??e.partition,t.order??e.order,t.frame??e.frame)}function XC(e,t){return e===0?"CURRENT ROW":Number.isFinite(e)?`${Math.abs(e)} ${t}`:`UNBOUNDED ${t}`}function yc(e){return e instanceof Ws}var Ws=class extends Bt{constructor(t,r){super(t),this.table=r}get column(){return null}toString(){let{column:t,table:r}=this,n=`${r??""}`,i=t==="*"?"*":no(t);return(n?n+".":"")+i}},Op=class extends Ws{constructor(t,r){super(Cf,r),this.name=t}get column(){return this.name}};var Rp=class extends Ws{constructor(t,r){super(bb,r),this.param=t}get column(){return`${this.param.value}`}};function Gs(e,t){let r=Wl(t);return io(e)?new Rp(new ro(e),r):new Op(e,r)}var Gl=class extends Bt{constructor(t){super(Lb),this.value=t}toString(){return this.value}};function Er(e){return new jl(e)}function HC(e){return new Gl(e)}function zb(...e){let t=$n(e,String);return t?.length?new Uf(t):void 0}function qt(e){return Ni(e)?OG(e):Hl(e)}function Xl(e){return Ni(e)?HC(e):Hl(e)}function Hl(e){return e instanceof Bt?e:io(e)?new ro(e):Er(e)}function Wl(e){return Ni(e)?RG(e):Ap(e)?zb(e):e}function OG(e){let t=ST(e);return Gs(t.pop(),zb(t))}function RG(e){return zb(ST(e))}function IT(){return new Yl}var Tp=class e extends Bt{constructor(t,r,n,i){super(zl),this.name=t,this.args=r,this.isDistinct=n,this.filter=i}distinct(t=!0){return new e(this.name,this.args,t,this.filter)}where(t){return Ni(t)&&(t=Xl(t)),new e(this.name,this.args,this.isDistinct,t)}window(){return new Vl(this)}partitionby(...t){return this.window().partitionby(...t)}orderby(...t){return this.window().orderby(...t)}toString(){let{name:t,args:r,isDistinct:n,filter:i}=this,o=n?"DISTINCT ":"",s=r?.length?r.join(", "):"*",a=i?` FILTER (WHERE ${i})`:"";return`${t}(${o}${s})${a}`}},QC=["any_value","approx_count_distinct","approx_quantile","arbitrary","arg_max","arg_max_null","arg_min","arg_min_null","array_agg","avg","bit_and","bit_or","bit_xor","bitstring_agg","bool_and","bool_or","corr","count","covar_pop","covar_samp","entropy","favg","first","fsum","geomean","kurtosis_pop","kurtosis","last","mad","max","max_by","median","min","min_by","mode","product","quantile","quantile_cont","quantile_disc","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_sxx","regr_sxy","regr_syy","regr_slope","reservoir_quantile","skewness","stddev","stddev_pop","stddev_samp","string_agg","sum","variance","var_pop","var_samp"];var jb=class extends Bt{constructor(t,r,n){super(t),this.expr=r,this.extent=n}toSQL(t){let{extent:r,expr:n}=this;return r?`(${n} ${t} ${r[0]} AND ${r[1]})`:""}},Ql=class extends jb{constructor(t,r){super(Ab,t,r)}toString(){return super.toSQL("BETWEEN")}},Dp=class extends jb{constructor(t,r){super(Eb,t,r)}toString(){return super.toSQL("NOT BETWEEN")}};var Lp=class extends Bt{constructor(t,r,n){super(Tb),this.op=t,this.left=r,this.right=n}toString(){return`(${this.left} ${this.op} ${this.right})`}};var $f=class e extends Bt{constructor(t=void 0,r=[],n=void 0){super(vb),this.expr=t,this._when=r,this._else=n}when(t,r){return new e(this.expr,this._when.concat(new zf(qt(t),qt(r))),this._else)}else(t){return new e(this.expr,this._when,qt(t))}toString(){return"CASE "+(this.expr?`${this.expr} `:"")+this._when.join(" ")+(this._else?` ELSE ${this._else}`:"")+" END"}},zf=class extends Je{constructor(t,r){super(Sb),this.when=t,this.then=r}toString(){return`WHEN ${this.when} THEN ${this.then}`}};var Fp=class extends Bt{constructor(t,r){super(wb),this.expr=t,this.cast=r}toString(){return`(${this.expr})::${this.cast}`}};var Cp=class extends Bt{constructor(t){super(Bf),this.spans=t}toString(){return this.spans.join("")}};var kp=class extends Je{constructor(t,r=!1,n=void 0,i=void 0){super(GC),this.size=t,this.perc=r,this.method=n,this.seed=i}toString(){let{size:t,perc:r,method:n,seed:i}=this,o=r?"%":" ROWS",s=i!=null?`, ${i}`:"";return`${t}${o}${n?` (${n}${s})`:""}`}};var Bp=class extends Je{constructor(t,r){super(Fb),this.expr=t,this.alias=r}toString(){let{expr:t,alias:r}=this;return!r||DG(t,r)?`${t}`:`${t} AS ${no(r)}`}};function DG(e,t){return e instanceof Ws&&e.table==null&&e.column===t}var Pp=class extends Je{constructor(t,r){super(WC),this.name=t,this.query=r}toString(){return`"${this.name}" AS (${this.query})`}};function qb(e){return e instanceof ft}function gc(e){return e instanceof Kl}function TT(e){return e instanceof Up}var ft=class extends Bt{static select(...t){return new Kl().select(...t)}static from(...t){return new Kl().from(...t)}static with(...t){return new Kl().with(...t)}static union(...t){return new Zl("UNION",t.flat())}static unionAll(...t){return new Zl("UNION ALL",t.flat())}static intersect(...t){return new Zl("INTERSECT",t.flat())}static except(...t){return new Zl("EXCEPT",t.flat())}static describe(t){return new Up(t)}constructor(t){super(t),this._orderby=[],this._limit=void 0,this._offset=void 0,this.cteFor=null}get subqueries(){return[]}clone(){return this}orderby(...t){return this._orderby=this._orderby.concat($n(t)),this}limit(t){return this._limit=Number.isFinite(t)?t:void 0,this}offset(t){return this._offset=Number.isFinite(t)?t:void 0,this}},Kl=class e extends ft{constructor(){super(Bb),this._with=[],this._select=[],this._from=[],this._where=[],this._sample=void 0,this._groupby=[],this._having=[],this._window=[],this._qualify=[]}get subqueries(){let t=this.cteFor||this,n=(t instanceof e?t._with:[]).reduce((o,s)=>(o[s.name]=s.query,o),{}),i=[];return this._from.forEach(({expr:o})=>{if(qb(o))i.push(o);else if(mc(o)){let s=n[o.name];s&&i.push(s)}}),i}clone(){return Object.assign(new e,this)}with(...t){let r=[],n=(i,o)=>{let s=o.clone();s.cteFor=this,r.push(new Pp(i,s))};return t.flat().forEach(i=>{if(i!=null)for(let o in i)n(o,i[o])}),this._with=this._with.concat(r),this}select(...t){let r=[],n=(o,s)=>r.push(new Bp(o==null?o:qt(o),$b(s)));t.flat().forEach(o=>{if(o!=null)if(Ni(o))n(o,o);else if(yc(o))n(o,o.column);else if(Ap(o))n(o[1],o[0]);else for(let s in o)n(o[s],s)});let i=new Set(r.map(o=>o.alias));return this._select=this._select.filter(o=>!i.has(o.alias)).concat(r.filter(o=>o.expr)),this}setSelect(...t){return this._select=[],this.select(...t)}distinct(t=!0){return this._distinct=!!t,this}from(...t){let r=[],n=(i,o)=>r.push(new $p(Wl(i),$b(o)));return t.flat().forEach(i=>{if(i!=null)if(Ni(i))n(i,i);else if(mc(i))n(i,i.name);else if(nn(i))n(i);else if(Ap(i))n(i[1],i[0]);else for(let o in i)n(i[o],o)}),this._from=this._from.concat(r),this}setFrom(...t){return this._from=[],this.from(...t)}sample(t,r,n){let i;if(typeof t=="number"){let o=t>0&&t<1,s=o?t*100:Math.floor(t);i=new kp(s,o,r,n)}else i=t;return this._sample=i,this}where(...t){return this._where=this._where.concat($n(t,Xl)),this}setWhere(...t){return this._where=[],this.where(...t)}groupby(...t){return this._groupby=this._groupby.concat($n(t)),this}setGroupby(...t){return this._groupby=[],this.groupby(...t)}having(...t){return this._having=this._having.concat($n(t,Xl)),this}window(...t){let r=[];return t.flat().forEach(n=>{if(n!=null)for(let i in n)r.push(new Mp($b(i),n[i]))}),this._window=this._window.concat(r),this}qualify(...t){return this._qualify=this._qualify.concat($n(t,Xl)),this}toString(){let{_with:t,_select:r,_distinct:n,_from:i,_sample:o,_where:s,_groupby:a,_having:c,_window:l,_qualify:u,_orderby:f,_limit:d,_offset:h}=this,p=[];if(t.length&&p.push(`WITH ${t.join(", ")}`),p.push(`SELECT${n?" DISTINCT":""} ${r.join(", ")}`),i.length&&p.push(`FROM ${i.join(", ")}`),s.length){let m=s.map(String).filter(y=>y).join(" AND ");m&&p.push(`WHERE ${m}`)}if(o&&p.push(`USING SAMPLE ${o}`),a.length&&p.push(`GROUP BY ${a.join(", ")}`),c.length){let m=c.map(String).filter(y=>y).join(" AND ");m&&p.push(`HAVING ${m}`)}if(l.length&&p.push(`WINDOW ${l.join(", ")}`),u.length){let m=u.map(String).filter(y=>y).join(" AND ");m&&p.push(`QUALIFY ${m}`)}return f.length&&p.push(`ORDER BY ${f.join(", ")}`),Number.isFinite(d)&&p.push(`LIMIT ${d}`),Number.isFinite(h)&&p.push(`OFFSET ${h}`),p.join(" ")}},Up=class e extends Je{constructor(t){super(Pb),this.query=t}clone(){return new e(this.query.clone())}toString(){return`DESCRIBE ${this.query}`}},Zl=class e extends ft{constructor(t,r){super(Ub),this.op=t,this.queries=r}get subqueries(){let{queries:t,cteFor:r}=this;return r&&t.forEach(n=>n.cteFor=r),t}clone(){let{op:t,queries:r,...n}=this;return Object.assign(new e(t,r),n)}toString(){let{op:t,queries:r,_orderby:n,_limit:i,_offset:o}=this,s=[r.join(` ${t} `)];return n.length&&s.push(`ORDER BY ${n.join(", ")}`),Number.isFinite(i)&&s.push(`LIMIT ${i}`),Number.isFinite(o)&&s.push(`OFFSET ${o}`),s.join(" ")}};var $p=class extends Je{constructor(t,r){super(Cb),this.expr=t,this.alias=r}toString(){let{expr:t,alias:r}=this,n=qb(t)?`(${t})`:`${t}`;return r&&!(mc(t)&&t.table.join(".")===r)?`${n} AS ${no(r)}`:`${n}`}};var zp=class extends Bt{constructor(t,r){super(Nb),this.expr=t,this.values=r}toString(){return`(${this.expr} IN (${this.values.join(", ")}))`}};var jp=class extends Bt{constructor(t,r=1){super(qC),this.name=t,this.steps=r}toString(){return`INTERVAL ${this.steps} ${this.name}`}};var Vb=class extends Bt{constructor(t,r){super(Mb),this.op=t,this.clauses=r}toString(){let t=this.clauses;return t.length===0?"":t.length===1?`${t[0]}`:`(${t.join(` ${this.op} `)})`}},qp=class extends Vb{constructor(t){super("AND",t)}},Vp=class extends Vb{constructor(t){super("OR",t)}};var jf=class extends Bt{constructor(t,r,n){super(_b),this.expr=t,this.desc=r,this.nullsFirst=n}toString(){let{expr:t,desc:r,nullsFirst:n}=this;return`${t}${r?" DESC":r===!1?" ASC":""}${n?" NULLS FIRST":n===!1?" NULLS LAST":""}`}};var Yb=class extends Bt{constructor(t,r,n){super(t),this.op=r,this.expr=n}},Yp=class extends Yb{constructor(t,r){super(Ib,t,r)}toString(){return`(${this.op} ${this.expr})`}},Wp=class extends Yb{constructor(t,r){super(VC,t,r)}toString(){return`(${this.expr} ${this.op})`}};function xc(e,t){return ee("arg_max",e,t)}function bc(e,t){return ee("arg_min",e,t)}function AT(e){return ee("array_agg",e)}function Gp(e){return ee("avg",e)}function ET(e,t){return ee("corr",e,t)}function Mr(e){return ee("count",e)}function MT(e,t){return ee("covar_samp",e,t)}function NT(e,t){return ee("covar_pop",e,t)}function OT(e){return ee("entropy",e)}function RT(e){return ee("first",e)}function DT(e){return ee("kurtosis",e)}function LT(e){return ee("mad",e)}function zr(e){return ee("max",e)}function FT(e){return ee("median",e)}function zn(e){return ee("min",e)}function CT(e){return ee("mode",e)}function kT(e){return ee("last",e)}function BT(e){return ee("product",e)}function PT(e,t){return ee("quantile",e,t)}function Xp(e,t){return ee("regr_avgx",e,t)}function UT(e,t){return ee("regr_avgy",e,t)}function Hp(e,t){return ee("regr_count",e,t)}function $T(e,t){return ee("regr_intercept",e,t)}function zT(e,t){return ee("regr_sxx",e,t)}function jT(e,t){return ee("regr_syy",e,t)}function qT(e,t){return ee("regr_slope",e,t)}function VT(e){return ee("skewness",e)}function Qp(e){return ee("stddev",e)}function YT(e){return ee("stddev_pop",e)}function WT(e){return ee("string_agg",e)}function de(e){return ee("sum",e)}function GT(e){return ee("var_samp",e)}function XT(e){return ee("var_pop",e)}function Xs(e,t,r){return e?new $f(void 0,[new zf(qt(e),qt(t))],qt(r)):new $f}function qf(e,t){return new Fp(qt(e),t)}function ve(e){return qf(e,"INTEGER")}function HT(e){return qf(e,"FLOAT")}function Ge(e){return qf(e,"DOUBLE")}function Wb(e,t){return new jp(e,t)}function QT(e){return we("epoch_ms",e)}function ZT(e,t,r=1){return we("time_bucket",Wb(t,r),e)}function KT(e){return we("make_date",2012,we("month",e),1)}function JT(e){let t=qt(e);return we("make_date",2012,we("month",t),we("day",t))}function tA(e){return we("make_date",2012,1,we("day",e))}function eA(...e){return we("greatest",...e)}function Gb(e){return we("exp",e)}function rA(e){return we("log",e)}function Vf(e){return we("ln",e)}function oo(e){return we("sign",e)}function Nr(e){return we("abs",e)}function Hs(e){return we("sqrt",e)}function nA(e){return we("ceil",e)}function Or(e){return we("floor",e)}function Qs(e,t){return we("round",e,t)}function LG(e,t){return new Yp(e,qt(t))}function ZC(e,t){return new Wp(e,qt(t))}function jn(e,t,r){return new Lp(e,qt(t),qt(r))}function KC(e,t,r=!1){let n=r?Dp:Ql;return new n(qt(e),t?.map(qt))}function on(...e){return new qp($n(e))}function Oi(...e){return new Vp($n(e))}function iA(e){return LG("NOT",e)}function Jl(e){return ZC("IS NULL",e)}function Ri(e){return ZC("IS NOT NULL",e)}function Zp(e,t){return jn("&",e,t)}function te(e,t){return jn("+",e,t)}function Tt(e,t){return jn("-",e,t)}function Nt(e,t){return jn("*",e,t)}function se(e,t){return jn("/",e,t)}function ir(e,t){return jn("**",e,t)}function oA(e,t){return jn("=",e,t)}function so(e,t){return jn("<>",e,t)}function ze(e,t){return jn("<",e,t)}function Di(e,t){return jn(">",e,t)}function ri(e,t){return jn("<=",e,t)}function sA(e,t){return jn(">=",e,t)}function aA(e,t){return jn("IS DISTINCT FROM",e,t)}function Kp(e,t){return jn("IS NOT DISTINCT FROM",e,t)}function jr(e,t){return KC(e,t,!1)}function cA(e,t){return KC(e,t,!0)}function Xb(e,t){return new zp(qt(e),t.map(qt))}function lA(e,t){return new jf(qt(e),!1,t)}function uA(e,t){return new jf(qt(e),!0,t)}function Jp(e){return we("st_asgeojson",e)}function JC(e){return we("st_x",e)}function tk(e){return we("st_y",e)}function tm(e){return we("st_centroid",e)}function fA(e){return JC(tm(e))}function dA(e){return tk(tm(e))}function tr(e,...t){return new Cp(FG(e,t))}function FG(e,t){let r=[e[0]],n=t.length;for(let i=0,o=0;i<n;){let s=t[i];nn(s)?r[++o]=s:io(s)?r[++o]=new ro(s):r[o]+=Ni(s)?s:Er(s);let a=e[++i];nn(r[o])?r[++o]=a:r[o]+=a}return r.filter(i=>i).map(i=>Ni(i)?new Gl(i):i)}function Hb(e,t,...r){return we(e,t,...Sp(r).map(Hl))}function hA(e,t,r){return Hb("regexp_matches",e,t,r)}function pA(e,t){return Hb("contains",e,t)}function mA(e,t){return Hb("starts_with",e,t)}function yA(e,t){return Hb("ends_with",e,t)}function gA(){return Mi("row_number")}function xA(){return Mi("rank")}function bA(){return Mi("dense_rank")}function _A(){return Mi("percent_rank")}function wA(){return Mi("cume_dist")}function vA(e){return Mi("ntile",e)}function SA(e,t,r){return Mi("lag",e,t,r)}function Yf(e,t,r){return Mi("lead",e,t,r)}function IA(e){return Mi("first_value",e)}function TA(e){return Mi("last_value",e)}function AA(e,t){return Mi("nth_value",e,t)}var Qb={[zl]:["args","filter"],[Ab]:["expr","extent"],[Tb]:["left","right"],[vb]:["expr","_when","_else"],[wb]:["expr"],[bb]:["param","table"],[Cf]:["table"],[Pb]:["query"],[YC]:["node"],[Bf]:["spans"],[Cb]:["expr"],[Ob]:["args"],[Nb]:["expr","values"],[Mb]:["clauses"],[Eb]:["expr","extent"],[_b]:["expr"],[Pf]:["value"],[Fb]:["expr"],[Bb]:["_with","_select","_from","_where","_sample","_groupby","_having","_window","_qualify","_orderby"],[Ub]:["subqueries","_orderby"],[Ib]:["expr"],[Sb]:["when","then"],[kf]:["func","def"],[kb]:["def"],[Rb]:["partition","order","frame"],[Db]:["extent"]};function em(e,t){if(t.has(e))return t.get(e);if(nn(e)){let r=Qb[e.type],n=r?.length??0;for(let i=0;i<n;++i){let o=r[i],s=e[o];if(Array.isArray(s)){let a=s.length;for(let c=0;c<a;++c)s[c]=em(s[c],t)}else s&&(e[o]=em(s,t))}}return e}function zo(e,t){if(!nn(e))return;let r=t(e);if(r)return r;let n=Qb[e.type],i=n?.length??0;for(let o=0;o<i;++o){let s=e[n[o]];if(Array.isArray(s)){let a=s.length;for(let c=0;c<a;++c)if(s[c]&&+zo(s[c],t)<0)return r}else if(s&&+zo(s,t)<0)return-1}}var CG=new RegExp(`^(${QC.join("|")})$`),kG=/(\\'|\\"|"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\w+\()/g;function BG(e){return e.split(kG).some(t=>t.endsWith("(")&&CG.test(t.slice(0,-1)))}function ni(e){let t=0;return zo(e,r=>{switch(r.type){case kf:return-1;case zl:return t|=1,-1;case Bf:case Lb:{let n=`${r}`.toLowerCase(),i=n.indexOf("(select ");return i>=0&&(n=n.slice(0,i)),n.includes(") over ")?-1:BG(n)?(t|=2,-1):1}}}),t}function EA(e){let t=new Set;return zo(e,r=>{r.type===zl&&t.add(r)}),Array.from(t)}function Wf(e){let t={};return zo(e,r=>{r.type===Cf&&(t[r]=r)}),Object.values(t)}function MA(e){let t=new Set;return zo(e,r=>{r.type===Pf&&t.add(r.param)}),Array.from(t)}function _c(e,t,{replace:r=!1,temp:n=!1,view:i=!1}={}){return"CREATE"+(r?" OR REPLACE ":" ")+(n?"TEMP ":"")+(i?"VIEW":"TABLE")+(r?" ":" IF NOT EXISTS ")+e+" AS "+t}function NA(e,{strict:t=!1}={}){return"CREATE SCHEMA "+(t?"":"IF NOT EXISTS ")+e}function OA(e){return`INSTALL ${e}; LOAD ${e}`}function ek(e,{columns:t=Object.keys(e?.[0]||{})}={}){let r=[];if(Array.isArray(t)?(r=t,t=r.reduce((i,o)=>(i[o]=o,i),{})):t&&(r=Object.keys(t)),!r.length)throw new Error("Can not create table from empty column set.");let n=[];for(let i of e){let o=r.map(s=>`${Hl(i[s])} AS "${t[s]}"`);n.push(`(SELECT ${o.join(", ")})`)}return n.join(" UNION ALL ")}function Zb(e,t,r,n={},i={}){let{select:o=["*"],where:s,view:a,temp:c,replace:l,...u}=n,f=PG({...i,...u}),d=`${e}('${r}'${f?", "+f:""})`,h=s?` WHERE ${s}`:"",p=`SELECT ${o.join(", ")} FROM ${d}${h}`;return _c(t,p,{view:a,temp:c,replace:l})}function DA(e,t,r){return Zb("read_csv",e,t,r,{auto_detect:!0,sample_size:-1})}function LA(e,t,r){return Zb("read_json",e,t,r,{auto_detect:!0,format:"auto"})}function FA(e,t,r){return Zb("read_parquet",e,t,r)}function CA(e,t,r={}){let{options:n,...i}=r;if(n){let o=Array.isArray(n)?n.join(", "):typeof n=="string"?n:Object.entries(n).map(([s,a])=>`${s}=${a}`).join(", ");Object.assign(i,{open_options:o.toUpperCase()})}return Zb("st_read",e,t,i)}function kA(e,t,r={}){let{select:n=["*"],...i}=r,o=ek(t),s=n.length===1&&n[0]==="*"?o:`SELECT ${n} FROM ${o}`;return _c(e,s,i)}function PG(e){return Object.entries(e).map(([t,r])=>`${t}=${RA(r)}`).join(", ")}function RA(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=>RA(t)).join(", ")+"]":"{"+Object.entries(e).map(([t,r])=>`'${t}': ${RA(r)}`).join(", ")+"}";default:return e}}function BA(e,t,r,n,i){let o=i?Tt(r,Ge(e)):Tt(Ge(e),t),s=r===t?0:n/(r-t);return s?Nt(o,Ge(s)):o}function PA(e,t,r,n,i,o){return e.select({index:te(ve(Or(t)),Nt(ve(Or(r)),i)),...n}).groupby("index",o)}function UA(e,t,r){let n=r?s=>Nt(s,r):s=>s,i=Or(t),o=te(i,1);return ft.from(ft.unionAll(e.clone().select({i:ve(i),w:n(Tt(o,t))}),e.clone().select({i:ve(o),w:n(Tt(t,i))}))).select({index:"i",density:de("w")}).groupby("index").having(so("density",0))}function UG(e){return e}function $A(e,t,r,n,i,o){let s=n?g=>Nt(g,n):UG,a=(g,x)=>e.clone().select({xp:t,yp:r,i:g,w:x}),c=(g,x)=>te(g,Nt(x,i)),l=ve(Or(t)),u=ve(Or(r)),f=te(l,1),d=te(u,1),h=Tt(t,l),p=Tt(f,t),m=Tt(r,u),y=Tt(d,r);return ft.from(ft.unionAll(a(c(l,u),s(Nt(p,y))),a(c(l,d),s(Nt(p,m))),a(c(f,u),s(Nt(h,y))),a(c(f,d),s(Nt(h,m))))).select({index:"i",density:de("w")},o).groupby("index",o).having(so("density",0))}function zA(e,t,r,n,i,o,s=[],a=!0){e.select({x:ve(Or(t)),y:ve(Or(r))});let c=s.concat(n),l=ft.from(e).select(c,{x0:"x",y0:"y",dx:Tt(Yf("x").over("sw"),"x"),dy:Tt(Yf("y").over("sw"),"y")}).window({sw:IT().partitionby(c).orderby(lA("x"))}).qualify([Oi(ze("x0",i),ze(te("x0","dx"),i)),Oi(ze("y0",o),ze(te("y0","dy"),o)),Oi(Di("x0",0),Di(te("x0","dx"),0)),Oi(Di("y0",0),Di(te("y0","dy"),0))]),u=ft.select({x:eA(zr(Nr("dx")),zr(Nr("dy")))}).from("pairs"),f=ft.select({i:ve(tr`UNNEST(range((${u})))`)}),d=ft.unionAll(ft.select(c,{x:te("x0","i"),y:te("y0",ve(Qs(se(Nt("i","dy"),"dx"))))}).from("pairs","indices").where([ri(Nr("dy"),Nr("dx")),ze("i",Nr("dx"))]),ft.select(c,{x:te("x0",ve(Qs(se(Nt(Nt(oo("dy"),"i"),"dx"),"dy")))),y:te("y0",Nt(oo("dy"),"i"))}).from("pairs","indices").where([Di(Nr("dy"),Nr("dx")),ze("i",Nr("dy"))]),ft.select(c,{x:"x0",y:"y0"}).from("pairs").where(Jl("dx"))),h=ft.from("raster").select(c,"x","y",a?{w:se(1,Mr().partitionby(["x"].concat(c)))}:null).where([ri(0,"x"),ze("x",i),ri(0,"y"),ze("y",o)]);return ft.with({pairs:l,indices:f,raster:d,points:h}).from("points").select(s,{index:te("x",Nt("y",ve(i))),density:a?de("w"):Mr()}).groupby("index",s)}function jA(e,t,r,n,i=[]){let o=ve(Or(t)),s=a=>ft.from(e).select(a).groupby(o,i);return ft.union(s([{[r]:zn(r),[n]:bc(n,r)},...i]),s([{[r]:zr(r),[n]:xc(n,r)},...i]),s([{[r]:bc(r,n),[n]:zn(n)},...i]),s([{[r]:xc(r,n),[n]:zr(n)},...i])).orderby(i,r)}var Kb=e=>e;function rk(){return{apply:Kb,invert:Kb,sqlApply:qt,sqlInvert:Kb}}function $G({base:e=null}={}){if(e==null||e===Math.E)return{apply:Math.log,invert:Math.exp,sqlApply:t=>Vf(t),sqlInvert:t=>Gb(t)};if(e===10)return{apply:Math.log10,invert:t=>Math.pow(10,t),sqlApply:t=>rA(t),sqlInvert:t=>ir(10,t)};{let t=+e;return{apply:r=>Math.log(r)/Math.log(t),invert:r=>Math.pow(t,r),sqlApply:r=>se(Vf(r),Vf(t)),sqlInvert:r=>ir(t,r)}}}function zG({constant:e=1}={}){let t=+e;return{apply:r=>Math.sign(r)*Math.log1p(Math.abs(r)),invert:r=>Math.sign(r)*Math.exp(Math.abs(r)-t),sqlApply:r=>(r=qt(r),Nt(oo(r),Vf(te(t,Nr(r))))),sqlInvert:r=>Nt(oo(r),Tt(Gb(Nr(r)),t))}}function jG(){return{apply:e=>Math.sign(e)*Math.sqrt(Math.abs(e)),invert:e=>Math.sign(e)*e*e,sqlApply:e=>(e=qt(e),Nt(oo(e),Hs(Nr(e)))),sqlInvert:e=>Nt(oo(e),ir(e,2))}}function qG({exponent:e=1}={}){let t=+e;return{apply:r=>Math.sign(r)*Math.pow(Math.abs(r),t),invert:r=>Math.sign(r)*Math.pow(Math.abs(r),1/t),sqlApply:r=>(r=qt(r),Nt(oo(r),ir(Nr(r),t))),sqlInvert:r=>Nt(oo(r),ir(Nr(r),se(1,t)))}}function nk(){return{apply:e=>+e,invert:e=>new Date(e),sqlApply:e=>e instanceof Date?Er(+e):YG(e)?Er(+e.value):QT(e),sqlInvert:Kb}}var VG={identity:rk,linear:rk,log:$G,symlog:zG,sqrt:jG,pow:qG,time:nk,utc:nk};function rm(e){let t=VG[e.type];return t?{...e,...t(e)}:null}function YG(e){return e instanceof jl&&e.value instanceof Date}function Jb(e){let t=2166136261;for(let r=0,n=e.length;r<n;++r){let i=e.charCodeAt(r),o=i&65280;o&&(t=ik(t^o>>8)),t=ik(t^i&255)}return WG(t)>>>0}function ik(e){return e+(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24)}function WG(e){return e+=e<<13,e^=e>>>7,e+=e<<3,e^=e>>>17,e+=e<<5,e&4294967295}function sk(e,t,r){switch(e.name){case"count":case"sum":return GG(t,e);case"avg":return XG(t,e);case"arg_max":return HG(t,e);case"arg_min":return QG(t,e);case"variance":case"var_samp":return t1(t,e,r);case"var_pop":return t1(t,e,r,!1);case"stddev":case"stddev_samp":return Hs(t1(t,e,r));case"stddev_pop":return Hs(t1(t,e,r,!1));case"covar_samp":return e1(t,e,r);case"covar_pop":return e1(t,e,r,!1);case"corr":return ok(t,e,r);case"regr_count":return Gf(t,e).expr;case"regr_avgx":return uk(t,e);case"regr_avgy":return fk(t,e);case"regr_syy":return VA(t,0,e,r);case"regr_sxx":return VA(t,1,e,r);case"regr_sxy":return e1(t,e,r,null);case"regr_slope":return dk(t,e,r);case"regr_intercept":return ZG(t,e,r);case"regr_r2":return ir(ok(t,e,r),2);case"max":case"min":case"bit_and":case"bit_or":case"bit_xor":case"bool_and":case"bool_or":case"product":{let n=ak(e);return t[n]=e,tr`${e.name}("${n}")`}default:return null}}function ak(e){return"pre_"+Jb(`${e}`).toString(16)}function gn(e,t,r){let n=r?.filter;n&&(t=t.filter?t.where(on(n,t.filter)):t.where(n));let i=ak(t);return e[i]=t,i}function ck(e,t){let r=gn(e,Mr(t.args[0]),t);return{expr:de(r),name:r}}function GG(e,t){return de(gn(e,t))}function XG(e,t){let r=gn(e,t),{expr:n,name:i}=ck(e,t);return se(de(Nt(r,i)),n)}function HG(e,t){let r=gn(e,t),n=gn(e,zr(t.args[1]),t);return xc(r,n)}function QG(e,t){let r=gn(e,t),n=gn(e,zn(t.args[1]),t);return bc(r,n)}function t1(e,t,r,n=!0){let i=t.args[0],{expr:o}=ck(e,t),s=Tt(i,r(i)),a=gn(e,de(ir(s,2)),t),c=gn(e,de(s),t),l=n?Tt(o,1):o;return se(Tt(de(a),se(ir(de(c),2),o)),l)}function e1(e,t,r,n=!0){let{expr:i}=Gf(e,t),o=lk(e,t,r),s=nm(e,1,t,r),a=nm(e,0,t,r),c=Tt(o,se(Nt(s,a),i));return n===null?c:n?se(c,Tt(i,1)):se(c,i)}function ok(e,t,r){let{expr:n}=Gf(e,t),i=lk(e,t,r),o=qA(e,1,t,r),s=qA(e,0,t,r),a=nm(e,1,t,r),c=nm(e,0,t,r),l=Tt(o,se(ir(a,2),n)),u=Tt(s,se(ir(c,2),n));return se(Tt(i,se(Nt(a,c),n)),Hs(Nt(l,u)))}function Gf(e,t){let[r,n]=t.args,i=gn(e,Hp(r,n),t);return{expr:de(i),name:i}}function nm(e,t,r,n){let i=r.args,o=i[t],s=i[1-t],a=de(Tt(o,n(o))).where(Ri(s));return de(gn(e,a,r))}function qA(e,t,r,n){let i=r.args,o=i[t],s=i[1-t],a=de(ir(Tt(o,n(o)),2)).where(Ri(s));return de(gn(e,a,r))}function lk(e,t,r){let[n,i]=t.args,o=de(Nt(Tt(i,r(i)),Tt(n,r(n))));return de(gn(e,o,t))}function uk(e,t){let[r,n]=t.args,{expr:i,name:o}=Gf(e,t),s=gn(e,Xp(r,n),t);return se(de(Nt(s,o)),i)}function fk(e,t){let[r,n]=t.args,{expr:i,name:o}=Gf(e,t),s=gn(e,UT(r,n),t);return se(de(Nt(s,o)),i)}function VA(e,t,r,n){let{expr:i}=Gf(e,r),o=nm(e,t,r,n),s=qA(e,t,r,n);return Tt(s,se(ir(o,2),i))}function dk(e,t,r){let n=e1(e,t,r,null),i=VA(e,1,t,r);return se(n,i)}function ZG(e,t,r){let n=uk(e,t),i=fk(e,t),o=dk(e,t,r);return Tt(i,Nt(o,n))}function hk(e){if(!e.filterStable)return null;let t=e.query();if(!gc(t))return null;let r=r1(t,c=>{let l=c._from[0]?.expr;return mc(l)?l.name:l});if(typeof r!="string")return null;let n=new Map,i={},o={},s=[],a=c=>{let l=c.column,u=r1(t,f=>f._select.find(d=>d.alias===l)?.expr);return tr`(SELECT avg(${u??c}) FROM "${r}")`};for(let{alias:c,expr:l}of t._select){if(ni(l)>1)return null;let u=EA(l);if(u.length===0)s.push(c),i[c]=l;else{for(let f of u){if(f.isDistinct)return null;let d=sk(f,i,a);if(!d)return null;n.set(f,d)}o[c]=em(l,n)}}return n.size?{group:s,preagg:i,output:o}:null}function r1(e,t){let r=e.subqueries;if(gc(e)&&r.length===0)return t(e);let n=r1(r[0],t);for(let i=1;i<r.length;++i){let o=r1(r[i],t);if(o!==void 0&&o!==n)return NaN}return n}var KG={skip:!0,result:null},n1=class{constructor(t,{schema:r="mosaic",enabled:n=!0}={}){this.entries=new Map,this.active=null,this.mc=t,this._schema=r,this._enabled=n}set enabled(t){this._enabled!==t&&(t||this.clear(),this._enabled=t)}get enabled(){return this._enabled}set schema(t){this._schema!==t&&(this.clear(),this._schema=t)}get schema(){return this._schema}dropSchema(){return this.clear(),this.mc.exec(`DROP SCHEMA IF EXISTS "${this.schema}" CASCADE`)}clear(){this.entries.clear(),this.active=null}request(t,r,n){if(!this.enabled)return null;let{entries:i,mc:o,schema:s}=this,{source:a}=n;if(!a||this.active&&(this.active.source!==a&&this.clear(),this.active?.source===null))return null;let{active:c}=this;if(!c&&(this.active=c=JG(n),c.source===null))return null;if(i.has(t))return i.get(t);let l=hk(t),u;if(!l)u=null;else if(r.skip(t,n))u=KG;else{let f=r.remove(a).predicate(t);u=rX(t.query(f),c,l,s),u.result=o.exec([`CREATE SCHEMA IF NOT EXISTS ${s}`,_c(u.table,u.create,{temp:!1})]),u.result.catch(d=>o.logger().error(d))}return i.set(t,u),u}};function JG(e){let{source:t,meta:r}=e,n=e.predicate,i=Wf(n).map(f=>f.column),o,s;if(!r||!i)return{source:null,columns:s,predicate:o};let{type:a,scales:c,bin:l,pixelSize:u=1}=r;if(a==="point")o=f=>f,s=Object.fromEntries(i.map(f=>[`${f}`,qt(f)]));else if(a==="interval"&&c){let f=c.map(d=>eX(d,u,l));f.some(d=>!d)||(f.length===1?(o=d=>d?jr("active0",d.extent.map(f[0])):[],s={active0:f[0](n.expr)}):(o=d=>d?on(d.clauses.map((h,p)=>jr(`active${p}`,h.extent.map(f[p])))):[],s=Object.fromEntries(n.clauses.map((d,h)=>[`active${h}`,f[h](d.expr)]))))}return{source:s?t:null,columns:s,predicate:o}}var tX={ceil:nA,round:Qs};function eX(e,t,r){let{type:n,domain:i,range:o,apply:s,sqlApply:a}=rm(e);if(!s)return;let c=tX[`${r}`.toLowerCase()]||Or,l=s(Math.min(...i)),u=s(Math.max(...i)),f=(n==="identity"?1:Math.abs(o[1]-o[0])/(u-l))/t,d=f===1?p=>p:p=>Nt(Ge(f),p),h=l===0?p=>p:p=>Tt(p,Ge(l));return p=>ve(c(d(h(a(p)))))}function rX(e,t,r,n){let{group:i,output:o,preagg:s}=r,{columns:a}=t,c=e.setSelect({...s,...a}).groupby(Object.keys(a)),[l]=c.subqueries;if(l){let y=Object.values(a).flatMap(g=>Wf(g).map(x=>x.column));nX(l,y)}let u=c._having,f=c._orderby;c._having=[],c._orderby=[];let d=c.toString(),h=(Jb(d)>>>0).toString(16),p=`${n}.preagg_${h}`,m=ft.select(i,o).from(p).groupby(i).having(u).orderby(f);return new YA({table:p,create:d,active:t,select:m})}function nX(e,t){let r=new Set,n=i=>{r.has(i)||(r.add(i),gc(i)&&i._from.length&&i.select(t),i.subqueries.forEach(n))};n(e)}var YA=class{constructor({table:t,create:r,active:n,select:i}){this.table=t,this.create=r,this.result=null,this.active=n,this.select=i,this.skip=!1}query(t){return this.select.clone().where(this.active.predicate(t))}};function WA(e){switch(e){case"BIGINT":case"HUGEINT":case"INTEGER":case"SMALLINT":case"TINYINT":case"UBIGINT":case"UINTEGER":case"USMALLINT":case"UTINYINT":case"DOUBLE":case"FLOAT":case"REAL":return"number";case"DATE":case"TIMESTAMP":case"TIMESTAMPTZ":case"TIMESTAMP WITH TIME ZONE":case"TIME":case"TIMESTAMP_NS":return"date";case"BOOLEAN":return"boolean";case"VARCHAR":case"UUID":case"JSON":return"string";case"ARRAY":case"LIST":return"array";case"BLOB":case"STRUCT":case"MAP":case"GEOMETRY":return"object";default:if(e.startsWith("DECIMAL"))return"number";if(e.startsWith("STRUCT")||e.startsWith("MAP"))return"object";if(e.endsWith("]"))return"array";throw new Error(`Unsupported type: ${e}`)}}var iX="count",oX="nulls",sX="max",aX="min",cX="distinct";var lX={[iX]:Mr,[cX]:e=>Mr(e).distinct(),[sX]:zr,[aX]:zn,[oX]:e=>Mr().where(Jl(e))};function uX(e,t,r){return ft.from(e).select(Array.from(r,n=>({[n]:lX[n](t)})))}async function pk(e,t){return t.length===1&&t[0].column==="*"?dX(e,t[0].table):(await Promise.all(t.map(r=>fX(e,r)))).filter(r=>r)}async function fX(e,{table:t,column:r,stats:n}){let i=ft.from({source:t}).select({column:r}).groupby(r.aggregate?tr`ALL`:[]),[o]=Array.from(await e.query(ft.describe(i))),s={table:t,column:`${r}`,sqlType:o.column_type,type:WA(o.column_type),nullable:o.null==="YES"};if(!(n?.length||n?.size))return s;let[a]=await e.query(uX(t,r,n),{persist:!0});return Object.assign(s,a)}async function dX(e,t){let r=await e.query(`DESCRIBE ${Wl(t)}`);return Array.from(r).map(n=>({table:t,column:n.column_name,sqlType:n.column_type,type:WA(n.column_type),nullable:n.null==="YES"}))}var wc=Object.freeze({pending:Symbol("pending"),ready:Symbol("ready"),error:Symbol("error"),done:Symbol("done")}),tu=class extends Promise{constructor(){let t,r;super((n,i)=>{t=n,r=i}),this._resolve=t,this._reject=r,this._state=wc.pending,this._value=void 0}fulfill(t){if(this._value!==void 0){if(t!==void 0)throw Error("Promise is ready and fulfill has a provided value");this._resolve(this._value)}else{if(t===void 0)throw Error("Promise is neither ready nor has provided value");this._resolve(t)}return this._state=wc.done,this}ready(t){return this._state=wc.ready,this._value=t,this}reject(t){return this._state=wc.error,this._reject(t),this}get state(){return this._state}};tu.prototype.constructor=Promise;function i1(){return{debug(...e){},info(...e){},log(...e){},warn(...e){},error(...e){}}}function hX(e){return(typeof requestAnimationFrame<"u"?requestAnimationFrame:typeof setImmediate<"u"?setImmediate:setTimeout)(e)}function mk(e,t){let r=[],n=0;function i(){let o=pX(r,t);r=[],n=0;for(let s of o)yX(s,e),bX(s,t)}return{add(o,s){o.request.type==="arrow"?(n=n||hX(()=>i()),r.push({entry:o,priority:s,index:r.length})):e(o,s)}}}function pX(e,t){let r=[],n=new Map;for(let i of e){let{entry:{request:o}}=i,s=mX(o.query,t);if(!n.has(s)){let a=[];r.push(a),n.set(s,a)}n.get(s).push(i)}return r}function mX(e,t){let r=`${e}`;if(gc(e)&&!t.get(r)){if(e._orderby.length||e._where.length||e._qualify.length||e._having.length)return r;let n=e.clone().setSelect("*"),i=e._groupby;if(i.length){let o={};e._select.forEach(({alias:s,expr:a})=>o[s]=a),n.setGroupby(i.map(s=>yc(s)&&o[s.column]||s))}else e._select.some(o=>ni(o.expr))&&n.setGroupby("ALL");return`${n}`}else return r}function yX(e,t){if(gX(e))t({request:{type:"arrow",cache:!1,query:e.query=xX(e)},result:e.result=new tu});else for(let{entry:r,priority:n}of e)t(r,n)}function gX(e){if(e.length>1){let t=`${e[0].entry.request.query}`;for(let r=1;r<e.length;++r)if(t!==`${e[r].entry.request.query}`)return!0}return!1}function xX(e){let t=e.maps=[],r=new Map;for(let o of e){let{query:s}=o.entry.request,a=[];t.push(a);for(let{alias:c,expr:l}of s._select){let u=`${l}`;r.has(u)||r.set(u,[`col${r.size}`,l]);let[f]=r.get(u);a.push([f,c])}}let n=e[0].entry.request.query.clone(),i=n._groupby;if(i.length){let o={};e.maps[0].forEach(([s,a])=>o[a]=s),n.setGroupby(i.map(s=>yc(s)&&o[s.column]||s))}return n.setSelect(Array.from(r.values()))}async function bX(e,t){let{maps:r,query:n,result:i}=e;if(!r)return;let o;try{o=await i}catch(a){for(let{entry:c}of e)c.result.reject(a);return}let s=TT(n);e.forEach(({entry:a},c)=>{let{request:l,result:u}=a,f=r[c],d=s&&f?wX(o,f):f?_X(o,f):o;l.cache&&t.set(String(l.query),d),u.fulfill(d)})}function _X(e,t){return e.select(t.map(r=>r[0]),t.map(r=>r[1]))}function wX(e,t){let r=new Map(t),n=[];for(let i of e)r.has(i.column_name)&&n.push({...i,column_name:r.get(i.column_name)});return n}var vX=typeof requestIdleCallback<"u"?requestIdleCallback:setTimeout,yk=()=>({get:()=>{},set:(e,t)=>t,clear:()=>{}});function gk({max:e=1e3,ttl:t=3*60*60*1e3}={}){let r=new Map;function n(){let i=performance.now()-t,o=null,s=1/0;for(let[a,c]of r){let{last:l}=c;l<s&&(o=a,s=l),i>l&&r.delete(a)}o&&r.delete(o)}return{get(i){let o=r.get(i);if(o)return o.last=performance.now(),o.value},set(i,o){return r.set(i,{last:performance.now(),value:o}),r.size>e&&vX(n),o},clear(){r=new Map}}}var o1=class{constructor(t){this.queue=Array.from({length:t},()=>({head:null,tail:null}))}isEmpty(){return this.queue.every(t=>!t.head)}insert(t,r){let n=this.queue[r];if(!n)throw new Error(`Invalid queue priority rank: ${r}`);let i={item:t,next:null};n.head===null?n.head=n.tail=i:n.tail=n.tail.next=i}remove(t){for(let r of this.queue){let{head:n,tail:i}=r;for(let o=null,s=n;s;o=s,s=s.next)t(s.item)&&(s===n?n=s.next:o.next=s.next,s===i&&(i=o||n));r.head=n,r.tail=i}}next(){for(let t of this.queue){let{head:r}=t;if(r!==null)return t.head=r.next,t.tail===r&&(t.tail=null),r.item}}};var jo=Object.freeze({High:0,Normal:1,Low:2}),s1=class{constructor(t=32){this.queue=new o1(3),this.db=null,this.clientCache=null,this._logger=i1(),this._logQueries=!1,this._consolidate=null,this.pendingResults=[],this.maxConcurrentRequests=t,this.pendingExec=!1}next(){if(this.queue.isEmpty()||this.pendingResults.length>this.maxConcurrentRequests||this.pendingExec)return;let{request:t,result:r}=this.queue.next();this.pendingResults.push(r),t.type==="exec"&&(this.pendingExec=!0),this.submit(t,r).finally(()=>{for(;this.pendingResults.length&&this.pendingResults[0].state!==wc.pending;){let n=this.pendingResults.shift();n.state===wc.ready?n.fulfill():n.state===wc.done&&this._logger.warn("Found resolved query in pending results.")}t.type==="exec"&&(this.pendingExec=!1),this.next()})}enqueue(t,r=jo.Normal){this.queue.insert(t,r),this.next()}async submit(t,r){try{let{query:n,type:i,cache:o=!1,options:s}=t,a=n?`${n}`:null;if(o){let f=this.clientCache.get(a);if(f){let d=await f;this._logger.debug("Cache"),r.ready(d);return}}let c=performance.now();this._logQueries&&this._logger.debug("Query",{type:i,sql:a,...s});let l=this.db.query({type:i,sql:a,...s});o&&this.clientCache.set(a,l);let u=await l;o&&this.clientCache.set(a,u),this._logger.debug(`Request: ${(performance.now()-c).toFixed(1)}`),r.ready(i==="exec"?null:u)}catch(n){r.reject(n)}}cache(t){return t!==void 0?this.clientCache=t===!0?gk():t||yk():this.clientCache}logger(t){return t?this._logger=t:this._logger}logQueries(t){return t!==void 0?this._logQueries=!!t:this._logQueries}connector(t){return t?this.db=t:this.db}consolidate(t){t&&!this._consolidate?this._consolidate=mk(this.enqueue.bind(this),this.clientCache):!t&&this._consolidate&&(this._consolidate=null)}request(t,r=jo.Normal){let n=new tu,i={request:t,result:n};return this._consolidate?this._consolidate.add(i,r):this.enqueue(i,r),n}cancel(t){let r=new Set(t);if(r.size){this.queue.remove(({result:n})=>r.has(n)?(n.reject("Canceled"),!0):!1);for(let n of this.pendingResults)r.has(n)&&n.reject("Canceled")}}clear(){this.queue.remove(({result:t})=>(t.reject("Cleared"),!0));for(let t of this.pendingResults)t.reject("Cleared");this.pendingResults=[]}};var a1;function Li(e){return e?a1=e:a1==null&&(a1=new im),a1}var im=class{constructor(t=xb(),{logger:r=console,manager:n=new s1,cache:i=!0,consolidate:o=!0,preagg:s={}}={}){this.manager=n,this.manager.cache(i),this.manager.consolidate(o),this.databaseConnector(t),this.logger(r),this.clear(),this.preaggregator=new n1(this,s)}clear({clients:t=!0,cache:r=!0}={}){this.manager.clear(),t&&(this.filterGroups?.forEach(n=>n.disconnect()),this.filterGroups=new Map,this.clients?.forEach(n=>this.disconnect(n)),this.clients=new Set),r&&this.manager.cache().clear()}databaseConnector(t){return this.manager.connector(t)}logger(t){return arguments.length&&(this._logger=t||i1(),this.manager.logger(this._logger)),this._logger}cancel(t){this.manager.cancel(t)}exec(t,{priority:r=jo.Normal}={}){return t=Array.isArray(t)?t.filter(n=>n).join(`;
2
+ `):t,this.manager.request({type:"exec",query:t},r)}query(t,{type:r="arrow",cache:n=!0,priority:i=jo.Normal,...o}={}){return this.manager.request({type:r,query:t,cache:n,options:o},i)}prefetch(t,r={}){return this.query(t,{...r,cache:!0,priority:jo.Low})}createBundle(t,r,n=jo.Low){let i={name:t,queries:r.map(o=>typeof o=="string"?{sql:o}:o)};return this.manager.request({type:"create-bundle",options:i},n)}loadBundle(t,r=jo.High){let n={name:t};return this.manager.request({type:"load-bundle",options:n},r)}updateClient(t,r,n=jo.Normal){return t.queryPending(),this.query(r,{priority:n}).then(i=>t.queryResult(i).update(),i=>{this._logger.error(i),t.queryError(i)}).catch(i=>this._logger.error(i))}requestQuery(t,r){return this.preaggregator.clear(),r?this.updateClient(t,r):Promise.resolve(t.update())}async connect(t){let{clients:r}=this;if(r.has(t))throw new Error("Client already connected.");r.add(t),t.coordinator=this,this.initializeClient(t),SX(this,t.filterBy,t)}async initializeClient(t){let r=t.fields();return r?.length&&t.fieldInfo(await pk(this,r)),t.requestQuery()}disconnect(t){let{clients:r,filterGroups:n}=this;if(!r.has(t))return;r.delete(t),t.coordinator=null;let i=n.get(t.filterBy);i&&i.clients.delete(t)}};function SX(e,t,r){if(!t)return;let n=e.filterGroups.get(t);if(!n){let i=s=>IX(e,t,s),o=()=>TX(e,t);t.addEventListener("activate",i),t.addEventListener("value",o),n={selection:t,clients:new Set,disconnect(){t.removeEventListener("activate",i),t.removeEventListener("value",o)}},e.filterGroups.set(t,n)}n.clients.add(r)}function IX(e,t,r){let{preaggregator:n,filterGroups:i}=e,{clients:o}=i.get(t);for(let s of o)n.request(s,t,r)}function TX(e,t){let{preaggregator:r,filterGroups:n}=e,{clients:i}=n.get(t),{active:o}=t;return Promise.allSettled(Array.from(i,s=>{let a=r.request(s,t,o),c=a?null:t.predicate(s);if(a?.skip||!a&&!c)return;let l=a?.query(o.predicate)??s.query(c);return e.updateClient(s,l)}))}var c1=class{constructor(){this._callbacks=new Map}addEventListener(t,r){this._callbacks.has(t)||this._callbacks.set(t,{callbacks:new Set,pending:null,queue:new GA}),this._callbacks.get(t).callbacks.add(r)}removeEventListener(t,r){let n=this._callbacks.get(t);n&&n.callbacks.delete(r)}willEmit(t,r){return r}emitQueueFilter(t,r){return null}cancel(t){this._callbacks.get(t)?.queue.clear()}async pending(t){await this._callbacks.get(t)?.pending}emit(t,r){let n=this._callbacks.get(t)||{};if(n.pending)n.queue.enqueue(r,this.emitQueueFilter(t,r));else{let i=this.willEmit(t,r),{callbacks:o,queue:s}=n;if(o?.size){let a=Array.from(o,c=>c(i));n.pending=Promise.allSettled(a).then(()=>{n.pending=null,s.isEmpty()||this.emit(t,s.dequeue())})}}}},GA=class{constructor(){this.clear()}clear(){this.next=null}isEmpty(){return!this.next}enqueue(t,r){let n={value:t};if(r&&this.next){let i=this;for(;i.next;)r(i.next.value)?i=i.next:i.next=i.next.next;i.next=n}else this.next=n}dequeue(){let{next:t}=this;return this.next=t?.next,t?.value}};function om(e,t){return e===t?!1:e instanceof Date&&t instanceof Date?+e!=+t:Array.isArray(e)&&Array.isArray(t)?AX(e,t):!0}function AX(e,t){if(e.length!==t.length)return!0;for(let r=0;r<e.length;++r)if(e[r]!==t[r])return!0;return!1}function or(e){return e instanceof vc}var vc=class e extends c1{constructor(t){super(),this._value=t}static value(t){return new e(t)}static array(t){if(t.some(r=>or(r))){let r=new e,n=()=>{r.update(t.map(i=>or(i)?i.value:i))};return n(),t.forEach(i=>or(i)?i.addEventListener("value",n):0),r}return new e(t)}get value(){return this._value}update(t,{force:r}={}){return om(this._value,t)||r?this.emit("value",t):this.cancel("value"),this}willEmit(t,r){return t==="value"&&(this._value=r),r}};function ii(e){return e instanceof qo}function l1(e,t){return new qo(new u1(e),t&&[t].flat())}var qo=class e extends vc{static intersect({cross:t=!1,empty:r=!1,include:n=[]}={}){return l1({cross:t,empty:r},n)}static union({cross:t=!1,empty:r=!1,include:n=[]}={}){return l1({cross:t,empty:r,union:!0},n)}static single({cross:t=!1,empty:r=!1,include:n=[]}={}){return l1({cross:t,empty:r,single:!0},n)}static crossfilter({empty:t=!1,include:r=[]}={}){return l1({cross:!0,empty:t},r)}constructor(t=new u1,r=[]){if(super([]),this._resolved=this._value,this._resolver=t,this._relay=new Set,Array.isArray(r))for(let n of r)n._relay.add(this)}clone(){let t=new e(this._resolver);return t._value=t._resolved=this._value,t}remove(t){let r=this.clone();return r._value=r._resolved=r._resolver.resolve(this._resolved,{source:t}),r._value.active={source:t},r}get resolver(){return this._resolver}get single(){return this._resolver.single}get clauses(){return super.value}get active(){return this.clauses.active}get value(){return this.active?.value}valueFor(t){return this.clauses.find(r=>r.source===t)?.value}activate(t){this.emit("activate",t),this._relay.forEach(r=>r.activate(t))}update(t){return this._resolved=this._resolver.resolve(this._resolved,t,!0),this._resolved.active=t,this._relay.forEach(r=>r.update(t)),super.update(this._resolved)}willEmit(t,r){return t==="value"?(this._value=r,this.value):r}emitQueueFilter(t,r){return t==="value"?this._resolver.queueFilter(r):null}skip(t,r){return this._resolver.skip(t,r)}predicate(t,r=!1){let{clauses:n}=this,i=r?null:n.active;return this._resolver.predicate(n,i,t)}},u1=class{constructor({union:t,cross:r,single:n,empty:i}={}){this.union=!!t,this.cross=!!r,this.single=!!n,this.empty=!!i}resolve(t,r,n=!1){let{source:i,predicate:o}=r,s=t.filter(c=>i!==c.source),a=this.single?[]:s;return this.single&&n&&s.forEach(c=>c.source?.reset?.()),o&&a.push(r),a}skip(t,r){return this.cross&&r?.clients?.has(t)}predicate(t,r,n){let{empty:i,union:o}=this;if(i&&!t.length)return[Er(!1)];if(this.skip(n,r))return;let s=t.filter(a=>!this.skip(n,a)).map(a=>a.predicate);return o&&s.length>1?Oi(s):s}queueFilter(t){if(this.cross){let r=t.active?.source;return n=>n.active?.source!==r}return null}};function xk(e="http://localhost:3000/"){return{async query(t){let r=fetch(e,{method:"POST",mode:"cors",cache:"no-cache",credentials:"omit",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return t.type==="exec"?r:t.type==="arrow"?pc(await(await r).arrayBuffer()):(await r).json()}}}function _k(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}function Q(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(u){try{l(n.next(u))}catch(f){s(f)}}function c(u){try{l(n.throw(u))}catch(f){s(f)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((n=n.apply(e,t||[])).next())})}function bk(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ut(e){return this instanceof Ut?(this.v=e,this):new Ut(e)}function oi(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(h){return function(p){return Promise.resolve(p).then(h,f)}}function a(h,p){n[h]&&(i[h]=function(m){return new Promise(function(y,g){o.push([h,m,y,g])>1||c(h,m)})},p&&(i[h]=p(i[h])))}function c(h,p){try{l(n[h](p))}catch(m){d(o[0][3],m)}}function l(h){h.value instanceof Ut?Promise.resolve(h.value.v).then(u,f):d(o[0][2],h)}function u(h){c("next",h)}function f(h){c("throw",h)}function d(h,p){h(p),o.shift(),o.length&&c(o[0][0],o[0][1])}}function Xf(e){var t,r;return t={},n("next"),n("throw",function(i){throw i}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(i,o){t[i]=e[i]?function(s){return(r=!r)?{value:Ut(e[i](s)),done:!1}:o?o(s):s}:o}}function ao(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof bk=="function"?bk(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=e[o]&&function(s){return new Promise(function(a,c){s=e[o](s),i(a,c,s.done,s.value)})}}function i(o,s,a,c){Promise.resolve(c).then(function(l){o({value:l,done:a})},s)}}var JA={};Jn(JA,{compareArrayLike:()=>KA,joinUint8Arrays:()=>si,memcpy:()=>cm,rebaseValueOffsets:()=>x1,toArrayBufferView:()=>zt,toArrayBufferViewAsyncIterator:()=>uo,toArrayBufferViewIterator:()=>Yo,toBigInt64Array:()=>g1,toBigUint64Array:()=>CX,toFloat32Array:()=>kX,toFloat32ArrayAsyncIterator:()=>KX,toFloat32ArrayIterator:()=>VX,toFloat64Array:()=>BX,toFloat64ArrayAsyncIterator:()=>JX,toFloat64ArrayIterator:()=>YX,toInt16Array:()=>DX,toInt16ArrayAsyncIterator:()=>XX,toInt16ArrayIterator:()=>$X,toInt32Array:()=>eu,toInt32ArrayAsyncIterator:()=>HX,toInt32ArrayIterator:()=>zX,toInt8Array:()=>RX,toInt8ArrayAsyncIterator:()=>GX,toInt8ArrayIterator:()=>UX,toUint16Array:()=>LX,toUint16ArrayAsyncIterator:()=>QX,toUint16ArrayIterator:()=>jX,toUint32Array:()=>FX,toUint32ArrayAsyncIterator:()=>ZX,toUint32ArrayIterator:()=>qX,toUint8Array:()=>It,toUint8ArrayAsyncIterator:()=>ZA,toUint8ArrayIterator:()=>QA,toUint8ClampedArray:()=>PX,toUint8ClampedArrayAsyncIterator:()=>tH,toUint8ClampedArrayIterator:()=>WX});var EX=new TextDecoder("utf-8"),sm=e=>EX.decode(e),MX=new TextEncoder,Vo=e=>MX.encode(e);var NX=e=>typeof e=="number",wk=e=>typeof e=="boolean",gr=e=>typeof e=="function",xn=e=>e!=null&&Object(e)===e,co=e=>xn(e)&&gr(e.then);var lo=e=>xn(e)&&gr(e[Symbol.iterator]),Fi=e=>xn(e)&&gr(e[Symbol.asyncIterator]),f1=e=>xn(e)&&xn(e.schema);var d1=e=>xn(e)&&"done"in e&&"value"in e;var h1=e=>xn(e)&&gr(e.stat)&&NX(e.fd);var p1=e=>xn(e)&&am(e.body),m1=e=>"_getDOMStream"in e&&"_getNodeStream"in e,vk=e=>xn(e)&&gr(e.abort)&&gr(e.getWriter)&&!m1(e),am=e=>xn(e)&&gr(e.cancel)&&gr(e.getReader)&&!m1(e),Sk=e=>xn(e)&&gr(e.end)&&gr(e.write)&&wk(e.writable)&&!m1(e),y1=e=>xn(e)&&gr(e.read)&&gr(e.pipe)&&wk(e.readable)&&!m1(e),Ik=e=>xn(e)&&gr(e.clear)&&gr(e.bytes)&&gr(e.position)&&gr(e.setPosition)&&gr(e.capacity)&&gr(e.getBufferIdentifier)&&gr(e.createLong);var HA=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function OX(e){let t=e[0]?[e[0]]:[],r,n,i,o;for(let s,a,c=0,l=0,u=e.length;++c<u;){if(s=t[l],a=e[c],!s||!a||s.buffer!==a.buffer||a.byteOffset<s.byteOffset){a&&(t[++l]=a);continue}if({byteOffset:r,byteLength:i}=s,{byteOffset:n,byteLength:o}=a,r+i<n||n+o<r){a&&(t[++l]=a);continue}t[l]=new Uint8Array(s.buffer,r,n-r+o)}return t}function cm(e,t,r=0,n=t.byteLength){let i=e.byteLength,o=new Uint8Array(e.buffer,e.byteOffset,i),s=new Uint8Array(t.buffer,t.byteOffset,Math.min(n,i));return o.set(s,r),e}function si(e,t){let r=OX(e),n=r.reduce((u,f)=>u+f.byteLength,0),i,o,s,a=0,c=-1,l=Math.min(t||Number.POSITIVE_INFINITY,n);for(let u=r.length;++c<u;){if(i=r[c],o=i.subarray(0,Math.min(i.length,l-a)),l<=a+o.length){o.length<i.length?r[c]=i.subarray(o.length):o.length===i.length&&c++,s?cm(s,o,a):s=o;break}cm(s||(s=new Uint8Array(l)),o,a),a+=o.length}return[s||new Uint8Array(0),r.slice(c),n-(s?s.byteLength:0)]}function zt(e,t){let r=d1(t)?t.value:t;return r instanceof e?e===Uint8Array?new e(r.buffer,r.byteOffset,r.byteLength):r:r?(typeof r=="string"&&(r=Vo(r)),r instanceof ArrayBuffer?new e(r):r instanceof HA?new e(r):Ik(r)?zt(e,r.bytes()):ArrayBuffer.isView(r)?r.byteLength<=0?new e(0):new e(r.buffer,r.byteOffset,r.byteLength/e.BYTES_PER_ELEMENT):e.from(r)):new e(0)}var RX=e=>zt(Int8Array,e),DX=e=>zt(Int16Array,e),eu=e=>zt(Int32Array,e),g1=e=>zt(BigInt64Array,e),It=e=>zt(Uint8Array,e),LX=e=>zt(Uint16Array,e),FX=e=>zt(Uint32Array,e),CX=e=>zt(BigUint64Array,e),kX=e=>zt(Float32Array,e),BX=e=>zt(Float64Array,e),PX=e=>zt(Uint8ClampedArray,e),XA=e=>(e.next(),e);function*Yo(e,t){let r=function*(i){yield i},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof HA?r(t):lo(t)?t:r(t);return yield*XA(function*(i){let o=null;do o=i.next(yield zt(e,o));while(!o.done)}(n[Symbol.iterator]())),new e}var UX=e=>Yo(Int8Array,e),$X=e=>Yo(Int16Array,e),zX=e=>Yo(Int32Array,e),QA=e=>Yo(Uint8Array,e),jX=e=>Yo(Uint16Array,e),qX=e=>Yo(Uint32Array,e),VX=e=>Yo(Float32Array,e),YX=e=>Yo(Float64Array,e),WX=e=>Yo(Uint8ClampedArray,e);function uo(e,t){return oi(this,arguments,function*(){if(co(t))return yield Ut(yield Ut(yield*Xf(ao(uo(e,yield Ut(t))))));let n=function(s){return oi(this,arguments,function*(){yield yield Ut(yield Ut(s))})},i=function(s){return oi(this,arguments,function*(){yield Ut(yield*Xf(ao(XA(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 HA?n(t):lo(t)?i(t):Fi(t)?t:n(t);return yield Ut(yield*Xf(ao(XA(function(s){return oi(this,arguments,function*(){let a=null;do a=yield Ut(s.next(yield yield Ut(zt(e,a))));while(!a.done)})}(o[Symbol.asyncIterator]()))))),yield Ut(new e)})}var GX=e=>uo(Int8Array,e),XX=e=>uo(Int16Array,e),HX=e=>uo(Int32Array,e),ZA=e=>uo(Uint8Array,e),QX=e=>uo(Uint16Array,e),ZX=e=>uo(Uint32Array,e),KX=e=>uo(Float32Array,e),JX=e=>uo(Float64Array,e),tH=e=>uo(Uint8ClampedArray,e);function x1(e,t,r){if(e!==0){r=r.slice(0,t);for(let n=-1,i=r.length;++n<i;)r[n]+=e}return r.subarray(0,t)}function KA(e,t){let r=0,n=e.length;if(n!==t.length)return!1;if(n>0)do if(e[r]!==t[r])return!1;while(++r<n);return!0}var qr={fromIterable(e){return b1(eH(e))},fromAsyncIterable(e){return b1(rH(e))},fromDOMStream(e){return b1(nH(e))},fromNodeStream(e){return b1(iH(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')}},b1=e=>(e.next(),e);function*eH(e){let t,r=!1,n=[],i,o,s,a=0;function c(){return o==="peek"?si(n,s)[0]:([i,n,a]=si(n,s),i)}({cmd:o,size:s}=(yield null)||{cmd:"read",size:0});let l=QA(e)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(s-a)?l.next():l.next(s-a),!t&&i.byteLength>0&&(n.push(i),a+=i.byteLength),t||s<=a)do({cmd:o,size:s}=yield c());while(s<a);while(!t)}catch(u){(r=!0)&&typeof l.throw=="function"&&l.throw(u)}finally{r===!1&&typeof l.return=="function"&&l.return(null)}return null}function rH(e){return oi(this,arguments,function*(){let r,n=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?si(i,a)[0]:([o,i,c]=si(i,a),o)}({cmd:s,size:a}=(yield yield Ut(null))||{cmd:"read",size:0});let u=ZA(e)[Symbol.asyncIterator]();try{do if({done:r,value:o}=Number.isNaN(a-c)?yield Ut(u.next()):yield Ut(u.next(a-c)),!r&&o.byteLength>0&&(i.push(o),c+=o.byteLength),r||a<=c)do({cmd:s,size:a}=yield yield Ut(l()));while(a<c);while(!r)}catch(f){(n=!0)&&typeof u.throw=="function"&&(yield Ut(u.throw(f)))}finally{n===!1&&typeof u.return=="function"&&(yield Ut(u.return(new Uint8Array(0))))}return yield Ut(null)})}function nH(e){return oi(this,arguments,function*(){let r=!1,n=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?si(i,a)[0]:([o,i,c]=si(i,a),o)}({cmd:s,size:a}=(yield yield Ut(null))||{cmd:"read",size:0});let u=new eE(e);try{do if({done:r,value:o}=Number.isNaN(a-c)?yield Ut(u.read()):yield Ut(u.read(a-c)),!r&&o.byteLength>0&&(i.push(It(o)),c+=o.byteLength),r||a<=c)do({cmd:s,size:a}=yield yield Ut(l()));while(a<c);while(!r)}catch(f){(n=!0)&&(yield Ut(u.cancel(f)))}finally{n===!1?yield Ut(u.cancel()):e.locked&&u.releaseLock()}return yield Ut(null)})}var eE=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 Q(this,void 0,void 0,function*(){let{reader:r,source:n}=this;r&&(yield r.cancel(t).catch(()=>{})),n&&n.locked&&this.releaseLock()})}read(t){return Q(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};let r=yield this.reader.read();return!r.done&&(r.value=It(r)),r})}},tE=(e,t)=>{let r=i=>n([t,i]),n;return[t,r,new Promise(i=>(n=i)&&e.once(t,r))]};function iH(e){return oi(this,arguments,function*(){let r=[],n="error",i=!1,o=null,s,a,c=0,l=[],u;function f(){return s==="peek"?si(l,a)[0]:([u,l,c]=si(l,a),u)}if({cmd:s,size:a}=(yield yield Ut(null))||{cmd:"read",size:0},e.isTTY)return yield yield Ut(new Uint8Array(0)),yield Ut(null);try{r[0]=tE(e,"end"),r[1]=tE(e,"error");do{if(r[2]=tE(e,"readable"),[n,o]=yield Ut(Promise.race(r.map(h=>h[2]))),n==="error")break;if((i=n==="end")||(Number.isFinite(a-c)?(u=It(e.read(a-c)),u.byteLength<a-c&&(u=It(e.read()))):u=It(e.read()),u.byteLength>0&&(l.push(u),c+=u.byteLength)),i||a<=c)do({cmd:s,size:a}=yield yield Ut(f()));while(a<c)}while(!i)}finally{yield Ut(d(r,n==="error"?o:null))}return yield Ut(null);function d(h,p){return u=l=null,new Promise((m,y)=>{for(let[g,x]of h)e.off(g,x);try{let g=e.destroy;g&&g.call(e,p),p=void 0}catch(g){p=g||p}finally{p!=null?y(p):m()}})}})}var he;(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"})(he||(he={}));var Se;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(Se||(Se={}));var be;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(be||(be={}));var Xe;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(Xe||(Xe={}));var ct;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(ct||(ct={}));var xr;(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"})(xr||(xr={}));var Wo=new Int32Array(2),_1=new Float32Array(Wo.buffer),w1=new Float64Array(Wo.buffer),Hf=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var lm;(function(e){e[e.UTF8_BYTES=1]="UTF8_BYTES",e[e.UTF16_STRING=2]="UTF16_STRING"})(lm||(lm={}));var ai=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 Wo[0]=this.readInt32(t),_1[0]}readFloat64(t){return Wo[Hf?0:1]=this.readInt32(t),Wo[Hf?1:0]=this.readInt32(t+4),w1[0]}writeInt8(t,r){this.bytes_[t]=r}writeUint8(t,r){this.bytes_[t]=r}writeInt16(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8}writeUint16(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8}writeInt32(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8,this.bytes_[t+2]=r>>16,this.bytes_[t+3]=r>>24}writeUint32(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8,this.bytes_[t+2]=r>>16,this.bytes_[t+3]=r>>24}writeInt64(t,r){this.writeInt32(t,Number(BigInt.asIntN(32,r))),this.writeInt32(t+4,Number(BigInt.asIntN(32,r>>BigInt(32))))}writeUint64(t,r){this.writeUint32(t,Number(BigInt.asUintN(32,r))),this.writeUint32(t+4,Number(BigInt.asUintN(32,r>>BigInt(32))))}writeFloat32(t,r){_1[0]=r,this.writeInt32(t,Wo[0])}writeFloat64(t,r){w1[0]=r,this.writeInt32(t,Wo[Hf?0:1]),this.writeInt32(t+4,Wo[Hf?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let r=0;r<4;r++)t+=String.fromCharCode(this.readInt8(this.position_+4+r));return t}__offset(t,r){let n=t-this.readInt32(t);return r<this.readInt16(n)?this.readInt16(n+r):0}__union(t,r){return t.bb_pos=r+this.readInt32(r),t.bb=this,t}__string(t,r){t+=this.readInt32(t);let n=this.readInt32(t);t+=4;let i=this.bytes_.subarray(t,t+n);return r===lm.UTF8_BYTES?i:this.text_decoder_.decode(i)}__union_with_string(t,r){return typeof t=="string"?this.__string(r):this.__union(t,r)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let r=0;r<4;r++)if(t.charCodeAt(r)!=this.readInt8(this.position()+4+r))return!1;return!0}createScalarList(t,r){let n=[];for(let i=0;i<r;++i){let o=t(i);o!==null&&n.push(o)}return n}createObjList(t,r){let n=[];for(let i=0;i<r;++i){let o=t(i);o!==null&&n.push(o.unpack())}return n}};var ru=class e{constructor(t){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let r;t?r=t:r=1024,this.bb=ai.allocate(r),this.space=r}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(t){this.force_defaults=t}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,r){t>this.minalign&&(this.minalign=t);let n=~(this.bb.capacity()-this.space+r)+1&t-1;for(;this.space<n+t+r;){let i=this.bb.capacity();this.bb=e.growByteBuffer(this.bb),this.space+=this.bb.capacity()-i}this.pad(n)}pad(t){for(let r=0;r<t;r++)this.bb.writeInt8(--this.space,0)}writeInt8(t){this.bb.writeInt8(this.space-=1,t)}writeInt16(t){this.bb.writeInt16(this.space-=2,t)}writeInt32(t){this.bb.writeInt32(this.space-=4,t)}writeInt64(t){this.bb.writeInt64(this.space-=8,t)}writeFloat32(t){this.bb.writeFloat32(this.space-=4,t)}writeFloat64(t){this.bb.writeFloat64(this.space-=8,t)}addInt8(t){this.prep(1,0),this.writeInt8(t)}addInt16(t){this.prep(2,0),this.writeInt16(t)}addInt32(t){this.prep(4,0),this.writeInt32(t)}addInt64(t){this.prep(8,0),this.writeInt64(t)}addFloat32(t){this.prep(4,0),this.writeFloat32(t)}addFloat64(t){this.prep(8,0),this.writeFloat64(t)}addFieldInt8(t,r,n){(this.force_defaults||r!=n)&&(this.addInt8(r),this.slot(t))}addFieldInt16(t,r,n){(this.force_defaults||r!=n)&&(this.addInt16(r),this.slot(t))}addFieldInt32(t,r,n){(this.force_defaults||r!=n)&&(this.addInt32(r),this.slot(t))}addFieldInt64(t,r,n){(this.force_defaults||r!==n)&&(this.addInt64(r),this.slot(t))}addFieldFloat32(t,r,n){(this.force_defaults||r!=n)&&(this.addFloat32(r),this.slot(t))}addFieldFloat64(t,r,n){(this.force_defaults||r!=n)&&(this.addFloat64(r),this.slot(t))}addFieldOffset(t,r,n){(this.force_defaults||r!=n)&&(this.addOffset(r),this.slot(t))}addFieldStruct(t,r,n){r!=n&&(this.nested(r),this.slot(t))}nested(t){if(t!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")}slot(t){this.vtable!==null&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){let r=t.capacity();if(r&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");let n=r<<1,i=ai.allocate(n);return i.setPosition(n-r),i.bytes().set(t.bytes(),n-r),i}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let r=0;r<t;r++)this.vtable[r]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let t=this.offset(),r=this.vtable_in_use-1;for(;r>=0&&this.vtable[r]==0;r--);let n=r+1;for(;r>=0;r--)this.addInt16(this.vtable[r]!=0?t-this.vtable[r]:0);let i=2;this.addInt16(t-this.object_start);let o=(n+i)*2;this.addInt16(o);let s=0,a=this.space;t:for(r=0;r<this.vtables.length;r++){let c=this.bb.capacity()-this.vtables[r];if(o==this.bb.readInt16(c)){for(let l=2;l<o;l+=2)if(this.bb.readInt16(a+l)!=this.bb.readInt16(c+l))continue t;s=this.vtables[r];break}}return s?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,s-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,r,n){let i=n?4:0;if(r){let o=r;if(this.prep(this.minalign,8+i),o.length!=4)throw new TypeError("FlatBuffers: file identifier must be length "+4);for(let s=3;s>=0;s--)this.writeInt8(o.charCodeAt(s))}this.prep(this.minalign,4+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,r){this.finish(t,r,!0)}requiredField(t,r){let n=this.bb.capacity()-t,i=n-this.bb.readInt32(n);if(!(r<this.bb.readInt16(i)&&this.bb.readInt16(i+r)!=0))throw new TypeError("FlatBuffers: field "+r+" must be set")}startVector(t,r,n){this.notNested(),this.vector_num_elems=r,this.prep(4,t*r),this.prep(n,t*r)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);let r=this.createString(t);return this.string_maps.set(t,r),r}createString(t){if(t==null)return 0;let r;return t instanceof Uint8Array?r=t:r=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,r.length,1),this.bb.setPosition(this.space-=r.length),this.bb.bytes().set(r,this.space),this.endVector()}createByteVector(t){return t==null?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector())}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){let r=[];for(let n=0;n<t.length;++n){let i=t[n];if(i!==null)r.push(this.createObjectOffset(i));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return r}createStructOffsetList(t,r){return r(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}};var um;(function(e){e[e.BUFFER=0]="BUFFER"})(um||(um={}));var fm;(function(e){e[e.LZ4_FRAME=0]="LZ4_FRAME",e[e.ZSTD=1]="ZSTD"})(fm||(fm={}));var S1=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBodyCompression(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}codec(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):fm.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):um.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,r){t.addFieldInt8(0,r,fm.LZ4_FRAME)}static addMethod(t,r){t.addFieldInt8(1,r,um.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,r,n){return e.startBodyCompression(t),e.addCodec(t,r),e.addMethod(t,n),e.endBodyCompression(t)}};var Qf=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(t,r,n){return t.prep(8,16),t.writeInt64(BigInt(n??0)),t.writeInt64(BigInt(r??0)),t.offset()}};var Zf=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(t,r,n){return t.prep(8,16),t.writeInt64(BigInt(n??0)),t.writeInt64(BigInt(r??0)),t.offset()}};var ci=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsRecordBatch(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}length(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,r){let n=this.bb.__offset(this.bb_pos,6);return n?(r||new Zf).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}nodesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,r){let n=this.bb.__offset(this.bb_pos,8);return n?(r||new Qf).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}buffersLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){let r=this.bb.__offset(this.bb_pos,10);return r?(t||new S1).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}static startRecordBatch(t){t.startObject(4)}static addLength(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addNodes(t,r){t.addFieldOffset(1,r,0)}static startNodesVector(t,r){t.startVector(16,r,8)}static addBuffers(t,r){t.addFieldOffset(2,r,0)}static startBuffersVector(t,r){t.startVector(16,r,8)}static addCompression(t,r){t.addFieldOffset(3,r,0)}static endRecordBatch(t){return t.endObject()}};var Zs=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDictionaryBatch(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new ci).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}isDelta(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startDictionaryBatch(t){t.startObject(3)}static addId(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addData(t,r){t.addFieldOffset(1,r,0)}static addIsDelta(t,r){t.addFieldInt8(2,+r,0)}static endDictionaryBatch(t){return t.endObject()}};var Sc;(function(e){e[e.Little=0]="Little",e[e.Big=1]="Big"})(Sc||(Sc={}));var dm;(function(e){e[e.DenseArray=0]="DenseArray"})(dm||(dm={}));var ho=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsInt(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startInt(t){t.startObject(2)}static addBitWidth(t,r){t.addFieldInt32(0,r,0)}static addIsSigned(t,r){t.addFieldInt8(1,+r,0)}static endInt(t){return t.endObject()}static createInt(t,r,n){return e.startInt(t),e.addBitWidth(t,r),e.addIsSigned(t,n),e.endInt(t)}};var Go=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDictionaryEncoding(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new ho).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}isOrdered(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}dictionaryKind(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):dm.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addIndexType(t,r){t.addFieldOffset(1,r,0)}static addIsOrdered(t,r){t.addFieldInt8(2,+r,0)}static addDictionaryKind(t,r){t.addFieldInt16(3,r,dm.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var br=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsKeyValue(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}key(t){let r=this.bb.__offset(this.bb_pos,4);return r?this.bb.__string(this.bb_pos+r,t):null}value(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.__string(this.bb_pos+r,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,r){t.addFieldOffset(0,r,0)}static addValue(t,r){t.addFieldOffset(1,r,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,r,n){return e.startKeyValue(t),e.addKey(t,r),e.addValue(t,n),e.endKeyValue(t)}};var hm=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBinary(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return e.startBinary(t),e.endBinary(t)}};var pm=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBool(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return e.startBool(t),e.endBool(t)}};var Ic=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDate(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Xe.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,Xe.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,r){return e.startDate(t),e.addUnit(t,r),e.endDate(t)}};var Xo=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDecimal(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,r){t.addFieldInt32(0,r,0)}static addScale(t,r){t.addFieldInt32(1,r,0)}static addBitWidth(t,r){t.addFieldInt32(2,r,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,r,n,i){return e.startDecimal(t),e.addPrecision(t,r),e.addScale(t,n),e.addBitWidth(t,i),e.endDecimal(t)}};var Tc=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDuration(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ct.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,ct.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,r){return e.startDuration(t),e.addUnit(t,r),e.endDuration(t)}};var Ac=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFixedSizeBinary(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,r){t.addFieldInt32(0,r,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,r){return e.startFixedSizeBinary(t),e.addByteWidth(t,r),e.endFixedSizeBinary(t)}};var Ec=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFixedSizeList(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}listSize(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,r){t.addFieldInt32(0,r,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,r){return e.startFixedSizeList(t),e.addListSize(t,r),e.endFixedSizeList(t)}};var Mc=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFloatingPoint(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):be.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,r){t.addFieldInt16(0,r,be.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,r){return e.startFloatingPoint(t),e.addPrecision(t,r),e.endFloatingPoint(t)}};var Nc=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsInterval(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):xr.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,xr.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,r){return e.startInterval(t),e.addUnit(t,r),e.endInterval(t)}};var mm=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsLargeBinary(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return e.startLargeBinary(t),e.endLargeBinary(t)}};var ym=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsLargeUtf8(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return e.startLargeUtf8(t),e.endLargeUtf8(t)}};var gm=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsList(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return e.startList(t),e.endList(t)}};var Oc=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsMap(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let t=this.bb.__offset(this.bb_pos,4);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startMap(t){t.startObject(1)}static addKeysSorted(t,r){t.addFieldInt8(0,+r,0)}static endMap(t){return t.endObject()}static createMap(t,r){return e.startMap(t),e.addKeysSorted(t,r),e.endMap(t)}};var xm=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsNull(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return e.startNull(t),e.endNull(t)}};var bm=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsStruct_(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return e.startStruct_(t),e.endStruct_(t)}};var Ks=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsTime(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ct.MILLISECOND}bitWidth(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,r){t.addFieldInt16(0,r,ct.MILLISECOND)}static addBitWidth(t,r){t.addFieldInt32(1,r,32)}static endTime(t){return t.endObject()}static createTime(t,r,n){return e.startTime(t),e.addUnit(t,r),e.addBitWidth(t,n),e.endTime(t)}};var Js=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsTimestamp(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ct.SECOND}timezone(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.__string(this.bb_pos+r,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,r){t.addFieldInt16(0,r,ct.SECOND)}static addTimezone(t,r){t.addFieldOffset(1,r,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,r,n){return e.startTimestamp(t),e.addUnit(t,r),e.addTimezone(t,n),e.endTimestamp(t)}};var po=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsUnion(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}mode(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Se.Sparse}typeIds(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.readInt32(this.bb.__vector(this.bb_pos+r)+t*4):0}typeIdsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){let t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,r){t.addFieldInt16(0,r,Se.Sparse)}static addTypeIds(t,r){t.addFieldOffset(1,r,0)}static createTypeIdsVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addInt32(r[n]);return t.endVector()}static startTypeIdsVector(t,r){t.startVector(4,r,4)}static endUnion(t){return t.endObject()}static createUnion(t,r,n){return e.startUnion(t),e.addMode(t,r),e.addTypeIds(t,n),e.endUnion(t)}};var _m=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsUtf8(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return e.startUtf8(t),e.endUtf8(t)}};var Ie;(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"})(Ie||(Ie={}));var sn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsField(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}name(t){let r=this.bb.__offset(this.bb_pos,4);return r?this.bb.__string(this.bb_pos+r,t):null}nullable(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):Ie.NONE}type(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.__union(t,this.bb_pos+r):null}dictionary(t){let r=this.bb.__offset(this.bb_pos,12);return r?(t||new Go).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}children(t,r){let n=this.bb.__offset(this.bb_pos,14);return n?(r||new e).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}childrenLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,16);return n?(r||new br).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,r){t.addFieldOffset(0,r,0)}static addNullable(t,r){t.addFieldInt8(1,+r,0)}static addTypeType(t,r){t.addFieldInt8(2,r,Ie.NONE)}static addType(t,r){t.addFieldOffset(3,r,0)}static addDictionary(t,r){t.addFieldOffset(4,r,0)}static addChildren(t,r){t.addFieldOffset(5,r,0)}static createChildrenVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startChildrenVector(t,r){t.startVector(4,r,4)}static addCustomMetadata(t,r){t.addFieldOffset(6,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endField(t){return t.endObject()}};var qn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsSchema(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Sc.Little}fields(t,r){let n=this.bb.__offset(this.bb_pos,6);return n?(r||new sn).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}fieldsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,8);return n?(r||new br).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.readInt64(this.bb.__vector(this.bb_pos+r)+t*8):BigInt(0)}featuresLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,r){t.addFieldInt16(0,r,Sc.Little)}static addFields(t,r){t.addFieldOffset(1,r,0)}static createFieldsVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startFieldsVector(t,r){t.startVector(4,r,4)}static addCustomMetadata(t,r){t.addFieldOffset(2,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static addFeatures(t,r){t.addFieldOffset(3,r,0)}static createFeaturesVector(t,r){t.startVector(8,r.length,8);for(let n=r.length-1;n>=0;n--)t.addInt64(r[n]);return t.endVector()}static startFeaturesVector(t,r){t.startVector(8,r,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,r){t.finish(r)}static finishSizePrefixedSchemaBuffer(t,r){t.finish(r,void 0,!0)}static createSchema(t,r,n,i,o){return e.startSchema(t),e.addEndianness(t,r),e.addFields(t,n),e.addCustomMetadata(t,i),e.addFeatures(t,o),e.endSchema(t)}};var Vt;(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"})(Vt||(Vt={}));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.LargeBinary=19]="LargeBinary",e[e.LargeUtf8=20]="LargeUtf8",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth",e[e.DurationSecond=-27]="DurationSecond",e[e.DurationMillisecond=-28]="DurationMillisecond",e[e.DurationMicrosecond=-29]="DurationMicrosecond",e[e.DurationNanosecond=-30]="DurationNanosecond"})(D||(D={}));var ki;(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(ki||(ki={}));var wE={};Jn(wE,{clampRange:()=>Im,createElementComparator:()=>Fc,wrapIndex:()=>nu});var rE={};Jn(rE,{valueToString:()=>mo});function mo(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=>mo(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,r)=>typeof r=="bigint"?`${r}`:r)}var sE={};Jn(sE,{BN:()=>vm,bigNumToBigInt:()=>Ak,bigNumToNumber:()=>oE,bigNumToString:()=>td,isArrowBigNumSymbol:()=>Tk});function re(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)}function nE(e,t){return re(e/t)+re(e%t)/re(t)}var Tk=Symbol.for("isArrowBigNum");function yo(e,...t){return t.length===0?Object.setPrototypeOf(zt(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}yo.prototype[Tk]=!0;yo.prototype.toJSON=function(){return`"${td(this)}"`};yo.prototype.valueOf=function(e){return oE(this,e)};yo.prototype.toString=function(){return td(this)};yo.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return oE(this);case"string":return td(this);case"default":return Ak(this)}return td(this)};function Kf(...e){return yo.apply(this,e)}function Jf(...e){return yo.apply(this,e)}function wm(...e){return yo.apply(this,e)}Object.setPrototypeOf(Kf.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(Jf.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(wm.prototype,Object.create(Uint32Array.prototype));Object.assign(Kf.prototype,yo.prototype,{constructor:Kf,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(Jf.prototype,yo.prototype,{constructor:Jf,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(wm.prototype,yo.prototype,{constructor:wm,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});var oH=BigInt(4294967296)*BigInt(4294967296),sH=oH-BigInt(1);function oE(e,t){let{buffer:r,byteOffset:n,byteLength:i,signed:o}=e,s=new BigUint64Array(r,n,i/8),a=o&&s.at(-1)&BigInt(1)<<BigInt(63),c=BigInt(0),l=0;if(a){for(let u of s)c|=(u^sH)*(BigInt(1)<<BigInt(64*l++));c*=BigInt(-1),c-=BigInt(1)}else for(let u of s)c|=u*(BigInt(1)<<BigInt(64*l++));if(typeof t=="number"){let u=BigInt(Math.pow(10,t)),f=c/u,d=c%u;return re(f)+re(d)/re(u)}return re(c)}function td(e){if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return iE(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return iE(e);t=t.slice();let n=1;for(let o=0;o<t.length;o++){let s=t[o],a=~s+n;t[o]=a,n&=s===0?1:0}return`-${iE(t)}`}function Ak(e){return e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:td(e)}function iE(e){let t="",r=new Uint32Array(2),n=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),i=new Uint32Array((n=new Uint16Array(n).reverse()).buffer),o=-1,s=n.length-1;do{for(r[0]=n[o=0];o<s;)n[o++]=r[1]=r[0]/10,r[0]=(r[0]-r[1]*10<<16)+n[o];n[o]=r[1]=r[0]/10,r[0]=r[0]-r[1]*10,t=`${r[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t??"0"}var vm=class e{static new(t,r){switch(r){case!0:return new Kf(t);case!1:return new Jf(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new Kf(t)}return t.byteLength===16?new wm(t):new Jf(t)}static signed(t){return new Kf(t)}static unsigned(t){return new Jf(t)}static decimal(t){return new wm(t)}constructor(t,r){return e.new(t,r)}};var Ek,Mk,Nk,Ok,Rk,Dk,Lk,Fk,Ck,kk,Bk,Pk,Uk,$k,zk,jk,qk,Vk,Yk,Wk,Gk,Xk,K=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 isLargeBinary(t){return t?.typeId===D.LargeBinary}static isUtf8(t){return t?.typeId===D.Utf8}static isLargeUtf8(t){return t?.typeId===D.LargeUtf8}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===Se.Dense}static isSparseUnion(t){return e.isUnion(t)&&t.mode===Se.Sparse}constructor(t){this.typeId=t}};Ek=Symbol.toStringTag;K[Ek]=(e=>(e.children=null,e.ArrayType=Array,e.OffsetArrayType=Int32Array,e[Symbol.toStringTag]="DataType"))(K.prototype);var bn=class extends K{constructor(){super(D.Null)}toString(){return"Null"}};Mk=Symbol.toStringTag;bn[Mk]=(e=>e[Symbol.toStringTag]="Null")(bn.prototype);var _r=class extends K{constructor(t,r){super(D.Int),this.isSigned=t,this.bitWidth=r}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}};Nk=Symbol.toStringTag;_r[Nk]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(_r.prototype);var I1=class extends _r{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},T1=class extends _r{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},Ho=class extends _r{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},A1=class extends _r{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},E1=class extends _r{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},M1=class extends _r{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},N1=class extends _r{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},O1=class extends _r{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(I1.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(T1.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(Ho.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(A1.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(E1.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(M1.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(N1.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(O1.prototype,"ArrayType",{value:BigUint64Array});var Bi=class extends K{constructor(t){super(D.Float),this.precision=t}get ArrayType(){switch(this.precision){case be.HALF:return Uint16Array;case be.SINGLE:return Float32Array;case be.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};Ok=Symbol.toStringTag;Bi[Ok]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(Bi.prototype);var R1=class extends Bi{constructor(){super(be.HALF)}},D1=class extends Bi{constructor(){super(be.SINGLE)}},L1=class extends Bi{constructor(){super(be.DOUBLE)}};Object.defineProperty(R1.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(D1.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(L1.prototype,"ArrayType",{value:Float64Array});var ta=class extends K{constructor(){super(D.Binary)}toString(){return"Binary"}};Rk=Symbol.toStringTag;ta[Rk]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(ta.prototype);var ea=class extends K{constructor(){super(D.LargeBinary)}toString(){return"LargeBinary"}};Dk=Symbol.toStringTag;ea[Dk]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeBinary"))(ea.prototype);var ra=class extends K{constructor(){super(D.Utf8)}toString(){return"Utf8"}};Lk=Symbol.toStringTag;ra[Lk]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(ra.prototype);var na=class extends K{constructor(){super(D.LargeUtf8)}toString(){return"LargeUtf8"}};Fk=Symbol.toStringTag;na[Fk]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeUtf8"))(na.prototype);var ia=class extends K{constructor(){super(D.Bool)}toString(){return"Bool"}};Ck=Symbol.toStringTag;ia[Ck]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(ia.prototype);var oa=class extends K{constructor(t,r,n=128){super(D.Decimal),this.scale=t,this.precision=r,this.bitWidth=n}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};kk=Symbol.toStringTag;oa[kk]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(oa.prototype);var sa=class extends K{constructor(t){super(D.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${Xe[this.unit]}>`}get ArrayType(){return this.unit===Xe.DAY?Int32Array:BigInt64Array}};Bk=Symbol.toStringTag;sa[Bk]=(e=>(e.unit=null,e[Symbol.toStringTag]="Date"))(sa.prototype);var aa=class extends K{constructor(t,r){super(D.Time),this.unit=t,this.bitWidth=r}toString(){return`Time${this.bitWidth}<${ct[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};Pk=Symbol.toStringTag;aa[Pk]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))(aa.prototype);var ca=class extends K{constructor(t,r){super(D.Timestamp),this.unit=t,this.timezone=r}toString(){return`Timestamp<${ct[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};Uk=Symbol.toStringTag;ca[Uk]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Timestamp"))(ca.prototype);var la=class extends K{constructor(t){super(D.Interval),this.unit=t}toString(){return`Interval<${xr[this.unit]}>`}};$k=Symbol.toStringTag;la[$k]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))(la.prototype);var ua=class extends K{constructor(t){super(D.Duration),this.unit=t}toString(){return`Duration<${ct[this.unit]}>`}};zk=Symbol.toStringTag;ua[zk]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Duration"))(ua.prototype);var go=class extends K{constructor(t){super(D.List),this.children=[t]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};jk=Symbol.toStringTag;go[jk]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(go.prototype);var Re=class extends K{constructor(t){super(D.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};qk=Symbol.toStringTag;Re[qk]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(Re.prototype);var xo=class extends K{constructor(t,r,n){super(D.Union),this.mode=t,this.children=n,this.typeIds=r=Int32Array.from(r),this.typeIdToChildIndex=r.reduce((i,o,s)=>(i[o]=s)&&i||i,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};Vk=Symbol.toStringTag;xo[Vk]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(xo.prototype);var fa=class extends K{constructor(t){super(D.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};Yk=Symbol.toStringTag;fa[Yk]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(fa.prototype);var bo=class extends K{constructor(t,r){super(D.FixedSizeList),this.listSize=t,this.children=[r]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}};Wk=Symbol.toStringTag;bo[Wk]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(bo.prototype);var _o=class extends K{constructor(t,r=!1){var n,i,o;if(super(D.Map),this.children=[t],this.keysSorted=r,t&&(t.name="entries",!((n=t?.type)===null||n===void 0)&&n.children)){let s=(i=t?.type)===null||i===void 0?void 0:i.children[0];s&&(s.name="key");let a=(o=t?.type)===null||o===void 0?void 0:o.children[1];a&&(a.name="value")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};Gk=Symbol.toStringTag;_o[Gk]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(_o.prototype);var aH=(e=>()=>++e)(-1),li=class extends K{constructor(t,r,n,i){super(D.Dictionary),this.indices=r,this.dictionary=t,this.isOrdered=i||!1,this.id=n==null?aH():re(n)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};Xk=Symbol.toStringTag;li[Xk]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(li.prototype);function ui(e){let t=e;switch(e.typeId){case D.Decimal:return e.bitWidth/32;case D.Interval:return 1+t.unit;case D.FixedSizeList:return t.listSize;case D.FixedSizeBinary:return t.byteWidth;default:return 1}}var mt=class{visitMany(t,...r){return t.map((n,i)=>this.visit(n,...r.map(o=>o[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,r=!0){return cH(this,t,r)}getVisitFnByTypeId(t,r=!0){return ed(this,t,r)}visitNull(t,...r){return null}visitBool(t,...r){return null}visitInt(t,...r){return null}visitFloat(t,...r){return null}visitUtf8(t,...r){return null}visitLargeUtf8(t,...r){return null}visitBinary(t,...r){return null}visitLargeBinary(t,...r){return null}visitFixedSizeBinary(t,...r){return null}visitDate(t,...r){return null}visitTimestamp(t,...r){return null}visitTime(t,...r){return null}visitDecimal(t,...r){return null}visitList(t,...r){return null}visitStruct(t,...r){return null}visitUnion(t,...r){return null}visitDictionary(t,...r){return null}visitInterval(t,...r){return null}visitDuration(t,...r){return null}visitFixedSizeList(t,...r){return null}visitMap(t,...r){return null}};function cH(e,t,r=!0){return typeof t=="number"?ed(e,t,r):typeof t=="string"&&t in D?ed(e,D[t],r):t&&t instanceof K?ed(e,Hk(t),r):t?.type&&t.type instanceof K?ed(e,Hk(t.type),r):ed(e,D.NONE,r)}function ed(e,t,r=!0){let n=null;switch(t){case D.Null:n=e.visitNull;break;case D.Bool:n=e.visitBool;break;case D.Int:n=e.visitInt;break;case D.Int8:n=e.visitInt8||e.visitInt;break;case D.Int16:n=e.visitInt16||e.visitInt;break;case D.Int32:n=e.visitInt32||e.visitInt;break;case D.Int64:n=e.visitInt64||e.visitInt;break;case D.Uint8:n=e.visitUint8||e.visitInt;break;case D.Uint16:n=e.visitUint16||e.visitInt;break;case D.Uint32:n=e.visitUint32||e.visitInt;break;case D.Uint64:n=e.visitUint64||e.visitInt;break;case D.Float:n=e.visitFloat;break;case D.Float16:n=e.visitFloat16||e.visitFloat;break;case D.Float32:n=e.visitFloat32||e.visitFloat;break;case D.Float64:n=e.visitFloat64||e.visitFloat;break;case D.Utf8:n=e.visitUtf8;break;case D.LargeUtf8:n=e.visitLargeUtf8;break;case D.Binary:n=e.visitBinary;break;case D.LargeBinary:n=e.visitLargeBinary;break;case D.FixedSizeBinary:n=e.visitFixedSizeBinary;break;case D.Date:n=e.visitDate;break;case D.DateDay:n=e.visitDateDay||e.visitDate;break;case D.DateMillisecond:n=e.visitDateMillisecond||e.visitDate;break;case D.Timestamp:n=e.visitTimestamp;break;case D.TimestampSecond:n=e.visitTimestampSecond||e.visitTimestamp;break;case D.TimestampMillisecond:n=e.visitTimestampMillisecond||e.visitTimestamp;break;case D.TimestampMicrosecond:n=e.visitTimestampMicrosecond||e.visitTimestamp;break;case D.TimestampNanosecond:n=e.visitTimestampNanosecond||e.visitTimestamp;break;case D.Time:n=e.visitTime;break;case D.TimeSecond:n=e.visitTimeSecond||e.visitTime;break;case D.TimeMillisecond:n=e.visitTimeMillisecond||e.visitTime;break;case D.TimeMicrosecond:n=e.visitTimeMicrosecond||e.visitTime;break;case D.TimeNanosecond:n=e.visitTimeNanosecond||e.visitTime;break;case D.Decimal:n=e.visitDecimal;break;case D.List:n=e.visitList;break;case D.Struct:n=e.visitStruct;break;case D.Union:n=e.visitUnion;break;case D.DenseUnion:n=e.visitDenseUnion||e.visitUnion;break;case D.SparseUnion:n=e.visitSparseUnion||e.visitUnion;break;case D.Dictionary:n=e.visitDictionary;break;case D.Interval:n=e.visitInterval;break;case D.IntervalDayTime:n=e.visitIntervalDayTime||e.visitInterval;break;case D.IntervalYearMonth:n=e.visitIntervalYearMonth||e.visitInterval;break;case D.Duration:n=e.visitDuration;break;case D.DurationSecond:n=e.visitDurationSecond||e.visitDuration;break;case D.DurationMillisecond:n=e.visitDurationMillisecond||e.visitDuration;break;case D.DurationMicrosecond:n=e.visitDurationMicrosecond||e.visitDuration;break;case D.DurationNanosecond:n=e.visitDurationNanosecond||e.visitDuration;break;case D.FixedSizeList:n=e.visitFixedSizeList;break;case D.Map:n=e.visitMap;break}if(typeof n=="function")return n;if(!r)return()=>null;throw new Error(`Unrecognized type '${D[t]}'`)}function Hk(e){switch(e.typeId){case D.Null:return D.Null;case D.Int:{let{bitWidth:t,isSigned:r}=e;switch(t){case 8:return r?D.Int8:D.Uint8;case 16:return r?D.Int16:D.Uint16;case 32:return r?D.Int32:D.Uint32;case 64:return r?D.Int64:D.Uint64}return D.Int}case D.Float:switch(e.precision){case be.HALF:return D.Float16;case be.SINGLE:return D.Float32;case be.DOUBLE:return D.Float64}return D.Float;case D.Binary:return D.Binary;case D.LargeBinary:return D.LargeBinary;case D.Utf8:return D.Utf8;case D.LargeUtf8:return D.LargeUtf8;case D.Bool:return D.Bool;case D.Decimal:return D.Decimal;case D.Time:switch(e.unit){case ct.SECOND:return D.TimeSecond;case ct.MILLISECOND:return D.TimeMillisecond;case ct.MICROSECOND:return D.TimeMicrosecond;case ct.NANOSECOND:return D.TimeNanosecond}return D.Time;case D.Timestamp:switch(e.unit){case ct.SECOND:return D.TimestampSecond;case ct.MILLISECOND:return D.TimestampMillisecond;case ct.MICROSECOND:return D.TimestampMicrosecond;case ct.NANOSECOND:return D.TimestampNanosecond}return D.Timestamp;case D.Date:switch(e.unit){case Xe.DAY:return D.DateDay;case Xe.MILLISECOND:return D.DateMillisecond}return D.Date;case D.Interval:switch(e.unit){case xr.DAY_TIME:return D.IntervalDayTime;case xr.YEAR_MONTH:return D.IntervalYearMonth}return D.Interval;case D.Duration:switch(e.unit){case ct.SECOND:return D.DurationSecond;case ct.MILLISECOND:return D.DurationMillisecond;case ct.MICROSECOND:return D.DurationMicrosecond;case ct.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 Se.Dense:return D.DenseUnion;case Se.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]}'`)}mt.prototype.visitInt8=null;mt.prototype.visitInt16=null;mt.prototype.visitInt32=null;mt.prototype.visitInt64=null;mt.prototype.visitUint8=null;mt.prototype.visitUint16=null;mt.prototype.visitUint32=null;mt.prototype.visitUint64=null;mt.prototype.visitFloat16=null;mt.prototype.visitFloat32=null;mt.prototype.visitFloat64=null;mt.prototype.visitDateDay=null;mt.prototype.visitDateMillisecond=null;mt.prototype.visitTimestampSecond=null;mt.prototype.visitTimestampMillisecond=null;mt.prototype.visitTimestampMicrosecond=null;mt.prototype.visitTimestampNanosecond=null;mt.prototype.visitTimeSecond=null;mt.prototype.visitTimeMillisecond=null;mt.prototype.visitTimeMicrosecond=null;mt.prototype.visitTimeNanosecond=null;mt.prototype.visitDenseUnion=null;mt.prototype.visitSparseUnion=null;mt.prototype.visitIntervalDayTime=null;mt.prototype.visitIntervalYearMonth=null;mt.prototype.visitDuration=null;mt.prototype.visitDurationSecond=null;mt.prototype.visitDurationMillisecond=null;mt.prototype.visitDurationMicrosecond=null;mt.prototype.visitDurationNanosecond=null;var aE={};Jn(aE,{float64ToUint16:()=>Sm,uint16ToFloat64:()=>F1});var Qk=new Float64Array(1),rd=new Uint32Array(Qk.buffer);function F1(e){let t=(e&31744)>>10,r=(e&1023)/1024,n=Math.pow(-1,(e&32768)>>15);switch(t){case 31:return n*(r?Number.NaN:1/0);case 0:return n*(r?6103515625e-14*r:0)}return n*Math.pow(2,t-15)*(1+r)}function Sm(e){if(e!==e)return 32256;Qk[0]=e;let t=(rd[1]&2147483648)>>16&65535,r=rd[1]&2146435072,n=0;return r>=1089470464?rd[0]>0?r=31744:(r=(r&2080374784)>>16,n=(rd[1]&1048575)>>10):r<=1056964608?(n=1048576+(rd[1]&1048575),n=1048576+(n<<(r>>20)-998)>>21,r=0):(r=r-1056964608>>10,n=(rd[1]&1048575)+512>>10),t|r|n&65535}var wt=class extends mt{};function Ot(e){return(t,r,n)=>{if(t.setValid(r,n!=null))return e(t,r,n)}}var lH=(e,t,r)=>{e[t]=Math.floor(r/864e5)},Zk=(e,t,r,n)=>{if(r+1<t.length){let i=re(t[r]),o=re(t[r+1]);e.set(n.subarray(0,o-i),i)}},uH=({offset:e,values:t},r,n)=>{let i=e+r;n?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},da=({values:e},t,r)=>{e[t]=r},cE=({values:e},t,r)=>{e[t]=r},Kk=({values:e},t,r)=>{e[t]=Sm(r)},fH=(e,t,r)=>{switch(e.type.precision){case be.HALF:return Kk(e,t,r);case be.SINGLE:case be.DOUBLE:return cE(e,t,r)}},C1=({values:e},t,r)=>{lH(e,t,r.valueOf())},k1=({values:e},t,r)=>{e[t]=BigInt(r)},lE=({stride:e,values:t},r,n)=>{t.set(n.subarray(0,e),e*r)},Jk=({values:e,valueOffsets:t},r,n)=>Zk(e,t,r,n),tB=({values:e,valueOffsets:t},r,n)=>Zk(e,t,r,Vo(n)),uE=(e,t,r)=>{e.type.unit===Xe.DAY?C1(e,t,r):k1(e,t,r)},B1=({values:e},t,r)=>{e[t]=BigInt(r/1e3)},P1=({values:e},t,r)=>{e[t]=BigInt(r)},U1=({values:e},t,r)=>{e[t]=BigInt(r*1e3)},$1=({values:e},t,r)=>{e[t]=BigInt(r*1e6)},fE=(e,t,r)=>{switch(e.type.unit){case ct.SECOND:return B1(e,t,r);case ct.MILLISECOND:return P1(e,t,r);case ct.MICROSECOND:return U1(e,t,r);case ct.NANOSECOND:return $1(e,t,r)}},z1=({values:e},t,r)=>{e[t]=r},j1=({values:e},t,r)=>{e[t]=r},q1=({values:e},t,r)=>{e[t]=r},V1=({values:e},t,r)=>{e[t]=r},dE=(e,t,r)=>{switch(e.type.unit){case ct.SECOND:return z1(e,t,r);case ct.MILLISECOND:return j1(e,t,r);case ct.MICROSECOND:return q1(e,t,r);case ct.NANOSECOND:return V1(e,t,r)}},hE=({values:e,stride:t},r,n)=>{e.set(n.subarray(0,t),t*r)},dH=(e,t,r)=>{let n=e.children[0],i=e.valueOffsets,o=Vr.getVisitFn(n);if(Array.isArray(r))for(let s=-1,a=i[t],c=i[t+1];a<c;)o(n,a++,r[++s]);else for(let s=-1,a=i[t],c=i[t+1];a<c;)o(n,a++,r.get(++s))},hH=(e,t,r)=>{let n=e.children[0],{valueOffsets:i}=e,o=Vr.getVisitFn(n),{[t]:s,[t+1]:a}=i,c=r instanceof Map?r.entries():Object.entries(r);for(let l of c)if(o(n,s,l),++s>=a)break},pH=(e,t)=>(r,n,i,o)=>n&&r(n,e,t[o]),mH=(e,t)=>(r,n,i,o)=>n&&r(n,e,t.get(o)),yH=(e,t)=>(r,n,i,o)=>n&&r(n,e,t.get(i.name)),gH=(e,t)=>(r,n,i,o)=>n&&r(n,e,t[i.name]),xH=(e,t,r)=>{let n=e.type.children.map(o=>Vr.getVisitFn(o.type)),i=r instanceof Map?yH(t,r):r instanceof Gt?mH(t,r):Array.isArray(r)?pH(t,r):gH(t,r);e.type.children.forEach((o,s)=>i(n[s],e.children[s],o,s))},bH=(e,t,r)=>{e.type.mode===Se.Dense?eB(e,t,r):rB(e,t,r)},eB=(e,t,r)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[n];Vr.visit(i,e.valueOffsets[t],r)},rB=(e,t,r)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[n];Vr.visit(i,t,r)},_H=(e,t,r)=>{var n;(n=e.dictionary)===null||n===void 0||n.set(e.values[t],r)},pE=(e,t,r)=>{e.type.unit===xr.DAY_TIME?Y1(e,t,r):W1(e,t,r)},Y1=({values:e},t,r)=>{e.set(r.subarray(0,2),2*t)},W1=({values:e},t,r)=>{e[t]=r[0]*12+r[1]%12},G1=({values:e},t,r)=>{e[t]=r},X1=({values:e},t,r)=>{e[t]=r},H1=({values:e},t,r)=>{e[t]=r},Q1=({values:e},t,r)=>{e[t]=r},mE=(e,t,r)=>{switch(e.type.unit){case ct.SECOND:return G1(e,t,r);case ct.MILLISECOND:return X1(e,t,r);case ct.MICROSECOND:return H1(e,t,r);case ct.NANOSECOND:return Q1(e,t,r)}},wH=(e,t,r)=>{let{stride:n}=e,i=e.children[0],o=Vr.getVisitFn(i);if(Array.isArray(r))for(let s=-1,a=t*n;++s<n;)o(i,a+s,r[s]);else for(let s=-1,a=t*n;++s<n;)o(i,a+s,r.get(s))};wt.prototype.visitBool=Ot(uH);wt.prototype.visitInt=Ot(da);wt.prototype.visitInt8=Ot(da);wt.prototype.visitInt16=Ot(da);wt.prototype.visitInt32=Ot(da);wt.prototype.visitInt64=Ot(da);wt.prototype.visitUint8=Ot(da);wt.prototype.visitUint16=Ot(da);wt.prototype.visitUint32=Ot(da);wt.prototype.visitUint64=Ot(da);wt.prototype.visitFloat=Ot(fH);wt.prototype.visitFloat16=Ot(Kk);wt.prototype.visitFloat32=Ot(cE);wt.prototype.visitFloat64=Ot(cE);wt.prototype.visitUtf8=Ot(tB);wt.prototype.visitLargeUtf8=Ot(tB);wt.prototype.visitBinary=Ot(Jk);wt.prototype.visitLargeBinary=Ot(Jk);wt.prototype.visitFixedSizeBinary=Ot(lE);wt.prototype.visitDate=Ot(uE);wt.prototype.visitDateDay=Ot(C1);wt.prototype.visitDateMillisecond=Ot(k1);wt.prototype.visitTimestamp=Ot(fE);wt.prototype.visitTimestampSecond=Ot(B1);wt.prototype.visitTimestampMillisecond=Ot(P1);wt.prototype.visitTimestampMicrosecond=Ot(U1);wt.prototype.visitTimestampNanosecond=Ot($1);wt.prototype.visitTime=Ot(dE);wt.prototype.visitTimeSecond=Ot(z1);wt.prototype.visitTimeMillisecond=Ot(j1);wt.prototype.visitTimeMicrosecond=Ot(q1);wt.prototype.visitTimeNanosecond=Ot(V1);wt.prototype.visitDecimal=Ot(hE);wt.prototype.visitList=Ot(dH);wt.prototype.visitStruct=Ot(xH);wt.prototype.visitUnion=Ot(bH);wt.prototype.visitDenseUnion=Ot(eB);wt.prototype.visitSparseUnion=Ot(rB);wt.prototype.visitDictionary=Ot(_H);wt.prototype.visitInterval=Ot(pE);wt.prototype.visitIntervalDayTime=Ot(Y1);wt.prototype.visitIntervalYearMonth=Ot(W1);wt.prototype.visitDuration=Ot(mE);wt.prototype.visitDurationSecond=Ot(G1);wt.prototype.visitDurationMillisecond=Ot(X1);wt.prototype.visitDurationMicrosecond=Ot(H1);wt.prototype.visitDurationNanosecond=Ot(Q1);wt.prototype.visitFixedSizeList=Ot(wH);wt.prototype.visitMap=Ot(hH);var Vr=new wt;var wo=Symbol.for("parent"),nd=Symbol.for("rowIndex"),Rc=class{constructor(t,r){return this[wo]=t,this[nd]=r,new Proxy(this,new gE)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[nd],r=this[wo],n=r.type.children,i={};for(let o=-1,s=n.length;++o<s;)i[n[o].name]=sr.visit(r.children[o],t);return i}toString(){return`{${[...this].map(([t,r])=>`${mo(t)}: ${mo(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new yE(this[wo],this[nd])}},yE=class{constructor(t,r){this.childIndex=0,this.children=t.children,this.rowIndex=r,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,sr.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(Rc.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[wo]:{writable:!0,enumerable:!1,configurable:!1,value:null},[nd]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var gE=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[wo].type.children.map(r=>r.name)}has(t,r){return t[wo].type.children.findIndex(n=>n.name===r)!==-1}getOwnPropertyDescriptor(t,r){if(t[wo].type.children.findIndex(n=>n.name===r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,r){if(Reflect.has(t,r))return t[r];let n=t[wo].type.children.findIndex(i=>i.name===r);if(n!==-1){let i=sr.visit(t[wo].children[n],t[nd]);return Reflect.set(t,r,i),i}}set(t,r,n){let i=t[wo].type.children.findIndex(o=>o.name===r);return i!==-1?(Vr.visit(t[wo].children[i],t[nd],n),Reflect.set(t,r,n)):Reflect.has(t,r)||typeof r=="symbol"?Reflect.set(t,r,n):!1}};var yt=class extends mt{};function At(e){return(t,r)=>t.getValid(r)?e(t,r):null}var vH=(e,t)=>864e5*e[t],SH=(e,t)=>null,nB=(e,t,r)=>{if(r+1>=t.length)return null;let n=re(t[r]),i=re(t[r+1]);return e.subarray(n,i)},IH=({offset:e,values:t},r)=>{let n=e+r;return(t[n>>3]&1<<n%8)!==0},iB=({values:e},t)=>vH(e,t),oB=({values:e},t)=>re(e[t]),Dc=({stride:e,values:t},r)=>t[e*r],TH=({stride:e,values:t},r)=>F1(t[e*r]),sB=({values:e},t)=>e[t],AH=({stride:e,values:t},r)=>t.subarray(e*r,e*(r+1)),aB=({values:e,valueOffsets:t},r)=>nB(e,t,r),cB=({values:e,valueOffsets:t},r)=>{let n=nB(e,t,r);return n!==null?sm(n):null},EH=({values:e},t)=>e[t],MH=({type:e,values:t},r)=>e.precision!==be.HALF?t[r]:F1(t[r]),NH=(e,t)=>e.type.unit===Xe.DAY?iB(e,t):oB(e,t),lB=({values:e},t)=>1e3*re(e[t]),uB=({values:e},t)=>re(e[t]),fB=({values:e},t)=>nE(e[t],BigInt(1e3)),dB=({values:e},t)=>nE(e[t],BigInt(1e6)),OH=(e,t)=>{switch(e.type.unit){case ct.SECOND:return lB(e,t);case ct.MILLISECOND:return uB(e,t);case ct.MICROSECOND:return fB(e,t);case ct.NANOSECOND:return dB(e,t)}},hB=({values:e},t)=>e[t],pB=({values:e},t)=>e[t],mB=({values:e},t)=>e[t],yB=({values:e},t)=>e[t],RH=(e,t)=>{switch(e.type.unit){case ct.SECOND:return hB(e,t);case ct.MILLISECOND:return pB(e,t);case ct.MICROSECOND:return mB(e,t);case ct.NANOSECOND:return yB(e,t)}},DH=({values:e,stride:t},r)=>vm.decimal(e.subarray(t*r,t*(r+1))),LH=(e,t)=>{let{valueOffsets:r,stride:n,children:i}=e,{[t*n]:o,[t*n+1]:s}=r,c=i[0].slice(o,s-o);return new Gt([c])},FH=(e,t)=>{let{valueOffsets:r,children:n}=e,{[t]:i,[t+1]:o}=r,s=n[0];return new Qo(s.slice(i,o-i))},CH=(e,t)=>new Rc(e,t),kH=(e,t)=>e.type.mode===Se.Dense?gB(e,t):xB(e,t),gB=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],n=e.children[r];return sr.visit(n,e.valueOffsets[t])},xB=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],n=e.children[r];return sr.visit(n,t)},BH=(e,t)=>{var r;return(r=e.dictionary)===null||r===void 0?void 0:r.get(e.values[t])},PH=(e,t)=>e.type.unit===xr.DAY_TIME?bB(e,t):_B(e,t),bB=({values:e},t)=>e.subarray(2*t,2*(t+1)),_B=({values:e},t)=>{let r=e[t],n=new Int32Array(2);return n[0]=Math.trunc(r/12),n[1]=Math.trunc(r%12),n},wB=({values:e},t)=>e[t],vB=({values:e},t)=>e[t],SB=({values:e},t)=>e[t],IB=({values:e},t)=>e[t],UH=(e,t)=>{switch(e.type.unit){case ct.SECOND:return wB(e,t);case ct.MILLISECOND:return vB(e,t);case ct.MICROSECOND:return SB(e,t);case ct.NANOSECOND:return IB(e,t)}},$H=(e,t)=>{let{stride:r,children:n}=e,o=n[0].slice(t*r,r);return new Gt([o])};yt.prototype.visitNull=At(SH);yt.prototype.visitBool=At(IH);yt.prototype.visitInt=At(EH);yt.prototype.visitInt8=At(Dc);yt.prototype.visitInt16=At(Dc);yt.prototype.visitInt32=At(Dc);yt.prototype.visitInt64=At(sB);yt.prototype.visitUint8=At(Dc);yt.prototype.visitUint16=At(Dc);yt.prototype.visitUint32=At(Dc);yt.prototype.visitUint64=At(sB);yt.prototype.visitFloat=At(MH);yt.prototype.visitFloat16=At(TH);yt.prototype.visitFloat32=At(Dc);yt.prototype.visitFloat64=At(Dc);yt.prototype.visitUtf8=At(cB);yt.prototype.visitLargeUtf8=At(cB);yt.prototype.visitBinary=At(aB);yt.prototype.visitLargeBinary=At(aB);yt.prototype.visitFixedSizeBinary=At(AH);yt.prototype.visitDate=At(NH);yt.prototype.visitDateDay=At(iB);yt.prototype.visitDateMillisecond=At(oB);yt.prototype.visitTimestamp=At(OH);yt.prototype.visitTimestampSecond=At(lB);yt.prototype.visitTimestampMillisecond=At(uB);yt.prototype.visitTimestampMicrosecond=At(fB);yt.prototype.visitTimestampNanosecond=At(dB);yt.prototype.visitTime=At(RH);yt.prototype.visitTimeSecond=At(hB);yt.prototype.visitTimeMillisecond=At(pB);yt.prototype.visitTimeMicrosecond=At(mB);yt.prototype.visitTimeNanosecond=At(yB);yt.prototype.visitDecimal=At(DH);yt.prototype.visitList=At(LH);yt.prototype.visitStruct=At(CH);yt.prototype.visitUnion=At(kH);yt.prototype.visitDenseUnion=At(gB);yt.prototype.visitSparseUnion=At(xB);yt.prototype.visitDictionary=At(BH);yt.prototype.visitInterval=At(PH);yt.prototype.visitIntervalDayTime=At(bB);yt.prototype.visitIntervalYearMonth=At(_B);yt.prototype.visitDuration=At(UH);yt.prototype.visitDurationSecond=At(wB);yt.prototype.visitDurationMillisecond=At(vB);yt.prototype.visitDurationMicrosecond=At(SB);yt.prototype.visitDurationNanosecond=At(IB);yt.prototype.visitFixedSizeList=At($H);yt.prototype.visitMap=At(FH);var sr=new yt;var Lc=Symbol.for("keys"),od=Symbol.for("vals"),id=Symbol.for("kKeysAsStrings"),xE=Symbol.for("_kKeysAsStrings"),Qo=class{constructor(t){return this[Lc]=new Gt([t.children[0]]).memoize(),this[od]=t.children[1],new Proxy(this,new _E)}get[id](){return this[xE]||(this[xE]=Array.from(this[Lc].toArray(),String))}[Symbol.iterator](){return new bE(this[Lc],this[od])}get size(){return this[Lc].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Lc],r=this[od],n={};for(let i=-1,o=t.length;++i<o;)n[t.get(i)]=sr.visit(r,i);return n}toString(){return`{${[...this].map(([t,r])=>`${mo(t)}: ${mo(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},bE=class{constructor(t,r){this.keys=t,this.vals=r,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){let t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),sr.visit(this.vals,t)]})}},_E=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[id]}has(t,r){return t[id].includes(r)}getOwnPropertyDescriptor(t,r){if(t[id].indexOf(r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,r){if(Reflect.has(t,r))return t[r];let n=t[id].indexOf(r);if(n!==-1){let i=sr.visit(Reflect.get(t,od),n);return Reflect.set(t,r,i),i}}set(t,r,n){let i=t[id].indexOf(r);return i!==-1?(Vr.visit(Reflect.get(t,od),i,n),Reflect.set(t,r,n)):Reflect.has(t,r)?Reflect.set(t,r,n):!1}};Object.defineProperties(Qo.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Lc]:{writable:!0,enumerable:!1,configurable:!1,value:null},[od]:{writable:!0,enumerable:!1,configurable:!1,value:null},[xE]:{writable:!0,enumerable:!1,configurable:!1,value:null}});var TB;function Im(e,t,r,n){let{length:i=0}=e,o=typeof t!="number"?0:t,s=typeof r!="number"?i:r;return o<0&&(o=(o%i+i)%i),s<0&&(s=(s%i+i)%i),s<o&&(TB=o,o=s,s=TB),s>i&&(s=i),n?n(e,o,s):[o,s]}var nu=(e,t)=>e<0?t+e:e,AB=e=>e!==e;function Fc(e){if(typeof e!=="object"||e===null)return AB(e)?AB:r=>r===e;if(e instanceof Date){let r=e.valueOf();return n=>n instanceof Date?n.valueOf()===r:!1}return ArrayBuffer.isView(e)?r=>r?KA(e,r):!1:e instanceof Map?jH(e):Array.isArray(e)?zH(e):e instanceof Gt?qH(e):VH(e,!0)}function zH(e){let t=[];for(let r=-1,n=e.length;++r<n;)t[r]=Fc(e[r]);return Z1(t)}function jH(e){let t=-1,r=[];for(let n of e.values())r[++t]=Fc(n);return Z1(r)}function qH(e){let t=[];for(let r=-1,n=e.length;++r<n;)t[r]=Fc(e.get(r));return Z1(t)}function VH(e,t=!1){let r=Object.keys(e);if(!t&&r.length===0)return()=>!1;let n=[];for(let i=-1,o=r.length;++i<o;)n[i]=Fc(e[r[i]]);return Z1(n,r)}function Z1(e,t){return r=>{if(!r||typeof r!="object")return!1;switch(r.constructor){case Array:return YH(e,r);case Map:return EB(e,r,r.keys());case Qo:case Rc:case Object:case void 0:return EB(e,r,t||Object.keys(r))}return r instanceof Gt?WH(e,r):!1}}function YH(e,t){let r=e.length;if(t.length!==r)return!1;for(let n=-1;++n<r;)if(!e[n](t[n]))return!1;return!0}function WH(e,t){let r=e.length;if(t.length!==r)return!1;for(let n=-1;++n<r;)if(!e[n](t.get(n)))return!1;return!0}function EB(e,t,r){let n=r[Symbol.iterator](),i=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),o=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),s=0,a=e.length,c=o.next(),l=n.next(),u=i.next();for(;s<a&&!l.done&&!u.done&&!c.done&&!(l.value!==u.value||!e[s](c.value));++s,l=n.next(),u=i.next(),c=o.next());return s===a&&l.done&&u.done&&c.done?!0:(n.return&&n.return(),i.return&&i.return(),o.return&&o.return(),!1)}var vE={};Jn(vE,{BitIterator:()=>iu,getBit:()=>MB,getBool:()=>J1,packBools:()=>su,popcnt_array:()=>NB,popcnt_bit_range:()=>Tm,popcnt_uint32:()=>K1,setBool:()=>GH,truncateBitmap:()=>ou});function J1(e,t,r,n){return(r&1<<n)!==0}function MB(e,t,r,n){return(r&1<<n)>>n}function GH(e,t,r){return r?!!(e[t>>3]|=1<<t%8)||!0:!(e[t>>3]&=~(1<<t%8))&&!1}function ou(e,t,r){let n=r.byteLength+7&-8;if(e>0||r.byteLength<n){let i=new Uint8Array(n);return i.set(e%8===0?r.subarray(e>>3):su(new iu(r,e,t,null,J1)).subarray(0,n)),i}return r}function su(e){let t=[],r=0,n=0,i=0;for(let s of e)s&&(i|=1<<n),++n===8&&(t[r++]=i,i=n=0);(r===0||n>0)&&(t[r++]=i);let o=new Uint8Array(t.length+7&-8);return o.set(t),o}var iu=class{constructor(t,r,n,i,o){this.bytes=t,this.length=n,this.context=i,this.get=o,this.bit=r%8,this.byteIndex=r>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}};function Tm(e,t,r){if(r-t<=0)return 0;if(r-t<8){let o=0;for(let s of new iu(e,t,r-t,e,MB))o+=s;return o}let n=r>>3<<3,i=t+(t%8===0?0:8-t%8);return Tm(e,t,i)+Tm(e,n,r)+NB(e,i>>3,n-i>>3)}function NB(e,t,r){let n=0,i=Math.trunc(t),o=new DataView(e.buffer,e.byteOffset,e.byteLength),s=r===void 0?e.byteLength:i+r;for(;s-i>=4;)n+=K1(o.getUint32(i)),i+=4;for(;s-i>=2;)n+=K1(o.getUint16(i)),i+=2;for(;s-i>=1;)n+=K1(o.getUint8(i)),i+=1;return n}function K1(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 XH=-1,ae=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 K.isSparseUnion(t)?this.children.some(r=>r.nullable):K.isDenseUnion(t)?this.children.some(r=>r.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0,{valueOffsets:r,values:n,nullBitmap:i,typeIds:o}=this;return r&&(t+=r.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),this.children.reduce((s,a)=>s+a.byteLength,t)}get nullCount(){if(K.isUnion(this.type))return this.children.reduce((n,i)=>n+i.nullCount,0);let t=this._nullCount,r;return t<=XH&&(r=this.nullBitmap)&&(this._nullCount=t=r.length===0?0:this.length-Tm(r,this.offset,this.offset+this.length)),t}constructor(t,r,n,i,o,s=[],a){this.type=t,this.children=s,this.dictionary=a,this.offset=Math.floor(Math.max(r||0,0)),this.length=Math.floor(Math.max(n||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let c;o instanceof e?(this.stride=o.stride,this.values=o.values,this.typeIds=o.typeIds,this.nullBitmap=o.nullBitmap,this.valueOffsets=o.valueOffsets):(this.stride=ui(t),o&&((c=o[0])&&(this.valueOffsets=c),(c=o[1])&&(this.values=c),(c=o[2])&&(this.nullBitmap=c),(c=o[3])&&(this.typeIds=c)))}getValid(t){let{type:r}=this;if(K.isUnion(r)){let n=r,i=this.children[n.typeIdToChildIndex[this.typeIds[t]]],o=n.mode===Se.Dense?this.valueOffsets[t]:t;return i.getValid(o)}if(this.nullable&&this.nullCount>0){let n=this.offset+t;return(this.nullBitmap[n>>3]&1<<n%8)!==0}return!0}setValid(t,r){let n,{type:i}=this;if(K.isUnion(i)){let o=i,s=this.children[o.typeIdToChildIndex[this.typeIds[t]]],a=o.mode===Se.Dense?this.valueOffsets[t]:t;n=s.getValid(a),s.setValid(a,r)}else{let{nullBitmap:o}=this,{offset:s,length:a}=this,c=s+t,l=1<<c%8,u=c>>3;(!o||o.byteLength<=u)&&(o=new Uint8Array((s+a+63&-64)>>3).fill(255),this.nullCount>0?(o.set(ou(s,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:o})):Object.assign(this,{nullBitmap:o,_nullCount:0}));let f=o[u];n=(f&l)!==0,o[u]=r?f|l:f&~l}return n!==!!r&&(this._nullCount=this.nullCount+(r?-1:1)),r}clone(t=this.type,r=this.offset,n=this.length,i=this._nullCount,o=this,s=this.children){return new e(t,r,n,i,o,s,this.dictionary)}slice(t,r){let{stride:n,typeId:i,children:o}=this,s=+(this._nullCount===0)-1,a=i===16?n:1,c=this._sliceBuffers(t,r,n,i);return this.clone(this.type,this.offset+t,r,s,c,o.length===0||this.valueOffsets?o:this._sliceChildren(o,a*t,a*r))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===D.Null)return this.clone(this.type,0,t,0);let{length:r,nullCount:n}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,r>>3);i[r>>3]=(1<<r-(r&-8))-1,n>0&&i.set(ou(this.offset,r,this.nullBitmap),0);let o=this.buffers;return o[ki.VALIDITY]=i,this.clone(this.type,0,t,n+(t-r),o)}_sliceBuffers(t,r,n,i){let o,{buffers:s}=this;return(o=s[ki.TYPE])&&(s[ki.TYPE]=o.subarray(t,t+r)),(o=s[ki.OFFSET])&&(s[ki.OFFSET]=o.subarray(t,t+r+1))||(o=s[ki.DATA])&&(s[ki.DATA]=i===6?o:o.subarray(n*t,n*(t+r))),s}_sliceChildren(t,r,n){return t.map(i=>i.slice(r,n))}};ae.prototype.children=Object.freeze([]);var SE=class e extends mt{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:r,["offset"]:n=0,["length"]:i=0}=t;return new ae(r,n,i,i)}visitBool(t){let{["type"]:r,["offset"]:n=0}=t,i=It(t.nullBitmap),o=zt(r.ArrayType,t.data),{["length"]:s=o.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ae(r,n,s,a,[void 0,o,i])}visitInt(t){let{["type"]:r,["offset"]:n=0}=t,i=It(t.nullBitmap),o=zt(r.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ae(r,n,s,a,[void 0,o,i])}visitFloat(t){let{["type"]:r,["offset"]:n=0}=t,i=It(t.nullBitmap),o=zt(r.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ae(r,n,s,a,[void 0,o,i])}visitUtf8(t){let{["type"]:r,["offset"]:n=0}=t,i=It(t.data),o=It(t.nullBitmap),s=eu(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ae(r,n,a,c,[s,i,o])}visitLargeUtf8(t){let{["type"]:r,["offset"]:n=0}=t,i=It(t.data),o=It(t.nullBitmap),s=g1(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ae(r,n,a,c,[s,i,o])}visitBinary(t){let{["type"]:r,["offset"]:n=0}=t,i=It(t.data),o=It(t.nullBitmap),s=eu(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ae(r,n,a,c,[s,i,o])}visitLargeBinary(t){let{["type"]:r,["offset"]:n=0}=t,i=It(t.data),o=It(t.nullBitmap),s=g1(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ae(r,n,a,c,[s,i,o])}visitFixedSizeBinary(t){let{["type"]:r,["offset"]:n=0}=t,i=It(t.nullBitmap),o=zt(r.ArrayType,t.data),{["length"]:s=o.length/ui(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ae(r,n,s,a,[void 0,o,i])}visitDate(t){let{["type"]:r,["offset"]:n=0}=t,i=It(t.nullBitmap),o=zt(r.ArrayType,t.data),{["length"]:s=o.length/ui(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ae(r,n,s,a,[void 0,o,i])}visitTimestamp(t){let{["type"]:r,["offset"]:n=0}=t,i=It(t.nullBitmap),o=zt(r.ArrayType,t.data),{["length"]:s=o.length/ui(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ae(r,n,s,a,[void 0,o,i])}visitTime(t){let{["type"]:r,["offset"]:n=0}=t,i=It(t.nullBitmap),o=zt(r.ArrayType,t.data),{["length"]:s=o.length/ui(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ae(r,n,s,a,[void 0,o,i])}visitDecimal(t){let{["type"]:r,["offset"]:n=0}=t,i=It(t.nullBitmap),o=zt(r.ArrayType,t.data),{["length"]:s=o.length/ui(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ae(r,n,s,a,[void 0,o,i])}visitList(t){let{["type"]:r,["offset"]:n=0,["child"]:i}=t,o=It(t.nullBitmap),s=eu(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ae(r,n,a,c,[s,void 0,o],[i])}visitStruct(t){let{["type"]:r,["offset"]:n=0,["children"]:i=[]}=t,o=It(t.nullBitmap),{length:s=i.reduce((c,{length:l})=>Math.max(c,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new ae(r,n,s,a,[void 0,void 0,o],i)}visitUnion(t){let{["type"]:r,["offset"]:n=0,["children"]:i=[]}=t,o=zt(r.ArrayType,t.typeIds),{["length"]:s=o.length,["nullCount"]:a=-1}=t;if(K.isSparseUnion(r))return new ae(r,n,s,a,[void 0,void 0,void 0,o],i);let c=eu(t.valueOffsets);return new ae(r,n,s,a,[c,void 0,void 0,o],i)}visitDictionary(t){let{["type"]:r,["offset"]:n=0}=t,i=It(t.nullBitmap),o=zt(r.indices.ArrayType,t.data),{["dictionary"]:s=new Gt([new e().visit({type:r.dictionary})])}=t,{["length"]:a=o.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ae(r,n,a,c,[void 0,o,i],[],s)}visitInterval(t){let{["type"]:r,["offset"]:n=0}=t,i=It(t.nullBitmap),o=zt(r.ArrayType,t.data),{["length"]:s=o.length/ui(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ae(r,n,s,a,[void 0,o,i])}visitDuration(t){let{["type"]:r,["offset"]:n=0}=t,i=It(t.nullBitmap),o=zt(r.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ae(r,n,s,a,[void 0,o,i])}visitFixedSizeList(t){let{["type"]:r,["offset"]:n=0,["child"]:i=new e().visit({type:r.valueType})}=t,o=It(t.nullBitmap),{["length"]:s=i.length/ui(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ae(r,n,s,a,[void 0,void 0,o],[i])}visitMap(t){let{["type"]:r,["offset"]:n=0,["child"]:i=new e().visit({type:r.childType})}=t,o=It(t.nullBitmap),s=eu(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ae(r,n,a,c,[s,void 0,o],[i])}},HH=new SE;function Dt(e){return HH.visit(e)}var Am=class{constructor(t=0,r){this.numChunks=t,this.getChunkIterator=r,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let t=this.chunkIterator.next();if(!t.done)return t;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}};function OB(e){return e.some(t=>t.nullable)}function t_(e){return e.reduce((t,r)=>t+r.nullCount,0)}function e_(e){return e.reduce((t,r,n)=>(t[n+1]=t[n]+r.length,t),new Uint32Array(e.length+1))}function r_(e,t,r,n){let i=[];for(let o=-1,s=e.length;++o<s;){let a=e[o],c=t[o],{length:l}=a;if(c>=n)break;if(r>=c+l)continue;if(c>=r&&c+l<=n){i.push(a);continue}let u=Math.max(0,r-c),f=Math.min(n-c,l);i.push(a.slice(u,f-u))}return i.length===0&&i.push(e[0].slice(0,0)),i}function IE(e,t,r,n){let i=0,o=0,s=t.length-1;do{if(i>=s-1)return r<t[s]?n(e,i,r-t[i]):null;o=i+Math.trunc((s-i)*.5),r<t[o]?s=o:i=o}while(i<s)}function Em(e,t){return e.getValid(t)}function sd(e){function t(r,n,i){return e(r[n],i)}return function(r){let n=this.data;return IE(n,this._offsets,r,t)}}function n_(e){let t;function r(n,i,o){return e(n[i],o,t)}return function(n,i){let o=this.data;t=i;let s=IE(o,this._offsets,n,r);return t=void 0,s}}function i_(e){let t;function r(n,i,o){let s=o,a=0,c=0;for(let l=i-1,u=n.length;++l<u;){let f=n[l];if(~(a=e(f,t,s)))return c+a;s=0,c+=f.length}return-1}return function(n,i){t=n;let o=this.data,s=typeof i!="number"?r(o,0,0):IE(o,this._offsets,i,r);return t=void 0,s}}var gt=class extends mt{};function QH(e,t){return t===null&&e.length>0?0:-1}function ZH(e,t){let{nullBitmap:r}=e;if(!r||e.nullCount<=0)return-1;let n=0;for(let i of new iu(r,e.offset+(t||0),e.length,r,J1)){if(!i)return n;++n}return-1}function Lt(e,t,r){if(t===void 0)return-1;if(t===null)switch(e.typeId){case D.Union:break;case D.Dictionary:break;default:return ZH(e,r)}let n=sr.getVisitFn(e),i=Fc(t);for(let o=(r||0)-1,s=e.length;++o<s;)if(i(n(e,o)))return o;return-1}function RB(e,t,r){let n=sr.getVisitFn(e),i=Fc(t);for(let o=(r||0)-1,s=e.length;++o<s;)if(i(n(e,o)))return o;return-1}gt.prototype.visitNull=QH;gt.prototype.visitBool=Lt;gt.prototype.visitInt=Lt;gt.prototype.visitInt8=Lt;gt.prototype.visitInt16=Lt;gt.prototype.visitInt32=Lt;gt.prototype.visitInt64=Lt;gt.prototype.visitUint8=Lt;gt.prototype.visitUint16=Lt;gt.prototype.visitUint32=Lt;gt.prototype.visitUint64=Lt;gt.prototype.visitFloat=Lt;gt.prototype.visitFloat16=Lt;gt.prototype.visitFloat32=Lt;gt.prototype.visitFloat64=Lt;gt.prototype.visitUtf8=Lt;gt.prototype.visitLargeUtf8=Lt;gt.prototype.visitBinary=Lt;gt.prototype.visitLargeBinary=Lt;gt.prototype.visitFixedSizeBinary=Lt;gt.prototype.visitDate=Lt;gt.prototype.visitDateDay=Lt;gt.prototype.visitDateMillisecond=Lt;gt.prototype.visitTimestamp=Lt;gt.prototype.visitTimestampSecond=Lt;gt.prototype.visitTimestampMillisecond=Lt;gt.prototype.visitTimestampMicrosecond=Lt;gt.prototype.visitTimestampNanosecond=Lt;gt.prototype.visitTime=Lt;gt.prototype.visitTimeSecond=Lt;gt.prototype.visitTimeMillisecond=Lt;gt.prototype.visitTimeMicrosecond=Lt;gt.prototype.visitTimeNanosecond=Lt;gt.prototype.visitDecimal=Lt;gt.prototype.visitList=Lt;gt.prototype.visitStruct=Lt;gt.prototype.visitUnion=Lt;gt.prototype.visitDenseUnion=RB;gt.prototype.visitSparseUnion=RB;gt.prototype.visitDictionary=Lt;gt.prototype.visitInterval=Lt;gt.prototype.visitIntervalDayTime=Lt;gt.prototype.visitIntervalYearMonth=Lt;gt.prototype.visitDuration=Lt;gt.prototype.visitDurationSecond=Lt;gt.prototype.visitDurationMillisecond=Lt;gt.prototype.visitDurationMicrosecond=Lt;gt.prototype.visitDurationNanosecond=Lt;gt.prototype.visitFixedSizeList=Lt;gt.prototype.visitMap=Lt;var au=new gt;var xt=class extends mt{};function Et(e){let{type:t}=e;if(e.nullCount===0&&e.stride===1&&(K.isInt(t)&&t.bitWidth!==64||K.isTime(t)&&t.bitWidth!==64||K.isFloat(t)&&t.precision!==be.HALF))return new Am(e.data.length,n=>{let i=e.data[n];return i.values.subarray(0,i.length)[Symbol.iterator]()});let r=0;return new Am(e.data.length,n=>{let o=e.data[n].length,s=e.slice(r,r+o);return r+=o,new TE(s)})}var TE=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.visitLargeUtf8=Et;xt.prototype.visitBinary=Et;xt.prototype.visitLargeBinary=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 ad=new xt;var DB,LB={},FB={},Gt=class e{constructor(t){var r,n,i;let o=t[0]instanceof e?t.flatMap(a=>a.data):t;if(o.length===0||o.some(a=>!(a instanceof ae)))throw new TypeError("Vector constructor expects an Array of Data instances.");let s=(r=o[0])===null||r===void 0?void 0:r.type;switch(o.length){case 0:this._offsets=[0];break;case 1:{let{get:a,set:c,indexOf:l}=LB[s.typeId],u=o[0];this.isValid=f=>Em(u,f),this.get=f=>a(u,f),this.set=(f,d)=>c(u,f,d),this.indexOf=f=>l(u,f),this._offsets=[0,u.length];break}default:Object.setPrototypeOf(this,FB[s.typeId]),this._offsets=e_(o);break}this.data=o,this.type=s,this.stride=ui(s),this.numChildren=(i=(n=s.children)===null||n===void 0?void 0:n.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,r)=>t+r.byteLength,0)}get nullable(){return OB(this.data)}get nullCount(){return t_(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}at(t){return this.get(nu(t,this.length))}set(t,r){}indexOf(t,r){return-1}includes(t,r){return this.indexOf(t,r)>-1}[Symbol.iterator](){return ad.visit(this)}concat(...t){return new e(this.data.concat(t.flatMap(r=>r.data).flat(Number.POSITIVE_INFINITY)))}slice(t,r){return new e(Im(this,t,r,({data:n,_offsets:i},o,s)=>r_(n,i,o,s)))}toJSON(){return[...this]}toArray(){let{type:t,data:r,length:n,stride:i,ArrayType:o}=this;switch(t.typeId){case D.Int:case D.Float:case D.Decimal:case D.Time:case D.Timestamp:switch(r.length){case 0:return new o;case 1:return r[0].values.subarray(0,n*i);default:return r.reduce((s,{values:a,length:c})=>(s.array.set(a.subarray(0,c*i),s.offset),s.offset+=c*i,s),{array:new o(n*i),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var r;return this.getChildAt((r=this.type.children)===null||r===void 0?void 0:r.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new e(this.data.map(({children:r})=>r[t])):null}get isMemoized(){return K.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(K.isDictionary(this.type)){let t=new o_(this.data[0].dictionary),r=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new e(r)}return new o_(this)}unmemoize(){if(K.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),r=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new e(r)}return this}};DB=Symbol.toStringTag;Gt[DB]=(e=>{e.type=K.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(r=>D[r]).filter(r=>typeof r=="number"&&r!==D.NONE);for(let r of t){let n=sr.getVisitFnByTypeId(r),i=Vr.getVisitFnByTypeId(r),o=au.getVisitFnByTypeId(r);LB[r]={get:n,set:i,indexOf:o},FB[r]=Object.create(e,{isValid:{value:sd(Em)},get:{value:sd(sr.getVisitFnByTypeId(r))},set:{value:n_(Vr.getVisitFnByTypeId(r))},indexOf:{value:i_(au.getVisitFnByTypeId(r))}})}return"Vector"})(Gt.prototype);var o_=class e extends Gt{constructor(t){super(t.data);let r=this.get,n=this.set,i=this.slice,o=new Array(this.length);Object.defineProperty(this,"get",{value(s){let a=o[s];if(a!==void 0)return a;let c=r.call(this,s);return o[s]=c,c}}),Object.defineProperty(this,"set",{value(s,a){n.call(this,s,a),o[s]=a}}),Object.defineProperty(this,"slice",{value:(s,a)=>new e(i.call(this,s,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new Gt(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function CB(e){if(!e||e.length<=0)return function(i){return!0};let t="",r=e.filter(n=>n===n);return r.length>0&&(t=`
3
3
  switch (x) {${r.map(n=>`
4
- case ${QH(n)}:`).join("")}
4
+ case ${KH(n)}:`).join("")}
5
5
  return false;
6
6
  }`),e.length!==r.length&&(t=`if (x !== x) return false;
7
7
  ${t}`),new Function("x",`${t}
8
- return true;`)}function QH(e){return typeof e!="bigint"?mo(e):`${mo(e)}n`}function AE(e,t){let r=Math.ceil(e)*t-1;return(r-r%64+64||64)/t}function FB(e,t=0){return e.length>=t?e.subarray(0,t):cm(new e.constructor(t),e,0)}var vo=class{constructor(t,r=0,n=1){this.length=Math.ceil(r/n),this.buffer=new t(this.length),this.stride=n,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t}get byteLength(){return Math.ceil(this.length*this.stride)*this.BYTES_PER_ELEMENT}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(t,r){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;let r=this.stride,n=this.length*r,i=this.buffer.length;n>=i&&this._resize(i===0?AE(n*1,this.BYTES_PER_ELEMENT):AE(n*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=AE(t*this.stride,this.BYTES_PER_ELEMENT);let r=FB(this.buffer,t);return this.clear(),r}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(t){return this.buffer=FB(this.buffer,t)}},ha=class extends vo{last(){return this.get(this.length-1)}get(t){return this.buffer[t]}set(t,r){return this.reserve(t-this.length+1),this.buffer[t*this.stride]=r,this}},ld=class extends ha{constructor(){super(Uint8Array,0,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,r){let{buffer:n}=this.reserve(t-this.length+1),i=t>>3,o=t%8,s=n[i]>>o&1;return r?s===0&&(n[i]|=1<<o,++this.numValid):s===1&&(n[i]&=~(1<<o),--this.numValid),this}clear(){return this.numValid=0,super.clear()}},ud=class extends ha{constructor(t){super(t.OffsetArrayType,1,1)}append(t){return this.set(this.length-1,t)}set(t,r){let n=this.length-1,i=this.reserve(t-n+1).buffer;return n<t++&&n>=0&&i.fill(i[n],n,t),i[t]=i[t-1]+r,this}flush(t=this.length-1){return t>this.length&&this.set(t-1,this.BYTES_PER_ELEMENT>4?BigInt(0):0),super.flush(t+1)}};var Le=class{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t){throw new Error('"throughDOM" not available in this environment')}constructor({type:t,nullValues:r}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=r,this.stride=ui(t),this._nulls=new ld,r&&r.length>0&&(this._isValid=LB(r))}toVector(){return new Gt([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:r,_values:n,_nulls:i,_typeIds:o,children:s}=this;return r&&(t+=r.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),s.reduce((a,c)=>a+c.byteLength,t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((r,n)=>r+n.reservedByteLength,t)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(t){return this.set(this.length,t)}isValid(t){return this._isValid(t)}set(t,r){return this.setValid(t,this.isValid(r))&&this.setValue(t,r),this}setValue(t,r){this._setValue(this,t,r)}setValid(t,r){return this.length=this._nulls.set(t,+r).length,r}addChild(t,r=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(t){return this.children[t]||null}flush(){let t,r,n,i,{type:o,length:s,nullCount:a,_typeIds:c,_offsets:l,_values:u,_nulls:f}=this;(r=c?.flush(s))?i=l?.flush(s):(i=l?.flush(s))?t=u?.flush(l.last()):t=u?.flush(s),a>0&&(n=f?.flush(s));let d=this.children.map(h=>h.flush());return this.clear(),Dt({type:o,length:s,nullCount:a,children:d,child:d[0],data:t,typeIds:r,nullBitmap:n,valueOffsets:i})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,r,n,i;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(r=this._values)===null||r===void 0||r.clear(),(n=this._offsets)===null||n===void 0||n.clear(),(i=this._typeIds)===null||i===void 0||i.clear();for(let o of this.children)o.clear();return this}};Le.prototype.length=1;Le.prototype.stride=1;Le.prototype.children=null;Le.prototype.finished=!1;Le.prototype.nullValues=null;Le.prototype._isValid=()=>!0;var ar=class extends Le{constructor(t){super(t),this._values=new ha(this.ArrayType,0,this.stride)}setValue(t,r){let n=this._values;return n.reserve(t-n.length+1),super.setValue(t,r)}},Vn=class extends Le{constructor(t){super(t),this._pendingLength=0,this._offsets=new ud(t.type)}setValue(t,r){let n=this._pending||(this._pending=new Map),i=n.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=r instanceof Qo?r[Lc].length:r.length,n.set(t,r)}setValid(t,r){return super.setValid(t,r)?!0:((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){let t=this._pending,r=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,r),this}};var au=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,r,n,i){return t.prep(8,24),t.writeInt64(BigInt(i??0)),t.pad(4),t.writeInt32(n),t.writeInt64(BigInt(r??0)),t.offset()}};var fi=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFooter(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):he.V1}schema(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new qn).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}dictionaries(t,r){let n=this.bb.__offset(this.bb_pos,8);return n?(r||new au).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}dictionariesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,r){let n=this.bb.__offset(this.bb_pos,10);return n?(r||new au).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}recordBatchesLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,12);return n?(r||new br).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,r){t.addFieldInt16(0,r,he.V1)}static addSchema(t,r){t.addFieldOffset(1,r,0)}static addDictionaries(t,r){t.addFieldOffset(2,r,0)}static startDictionariesVector(t,r){t.startVector(24,r,8)}static addRecordBatches(t,r){t.addFieldOffset(3,r,0)}static startRecordBatchesVector(t,r){t.startVector(24,r,8)}static addCustomMetadata(t,r){t.addFieldOffset(4,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,r){t.finish(r)}static finishSizePrefixedFooterBuffer(t,r){t.finish(r,void 0,!0)}};var me=class e{constructor(t=[],r,n,i=he.V5){this.fields=t||[],this.metadata=r||new Map,n||(n=EE(this.fields)),this.dictionaries=n,this.metadataVersion=i}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,r)=>`${r}: ${t}`).join(", ")} }>`}select(t){let r=new Set(t),n=this.fields.filter(i=>r.has(i.name));return new e(n,this.metadata)}selectAt(t){let r=t.map(n=>this.fields[n]).filter(Boolean);return new e(r,this.metadata)}assign(...t){let r=t[0]instanceof e?t[0]:Array.isArray(t[0])?new e(t[0]):new e(t),n=[...this.fields],i=o_(o_(new Map,this.metadata),r.metadata),o=r.fields.filter(a=>{let c=n.findIndex(l=>l.name===a.name);return~c?(n[c]=a.clone({metadata:o_(o_(new Map,n[c].metadata),a.metadata)}))&&!1:!0}),s=EE(o,new Map);return new e([...n,...o],i,new Map([...this.dictionaries,...s]))}};me.prototype.fields=null;me.prototype.metadata=null;me.prototype.dictionaries=null;var jt=class e{static new(...t){let[r,n,i,o]=t;return t[0]&&typeof t[0]=="object"&&({name:r}=t[0],n===void 0&&(n=t[0].type),i===void 0&&(i=t[0].nullable),o===void 0&&(o=t[0].metadata)),new e(`${r}`,n,i,o)}constructor(t,r,n=!1,i){this.name=t,this.type=r,this.nullable=n,this.metadata=i||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[r,n,i,o]=t;return!t[0]||typeof t[0]!="object"?[r=this.name,n=this.type,i=this.nullable,o=this.metadata]=t:{name:r=this.name,type:n=this.type,nullable:i=this.nullable,metadata:o=this.metadata}=t[0],e.new(r,n,i,o)}};jt.prototype.type=null;jt.prototype.name=null;jt.prototype.nullable=null;jt.prototype.metadata=null;function o_(e,t){return new Map([...e||new Map,...t||new Map])}function EE(e,t=new Map){for(let r=-1,n=e.length;++r<n;){let o=e[r].type;if(K.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&&EE(o.children,t)}return t}var ZH=eu,KH=ai,pa=class{static decode(t){t=new KH(St(t));let r=fi.getRootAsFooter(t),n=me.decode(r.schema(),new Map,r.version());return new ME(n,r)}static encode(t){let r=new ZH,n=me.encode(r,t.schema);fi.startRecordBatchesVector(r,t.numRecordBatches);for(let s of[...t.recordBatches()].slice().reverse())ma.encode(r,s);let i=r.endVector();fi.startDictionariesVector(r,t.numDictionaries);for(let s of[...t.dictionaryBatches()].slice().reverse())ma.encode(r,s);let o=r.endVector();return fi.startFooter(r),fi.addSchema(r,n),fi.addVersion(r,he.V5),fi.addRecordBatches(r,i),fi.addDictionaries(r,o),fi.finishFooterBuffer(r,fi.endFooter(r)),r.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,r=he.V5,n,i){this.schema=t,this.version=r,n&&(this._recordBatches=n),i&&(this._dictionaryBatches=i)}*recordBatches(){for(let t,r=-1,n=this.numRecordBatches;++r<n;)(t=this.getRecordBatch(r))&&(yield t)}*dictionaryBatches(){for(let t,r=-1,n=this.numDictionaries;++r<n;)(t=this.getDictionaryBatch(r))&&(yield t)}getRecordBatch(t){return t>=0&&t<this.numRecordBatches&&this._recordBatches[t]||null}getDictionaryBatch(t){return t>=0&&t<this.numDictionaries&&this._dictionaryBatches[t]||null}};var ME=class extends pa{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(t,r){super(t,r.version()),this._footer=r}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){let r=this._footer.recordBatches(t);if(r)return ma.decode(r)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let r=this._footer.dictionaries(t);if(r)return ma.decode(r)}return null}},ma=class e{static decode(t){return new e(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,r){let{metaDataLength:n}=r,i=BigInt(r.offset),o=BigInt(r.bodyLength);return au.createBlock(t,i,n,o)}constructor(t,r,n){this.metaDataLength=t,this.offset=re(n),this.bodyLength=re(r)}};var De=Object.freeze({done:!0,value:void 0}),Mm=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},cu=class{tee(){return this._getDOMStream().tee()}pipe(t,r){return this._getNodeStream().pipe(t,r)}pipeTo(t,r){return this._getDOMStream().pipeTo(t,r)}pipeThrough(t,r){return this._getDOMStream().pipeThrough(t,r)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}},s_=class extends cu{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return Q(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(De);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return qr.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return qr.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return Q(this,void 0,void 0,function*(){return yield this.abort(t),De})}return(t){return Q(this,void 0,void 0,function*(){return yield this.close(),De})}read(t){return Q(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return Q(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((r,n)=>{this.resolvers.push({resolve:r,reject:n})}):Promise.resolve(De)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var Zo=class extends s_{write(t){if((t=St(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?sm(this.toUint8Array(!0)):this.toUint8Array(!1).then(sm)}toUint8Array(t=!1){return t?si(this._values)[0]:Q(this,void 0,void 0,function*(){var r,n,i,o;let s=[],a=0;try{for(var c=!0,l=ao(this),u;u=yield l.next(),r=u.done,!r;c=!0){o=u.value,c=!1;let f=o;s.push(f),a+=f.byteLength}}catch(f){n={error:f}}finally{try{!c&&!r&&(i=l.return)&&(yield i.call(l))}finally{if(n)throw n.error}}return si(s,a)[0]})}},Ko=class{constructor(t){t&&(this.source=new NE(qr.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)}},Pi=class e{constructor(t){t instanceof e?this.source=t.source:t instanceof Zo?this.source=new ya(qr.fromAsyncIterable(t)):m1(t)?this.source=new ya(qr.fromNodeStream(t)):am(t)?this.source=new ya(qr.fromDOMStream(t)):h1(t)?this.source=new ya(qr.fromDOMStream(t.body)):lo(t)?this.source=new ya(qr.fromIterable(t)):co(t)?this.source=new ya(qr.fromAsyncIterable(t)):Fi(t)&&(this.source=new ya(qr.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)}},NE=class{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,r="read"){return this.source.next({cmd:r,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||De)}return(t){return Object.create(this.source.return&&this.source.return(t)||De)}},ya=class{constructor(t){this.source=t,this._closedPromise=new Promise(r=>this._closedPromiseResolve=r)}cancel(t){return Q(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return Q(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return Q(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t){return Q(this,arguments,void 0,function*(r,n="read"){return yield this.source.next({cmd:n,size:r})})}throw(t){return Q(this,void 0,void 0,function*(){let r=this.source.throw&&(yield this.source.throw(t))||De;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}return(t){return Q(this,void 0,void 0,function*(){let r=this.source.return&&(yield this.source.return(t))||De;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}};var Nm=class extends Ko{constructor(t,r){super(),this.position=0,this.buffer=St(t),this.size=r===void 0?this.buffer.byteLength:r}readInt32(t){let{buffer:r,byteOffset:n}=this.readAt(t,4);return new DataView(r,n).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){let{buffer:r,size:n,position:i}=this;return r&&i<n?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(n,i+Math.min(n-i,t)),r.subarray(i,this.position)):null}readAt(t,r){let n=this.buffer,i=Math.min(this.size,t+r);return n?n.subarray(t,i):new Uint8Array(r)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}},Cc=class extends Pi{constructor(t,r){super(),this.position=0,this._handle=t,typeof r=="number"?this.size=r:this._pending=Q(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return Q(this,void 0,void 0,function*(){let{buffer:r,byteOffset:n}=yield this.readAt(t,4);return new DataView(r,n).getInt32(0,!0)})}seek(t){return Q(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 Q(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:r,size:n,position:i}=this;if(r&&i<n){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let o=i,s=0,a=0,c=Math.min(n,o+Math.min(n-o,t)),l=new Uint8Array(Math.max(0,(this.position=c)-o));for(;(o+=a)<c&&(s+=a)<l.byteLength;)({bytesRead:a}=yield r.read(l,s,l.byteLength-s,o));return l}return null})}readAt(t,r){return Q(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:n,size:i}=this;if(n&&t+r<i){let o=Math.min(i,t+r),s=new Uint8Array(o-t);return(yield n.read(s,0,r,t)).buffer}return new Uint8Array(r)})}close(){return Q(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return Q(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return Q(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var RE={};Jn(RE,{BaseInt64:()=>Om,Int128:()=>Rm,Int64:()=>ga,Uint64:()=>je});function fd(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}var dd=8,OE=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],Om=class{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){let r=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]),i=r[3]*n[3];this.buffer[0]=i&65535;let o=i>>>16;return i=r[2]*n[3],o+=i,i=r[3]*n[2]>>>0,o+=i,this.buffer[0]+=o<<16,this.buffer[1]=o>>>0<i?65536:0,this.buffer[1]+=o>>>16,this.buffer[1]+=r[1]*n[3]+r[2]*n[2]+r[3]*n[1],this.buffer[1]+=r[0]*n[3]+r[1]*n[2]+r[2]*n[1]+r[3]*n[0]<<16,this}_plus(t){let r=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],r<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=r}lessThan(t){return this.buffer[1]<t.buffer[1]||this.buffer[1]===t.buffer[1]&&this.buffer[0]<t.buffer[0]}equals(t){return this.buffer[1]===t.buffer[1]&&this.buffer[0]==t.buffer[0]}greaterThan(t){return t.lessThan(this)}hex(){return`${fd(this.buffer[1])} ${fd(this.buffer[0])}`}},je=class e extends Om{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,r=new Uint32Array(2)){return e.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(2)){return e.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(2)){let n=t.length,i=new e(r);for(let o=0;o<n;){let s=dd<n-o?dd:n-o,a=new e(new Uint32Array([Number.parseInt(t.slice(o,o+s),10),0])),c=new e(new Uint32Array([OE[s],0]));i.times(c),i.plus(a),o+=s}return i}static convertArray(t){let r=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)e.from(t[n],new Uint32Array(r.buffer,r.byteOffset+2*n*4,2));return r}static multiply(t,r){return new e(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new e(new Uint32Array(t.buffer)).plus(r)}},ga=class e extends Om{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(t){return this._times(t),this}plus(t){return this._plus(t),this}lessThan(t){let r=this.buffer[1]<<0,n=t.buffer[1]<<0;return r<n||r===n&&this.buffer[0]<t.buffer[0]}static from(t,r=new Uint32Array(2)){return e.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(2)){return e.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(2)){let n=t.startsWith("-"),i=t.length,o=new e(r);for(let s=n?1:0;s<i;){let a=dd<i-s?dd:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0])),l=new e(new Uint32Array([OE[a],0]));o.times(l),o.plus(c),s+=a}return n?o.negate():o}static convertArray(t){let r=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)e.from(t[n],new Uint32Array(r.buffer,r.byteOffset+2*n*4,2));return r}static multiply(t,r){return new e(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new e(new Uint32Array(t.buffer)).plus(r)}},Rm=class e{constructor(t){this.buffer=t}high(){return new ga(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new ga(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(t){let r=new je(new Uint32Array([this.buffer[3],0])),n=new je(new Uint32Array([this.buffer[2],0])),i=new je(new Uint32Array([this.buffer[1],0])),o=new je(new Uint32Array([this.buffer[0],0])),s=new je(new Uint32Array([t.buffer[3],0])),a=new je(new Uint32Array([t.buffer[2],0])),c=new je(new Uint32Array([t.buffer[1],0])),l=new je(new Uint32Array([t.buffer[0],0])),u=je.multiply(o,l);this.buffer[0]=u.low();let f=new je(new Uint32Array([u.high(),0]));return u=je.multiply(i,l),f.plus(u),u=je.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 je(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(je.multiply(n,l)).plus(je.multiply(i,c)).plus(je.multiply(o,a)),this.buffer[3]+=je.multiply(r,l).plus(je.multiply(n,c)).plus(je.multiply(i,a)).plus(je.multiply(o,s)).low(),this}plus(t){let r=new Uint32Array(4);return r[3]=this.buffer[3]+t.buffer[3]>>>0,r[2]=this.buffer[2]+t.buffer[2]>>>0,r[1]=this.buffer[1]+t.buffer[1]>>>0,r[0]=this.buffer[0]+t.buffer[0]>>>0,r[0]<this.buffer[0]>>>0&&++r[1],r[1]<this.buffer[1]>>>0&&++r[2],r[2]<this.buffer[2]>>>0&&++r[3],this.buffer[3]=r[3],this.buffer[2]=r[2],this.buffer[1]=r[1],this.buffer[0]=r[0],this}hex(){return`${fd(this.buffer[3])} ${fd(this.buffer[2])} ${fd(this.buffer[1])} ${fd(this.buffer[0])}`}static multiply(t,r){return new e(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new e(new Uint32Array(t.buffer)).plus(r)}static from(t,r=new Uint32Array(4)){return e.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(4)){return e.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(4)){let n=t.startsWith("-"),i=t.length,o=new e(r);for(let s=n?1:0;s<i;){let a=dd<i-s?dd:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0,0,0])),l=new e(new Uint32Array([OE[a],0,0,0]));o.times(l),o.plus(c),s+=a}return n?o.negate():o}static convertArray(t){let r=new Uint32Array(t.length*4);for(let n=-1,i=t.length;++n<i;)e.from(t[n],new Uint32Array(r.buffer,r.byteOffset+4*4*n,4));return r}};var Dm=class extends mt{constructor(t,r,n,i,o=he.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=r,this.buffers=n,this.dictionaries=i,this.metadataVersion=o}visit(t){return super.visit(t instanceof jt?t.type:t)}visitNull(t,{length:r}=this.nextFieldNode()){return Dt({type:t,length:r})}visitBool(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitInt(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFloat(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitUtf8(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeUtf8(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeBinary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitFixedSizeBinary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDate(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTimestamp(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTime(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDecimal(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitList(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),children:this.visitMany(t.children)})}visitUnion(t,{length:r,nullCount:n}=this.nextFieldNode()){return this.metadataVersion<he.V5&&this.readNullBitmap(t,n),t.mode===Se.Sparse?this.visitSparseUnion(t,{length:r,nullCount:n}):this.visitDenseUnion(t,{length:r,nullCount:n})}visitDenseUnion(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDuration(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFixedSizeList(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),child:this.visit(t.children[0])})}visitMap(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,r,n=this.nextBufferRange()){return r>0&&this.readData(t,n)||new Uint8Array(0)}readOffsets(t,r){return this.readData(t,r)}readTypeIds(t,r){return this.readData(t,r)}readData(t,{length:r,offset:n}=this.nextBufferRange()){return this.bytes.subarray(n,n+r)}readDictionary(t){return this.dictionaries.get(t.id)}},a_=class extends Dm{constructor(t,r,n,i,o){super(new Uint8Array(0),r,n,i,o),this.sources=t}readNullBitmap(t,r,{offset:n}=this.nextBufferRange()){return r<=0?new Uint8Array(0):ou(this.sources[n])}readOffsets(t,{offset:r}=this.nextBufferRange()){return zt(Uint8Array,zt(t.OffsetArrayType,this.sources[r]))}readTypeIds(t,{offset:r}=this.nextBufferRange()){return zt(Uint8Array,zt(t.ArrayType,this.sources[r]))}readData(t,{offset:r}=this.nextBufferRange()){let{sources:n}=this;return K.isTimestamp(t)?zt(Uint8Array,ga.convertArray(n[r])):(K.isInt(t)||K.isTime(t))&&t.bitWidth===64||K.isDuration(t)?zt(Uint8Array,ga.convertArray(n[r])):K.isDate(t)&&t.unit===Xe.MILLISECOND?zt(Uint8Array,ga.convertArray(n[r])):K.isDecimal(t)?zt(Uint8Array,Rm.convertArray(n[r])):K.isBinary(t)||K.isLargeBinary(t)||K.isFixedSizeBinary(t)?JH(n[r]):K.isBool(t)?ou(n[r]):K.isUtf8(t)||K.isLargeUtf8(t)?Vo(n[r].join("")):zt(Uint8Array,zt(t.ArrayType,n[r].map(i=>+i)))}};function JH(e){let t=e.join(""),r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n>>1]=Number.parseInt(t.slice(n,n+2),16);return r}var hd=class extends Vn{constructor(t){super(t),this._values=new vo(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,St(r))}_flushPending(t,r){let n=this._offsets,i=this._values.reserve(r).buffer,o=0;for(let[s,a]of t)if(a===void 0)n.set(s,0);else{let c=a.length;i.set(a,o),n.set(s,c),o+=c}}};var pd=class extends Vn{constructor(t){super(t),this._values=new vo(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,St(r))}_flushPending(t,r){let n=this._offsets,i=this._values.reserve(r).buffer,o=0;for(let[s,a]of t)if(a===void 0)n.set(s,BigInt(0));else{let c=a.length;i.set(a,o),n.set(s,BigInt(c)),o+=c}}};var c_=class extends Le{constructor(t){super(t),this._values=new ld}setValue(t,r){this._values.set(t,+r)}};var lu=class extends ar{};lu.prototype._setValue=uE;var Lm=class extends lu{};Lm.prototype._setValue=F1;var Fm=class extends lu{};Fm.prototype._setValue=C1;var Cm=class extends ar{};Cm.prototype._setValue=hE;var l_=class extends Le{constructor({type:t,nullValues:r,dictionaryHashFunction:n}){super({type:new li(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=uu({type:this.type.indices,nullValues:r}),this.dictionary=uu({type:this.type.dictionary,nullValues:null}),typeof n=="function"&&(this.valueToKey=n)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,r){let n=this.indices;return r=n.setValid(t,r),this.length=n.length,r}setValue(t,r){let n=this._keysToIndices,i=this.valueToKey(r),o=n[i];return o===void 0&&(n[i]=o=this._dictionaryOffset+this.dictionary.append(r).length-1),this.indices.setValue(t,o)}flush(){let t=this.type,r=this._dictionary,n=this.dictionary.toVector(),i=this.indices.flush().clone(t);return i.dictionary=r?r.concat(n):n,this.finished||(this._dictionaryOffset+=n.length),this._dictionary=i.dictionary,this.clear(),i}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(t){return typeof t=="string"?t:`${t}`}};var km=class extends ar{};km.prototype._setValue=lE;var u_=class extends Le{setValue(t,r){let[n]=this.children,i=t*this.stride;for(let o=-1,s=r.length;++o<s;)n.set(i+o,r[o])}addChild(t,r="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");let n=this.children.push(t);return this.type=new bo(this.type.listSize,new jt(r,t.type,!0)),n}};var fu=class extends ar{setValue(t,r){this._values.set(t,r)}},f_=class extends fu{setValue(t,r){super.setValue(t,Sm(r))}},d_=class extends fu{},h_=class extends fu{};var du=class extends ar{};du.prototype._setValue=pE;var Bm=class extends du{};Bm.prototype._setValue=V1;var Pm=class extends du{};Pm.prototype._setValue=Y1;var xa=class extends ar{};xa.prototype._setValue=mE;var Um=class extends xa{};Um.prototype._setValue=W1;var $m=class extends xa{};$m.prototype._setValue=G1;var zm=class extends xa{};zm.prototype._setValue=X1;var jm=class extends xa{};jm.prototype._setValue=H1;var Ui=class extends ar{setValue(t,r){this._values.set(t,r)}},p_=class extends Ui{},m_=class extends Ui{},y_=class extends Ui{},g_=class extends Ui{},x_=class extends Ui{},b_=class extends Ui{},__=class extends Ui{},w_=class extends Ui{};var v_=class extends Vn{constructor(t){super(t),this._offsets=new ud(t.type)}addChild(t,r="0"){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new go(new jt(r,t.type,!0)),this.numChildren-1}_flushPending(t){let r=this._offsets,[n]=this.children;for(let[i,o]of t)if(typeof o>"u")r.set(i,0);else{let s=o,a=s.length,c=r.set(i,a).buffer[i];for(let l=-1;++l<a;)n.set(c+l,s[l])}}};var S_=class extends Vn{set(t,r){return super.set(t,r)}setValue(t,r){let n=r instanceof Map?r:new Map(Object.entries(r)),i=this._pending||(this._pending=new Map),o=i.get(t);o&&(this._pendingLength-=o.size),this._pendingLength+=n.size,i.set(t,n)}addChild(t,r=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new _o(new jt(r,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let r=this._offsets,[n]=this.children;for(let[i,o]of t)if(o===void 0)r.set(i,0);else{let{[i]:s,[i+1]:a}=r.set(i,o.size).buffer;for(let c of o.entries())if(n.set(s,c),++s>=a)break}}};var I_=class extends Le{setValue(t,r){}setValid(t,r){return this.length=Math.max(t+1,this.length),r}};var T_=class extends Le{setValue(t,r){let{children:n,type:i}=this;switch(Array.isArray(r)||r.constructor){case!0:return i.children.forEach((o,s)=>n[s].set(t,r[s]));case Map:return i.children.forEach((o,s)=>n[s].set(t,r.get(o.name)));default:return i.children.forEach((o,s)=>n[s].set(t,r[o.name]))}}setValid(t,r){return super.setValid(t,r)||this.children.forEach(n=>n.setValid(t,r)),r}addChild(t,r=`${this.numChildren}`){let n=this.children.push(t);return this.type=new Re([...this.type.children,new jt(r,t.type,!0)]),n}};var ba=class extends ar{};ba.prototype._setValue=fE;var qm=class extends ba{};qm.prototype._setValue=k1;var Vm=class extends ba{};Vm.prototype._setValue=B1;var Ym=class extends ba{};Ym.prototype._setValue=P1;var Wm=class extends ba{};Wm.prototype._setValue=U1;var _a=class extends ar{};_a.prototype._setValue=dE;var Gm=class extends _a{};Gm.prototype._setValue=$1;var Xm=class extends _a{};Xm.prototype._setValue=z1;var Hm=class extends _a{};Hm.prototype._setValue=j1;var Qm=class extends _a{};Qm.prototype._setValue=q1;var md=class extends Le{constructor(t){super(t),this._typeIds=new ha(Int8Array,0,1),typeof t.valueToChildTypeId=="function"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,r){return this.set(this.length,t,r)}set(t,r,n){return n===void 0&&(n=this._valueToChildTypeId(this,r,t)),this.setValue(t,r,n),this}setValue(t,r,n){this._typeIds.set(t,n);let i=this.type.typeIdToChildIndex[n],o=this.children[i];o?.set(t,r)}addChild(t,r=`${this.children.length}`){let n=this.children.push(t),{type:{children:i,mode:o,typeIds:s}}=this,a=[...i,new jt(r,t.type)];return this.type=new xo(o,[...s,n],a),n}_valueToChildTypeId(t,r,n){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}},A_=class extends md{},E_=class extends md{constructor(t){super(t),this._offsets=new ha(Int32Array)}setValue(t,r,n){let i=this._typeIds.set(t,n).buffer[t],o=this.getChildAt(this.type.typeIdToChildIndex[i]),s=this._offsets.set(t,o.length).buffer[t];o?.set(s,r)}};var Zm=class extends Vn{constructor(t){super(t),this._values=new vo(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,Vo(r))}_flushPending(t,r){}};Zm.prototype._flushPending=hd.prototype._flushPending;var Km=class extends Vn{constructor(t){super(t),this._values=new vo(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,Vo(r))}_flushPending(t,r){}};Km.prototype._flushPending=pd.prototype._flushPending;var DE=class extends mt{visitNull(){return I_}visitBool(){return c_}visitInt(){return Ui}visitInt8(){return p_}visitInt16(){return m_}visitInt32(){return y_}visitInt64(){return g_}visitUint8(){return x_}visitUint16(){return b_}visitUint32(){return __}visitUint64(){return w_}visitFloat(){return fu}visitFloat16(){return f_}visitFloat32(){return d_}visitFloat64(){return h_}visitUtf8(){return Zm}visitLargeUtf8(){return Km}visitBinary(){return hd}visitLargeBinary(){return pd}visitFixedSizeBinary(){return km}visitDate(){return lu}visitDateDay(){return Lm}visitDateMillisecond(){return Fm}visitTimestamp(){return ba}visitTimestampSecond(){return qm}visitTimestampMillisecond(){return Vm}visitTimestampMicrosecond(){return Ym}visitTimestampNanosecond(){return Wm}visitTime(){return _a}visitTimeSecond(){return Gm}visitTimeMillisecond(){return Xm}visitTimeMicrosecond(){return Hm}visitTimeNanosecond(){return Qm}visitDecimal(){return Cm}visitList(){return v_}visitStruct(){return T_}visitUnion(){return md}visitDenseUnion(){return E_}visitSparseUnion(){return A_}visitDictionary(){return l_}visitInterval(){return du}visitIntervalDayTime(){return Bm}visitIntervalYearMonth(){return Pm}visitDuration(){return xa}visitDurationSecond(){return Um}visitDurationMillisecond(){return $m}visitDurationMicrosecond(){return zm}visitDurationNanosecond(){return jm}visitFixedSizeList(){return u_}visitMap(){return S_}},CB=new DE;var bt=class extends mt{compareSchemas(t,r){return t===r||r instanceof t.constructor&&this.compareManyFields(t.fields,r.fields)}compareManyFields(t,r){return t===r||Array.isArray(t)&&Array.isArray(r)&&t.length===r.length&&t.every((n,i)=>this.compareFields(n,r[i]))}compareFields(t,r){return t===r||r instanceof t.constructor&&t.name===r.name&&t.nullable===r.nullable&&this.visit(t.type,r.type)}};function _n(e,t){return t instanceof e.constructor}function hu(e,t){return e===t||_n(e,t)}function wa(e,t){return e===t||_n(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function M_(e,t){return e===t||_n(e,t)&&e.precision===t.precision}function tQ(e,t){return e===t||_n(e,t)&&e.byteWidth===t.byteWidth}function LE(e,t){return e===t||_n(e,t)&&e.unit===t.unit}function Jm(e,t){return e===t||_n(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function ty(e,t){return e===t||_n(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function eQ(e,t){return e===t||_n(e,t)&&e.children.length===t.children.length&&Jo.compareManyFields(e.children,t.children)}function rQ(e,t){return e===t||_n(e,t)&&e.children.length===t.children.length&&Jo.compareManyFields(e.children,t.children)}function FE(e,t){return e===t||_n(e,t)&&e.mode===t.mode&&e.typeIds.every((r,n)=>r===t.typeIds[n])&&Jo.compareManyFields(e.children,t.children)}function nQ(e,t){return e===t||_n(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&Jo.visit(e.indices,t.indices)&&Jo.visit(e.dictionary,t.dictionary)}function CE(e,t){return e===t||_n(e,t)&&e.unit===t.unit}function ey(e,t){return e===t||_n(e,t)&&e.unit===t.unit}function iQ(e,t){return e===t||_n(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&Jo.compareManyFields(e.children,t.children)}function oQ(e,t){return e===t||_n(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&Jo.compareManyFields(e.children,t.children)}bt.prototype.visitNull=hu;bt.prototype.visitBool=hu;bt.prototype.visitInt=wa;bt.prototype.visitInt8=wa;bt.prototype.visitInt16=wa;bt.prototype.visitInt32=wa;bt.prototype.visitInt64=wa;bt.prototype.visitUint8=wa;bt.prototype.visitUint16=wa;bt.prototype.visitUint32=wa;bt.prototype.visitUint64=wa;bt.prototype.visitFloat=M_;bt.prototype.visitFloat16=M_;bt.prototype.visitFloat32=M_;bt.prototype.visitFloat64=M_;bt.prototype.visitUtf8=hu;bt.prototype.visitLargeUtf8=hu;bt.prototype.visitBinary=hu;bt.prototype.visitLargeBinary=hu;bt.prototype.visitFixedSizeBinary=tQ;bt.prototype.visitDate=LE;bt.prototype.visitDateDay=LE;bt.prototype.visitDateMillisecond=LE;bt.prototype.visitTimestamp=Jm;bt.prototype.visitTimestampSecond=Jm;bt.prototype.visitTimestampMillisecond=Jm;bt.prototype.visitTimestampMicrosecond=Jm;bt.prototype.visitTimestampNanosecond=Jm;bt.prototype.visitTime=ty;bt.prototype.visitTimeSecond=ty;bt.prototype.visitTimeMillisecond=ty;bt.prototype.visitTimeMicrosecond=ty;bt.prototype.visitTimeNanosecond=ty;bt.prototype.visitDecimal=hu;bt.prototype.visitList=eQ;bt.prototype.visitStruct=rQ;bt.prototype.visitUnion=FE;bt.prototype.visitDenseUnion=FE;bt.prototype.visitSparseUnion=FE;bt.prototype.visitDictionary=nQ;bt.prototype.visitInterval=CE;bt.prototype.visitIntervalDayTime=CE;bt.prototype.visitIntervalYearMonth=CE;bt.prototype.visitDuration=ey;bt.prototype.visitDurationSecond=ey;bt.prototype.visitDurationMillisecond=ey;bt.prototype.visitDurationMicrosecond=ey;bt.prototype.visitDurationNanosecond=ey;bt.prototype.visitFixedSizeList=iQ;bt.prototype.visitMap=oQ;var Jo=new bt;function pu(e,t){return Jo.compareSchemas(e,t)}function kB(e,t){return Jo.compareFields(e,t)}function BB(e,t){return Jo.visit(e,t)}function uu(e){let t=e.type,r=new(CB.getVisitFn(t)())(e);if(t.children&&t.children.length>0){let n=e.children||[],i={nullValues:e.nullValues},o=Array.isArray(n)?(s,a)=>n[a]||i:({name:s})=>n[s]||i;for(let[s,a]of t.children.entries()){let{type:c}=a,l=o(a,s);r.children.push(uu(Object.assign(Object.assign({},l),{type:c})))}}return r}function N_(e,t){return sQ(e,t.map(r=>r.data.concat()))}function sQ(e,t){let r=[...e.fields],n=[],i={numBatches:t.reduce((f,d)=>Math.max(f,d.length),0)},o=0,s=0,a=-1,c=t.length,l,u=[];for(;i.numBatches-- >0;){for(s=Number.POSITIVE_INFINITY,a=-1;++a<c;)u[a]=l=t[a].shift(),s=Math.min(s,l?l.length:s);Number.isFinite(s)&&(u=aQ(r,s,u,t,i),s>0&&(n[o++]=Dt({type:new Re(r),length:s,nullCount:0,children:u.slice()})))}return[e=e.assign(r),n.map(f=>new He(e,f))]}function aQ(e,t,r,n,i){var o;let s=(t+63&-64)>>3;for(let a=-1,c=n.length;++a<c;){let l=r[a],u=l?.length;if(u>=t)u===t?r[a]=l:(r[a]=l.slice(0,t),i.numBatches=Math.max(i.numBatches,n[a].unshift(l.slice(t,u-t))));else{let f=e[a];e[a]=f.clone({nullable:!0}),r[a]=(o=l?._changeLengthAndBackfillNullBitmap(t))!==null&&o!==void 0?o:Dt({type:f.type,length:t,nullCount:t,nullBitmap:new Uint8Array(s)})}}return r}var PB,wn=class e{constructor(...t){var r,n;if(t.length===0)return this.batches=[],this.schema=new me([]),this._offsets=[0],this;let i,o;t[0]instanceof me&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(o=t.pop());let s=c=>{if(c){if(c instanceof He)return[c];if(c instanceof e)return c.batches;if(c instanceof ae){if(c.type instanceof Re)return[new He(new me(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 Gt([c[h]])),f=i??new me(l.map((h,p)=>new jt(String(h),u[p].type,u[p].nullable))),[,d]=N_(f,u);return d.length===0?[new He(c)]:d}}}return[]},a=t.flatMap(c=>s(c));if(i=(n=i??((r=a[0])===null||r===void 0?void 0:r.schema))!==null&&n!==void 0?n:new me([]),!(i instanceof me))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let c of a){if(!(c instanceof He))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!pu(i,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=o??t_(this.data)}get data(){return this.batches.map(({data:t})=>t)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((t,r)=>t+r.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=J1(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(ru(t,this.numRows))}set(t,r){}indexOf(t,r){return-1}[Symbol.iterator](){return this.batches.length>0?cd.visit(new Gt(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
8
+ return true;`)}function KH(e){return typeof e!="bigint"?mo(e):`${mo(e)}n`}function AE(e,t){let r=Math.ceil(e)*t-1;return(r-r%64+64||64)/t}function kB(e,t=0){return e.length>=t?e.subarray(0,t):cm(new e.constructor(t),e,0)}var vo=class{constructor(t,r=0,n=1){this.length=Math.ceil(r/n),this.buffer=new t(this.length),this.stride=n,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t}get byteLength(){return Math.ceil(this.length*this.stride)*this.BYTES_PER_ELEMENT}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(t,r){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;let r=this.stride,n=this.length*r,i=this.buffer.length;n>=i&&this._resize(i===0?AE(n*1,this.BYTES_PER_ELEMENT):AE(n*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=AE(t*this.stride,this.BYTES_PER_ELEMENT);let r=kB(this.buffer,t);return this.clear(),r}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(t){return this.buffer=kB(this.buffer,t)}},ha=class extends vo{last(){return this.get(this.length-1)}get(t){return this.buffer[t]}set(t,r){return this.reserve(t-this.length+1),this.buffer[t*this.stride]=r,this}},cd=class extends ha{constructor(){super(Uint8Array,0,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,r){let{buffer:n}=this.reserve(t-this.length+1),i=t>>3,o=t%8,s=n[i]>>o&1;return r?s===0&&(n[i]|=1<<o,++this.numValid):s===1&&(n[i]&=~(1<<o),--this.numValid),this}clear(){return this.numValid=0,super.clear()}},ld=class extends ha{constructor(t){super(t.OffsetArrayType,1,1)}append(t){return this.set(this.length-1,t)}set(t,r){let n=this.length-1,i=this.reserve(t-n+1).buffer;return n<t++&&n>=0&&i.fill(i[n],n,t),i[t]=i[t-1]+r,this}flush(t=this.length-1){return t>this.length&&this.set(t-1,this.BYTES_PER_ELEMENT>4?BigInt(0):0),super.flush(t+1)}};var Le=class{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t){throw new Error('"throughDOM" not available in this environment')}constructor({type:t,nullValues:r}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=r,this.stride=ui(t),this._nulls=new cd,r&&r.length>0&&(this._isValid=CB(r))}toVector(){return new Gt([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:r,_values:n,_nulls:i,_typeIds:o,children:s}=this;return r&&(t+=r.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),s.reduce((a,c)=>a+c.byteLength,t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((r,n)=>r+n.reservedByteLength,t)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(t){return this.set(this.length,t)}isValid(t){return this._isValid(t)}set(t,r){return this.setValid(t,this.isValid(r))&&this.setValue(t,r),this}setValue(t,r){this._setValue(this,t,r)}setValid(t,r){return this.length=this._nulls.set(t,+r).length,r}addChild(t,r=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(t){return this.children[t]||null}flush(){let t,r,n,i,{type:o,length:s,nullCount:a,_typeIds:c,_offsets:l,_values:u,_nulls:f}=this;(r=c?.flush(s))?i=l?.flush(s):(i=l?.flush(s))?t=u?.flush(l.last()):t=u?.flush(s),a>0&&(n=f?.flush(s));let d=this.children.map(h=>h.flush());return this.clear(),Dt({type:o,length:s,nullCount:a,children:d,child:d[0],data:t,typeIds:r,nullBitmap:n,valueOffsets:i})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,r,n,i;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(r=this._values)===null||r===void 0||r.clear(),(n=this._offsets)===null||n===void 0||n.clear(),(i=this._typeIds)===null||i===void 0||i.clear();for(let o of this.children)o.clear();return this}};Le.prototype.length=1;Le.prototype.stride=1;Le.prototype.children=null;Le.prototype.finished=!1;Le.prototype.nullValues=null;Le.prototype._isValid=()=>!0;var ar=class extends Le{constructor(t){super(t),this._values=new ha(this.ArrayType,0,this.stride)}setValue(t,r){let n=this._values;return n.reserve(t-n.length+1),super.setValue(t,r)}},Vn=class extends Le{constructor(t){super(t),this._pendingLength=0,this._offsets=new ld(t.type)}setValue(t,r){let n=this._pending||(this._pending=new Map),i=n.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=r instanceof Qo?r[Lc].length:r.length,n.set(t,r)}setValid(t,r){return super.setValid(t,r)?!0:((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){let t=this._pending,r=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,r),this}};var cu=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,r,n,i){return t.prep(8,24),t.writeInt64(BigInt(i??0)),t.pad(4),t.writeInt32(n),t.writeInt64(BigInt(r??0)),t.offset()}};var fi=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFooter(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):he.V1}schema(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new qn).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}dictionaries(t,r){let n=this.bb.__offset(this.bb_pos,8);return n?(r||new cu).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}dictionariesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,r){let n=this.bb.__offset(this.bb_pos,10);return n?(r||new cu).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}recordBatchesLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,12);return n?(r||new br).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,r){t.addFieldInt16(0,r,he.V1)}static addSchema(t,r){t.addFieldOffset(1,r,0)}static addDictionaries(t,r){t.addFieldOffset(2,r,0)}static startDictionariesVector(t,r){t.startVector(24,r,8)}static addRecordBatches(t,r){t.addFieldOffset(3,r,0)}static startRecordBatchesVector(t,r){t.startVector(24,r,8)}static addCustomMetadata(t,r){t.addFieldOffset(4,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,r){t.finish(r)}static finishSizePrefixedFooterBuffer(t,r){t.finish(r,void 0,!0)}};var me=class e{constructor(t=[],r,n,i=he.V5){this.fields=t||[],this.metadata=r||new Map,n||(n=EE(this.fields)),this.dictionaries=n,this.metadataVersion=i}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,r)=>`${r}: ${t}`).join(", ")} }>`}select(t){let r=new Set(t),n=this.fields.filter(i=>r.has(i.name));return new e(n,this.metadata)}selectAt(t){let r=t.map(n=>this.fields[n]).filter(Boolean);return new e(r,this.metadata)}assign(...t){let r=t[0]instanceof e?t[0]:Array.isArray(t[0])?new e(t[0]):new e(t),n=[...this.fields],i=s_(s_(new Map,this.metadata),r.metadata),o=r.fields.filter(a=>{let c=n.findIndex(l=>l.name===a.name);return~c?(n[c]=a.clone({metadata:s_(s_(new Map,n[c].metadata),a.metadata)}))&&!1:!0}),s=EE(o,new Map);return new e([...n,...o],i,new Map([...this.dictionaries,...s]))}};me.prototype.fields=null;me.prototype.metadata=null;me.prototype.dictionaries=null;var jt=class e{static new(...t){let[r,n,i,o]=t;return t[0]&&typeof t[0]=="object"&&({name:r}=t[0],n===void 0&&(n=t[0].type),i===void 0&&(i=t[0].nullable),o===void 0&&(o=t[0].metadata)),new e(`${r}`,n,i,o)}constructor(t,r,n=!1,i){this.name=t,this.type=r,this.nullable=n,this.metadata=i||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[r,n,i,o]=t;return!t[0]||typeof t[0]!="object"?[r=this.name,n=this.type,i=this.nullable,o=this.metadata]=t:{name:r=this.name,type:n=this.type,nullable:i=this.nullable,metadata:o=this.metadata}=t[0],e.new(r,n,i,o)}};jt.prototype.type=null;jt.prototype.name=null;jt.prototype.nullable=null;jt.prototype.metadata=null;function s_(e,t){return new Map([...e||new Map,...t||new Map])}function EE(e,t=new Map){for(let r=-1,n=e.length;++r<n;){let o=e[r].type;if(K.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&&EE(o.children,t)}return t}var JH=ru,tQ=ai,pa=class{static decode(t){t=new tQ(It(t));let r=fi.getRootAsFooter(t),n=me.decode(r.schema(),new Map,r.version());return new ME(n,r)}static encode(t){let r=new JH,n=me.encode(r,t.schema);fi.startRecordBatchesVector(r,t.numRecordBatches);for(let s of[...t.recordBatches()].slice().reverse())ma.encode(r,s);let i=r.endVector();fi.startDictionariesVector(r,t.numDictionaries);for(let s of[...t.dictionaryBatches()].slice().reverse())ma.encode(r,s);let o=r.endVector();return fi.startFooter(r),fi.addSchema(r,n),fi.addVersion(r,he.V5),fi.addRecordBatches(r,i),fi.addDictionaries(r,o),fi.finishFooterBuffer(r,fi.endFooter(r)),r.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,r=he.V5,n,i){this.schema=t,this.version=r,n&&(this._recordBatches=n),i&&(this._dictionaryBatches=i)}*recordBatches(){for(let t,r=-1,n=this.numRecordBatches;++r<n;)(t=this.getRecordBatch(r))&&(yield t)}*dictionaryBatches(){for(let t,r=-1,n=this.numDictionaries;++r<n;)(t=this.getDictionaryBatch(r))&&(yield t)}getRecordBatch(t){return t>=0&&t<this.numRecordBatches&&this._recordBatches[t]||null}getDictionaryBatch(t){return t>=0&&t<this.numDictionaries&&this._dictionaryBatches[t]||null}};var ME=class extends pa{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(t,r){super(t,r.version()),this._footer=r}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){let r=this._footer.recordBatches(t);if(r)return ma.decode(r)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let r=this._footer.dictionaries(t);if(r)return ma.decode(r)}return null}},ma=class e{static decode(t){return new e(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,r){let{metaDataLength:n}=r,i=BigInt(r.offset),o=BigInt(r.bodyLength);return cu.createBlock(t,i,n,o)}constructor(t,r,n){this.metaDataLength=t,this.offset=re(n),this.bodyLength=re(r)}};var De=Object.freeze({done:!0,value:void 0}),Mm=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},lu=class{tee(){return this._getDOMStream().tee()}pipe(t,r){return this._getNodeStream().pipe(t,r)}pipeTo(t,r){return this._getDOMStream().pipeTo(t,r)}pipeThrough(t,r){return this._getDOMStream().pipeThrough(t,r)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}},a_=class extends lu{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return Q(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(De);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return qr.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return qr.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return Q(this,void 0,void 0,function*(){return yield this.abort(t),De})}return(t){return Q(this,void 0,void 0,function*(){return yield this.close(),De})}read(t){return Q(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return Q(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((r,n)=>{this.resolvers.push({resolve:r,reject:n})}):Promise.resolve(De)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var Zo=class extends a_{write(t){if((t=It(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?sm(this.toUint8Array(!0)):this.toUint8Array(!1).then(sm)}toUint8Array(t=!1){return t?si(this._values)[0]:Q(this,void 0,void 0,function*(){var r,n,i,o;let s=[],a=0;try{for(var c=!0,l=ao(this),u;u=yield l.next(),r=u.done,!r;c=!0){o=u.value,c=!1;let f=o;s.push(f),a+=f.byteLength}}catch(f){n={error:f}}finally{try{!c&&!r&&(i=l.return)&&(yield i.call(l))}finally{if(n)throw n.error}}return si(s,a)[0]})}},Ko=class{constructor(t){t&&(this.source=new NE(qr.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)}},Pi=class e{constructor(t){t instanceof e?this.source=t.source:t instanceof Zo?this.source=new ya(qr.fromAsyncIterable(t)):y1(t)?this.source=new ya(qr.fromNodeStream(t)):am(t)?this.source=new ya(qr.fromDOMStream(t)):p1(t)?this.source=new ya(qr.fromDOMStream(t.body)):lo(t)?this.source=new ya(qr.fromIterable(t)):co(t)?this.source=new ya(qr.fromAsyncIterable(t)):Fi(t)&&(this.source=new ya(qr.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)}},NE=class{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,r="read"){return this.source.next({cmd:r,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||De)}return(t){return Object.create(this.source.return&&this.source.return(t)||De)}},ya=class{constructor(t){this.source=t,this._closedPromise=new Promise(r=>this._closedPromiseResolve=r)}cancel(t){return Q(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return Q(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return Q(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t){return Q(this,arguments,void 0,function*(r,n="read"){return yield this.source.next({cmd:n,size:r})})}throw(t){return Q(this,void 0,void 0,function*(){let r=this.source.throw&&(yield this.source.throw(t))||De;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}return(t){return Q(this,void 0,void 0,function*(){let r=this.source.return&&(yield this.source.return(t))||De;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}};var Nm=class extends Ko{constructor(t,r){super(),this.position=0,this.buffer=It(t),this.size=r===void 0?this.buffer.byteLength:r}readInt32(t){let{buffer:r,byteOffset:n}=this.readAt(t,4);return new DataView(r,n).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){let{buffer:r,size:n,position:i}=this;return r&&i<n?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(n,i+Math.min(n-i,t)),r.subarray(i,this.position)):null}readAt(t,r){let n=this.buffer,i=Math.min(this.size,t+r);return n?n.subarray(t,i):new Uint8Array(r)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}},Cc=class extends Pi{constructor(t,r){super(),this.position=0,this._handle=t,typeof r=="number"?this.size=r:this._pending=Q(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return Q(this,void 0,void 0,function*(){let{buffer:r,byteOffset:n}=yield this.readAt(t,4);return new DataView(r,n).getInt32(0,!0)})}seek(t){return Q(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 Q(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:r,size:n,position:i}=this;if(r&&i<n){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let o=i,s=0,a=0,c=Math.min(n,o+Math.min(n-o,t)),l=new Uint8Array(Math.max(0,(this.position=c)-o));for(;(o+=a)<c&&(s+=a)<l.byteLength;)({bytesRead:a}=yield r.read(l,s,l.byteLength-s,o));return l}return null})}readAt(t,r){return Q(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:n,size:i}=this;if(n&&t+r<i){let o=Math.min(i,t+r),s=new Uint8Array(o-t);return(yield n.read(s,0,r,t)).buffer}return new Uint8Array(r)})}close(){return Q(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return Q(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return Q(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var RE={};Jn(RE,{BaseInt64:()=>Om,Int128:()=>Rm,Int64:()=>ga,Uint64:()=>je});function ud(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}var fd=8,OE=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],Om=class{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){let r=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]),i=r[3]*n[3];this.buffer[0]=i&65535;let o=i>>>16;return i=r[2]*n[3],o+=i,i=r[3]*n[2]>>>0,o+=i,this.buffer[0]+=o<<16,this.buffer[1]=o>>>0<i?65536:0,this.buffer[1]+=o>>>16,this.buffer[1]+=r[1]*n[3]+r[2]*n[2]+r[3]*n[1],this.buffer[1]+=r[0]*n[3]+r[1]*n[2]+r[2]*n[1]+r[3]*n[0]<<16,this}_plus(t){let r=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],r<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=r}lessThan(t){return this.buffer[1]<t.buffer[1]||this.buffer[1]===t.buffer[1]&&this.buffer[0]<t.buffer[0]}equals(t){return this.buffer[1]===t.buffer[1]&&this.buffer[0]==t.buffer[0]}greaterThan(t){return t.lessThan(this)}hex(){return`${ud(this.buffer[1])} ${ud(this.buffer[0])}`}},je=class e extends Om{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,r=new Uint32Array(2)){return e.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(2)){return e.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(2)){let n=t.length,i=new e(r);for(let o=0;o<n;){let s=fd<n-o?fd:n-o,a=new e(new Uint32Array([Number.parseInt(t.slice(o,o+s),10),0])),c=new e(new Uint32Array([OE[s],0]));i.times(c),i.plus(a),o+=s}return i}static convertArray(t){let r=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)e.from(t[n],new Uint32Array(r.buffer,r.byteOffset+2*n*4,2));return r}static multiply(t,r){return new e(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new e(new Uint32Array(t.buffer)).plus(r)}},ga=class e extends Om{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(t){return this._times(t),this}plus(t){return this._plus(t),this}lessThan(t){let r=this.buffer[1]<<0,n=t.buffer[1]<<0;return r<n||r===n&&this.buffer[0]<t.buffer[0]}static from(t,r=new Uint32Array(2)){return e.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(2)){return e.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(2)){let n=t.startsWith("-"),i=t.length,o=new e(r);for(let s=n?1:0;s<i;){let a=fd<i-s?fd:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0])),l=new e(new Uint32Array([OE[a],0]));o.times(l),o.plus(c),s+=a}return n?o.negate():o}static convertArray(t){let r=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)e.from(t[n],new Uint32Array(r.buffer,r.byteOffset+2*n*4,2));return r}static multiply(t,r){return new e(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new e(new Uint32Array(t.buffer)).plus(r)}},Rm=class e{constructor(t){this.buffer=t}high(){return new ga(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new ga(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(t){let r=new je(new Uint32Array([this.buffer[3],0])),n=new je(new Uint32Array([this.buffer[2],0])),i=new je(new Uint32Array([this.buffer[1],0])),o=new je(new Uint32Array([this.buffer[0],0])),s=new je(new Uint32Array([t.buffer[3],0])),a=new je(new Uint32Array([t.buffer[2],0])),c=new je(new Uint32Array([t.buffer[1],0])),l=new je(new Uint32Array([t.buffer[0],0])),u=je.multiply(o,l);this.buffer[0]=u.low();let f=new je(new Uint32Array([u.high(),0]));return u=je.multiply(i,l),f.plus(u),u=je.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 je(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(je.multiply(n,l)).plus(je.multiply(i,c)).plus(je.multiply(o,a)),this.buffer[3]+=je.multiply(r,l).plus(je.multiply(n,c)).plus(je.multiply(i,a)).plus(je.multiply(o,s)).low(),this}plus(t){let r=new Uint32Array(4);return r[3]=this.buffer[3]+t.buffer[3]>>>0,r[2]=this.buffer[2]+t.buffer[2]>>>0,r[1]=this.buffer[1]+t.buffer[1]>>>0,r[0]=this.buffer[0]+t.buffer[0]>>>0,r[0]<this.buffer[0]>>>0&&++r[1],r[1]<this.buffer[1]>>>0&&++r[2],r[2]<this.buffer[2]>>>0&&++r[3],this.buffer[3]=r[3],this.buffer[2]=r[2],this.buffer[1]=r[1],this.buffer[0]=r[0],this}hex(){return`${ud(this.buffer[3])} ${ud(this.buffer[2])} ${ud(this.buffer[1])} ${ud(this.buffer[0])}`}static multiply(t,r){return new e(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new e(new Uint32Array(t.buffer)).plus(r)}static from(t,r=new Uint32Array(4)){return e.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(4)){return e.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(4)){let n=t.startsWith("-"),i=t.length,o=new e(r);for(let s=n?1:0;s<i;){let a=fd<i-s?fd:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0,0,0])),l=new e(new Uint32Array([OE[a],0,0,0]));o.times(l),o.plus(c),s+=a}return n?o.negate():o}static convertArray(t){let r=new Uint32Array(t.length*4);for(let n=-1,i=t.length;++n<i;)e.from(t[n],new Uint32Array(r.buffer,r.byteOffset+4*4*n,4));return r}};var Dm=class extends mt{constructor(t,r,n,i,o=he.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=r,this.buffers=n,this.dictionaries=i,this.metadataVersion=o}visit(t){return super.visit(t instanceof jt?t.type:t)}visitNull(t,{length:r}=this.nextFieldNode()){return Dt({type:t,length:r})}visitBool(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitInt(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFloat(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitUtf8(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeUtf8(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeBinary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitFixedSizeBinary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDate(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTimestamp(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTime(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDecimal(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitList(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),children:this.visitMany(t.children)})}visitUnion(t,{length:r,nullCount:n}=this.nextFieldNode()){return this.metadataVersion<he.V5&&this.readNullBitmap(t,n),t.mode===Se.Sparse?this.visitSparseUnion(t,{length:r,nullCount:n}):this.visitDenseUnion(t,{length:r,nullCount:n})}visitDenseUnion(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDuration(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFixedSizeList(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),child:this.visit(t.children[0])})}visitMap(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,r,n=this.nextBufferRange()){return r>0&&this.readData(t,n)||new Uint8Array(0)}readOffsets(t,r){return this.readData(t,r)}readTypeIds(t,r){return this.readData(t,r)}readData(t,{length:r,offset:n}=this.nextBufferRange()){return this.bytes.subarray(n,n+r)}readDictionary(t){return this.dictionaries.get(t.id)}},c_=class extends Dm{constructor(t,r,n,i,o){super(new Uint8Array(0),r,n,i,o),this.sources=t}readNullBitmap(t,r,{offset:n}=this.nextBufferRange()){return r<=0?new Uint8Array(0):su(this.sources[n])}readOffsets(t,{offset:r}=this.nextBufferRange()){return zt(Uint8Array,zt(t.OffsetArrayType,this.sources[r]))}readTypeIds(t,{offset:r}=this.nextBufferRange()){return zt(Uint8Array,zt(t.ArrayType,this.sources[r]))}readData(t,{offset:r}=this.nextBufferRange()){let{sources:n}=this;return K.isTimestamp(t)?zt(Uint8Array,ga.convertArray(n[r])):(K.isInt(t)||K.isTime(t))&&t.bitWidth===64||K.isDuration(t)?zt(Uint8Array,ga.convertArray(n[r])):K.isDate(t)&&t.unit===Xe.MILLISECOND?zt(Uint8Array,ga.convertArray(n[r])):K.isDecimal(t)?zt(Uint8Array,Rm.convertArray(n[r])):K.isBinary(t)||K.isLargeBinary(t)||K.isFixedSizeBinary(t)?eQ(n[r]):K.isBool(t)?su(n[r]):K.isUtf8(t)||K.isLargeUtf8(t)?Vo(n[r].join("")):zt(Uint8Array,zt(t.ArrayType,n[r].map(i=>+i)))}};function eQ(e){let t=e.join(""),r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n>>1]=Number.parseInt(t.slice(n,n+2),16);return r}var dd=class extends Vn{constructor(t){super(t),this._values=new vo(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,It(r))}_flushPending(t,r){let n=this._offsets,i=this._values.reserve(r).buffer,o=0;for(let[s,a]of t)if(a===void 0)n.set(s,0);else{let c=a.length;i.set(a,o),n.set(s,c),o+=c}}};var hd=class extends Vn{constructor(t){super(t),this._values=new vo(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,It(r))}_flushPending(t,r){let n=this._offsets,i=this._values.reserve(r).buffer,o=0;for(let[s,a]of t)if(a===void 0)n.set(s,BigInt(0));else{let c=a.length;i.set(a,o),n.set(s,BigInt(c)),o+=c}}};var l_=class extends Le{constructor(t){super(t),this._values=new cd}setValue(t,r){this._values.set(t,+r)}};var uu=class extends ar{};uu.prototype._setValue=uE;var Lm=class extends uu{};Lm.prototype._setValue=C1;var Fm=class extends uu{};Fm.prototype._setValue=k1;var Cm=class extends ar{};Cm.prototype._setValue=hE;var u_=class extends Le{constructor({type:t,nullValues:r,dictionaryHashFunction:n}){super({type:new li(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=fu({type:this.type.indices,nullValues:r}),this.dictionary=fu({type:this.type.dictionary,nullValues:null}),typeof n=="function"&&(this.valueToKey=n)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,r){let n=this.indices;return r=n.setValid(t,r),this.length=n.length,r}setValue(t,r){let n=this._keysToIndices,i=this.valueToKey(r),o=n[i];return o===void 0&&(n[i]=o=this._dictionaryOffset+this.dictionary.append(r).length-1),this.indices.setValue(t,o)}flush(){let t=this.type,r=this._dictionary,n=this.dictionary.toVector(),i=this.indices.flush().clone(t);return i.dictionary=r?r.concat(n):n,this.finished||(this._dictionaryOffset+=n.length),this._dictionary=i.dictionary,this.clear(),i}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(t){return typeof t=="string"?t:`${t}`}};var km=class extends ar{};km.prototype._setValue=lE;var f_=class extends Le{setValue(t,r){let[n]=this.children,i=t*this.stride;for(let o=-1,s=r.length;++o<s;)n.set(i+o,r[o])}addChild(t,r="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");let n=this.children.push(t);return this.type=new bo(this.type.listSize,new jt(r,t.type,!0)),n}};var du=class extends ar{setValue(t,r){this._values.set(t,r)}},d_=class extends du{setValue(t,r){super.setValue(t,Sm(r))}},h_=class extends du{},p_=class extends du{};var hu=class extends ar{};hu.prototype._setValue=pE;var Bm=class extends hu{};Bm.prototype._setValue=Y1;var Pm=class extends hu{};Pm.prototype._setValue=W1;var xa=class extends ar{};xa.prototype._setValue=mE;var Um=class extends xa{};Um.prototype._setValue=G1;var $m=class extends xa{};$m.prototype._setValue=X1;var zm=class extends xa{};zm.prototype._setValue=H1;var jm=class extends xa{};jm.prototype._setValue=Q1;var Ui=class extends ar{setValue(t,r){this._values.set(t,r)}},m_=class extends Ui{},y_=class extends Ui{},g_=class extends Ui{},x_=class extends Ui{},b_=class extends Ui{},__=class extends Ui{},w_=class extends Ui{},v_=class extends Ui{};var S_=class extends Vn{constructor(t){super(t),this._offsets=new ld(t.type)}addChild(t,r="0"){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new go(new jt(r,t.type,!0)),this.numChildren-1}_flushPending(t){let r=this._offsets,[n]=this.children;for(let[i,o]of t)if(typeof o>"u")r.set(i,0);else{let s=o,a=s.length,c=r.set(i,a).buffer[i];for(let l=-1;++l<a;)n.set(c+l,s[l])}}};var I_=class extends Vn{set(t,r){return super.set(t,r)}setValue(t,r){let n=r instanceof Map?r:new Map(Object.entries(r)),i=this._pending||(this._pending=new Map),o=i.get(t);o&&(this._pendingLength-=o.size),this._pendingLength+=n.size,i.set(t,n)}addChild(t,r=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new _o(new jt(r,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let r=this._offsets,[n]=this.children;for(let[i,o]of t)if(o===void 0)r.set(i,0);else{let{[i]:s,[i+1]:a}=r.set(i,o.size).buffer;for(let c of o.entries())if(n.set(s,c),++s>=a)break}}};var T_=class extends Le{setValue(t,r){}setValid(t,r){return this.length=Math.max(t+1,this.length),r}};var A_=class extends Le{setValue(t,r){let{children:n,type:i}=this;switch(Array.isArray(r)||r.constructor){case!0:return i.children.forEach((o,s)=>n[s].set(t,r[s]));case Map:return i.children.forEach((o,s)=>n[s].set(t,r.get(o.name)));default:return i.children.forEach((o,s)=>n[s].set(t,r[o.name]))}}setValid(t,r){return super.setValid(t,r)||this.children.forEach(n=>n.setValid(t,r)),r}addChild(t,r=`${this.numChildren}`){let n=this.children.push(t);return this.type=new Re([...this.type.children,new jt(r,t.type,!0)]),n}};var ba=class extends ar{};ba.prototype._setValue=fE;var qm=class extends ba{};qm.prototype._setValue=B1;var Vm=class extends ba{};Vm.prototype._setValue=P1;var Ym=class extends ba{};Ym.prototype._setValue=U1;var Wm=class extends ba{};Wm.prototype._setValue=$1;var _a=class extends ar{};_a.prototype._setValue=dE;var Gm=class extends _a{};Gm.prototype._setValue=z1;var Xm=class extends _a{};Xm.prototype._setValue=j1;var Hm=class extends _a{};Hm.prototype._setValue=q1;var Qm=class extends _a{};Qm.prototype._setValue=V1;var pd=class extends Le{constructor(t){super(t),this._typeIds=new ha(Int8Array,0,1),typeof t.valueToChildTypeId=="function"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,r){return this.set(this.length,t,r)}set(t,r,n){return n===void 0&&(n=this._valueToChildTypeId(this,r,t)),this.setValue(t,r,n),this}setValue(t,r,n){this._typeIds.set(t,n);let i=this.type.typeIdToChildIndex[n],o=this.children[i];o?.set(t,r)}addChild(t,r=`${this.children.length}`){let n=this.children.push(t),{type:{children:i,mode:o,typeIds:s}}=this,a=[...i,new jt(r,t.type)];return this.type=new xo(o,[...s,n],a),n}_valueToChildTypeId(t,r,n){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}},E_=class extends pd{},M_=class extends pd{constructor(t){super(t),this._offsets=new ha(Int32Array)}setValue(t,r,n){let i=this._typeIds.set(t,n).buffer[t],o=this.getChildAt(this.type.typeIdToChildIndex[i]),s=this._offsets.set(t,o.length).buffer[t];o?.set(s,r)}};var Zm=class extends Vn{constructor(t){super(t),this._values=new vo(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,Vo(r))}_flushPending(t,r){}};Zm.prototype._flushPending=dd.prototype._flushPending;var Km=class extends Vn{constructor(t){super(t),this._values=new vo(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,Vo(r))}_flushPending(t,r){}};Km.prototype._flushPending=hd.prototype._flushPending;var DE=class extends mt{visitNull(){return T_}visitBool(){return l_}visitInt(){return Ui}visitInt8(){return m_}visitInt16(){return y_}visitInt32(){return g_}visitInt64(){return x_}visitUint8(){return b_}visitUint16(){return __}visitUint32(){return w_}visitUint64(){return v_}visitFloat(){return du}visitFloat16(){return d_}visitFloat32(){return h_}visitFloat64(){return p_}visitUtf8(){return Zm}visitLargeUtf8(){return Km}visitBinary(){return dd}visitLargeBinary(){return hd}visitFixedSizeBinary(){return km}visitDate(){return uu}visitDateDay(){return Lm}visitDateMillisecond(){return Fm}visitTimestamp(){return ba}visitTimestampSecond(){return qm}visitTimestampMillisecond(){return Vm}visitTimestampMicrosecond(){return Ym}visitTimestampNanosecond(){return Wm}visitTime(){return _a}visitTimeSecond(){return Gm}visitTimeMillisecond(){return Xm}visitTimeMicrosecond(){return Hm}visitTimeNanosecond(){return Qm}visitDecimal(){return Cm}visitList(){return S_}visitStruct(){return A_}visitUnion(){return pd}visitDenseUnion(){return M_}visitSparseUnion(){return E_}visitDictionary(){return u_}visitInterval(){return hu}visitIntervalDayTime(){return Bm}visitIntervalYearMonth(){return Pm}visitDuration(){return xa}visitDurationSecond(){return Um}visitDurationMillisecond(){return $m}visitDurationMicrosecond(){return zm}visitDurationNanosecond(){return jm}visitFixedSizeList(){return f_}visitMap(){return I_}},BB=new DE;var bt=class extends mt{compareSchemas(t,r){return t===r||r instanceof t.constructor&&this.compareManyFields(t.fields,r.fields)}compareManyFields(t,r){return t===r||Array.isArray(t)&&Array.isArray(r)&&t.length===r.length&&t.every((n,i)=>this.compareFields(n,r[i]))}compareFields(t,r){return t===r||r instanceof t.constructor&&t.name===r.name&&t.nullable===r.nullable&&this.visit(t.type,r.type)}};function _n(e,t){return t instanceof e.constructor}function pu(e,t){return e===t||_n(e,t)}function wa(e,t){return e===t||_n(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function N_(e,t){return e===t||_n(e,t)&&e.precision===t.precision}function rQ(e,t){return e===t||_n(e,t)&&e.byteWidth===t.byteWidth}function LE(e,t){return e===t||_n(e,t)&&e.unit===t.unit}function Jm(e,t){return e===t||_n(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function ty(e,t){return e===t||_n(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function nQ(e,t){return e===t||_n(e,t)&&e.children.length===t.children.length&&Jo.compareManyFields(e.children,t.children)}function iQ(e,t){return e===t||_n(e,t)&&e.children.length===t.children.length&&Jo.compareManyFields(e.children,t.children)}function FE(e,t){return e===t||_n(e,t)&&e.mode===t.mode&&e.typeIds.every((r,n)=>r===t.typeIds[n])&&Jo.compareManyFields(e.children,t.children)}function oQ(e,t){return e===t||_n(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&Jo.visit(e.indices,t.indices)&&Jo.visit(e.dictionary,t.dictionary)}function CE(e,t){return e===t||_n(e,t)&&e.unit===t.unit}function ey(e,t){return e===t||_n(e,t)&&e.unit===t.unit}function sQ(e,t){return e===t||_n(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&Jo.compareManyFields(e.children,t.children)}function aQ(e,t){return e===t||_n(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&Jo.compareManyFields(e.children,t.children)}bt.prototype.visitNull=pu;bt.prototype.visitBool=pu;bt.prototype.visitInt=wa;bt.prototype.visitInt8=wa;bt.prototype.visitInt16=wa;bt.prototype.visitInt32=wa;bt.prototype.visitInt64=wa;bt.prototype.visitUint8=wa;bt.prototype.visitUint16=wa;bt.prototype.visitUint32=wa;bt.prototype.visitUint64=wa;bt.prototype.visitFloat=N_;bt.prototype.visitFloat16=N_;bt.prototype.visitFloat32=N_;bt.prototype.visitFloat64=N_;bt.prototype.visitUtf8=pu;bt.prototype.visitLargeUtf8=pu;bt.prototype.visitBinary=pu;bt.prototype.visitLargeBinary=pu;bt.prototype.visitFixedSizeBinary=rQ;bt.prototype.visitDate=LE;bt.prototype.visitDateDay=LE;bt.prototype.visitDateMillisecond=LE;bt.prototype.visitTimestamp=Jm;bt.prototype.visitTimestampSecond=Jm;bt.prototype.visitTimestampMillisecond=Jm;bt.prototype.visitTimestampMicrosecond=Jm;bt.prototype.visitTimestampNanosecond=Jm;bt.prototype.visitTime=ty;bt.prototype.visitTimeSecond=ty;bt.prototype.visitTimeMillisecond=ty;bt.prototype.visitTimeMicrosecond=ty;bt.prototype.visitTimeNanosecond=ty;bt.prototype.visitDecimal=pu;bt.prototype.visitList=nQ;bt.prototype.visitStruct=iQ;bt.prototype.visitUnion=FE;bt.prototype.visitDenseUnion=FE;bt.prototype.visitSparseUnion=FE;bt.prototype.visitDictionary=oQ;bt.prototype.visitInterval=CE;bt.prototype.visitIntervalDayTime=CE;bt.prototype.visitIntervalYearMonth=CE;bt.prototype.visitDuration=ey;bt.prototype.visitDurationSecond=ey;bt.prototype.visitDurationMillisecond=ey;bt.prototype.visitDurationMicrosecond=ey;bt.prototype.visitDurationNanosecond=ey;bt.prototype.visitFixedSizeList=sQ;bt.prototype.visitMap=aQ;var Jo=new bt;function mu(e,t){return Jo.compareSchemas(e,t)}function PB(e,t){return Jo.compareFields(e,t)}function UB(e,t){return Jo.visit(e,t)}function fu(e){let t=e.type,r=new(BB.getVisitFn(t)())(e);if(t.children&&t.children.length>0){let n=e.children||[],i={nullValues:e.nullValues},o=Array.isArray(n)?(s,a)=>n[a]||i:({name:s})=>n[s]||i;for(let[s,a]of t.children.entries()){let{type:c}=a,l=o(a,s);r.children.push(fu(Object.assign(Object.assign({},l),{type:c})))}}return r}function O_(e,t){return cQ(e,t.map(r=>r.data.concat()))}function cQ(e,t){let r=[...e.fields],n=[],i={numBatches:t.reduce((f,d)=>Math.max(f,d.length),0)},o=0,s=0,a=-1,c=t.length,l,u=[];for(;i.numBatches-- >0;){for(s=Number.POSITIVE_INFINITY,a=-1;++a<c;)u[a]=l=t[a].shift(),s=Math.min(s,l?l.length:s);Number.isFinite(s)&&(u=lQ(r,s,u,t,i),s>0&&(n[o++]=Dt({type:new Re(r),length:s,nullCount:0,children:u.slice()})))}return[e=e.assign(r),n.map(f=>new He(e,f))]}function lQ(e,t,r,n,i){var o;let s=(t+63&-64)>>3;for(let a=-1,c=n.length;++a<c;){let l=r[a],u=l?.length;if(u>=t)u===t?r[a]=l:(r[a]=l.slice(0,t),i.numBatches=Math.max(i.numBatches,n[a].unshift(l.slice(t,u-t))));else{let f=e[a];e[a]=f.clone({nullable:!0}),r[a]=(o=l?._changeLengthAndBackfillNullBitmap(t))!==null&&o!==void 0?o:Dt({type:f.type,length:t,nullCount:t,nullBitmap:new Uint8Array(s)})}}return r}var $B,wn=class e{constructor(...t){var r,n;if(t.length===0)return this.batches=[],this.schema=new me([]),this._offsets=[0],this;let i,o;t[0]instanceof me&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(o=t.pop());let s=c=>{if(c){if(c instanceof He)return[c];if(c instanceof e)return c.batches;if(c instanceof ae){if(c.type instanceof Re)return[new He(new me(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 Gt([c[h]])),f=i??new me(l.map((h,p)=>new jt(String(h),u[p].type,u[p].nullable))),[,d]=O_(f,u);return d.length===0?[new He(c)]:d}}}return[]},a=t.flatMap(c=>s(c));if(i=(n=i??((r=a[0])===null||r===void 0?void 0:r.schema))!==null&&n!==void 0?n:new me([]),!(i instanceof me))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let c of a){if(!(c instanceof He))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!mu(i,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=o??e_(this.data)}get data(){return this.batches.map(({data:t})=>t)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((t,r)=>t+r.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=t_(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(nu(t,this.numRows))}set(t,r){}indexOf(t,r){return-1}[Symbol.iterator](){return this.batches.length>0?ad.visit(new Gt(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
9
9
  ${this.toArray().join(`,
10
10
  `)}
11
- ]`}concat(...t){let r=this.schema,n=this.data.concat(t.flatMap(({data:i})=>i));return new e(r,n.map(i=>new He(r,i)))}slice(t,r){let n=this.schema;[t,r]=Im({length:this.numRows},t,r);let i=e_(this.data,this._offsets,t,r);return new e(n,i.map(o=>new He(n,o)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(r=>r.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let r=this.data.map(n=>n.children[t]);if(r.length===0){let{type:n}=this.schema.fields[t],i=Dt({type:n,length:0,nullCount:0});r.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new Gt(r)}return null}setChild(t,r){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),r)}setChildAt(t,r){let n=this.schema,i=[...this.batches];if(t>-1&&t<this.numCols){r||(r=new Gt([Dt({type:new bn,length:this.numRows})]));let o=n.fields.slice(),s=o[t].clone({type:r.type}),a=this.schema.fields.map((c,l)=>this.getChildAt(l));[o[t],a[t]]=[s,r],[n,i]=N_(n,a)}return new e(n,i)}select(t){let r=this.schema.fields.reduce((n,i,o)=>n.set(i.name,o),new Map);return this.selectAt(t.map(n=>r.get(n)).filter(n=>n>-1))}selectAt(t){let r=this.schema.selectAt(t),n=this.batches.map(i=>i.selectAt(t));return new e(r,n)}assign(t){let r=this.schema.fields,[n,i]=t.schema.fields.reduce((a,c,l)=>{let[u,f]=a,d=r.findIndex(h=>h.name===c.name);return~d?f[d]=l:u.push(l),a},[[],[]]),o=this.schema.assign(t.schema),s=[...r.map((a,c)=>[c,i[c]]).map(([a,c])=>c===void 0?this.getChildAt(a):t.getChildAt(c)),...n.map(a=>t.getChildAt(a))].filter(Boolean);return new e(...N_(o,s))}};PB=Symbol.toStringTag;wn[PB]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e.isValid=ad(Em),e.get=ad(sr.getVisitFn(D.Struct)),e.set=r_(Vr.getVisitFn(D.Struct)),e.indexOf=n_(su.getVisitFn(D.Struct)),"Table"))(wn.prototype);var $B,He=class e{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof me))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=Dt({nullCount:0,type:new Re(this.schema.fields),children:this.schema.fields.map(r=>Dt({type:r.type,nullCount:0}))})]=t,!(this.data instanceof ae))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=UB(this.schema,this.data.children);break}case 1:{let[r]=t,{fields:n,children:i,length:o}=Object.keys(r).reduce((c,l,u)=>(c.children[u]=r[l],c.length=Math.max(c.length,r[l].length),c.fields[u]=jt.new({name:l,type:r[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),s=new me(n),a=Dt({type:new Re(n),length:o,children:i,nullCount:0});[this.schema,this.data]=UB(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=zB(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 sr.visit(this.data,t)}at(t){return this.get(ru(t,this.numRows))}set(t,r){return Vr.visit(this.data,t,r)}indexOf(t,r){return su.visit(this.data,t,r)}[Symbol.iterator](){return cd.visit(new Gt([this.data]))}toArray(){return[...this]}concat(...t){return new wn(this.schema,[this,...t])}slice(t,r){let[n]=new Gt([this.data]).slice(t,r).data;return new e(this.schema,n)}getChild(t){var r;return this.getChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new Gt([this.data.children[t]]):null}setChild(t,r){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),r)}setChildAt(t,r){let n=this.schema,i=this.data;if(t>-1&&t<this.numCols){r||(r=new Gt([Dt({type:new bn,length:this.numRows})]));let o=n.fields.slice(),s=i.children.slice(),a=o[t].clone({type:r.type});[o[t],s[t]]=[a,r.data[0]],n=new me(o,new Map(this.schema.metadata)),i=Dt({type:new Re(o),children:s})}return new e(n,i)}select(t){let r=this.schema.select(t),n=new Re(r.fields),i=[];for(let o of t){let s=this.schema.fields.findIndex(a=>a.name===o);~s&&(i[s]=this.data.children[s])}return new e(r,Dt({type:n,length:this.numRows,children:i}))}selectAt(t){let r=this.schema.selectAt(t),n=t.map(o=>this.data.children[o]).filter(Boolean),i=Dt({type:new Re(r.fields),length:this.numRows,children:n});return new e(r,i)}};$B=Symbol.toStringTag;He[$B]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(He.prototype);function UB(e,t,r=t.reduce((n,i)=>Math.max(n,i.length),0)){var n;let i=[...e.fields],o=[...t],s=(r+63&-64)>>3;for(let[a,c]of e.fields.entries()){let l=t[a];(!l||l.length!==r)&&(i[a]=c.clone({nullable:!0}),o[a]=(n=l?._changeLengthAndBackfillNullBitmap(r))!==null&&n!==void 0?n:Dt({type:c.type,length:r,nullCount:r,nullBitmap:new Uint8Array(s)}))}return[e.assign(i),Dt({type:new Re(i),length:r,children:o})]}function zB(e,t,r=new Map){var n,i;if(((n=e?.length)!==null&&n!==void 0?n:0)>0&&e?.length===t?.length)for(let o=-1,s=e.length;++o<s;){let{type:a}=e[o],c=t[o];for(let l of[c,...((i=c?.dictionary)===null||i===void 0?void 0:i.data)||[]])zB(a.children,l?.children,r);if(K.isDictionary(a)){let{id:l}=a;if(!r.has(l))c?.dictionary&&r.set(l,c.dictionary);else if(r.get(l)!==c.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return r}var mu=class extends He{constructor(t){let r=t.fields.map(i=>Dt({type:i.type})),n=Dt({type:new Re(t.fields),nullCount:0,children:r});super(t,n)}};var So=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsMessage(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):he.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):Vt.NONE}header(t){let r=this.bb.__offset(this.bb_pos,8);return r?this.bb.__union(t,this.bb_pos+r):null}bodyLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,12);return n?(r||new br).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,r){t.addFieldInt16(0,r,he.V1)}static addHeaderType(t,r){t.addFieldInt8(1,r,Vt.NONE)}static addHeader(t,r){t.addFieldOffset(2,r,0)}static addBodyLength(t,r){t.addFieldInt64(3,r,BigInt("0"))}static addCustomMetadata(t,r){t.addFieldOffset(4,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,r){t.finish(r)}static finishSizePrefixedMessageBuffer(t,r){t.finish(r,void 0,!0)}static createMessage(t,r,n,i,o,s){return e.startMessage(t),e.addVersion(t,r),e.addHeaderType(t,n),e.addHeader(t,i),e.addBodyLength(t,o),e.addCustomMetadata(t,s),e.endMessage(t)}};var kE=class extends mt{visit(t,r){return t==null||r==null?void 0:super.visit(t,r)}visitNull(t,r){return xm.startNull(r),xm.endNull(r)}visitInt(t,r){return ho.startInt(r),ho.addBitWidth(r,t.bitWidth),ho.addIsSigned(r,t.isSigned),ho.endInt(r)}visitFloat(t,r){return Mc.startFloatingPoint(r),Mc.addPrecision(r,t.precision),Mc.endFloatingPoint(r)}visitBinary(t,r){return hm.startBinary(r),hm.endBinary(r)}visitLargeBinary(t,r){return mm.startLargeBinary(r),mm.endLargeBinary(r)}visitBool(t,r){return pm.startBool(r),pm.endBool(r)}visitUtf8(t,r){return _m.startUtf8(r),_m.endUtf8(r)}visitLargeUtf8(t,r){return ym.startLargeUtf8(r),ym.endLargeUtf8(r)}visitDecimal(t,r){return Xo.startDecimal(r),Xo.addScale(r,t.scale),Xo.addPrecision(r,t.precision),Xo.addBitWidth(r,t.bitWidth),Xo.endDecimal(r)}visitDate(t,r){return Ic.startDate(r),Ic.addUnit(r,t.unit),Ic.endDate(r)}visitTime(t,r){return Ks.startTime(r),Ks.addUnit(r,t.unit),Ks.addBitWidth(r,t.bitWidth),Ks.endTime(r)}visitTimestamp(t,r){let n=t.timezone&&r.createString(t.timezone)||void 0;return Js.startTimestamp(r),Js.addUnit(r,t.unit),n!==void 0&&Js.addTimezone(r,n),Js.endTimestamp(r)}visitInterval(t,r){return Nc.startInterval(r),Nc.addUnit(r,t.unit),Nc.endInterval(r)}visitDuration(t,r){return Tc.startDuration(r),Tc.addUnit(r,t.unit),Tc.endDuration(r)}visitList(t,r){return gm.startList(r),gm.endList(r)}visitStruct(t,r){return bm.startStruct_(r),bm.endStruct_(r)}visitUnion(t,r){po.startTypeIdsVector(r,t.typeIds.length);let n=po.createTypeIdsVector(r,t.typeIds);return po.startUnion(r),po.addMode(r,t.mode),po.addTypeIds(r,n),po.endUnion(r)}visitDictionary(t,r){let n=this.visit(t.indices,r);return Go.startDictionaryEncoding(r),Go.addId(r,BigInt(t.id)),Go.addIsOrdered(r,t.isOrdered),n!==void 0&&Go.addIndexType(r,n),Go.endDictionaryEncoding(r)}visitFixedSizeBinary(t,r){return Ac.startFixedSizeBinary(r),Ac.addByteWidth(r,t.byteWidth),Ac.endFixedSizeBinary(r)}visitFixedSizeList(t,r){return Ec.startFixedSizeList(r),Ec.addListSize(r,t.listSize),Ec.endFixedSizeList(r)}visitMap(t,r){return Oc.startMap(r),Oc.addKeysSorted(r,t.keysSorted),Oc.endMap(r)}},O_=new kE;function YB(e,t=new Map){return new me(lQ(e,t),R_(e.metadata),t)}function BE(e){return new Yr(e.count,GB(e.columns),XB(e.columns))}function WB(e){return new Wn(BE(e.data),e.id,e.isDelta)}function lQ(e,t){return(e.fields||[]).filter(Boolean).map(r=>jt.fromJSON(r,t))}function jB(e,t){return(e.children||[]).filter(Boolean).map(r=>jt.fromJSON(r,t))}function GB(e){return(e||[]).reduce((t,r)=>[...t,new $i(r.count,uQ(r.VALIDITY)),...GB(r.children)],[])}function XB(e,t=[]){for(let r=-1,n=(e||[]).length;++r<n;){let i=e[r];i.VALIDITY&&t.push(new Yn(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new Yn(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new Yn(t.length,i.OFFSET.length)),i.DATA&&t.push(new Yn(t.length,i.DATA.length)),t=XB(i.children,t)}return t}function uQ(e){return(e||[]).reduce((t,r)=>t+ +(r===0),0)}function HB(e,t){let r,n,i,o,s,a;return!t||!(o=e.dictionary)?(s=VB(e,jB(e,t)),i=new jt(e.name,s,e.nullable,R_(e.metadata))):t.has(r=o.id)?(n=(n=o.indexType)?qB(n):new Ho,a=new li(t.get(r),n,r,o.isOrdered),i=new jt(e.name,a,e.nullable,R_(e.metadata))):(n=(n=o.indexType)?qB(n):new Ho,t.set(r,s=VB(e,jB(e,t))),a=new li(s,n,r,o.isOrdered),i=new jt(e.name,a,e.nullable,R_(e.metadata))),i||null}function R_(e=[]){return new Map(e.map(({key:t,value:r})=>[t,r]))}function qB(e){return new _r(e.isSigned,e.bitWidth)}function VB(e,t){let r=e.type.name;switch(r){case"NONE":return new bn;case"null":return new bn;case"binary":return new ta;case"largebinary":return new ea;case"utf8":return new ra;case"largeutf8":return new na;case"bool":return new ia;case"list":return new go((t||[])[0]);case"struct":return new Re(t||[]);case"struct_":return new Re(t||[])}switch(r){case"int":{let n=e.type;return new _r(n.isSigned,n.bitWidth)}case"floatingpoint":{let n=e.type;return new Bi(be[n.precision])}case"decimal":{let n=e.type;return new oa(n.scale,n.precision,n.bitWidth)}case"date":{let n=e.type;return new sa(Xe[n.unit])}case"time":{let n=e.type;return new aa(ct[n.unit],n.bitWidth)}case"timestamp":{let n=e.type;return new ca(ct[n.unit],n.timezone)}case"interval":{let n=e.type;return new la(xr[n.unit])}case"duration":{let n=e.type;return new ua(ct[n.unit])}case"union":{let n=e.type,[i,...o]=(n.mode+"").toLowerCase(),s=i.toUpperCase()+o.join("");return new xo(Se[s],n.typeIds||[],t||[])}case"fixedsizebinary":{let n=e.type;return new fa(n.byteWidth)}case"fixedsizelist":{let n=e.type;return new bo(n.listSize,(t||[])[0])}case"map":{let n=e.type;return new _o((t||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${r}"`)}var fQ=eu,dQ=ai,Gn=class e{static fromJSON(t,r){let n=new e(0,he.V5,r);return n._createHeader=hQ(t,r),n}static decode(t){t=new dQ(St(t));let r=So.getRootAsMessage(t),n=r.bodyLength(),i=r.version(),o=r.headerType(),s=new e(n,i,o);return s._createHeader=pQ(r,o),s}static encode(t){let r=new fQ,n=-1;return t.isSchema()?n=me.encode(r,t.header()):t.isRecordBatch()?n=Yr.encode(r,t.header()):t.isDictionaryBatch()&&(n=Wn.encode(r,t.header())),So.startMessage(r),So.addVersion(r,he.V5),So.addHeader(r,n),So.addHeaderType(r,t.headerType),So.addBodyLength(r,BigInt(t.bodyLength)),So.finishMessageBuffer(r,So.endMessage(r)),r.asUint8Array()}static from(t,r=0){if(t instanceof me)return new e(0,he.V5,Vt.Schema,t);if(t instanceof Yr)return new e(r,he.V5,Vt.RecordBatch,t);if(t instanceof Wn)return new e(r,he.V5,Vt.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===Vt.Schema}isRecordBatch(){return this.headerType===Vt.RecordBatch}isDictionaryBatch(){return this.headerType===Vt.DictionaryBatch}constructor(t,r,n,i){this._version=r,this._headerType=n,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=re(t)}},Yr=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,r,n){this._nodes=r,this._buffers=n,this._length=re(t)}},Wn=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,r,n=!1){this._data=t,this._isDelta=n,this._id=re(r)}},Yn=class{constructor(t,r){this.offset=re(t),this.length=re(r)}},$i=class{constructor(t,r){this.length=re(t),this.nullCount=re(r)}};function hQ(e,t){return()=>{switch(t){case Vt.Schema:return me.fromJSON(e);case Vt.RecordBatch:return Yr.fromJSON(e);case Vt.DictionaryBatch:return Wn.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${Vt[t]}, type: ${t} }`)}}function pQ(e,t){return()=>{switch(t){case Vt.Schema:return me.decode(e.header(new qn),new Map,e.version());case Vt.RecordBatch:return Yr.decode(e.header(new ci),e.version());case Vt.DictionaryBatch:return Wn.decode(e.header(new Zs),e.version())}throw new Error(`Unrecognized Message type: { name: ${Vt[t]}, type: ${t} }`)}}jt.encode=TQ;jt.decode=SQ;jt.fromJSON=HB;me.encode=IQ;me.decode=mQ;me.fromJSON=YB;Yr.encode=AQ;Yr.decode=yQ;Yr.fromJSON=BE;Wn.encode=EQ;Wn.decode=gQ;Wn.fromJSON=WB;$i.encode=MQ;$i.decode=bQ;Yn.encode=NQ;Yn.decode=xQ;function mQ(e,t=new Map,r=he.V5){let n=vQ(e,t);return new me(n,D_(e),t,r)}function yQ(e,t=he.V5){if(e.compression()!==null)throw new Error("Record batch compression not implemented");return new Yr(e.length(),_Q(e),wQ(e,t))}function gQ(e,t=he.V5){return new Wn(Yr.decode(e.data(),t),e.id(),e.isDelta())}function xQ(e){return new Yn(e.offset(),e.length())}function bQ(e){return new $i(e.length(),e.nullCount())}function _Q(e){let t=[];for(let r,n=-1,i=-1,o=e.nodesLength();++n<o;)(r=e.nodes(n))&&(t[++i]=$i.decode(r));return t}function wQ(e,t){let r=[];for(let n,i=-1,o=-1,s=e.buffersLength();++i<s;)(n=e.buffers(i))&&(t<he.V4&&(n.bb_pos+=8*(i+1)),r[++o]=Yn.decode(n));return r}function vQ(e,t){let r=[];for(let n,i=-1,o=-1,s=e.fieldsLength();++i<s;)(n=e.fields(i))&&(r[++o]=jt.decode(n,t));return r}function QB(e,t){let r=[];for(let n,i=-1,o=-1,s=e.childrenLength();++i<s;)(n=e.children(i))&&(r[++o]=jt.decode(n,t));return r}function SQ(e,t){let r,n,i,o,s,a;return!t||!(a=e.dictionary())?(i=KB(e,QB(e,t)),n=new jt(e.name(),i,e.nullable(),D_(e))):t.has(r=re(a.id()))?(o=(o=a.indexType())?ZB(o):new Ho,s=new li(t.get(r),o,r,a.isOrdered()),n=new jt(e.name(),s,e.nullable(),D_(e))):(o=(o=a.indexType())?ZB(o):new Ho,t.set(r,i=KB(e,QB(e,t))),s=new li(i,o,r,a.isOrdered()),n=new jt(e.name(),s,e.nullable(),D_(e))),n||null}function D_(e){let t=new Map;if(e)for(let r,n,i=-1,o=Math.trunc(e.customMetadataLength());++i<o;)(r=e.customMetadata(i))&&(n=r.key())!=null&&t.set(n,r.value());return t}function ZB(e){return new _r(e.isSigned(),e.bitWidth())}function KB(e,t){let r=e.typeType();switch(r){case Ie.NONE:return new bn;case Ie.Null:return new bn;case Ie.Binary:return new ta;case Ie.LargeBinary:return new ea;case Ie.Utf8:return new ra;case Ie.LargeUtf8:return new na;case Ie.Bool:return new ia;case Ie.List:return new go((t||[])[0]);case Ie.Struct_:return new Re(t||[])}switch(r){case Ie.Int:{let n=e.type(new ho);return new _r(n.isSigned(),n.bitWidth())}case Ie.FloatingPoint:{let n=e.type(new Mc);return new Bi(n.precision())}case Ie.Decimal:{let n=e.type(new Xo);return new oa(n.scale(),n.precision(),n.bitWidth())}case Ie.Date:{let n=e.type(new Ic);return new sa(n.unit())}case Ie.Time:{let n=e.type(new Ks);return new aa(n.unit(),n.bitWidth())}case Ie.Timestamp:{let n=e.type(new Js);return new ca(n.unit(),n.timezone())}case Ie.Interval:{let n=e.type(new Nc);return new la(n.unit())}case Ie.Duration:{let n=e.type(new Tc);return new ua(n.unit())}case Ie.Union:{let n=e.type(new po);return new xo(n.mode(),n.typeIdsArray()||[],t||[])}case Ie.FixedSizeBinary:{let n=e.type(new Ac);return new fa(n.byteWidth())}case Ie.FixedSizeList:{let n=e.type(new Ec);return new bo(n.listSize(),(t||[])[0])}case Ie.Map:{let n=e.type(new Oc);return new _o((t||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${Ie[r]}" (${r})`)}function IQ(e,t){let r=t.fields.map(o=>jt.encode(e,o));qn.startFieldsVector(e,r.length);let n=qn.createFieldsVector(e,r),i=t.metadata&&t.metadata.size>0?qn.createCustomMetadataVector(e,[...t.metadata].map(([o,s])=>{let a=e.createString(`${o}`),c=e.createString(`${s}`);return br.startKeyValue(e),br.addKey(e,a),br.addValue(e,c),br.endKeyValue(e)})):-1;return qn.startSchema(e),qn.addFields(e,n),qn.addEndianness(e,OQ?Sc.Little:Sc.Big),i!==-1&&qn.addCustomMetadata(e,i),qn.endSchema(e)}function TQ(e,t){let r=-1,n=-1,i=-1,o=t.type,s=t.typeId;K.isDictionary(o)?(s=o.dictionary.typeId,i=O_.visit(o,e),n=O_.visit(o.dictionary,e)):n=O_.visit(o,e);let a=(o.children||[]).map(u=>jt.encode(e,u)),c=sn.createChildrenVector(e,a),l=t.metadata&&t.metadata.size>0?sn.createCustomMetadataVector(e,[...t.metadata].map(([u,f])=>{let d=e.createString(`${u}`),h=e.createString(`${f}`);return br.startKeyValue(e),br.addKey(e,d),br.addValue(e,h),br.endKeyValue(e)})):-1;return t.name&&(r=e.createString(t.name)),sn.startField(e),sn.addType(e,n),sn.addTypeType(e,s),sn.addChildren(e,c),sn.addNullable(e,!!t.nullable),r!==-1&&sn.addName(e,r),i!==-1&&sn.addDictionary(e,i),l!==-1&&sn.addCustomMetadata(e,l),sn.endField(e)}function AQ(e,t){let r=t.nodes||[],n=t.buffers||[];ci.startNodesVector(e,r.length);for(let s of r.slice().reverse())$i.encode(e,s);let i=e.endVector();ci.startBuffersVector(e,n.length);for(let s of n.slice().reverse())Yn.encode(e,s);let o=e.endVector();return ci.startRecordBatch(e),ci.addLength(e,BigInt(t.length)),ci.addNodes(e,i),ci.addBuffers(e,o),ci.endRecordBatch(e)}function EQ(e,t){let r=Yr.encode(e,t.data);return Zs.startDictionaryBatch(e),Zs.addId(e,BigInt(t.id)),Zs.addIsDelta(e,t.isDelta),Zs.addData(e,r),Zs.endDictionaryBatch(e)}function MQ(e,t){return Kf.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function NQ(e,t){return Zf.createBuffer(e,BigInt(t.offset),BigInt(t.length))}var OQ=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})();var UE=e=>`Expected ${Vt[e]} Message in stream, but was null or length 0.`,$E=e=>`Header pointer of flatbuffer-encoded ${Vt[e]} Message is null or length 0.`,JB=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,t5=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,yd=class{constructor(t){this.source=t instanceof Ko?t:new Ko(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?De:t.value===-1&&(t=this.readMetadataLength()).done?De:(t=this.readMetadata(t.value)).done?De:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let r;if((r=this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(UE(t));return r.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let r=St(this.source.read(t));if(r.byteLength<t)throw new Error(t5(t,r.byteLength));return r.byteOffset%8===0&&r.byteOffset+r.byteLength<=r.buffer.byteLength?r:r.slice()}readSchema(t=!1){let r=Vt.Schema,n=this.readMessage(r),i=n?.header();if(t&&!i)throw new Error($E(r));return i}readMetadataLength(){let t=this.source.read(L_),r=t&&new ai(t),n=r?.readInt32(0)||0;return{done:n===0,value:n}}readMetadata(t){let r=this.source.read(t);if(!r)return De;if(r.byteLength<t)throw new Error(JB(t,r.byteLength));return{done:!1,value:Gn.decode(r)}}},ry=class{constructor(t,r){this.source=t instanceof Pi?t:d1(t)?new Cc(t,r):new Pi(t)}[Symbol.asyncIterator](){return this}next(){return Q(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?De:t.value===-1&&(t=yield this.readMetadataLength()).done?De:(t=yield this.readMetadata(t.value)).done?De:t})}throw(t){return Q(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return Q(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return Q(this,void 0,void 0,function*(){let r;if((r=yield this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(UE(t));return r.value})}readMessageBody(t){return Q(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let r=St(yield this.source.read(t));if(r.byteLength<t)throw new Error(t5(t,r.byteLength));return r.byteOffset%8===0&&r.byteOffset+r.byteLength<=r.buffer.byteLength?r:r.slice()})}readSchema(){return Q(this,arguments,void 0,function*(t=!1){let r=Vt.Schema,n=yield this.readMessage(r),i=n?.header();if(t&&!i)throw new Error($E(r));return i})}readMetadataLength(){return Q(this,void 0,void 0,function*(){let t=yield this.source.read(L_),r=t&&new ai(t),n=r?.readInt32(0)||0;return{done:n===0,value:n}})}readMetadata(t){return Q(this,void 0,void 0,function*(){let r=yield this.source.read(t);if(!r)return De;if(r.byteLength<t)throw new Error(JB(t,r.byteLength));return{done:!1,value:Gn.decode(r)}})}},ny=class extends yd{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof Mm?t:new Mm(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:Gn.fromJSON(t.schema,Vt.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let r=t.dictionaries[this._dictionaryIndex++];return this._body=r.data.columns,{done:!1,value:Gn.fromJSON(r,Vt.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let r=t.batches[this._batchIndex++];return this._body=r.columns,{done:!1,value:Gn.fromJSON(r,Vt.RecordBatch)}}return this._body=[],De}readMessageBody(t){return r(this._body);function r(n){return(n||[]).reduce((i,o)=>[...i,...o.VALIDITY&&[o.VALIDITY]||[],...o.TYPE_ID&&[o.TYPE_ID]||[],...o.OFFSET&&[o.OFFSET]||[],...o.DATA&&[o.DATA]||[],...r(o.children)],[])}}readMessage(t){let r;if((r=this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(UE(t));return r.value}readSchema(){let t=Vt.Schema,r=this.readMessage(t),n=r?.header();if(!r||!n)throw new Error($E(t));return n}},L_=4,PE="ARROW1",gd=new Uint8Array(PE.length);for(let e=0;e<PE.length;e+=1)gd[e]=PE.codePointAt(e);function F_(e,t=0){for(let r=-1,n=gd.length;++r<n;)if(gd[r]!==e[t+r])return!1;return!0}var xd=gd.length,zE=xd+L_,e5=xd*2+L_;var Wr=class e extends cu{constructor(t){super(),this._impl=t}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(t){return this._impl.throw(t)}return(t){return this._impl.return(t)}cancel(){return this._impl.cancel()}reset(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}open(t){let r=this._impl.open(t);return co(r)?r.then(()=>this):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return qr.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return qr.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,r){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof e?t:u1(t)?DQ(t):d1(t)?CQ(t):co(t)?Q(this,void 0,void 0,function*(){return yield e.from(yield t)}):h1(t)||am(t)||m1(t)||Fi(t)?FQ(new Pi(t)):LQ(new Ko(t))}static readAll(t){return t instanceof e?t.isSync()?r5(t):n5(t):u1(t)||ArrayBuffer.isView(t)||lo(t)||f1(t)?r5(t):n5(t)}},ts=class extends Wr{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return oi(this,arguments,function*(){yield Ut(yield*Hf(ao(this[Symbol.iterator]())))})}},kc=class extends Wr{constructor(t){super(t),this._impl=t}readAll(){return Q(this,void 0,void 0,function*(){var t,r,n,i;let o=new Array;try{for(var s=!0,a=ao(this),c;c=yield a.next(),t=c.done,!t;s=!0){i=c.value,s=!1;let l=i;o.push(l)}}catch(l){r={error:l}}finally{try{!s&&!t&&(n=a.return)&&(yield n.call(a))}finally{if(r)throw r.error}}return o})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},Bc=class extends ts{constructor(t){super(t),this._impl=t}},iy=class extends kc{constructor(t){super(t),this._impl=t}},C_=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,r){let n=this._loadVectors(t,r,this.schema.fields),i=Dt({type:new Re(this.schema.fields),length:t.length,children:n});return new He(this.schema,i)}_loadDictionaryBatch(t,r){let{id:n,isDelta:i}=t,{dictionaries:o,schema:s}=this,a=o.get(n),c=s.dictionaries.get(n),l=this._loadVectors(t.data,r,[c]);return(a&&i?a.concat(new Gt(l)):new Gt(l)).memoize()}_loadVectors(t,r,n){return new Dm(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}},bd=class extends C_{constructor(t,r){super(r),this._reader=u1(t)?new ny(this._handle=t):new yd(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=i5(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):De}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):De}next(){if(this.closed)return De;let t,{_reader:r}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=r.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=r.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new mu(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},_d=class extends C_{constructor(t,r){super(r),this._reader=new ry(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return Q(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 Q(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=i5(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return Q(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):De})}return(t){return Q(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):De})}next(){return Q(this,void 0,void 0,function*(){if(this.closed)return De;let t,{_reader:r}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=yield r.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=yield r.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new mu(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return Q(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},k_=class extends bd{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,r){super(t instanceof Nm?t:new Nm(t),r)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let r of this._footer.dictionaryBatches())r&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var r;if(this.closed)return null;this._footer||this.open();let n=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(Vt.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s)}}return null}_readDictionaryBatch(t){var r;let n=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(Vt.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}}_readFooter(){let{_handle:t}=this,r=t.size-zE,n=t.readInt32(r),i=t.readAt(r-n,n);return pa.decode(i)}_readNextMessageAndValidate(t){var r;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let n=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(this._recordBatchIndex);if(n&&this._handle.seek(n.offset))return this._reader.readMessage(t)}return null}},jE=class extends _d{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,...r){let n=typeof r[0]!="number"?r.shift():void 0,i=r[0]instanceof Map?r.shift():void 0;super(t instanceof Cc?t:new Cc(t,n),i)}isFile(){return!0}isAsync(){return!0}open(t){let r=Object.create(null,{open:{get:()=>super.open}});return Q(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let n of this._footer.dictionaryBatches())n&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield r.open.call(this,t)})}readRecordBatch(t){return Q(this,void 0,void 0,function*(){var r;if(this.closed)return null;this._footer||(yield this.open());let n=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(Vt.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s)}}return null})}_readDictionaryBatch(t){return Q(this,void 0,void 0,function*(){var r;let n=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(Vt.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 Q(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let r=t.size-zE,n=yield t.readInt32(r),i=yield t.readAt(r-n,n);return pa.decode(i)})}_readNextMessageAndValidate(t){return Q(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let r=this._footer.getRecordBatch(this._recordBatchIndex);if(r&&(yield this._handle.seek(r.offset)))return yield this._reader.readMessage(t)}return null})}},qE=class extends bd{constructor(t,r){super(t,r)}_loadVectors(t,r,n){return new a_(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}};function i5(e,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:e.autoDestroy}function*r5(e){let t=Wr.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function n5(e){return oi(this,arguments,function*(){let r=yield Ut(Wr.from(e));try{if(!(yield Ut(r.open({autoDestroy:!1}))).closed)do yield yield Ut(r);while(!(yield Ut(r.reset().open())).closed)}finally{yield Ut(r.cancel())}})}function DQ(e){return new ts(new qE(e))}function LQ(e){let t=e.peek(xd+7&-8);return t&&t.byteLength>=4?F_(t)?new Bc(new k_(e.read())):new ts(new bd(e)):new ts(new bd(function*(){}()))}function FQ(e){return Q(this,void 0,void 0,function*(){let t=yield e.peek(xd+7&-8);return t&&t.byteLength>=4?F_(t)?new Bc(new k_(yield e.read())):new kc(new _d(e)):new kc(new _d(function(){return oi(this,arguments,function*(){})}()))})}function CQ(e){return Q(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),r=new Cc(e,t);return t>=e5&&F_(yield r.readAt(0,xd+7&-8))?new iy(new jE(r)):new kc(new _d(r))})}var ke=class e extends mt{static assemble(...t){let r=i=>i.flatMap(o=>Array.isArray(o)?r(o):o instanceof He?o.data.children:o.data),n=new e;return n.visitMany(r(t)),n}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof Gt)return this.visitMany(t.data),this;let{type:r}=t;if(!K.isDictionary(r)){let{length:n}=t;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(K.isUnion(r))this.nodes.push(new $i(n,0));else{let{nullCount:i}=t;K.isNull(r)||Io.call(this,i<=0?new Uint8Array(0):iu(t.offset,n,t.nullBitmap)),this.nodes.push(new $i(n,i))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}};function Io(e){let t=e.byteLength+7&-8;return this.buffers.push(e),this.bufferRegions.push(new Yn(this._byteLength,t)),this._byteLength+=t,this}function kQ(e){var t;let{type:r,length:n,typeIds:i,valueOffsets:o}=e;if(Io.call(this,i),r.mode===Se.Sparse)return VE.call(this,e);if(r.mode===Se.Dense){if(e.offset<=0)return Io.call(this,o),VE.call(this,e);{let s=new Int32Array(n),a=Object.create(null),c=Object.create(null);for(let l,u,f=-1;++f<n;)(l=i[f])!==void 0&&((u=a[l])===void 0&&(u=a[l]=o[f]),s[f]=o[f]-u,c[l]=((t=c[l])!==null&&t!==void 0?t:0)+1);Io.call(this,s),this.visitMany(e.children.map((l,u)=>{let f=r.typeIds[u],d=a[f],h=c[f];return l.slice(d,Math.min(n,h))}))}}return this}function BQ(e){let t;return e.nullCount>=e.length?Io.call(this,new Uint8Array(0)):(t=e.values)instanceof Uint8Array?Io.call(this,iu(e.offset,e.length,t)):Io.call(this,ou(e.values))}function va(e){return Io.call(this,e.values.subarray(0,e.length*e.stride))}function B_(e){let{length:t,values:r,valueOffsets:n}=e,i=re(n[0]),o=re(n[t]),s=Math.min(o-i,r.byteLength-i);return Io.call(this,g1(-i,t+1,n)),Io.call(this,r.subarray(i,i+s)),this}function YE(e){let{length:t,valueOffsets:r}=e;if(r){let{[0]:n,[t]:i}=r;return Io.call(this,g1(-n,t+1,r)),this.visit(e.children[0].slice(n,i-n))}return this.visit(e.children[0])}function VE(e){return this.visitMany(e.type.children.map((t,r)=>e.children[r]).filter(Boolean))[0]}ke.prototype.visitBool=BQ;ke.prototype.visitInt=va;ke.prototype.visitFloat=va;ke.prototype.visitUtf8=B_;ke.prototype.visitLargeUtf8=B_;ke.prototype.visitBinary=B_;ke.prototype.visitLargeBinary=B_;ke.prototype.visitFixedSizeBinary=va;ke.prototype.visitDate=va;ke.prototype.visitTimestamp=va;ke.prototype.visitTime=va;ke.prototype.visitDecimal=va;ke.prototype.visitList=YE;ke.prototype.visitStruct=VE;ke.prototype.visitUnion=kQ;ke.prototype.visitInterval=va;ke.prototype.visitDuration=va;ke.prototype.visitFixedSizeList=YE;ke.prototype.visitMap=YE;var yu=class extends cu{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,r){throw new Error('"throughDOM" not available in this environment')}constructor(t){super(),this._position=0,this._started=!1,this._sink=new Zo,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,xn(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 co(t)?t.then(r=>this.writeAll(r)):Fi(t)?GE(this,t):WE(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,r=null){return t===this._sink||t instanceof Zo?this._sink=t:(this._sink=new Zo,t&&_k(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&wk(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,(!r||!pu(r,this._schema))&&(r==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=r,this._writeSchema(r))),this}write(t){let r=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof wn&&!(r=t.schema))return this.finish()&&void 0;if(t instanceof He&&!(r=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(r&&!pu(r,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,r)}t instanceof He?t instanceof mu||this._writeRecordBatch(t):t instanceof wn?this.writeAll(t.batches):lo(t)&&this.writeAll(t)}_writeMessage(t,r=8){let n=r-1,i=Gn.encode(t),o=i.byteLength,s=this._writeLegacyIpcFormat?4:8,a=o+s+n&~n,c=a-o-s;return t.headerType===Vt.RecordBatch?this._recordBatchBlocks.push(new ma(a,t.bodyLength,this._position)):t.headerType===Vt.DictionaryBatch&&this._dictionaryBlocks.push(new ma(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-s)),o>0&&this._write(i),this._writePadding(c)}_write(t){if(this._started){let r=St(t);r&&r.byteLength>0&&(this._sink.write(r),this._position+=r.byteLength)}return this}_writeSchema(t){return this._writeMessage(Gn.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(gd)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:r,nodes:n,bufferRegions:i,buffers:o}=ke.assemble(t),s=new Yr(t.numRows,n,i),a=Gn.from(s,r);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(o)}_writeDictionaryBatch(t,r,n=!1){let{byteLength:i,nodes:o,bufferRegions:s,buffers:a}=ke.assemble(new Gt([t])),c=new Yr(t.length,o,s),l=new Wn(c,r,n),u=Gn.from(l,i);return this._writeMessage(u)._writeBodyBuffers(a)}_writeBodyBuffers(t){let r,n,i;for(let o=-1,s=t.length;++o<s;)(r=t[o])&&(n=r.byteLength)>0&&(this._write(r),(i=(n+7&-8)-n)>0&&this._writePadding(i));return this}_writeDictionaries(t){var r,n;for(let[i,o]of t.dictionaries){let s=(r=o?.data)!==null&&r!==void 0?r:[],a=this._seenDictionaries.get(i),c=(n=this._dictionaryDeltaOffsets.get(i))!==null&&n!==void 0?n:0;if(!a||a.data[0]!==s[0])for(let[l,u]of s.entries())this._writeDictionaryBatch(u,i,l>0);else if(c<s.length)for(let l of s.slice(c))this._writeDictionaryBatch(l,i,!0);this._seenDictionaries.set(i,o),this._dictionaryDeltaOffsets.set(i,s.length)}return this}},gu=class e extends yu{static writeAll(t,r){let n=new e(r);return co(t)?t.then(i=>n.writeAll(i)):Fi(t)?GE(n,t):WE(n,t)}},xu=class e extends yu{static writeAll(t){let r=new e;return co(t)?t.then(n=>r.writeAll(n)):Fi(t)?GE(r,t):WE(r,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(t,r,n=!1){if(!n&&this._seenDictionaries.has(r))throw new Error("The Arrow File format does not support replacement dictionaries. ");return super._writeDictionaryBatch(t,r,n)}_writeFooter(t){let r=pa.encode(new pa(t,he.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(r)._write(Int32Array.of(r.byteLength))._writeMagic()}};function WE(e,t){let r=t;t instanceof wn&&(r=t.batches,e.reset(void 0,t.schema));for(let n of r)e.write(n);return e.finish()}function GE(e,t){return Q(this,void 0,void 0,function*(){var r,n,i,o,s,a,c;try{for(r=!0,n=ao(t);i=yield n.next(),o=i.done,!o;r=!0){c=i.value,r=!1;let l=c;e.write(l)}}catch(l){s={error:l}}finally{try{!r&&!o&&(a=n.return)&&(yield a.call(n))}finally{if(s)throw s.error}}return e.finish()})}function o5(e,t){if(Fi(e))return UQ(e,t);if(lo(e))return PQ(e,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function PQ(e,t){let r=null,n=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){o(s,r||(r=e[Symbol.iterator]()))},pull(s){r?o(s,r):s.close()},cancel(){(r?.return&&r.return()||!0)&&(r=null)}}),Object.assign({highWaterMark:n?i:void 0},t));function o(s,a){let c,l=null,u=s.desiredSize||null;for(;!(l=a.next(n?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=St(l.value))&&(u!=null&&n&&(u=u-c.byteLength+1),l.value=c),s.enqueue(l.value),u!=null&&--u<=0)return;s.close()}}function UQ(e,t){let r=null,n=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){return Q(this,void 0,void 0,function*(){yield o(s,r||(r=e[Symbol.asyncIterator]()))})},pull(s){return Q(this,void 0,void 0,function*(){r?yield o(s,r):s.close()})},cancel(){return Q(this,void 0,void 0,function*(){(r?.return&&(yield r.return())||!0)&&(r=null)})}}),Object.assign({highWaterMark:n?i:void 0},t));function o(s,a){return Q(this,void 0,void 0,function*(){let c,l=null,u=s.desiredSize||null;for(;!(l=yield a.next(n?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=St(l.value))&&(u!=null&&n&&(u=u-c.byteLength+1),l.value=c),s.enqueue(l.value),u!=null&&--u<=0)return;s.close()})}}function c5(e){return new XE(e)}var XE=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:r,["writableStrategy"]:n,["queueingStrategy"]:i="count"}=t,o=xk(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=uu(o),this._getSize=i!=="bytes"?s5:a5;let{["highWaterMark"]:s=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},r),{["highWaterMark"]:a=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},n);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:c=>{this._maybeFlush(this._builder,this._controller=c)},start:c=>{this._maybeFlush(this._builder,this._controller=c)}},{highWaterMark:s,size:i!=="bytes"?s5:a5}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:a,size:c=>this._writeValueAndReturnChunkSize(c)})}_writeValueAndReturnChunkSize(t){let r=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-r}_maybeFlush(t,r){r!=null&&(this._bufferedSize>=r.desiredSize&&++this._numChunks&&this._enqueue(r,t.toVector()),t.finished&&((t.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(r,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(r,null)))}_enqueue(t,r){this._bufferedSize=0,this._controller=null,r==null?t.close():t.enqueue(r)}},s5=e=>{var t;return(t=e?.length)!==null&&t!==void 0?t:0},a5=e=>{var t;return(t=e?.byteLength)!==null&&t!==void 0?t:0};function P_(e,t){let r=new Zo,n=null,i=new ReadableStream({cancel(){return Q(this,void 0,void 0,function*(){yield r.close()})},start(a){return Q(this,void 0,void 0,function*(){yield s(a,n||(n=yield o()))})},pull(a){return Q(this,void 0,void 0,function*(){n?yield s(a,n):a.close()})}});return{writable:new WritableStream(r,Object.assign({highWaterMark:Math.pow(2,14)},e)),readable:i};function o(){return Q(this,void 0,void 0,function*(){return yield(yield Wr.from(r)).open(t)})}function s(a,c){return Q(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 U_(e,t){let r=new this(e),n=new Pi(r),i=new ReadableStream({cancel(){return Q(this,void 0,void 0,function*(){yield n.cancel()})},pull(s){return Q(this,void 0,void 0,function*(){yield o(s)})},start(s){return Q(this,void 0,void 0,function*(){yield o(s)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(r,e),readable:i};function o(s){return Q(this,void 0,void 0,function*(){let a=null,c=s.desiredSize;for(;a=yield n.read(c||null);)if(s.enqueue(a),c!=null&&(c-=a.byteLength)<=0)return;s.close()})}}function $_(e,t="stream"){return(t==="stream"?gu:xu).writeAll(e).toUint8Array(!0)}var qQ=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},sE),RE),vE),aE),JA),wE),rE),{compareSchemas:pu,compareFields:kB,compareTypes:BB});qr.toDOMStream=o5;Le.throughDOM=c5;Wr.throughDOM=P_;Bc.throughDOM=P_;ts.throughDOM=P_;yu.throughDOM=U_;xu.throughDOM=U_;gu.throughDOM=U_;var VQ=Object.create,u5=Object.defineProperty,YQ=Object.getOwnPropertyDescriptor,WQ=Object.getOwnPropertyNames,GQ=Object.getPrototypeOf,XQ=Object.prototype.hasOwnProperty,HQ=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),QQ=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of WQ(t))!XQ.call(e,i)&&i!==r&&u5(e,i,{get:()=>t[i],enumerable:!(n=YQ(t,i))||n.enumerable});return e},ZQ=(e,t,r)=>(r=e!=null?VQ(GQ(e)):{},QQ(t||!e||!e.__esModule?u5(r,"default",{value:e,enumerable:!0}):r,e)),KQ=HQ((e,t)=>{t.exports=Worker}),JQ=(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))(JQ||{}),tZ=(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))(tZ||{}),eZ=(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))(eZ||{}),rZ=(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))(rZ||{}),nZ=(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))(nZ||{}),iZ=(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))(iZ||{}),f5=class{log(e){}},d5=class{constructor(e=2){this.level=e}log(e){e.level>=this.level&&console.log(e)}};var oZ=(e=>(e[e.SUCCESS=0]="SUCCESS",e))(oZ||{}),sZ=class{constructor(e,t){this._bindings=e,this._conn=t}get bindings(){return this._bindings}async close(){return this._bindings.disconnect(this._conn)}useUnsafe(e){return e(this._bindings,this._conn)}async query(e){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:e});let t=await this._bindings.runQuery(this._conn,e),r=Wr.from(t);return console.assert(r.isSync(),"Reader is not sync"),console.assert(r.isFile(),"Reader is not file"),new wn(r)}async send(e){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:e});let t=await this._bindings.startPendingQuery(this._conn,e);for(;t==null;)t=await this._bindings.pollPendingQuery(this._conn);let r=new h5(this._bindings,this._conn,t),n=await Wr.from(r);return console.assert(n.isAsync()),console.assert(n.isStream()),n}async cancelSent(){return await this._bindings.cancelPendingQuery(this._conn)}async getTableNames(e){return await this._bindings.getTableNames(this._conn,e)}async prepare(e){let t=await this._bindings.createPrepared(this._conn,e);return new aZ(this._bindings,this._conn,t)}async insertArrowTable(e,t){let r=$_(e,"stream");await this.insertArrowFromIPCStream(r,t)}async insertArrowFromIPCStream(e,t){await this._bindings.insertArrowFromIPCStream(this._conn,e,t)}async insertCSVFromPath(e,t){await this._bindings.insertCSVFromPath(this._conn,e,t)}async insertJSONFromPath(e,t){await this._bindings.insertJSONFromPath(this._conn,e,t)}},h5=class{constructor(e,t,r){this.db=e,this.conn=t,this.header=r,this._first=!0,this._depleted=!1,this._inFlight=null}async next(){if(this._first)return this._first=!1,{done:!1,value:this.header};if(this._depleted)return{done:!0,value:null};let e;return this._inFlight!=null?(e=await this._inFlight,this._inFlight=null):e=await this.db.fetchQueryResults(this.conn),this._depleted=e.length==0,this._depleted||(this._inFlight=this.db.fetchQueryResults(this.conn)),{done:this._depleted,value:e}}[Symbol.asyncIterator](){return this}},aZ=class{constructor(e,t,r){this.bindings=e,this.connectionId=t,this.statementId=r}async close(){await this.bindings.closePrepared(this.connectionId,this.statementId)}async query(...e){let t=await this.bindings.runPrepared(this.connectionId,this.statementId,e),r=Wr.from(t);return console.assert(r.isSync()),console.assert(r.isFile()),new wn(r)}async send(...e){let t=await this.bindings.sendPrepared(this.connectionId,this.statementId,e),r=new h5(this.bindings,this.connectionId,t),n=await Wr.from(r);return console.assert(n.isAsync()),console.assert(n.isStream()),n}},cZ=(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))(cZ||{}),lZ=(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))(lZ||{}),oe=class{constructor(e,t){this.promiseResolver=()=>{},this.promiseRejecter=()=>{},this.type=e,this.data=t,this.promise=new Promise((r,n)=>{this.promiseResolver=r,this.promiseRejecter=n})}};function z_(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:z_(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=>tM(t.name,t.type))};case D.Map:{let t=e;return{sqlType:"map",keyType:z_(t.keyType),valueType:z_(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 tM(e,t){let r=z_(t);return r.name=e,r}var uZ=new TextEncoder,p5=class{constructor(e,t=null){this._onInstantiationProgress=[],this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{},this._nextMessageId=0,this._pendingRequests=new Map,this._logger=e,this._onMessageHandler=this.onMessage.bind(this),this._onErrorHandler=this.onError.bind(this),this._onCloseHandler=this.onClose.bind(this),t!=null&&this.attach(t)}get logger(){return this._logger}attach(e){this._worker=e,this._worker.addEventListener("message",this._onMessageHandler),this._worker.addEventListener("error",this._onErrorHandler),this._worker.addEventListener("close",this._onCloseHandler),this._workerShutdownPromise=new Promise((t,r)=>{this._workerShutdownResolver=t})}detach(){this._worker&&(this._worker.removeEventListener("message",this._onMessageHandler),this._worker.removeEventListener("error",this._onErrorHandler),this._worker.removeEventListener("close",this._onCloseHandler),this._worker=null,this._workerShutdownResolver(null),this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async terminate(){this._worker&&(this._worker.terminate(),this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async postTask(e,t=[]){if(!this._worker){console.error("cannot send a message since the worker is not set!");return}let r=this._nextMessageId++;return this._pendingRequests.set(r,e),this._worker.postMessage({messageId:r,type:e.type,data:e.data},t),await e.promise}onMessage(e){var t;let r=e.data;switch(r.type){case"LOG":{this._logger.log(r.data);return}case"INSTANTIATE_PROGRESS":{for(let i of this._onInstantiationProgress)i(r.data);return}}let n=this._pendingRequests.get(r.requestId);if(!n){console.warn("unassociated response: [".concat(r.requestId,", ").concat(r.type.toString(),"]"));return}if(this._pendingRequests.delete(r.requestId),r.type=="ERROR"){let i=new Error(r.data.message);i.name=r.data.name,(t=Object.getOwnPropertyDescriptor(i,"stack"))!=null&&t.writable&&(i.stack=r.data.stack),n.promiseRejecter(i);return}switch(n.type){case"CLOSE_PREPARED":case"COLLECT_FILE_STATISTICS":case"COPY_FILE_TO_PATH":case"DISCONNECT":case"DROP_FILE":case"DROP_FILES":case"FLUSH_FILES":case"INSERT_ARROW_FROM_IPC_STREAM":case"IMPORT_CSV_FROM_PATH":case"IMPORT_JSON_FROM_PATH":case"OPEN":case"PING":case"REGISTER_FILE_BUFFER":case"REGISTER_FILE_HANDLE":case"REGISTER_FILE_URL":case"RESET":if(r.type=="OK"){n.promiseResolver(r.data);return}break;case"INSTANTIATE":if(this._onInstantiationProgress=[],r.type=="OK"){n.promiseResolver(r.data);return}break;case"GLOB_FILE_INFOS":if(r.type=="FILE_INFOS"){n.promiseResolver(r.data);return}break;case"GET_VERSION":if(r.type=="VERSION_STRING"){n.promiseResolver(r.data);return}break;case"GET_FEATURE_FLAGS":if(r.type=="FEATURE_FLAGS"){n.promiseResolver(r.data);return}break;case"GET_TABLE_NAMES":if(r.type=="TABLE_NAMES"){n.promiseResolver(r.data);return}break;case"TOKENIZE":if(r.type=="SCRIPT_TOKENS"){n.promiseResolver(r.data);return}break;case"COPY_FILE_TO_BUFFER":if(r.type=="FILE_BUFFER"){n.promiseResolver(r.data);return}break;case"EXPORT_FILE_STATISTICS":if(r.type=="FILE_STATISTICS"){n.promiseResolver(r.data);return}break;case"CONNECT":if(r.type=="CONNECTION_INFO"){n.promiseResolver(r.data);return}break;case"RUN_PREPARED":case"RUN_QUERY":if(r.type=="QUERY_RESULT"){n.promiseResolver(r.data);return}break;case"SEND_PREPARED":if(r.type=="QUERY_RESULT_HEADER"){n.promiseResolver(r.data);return}break;case"START_PENDING_QUERY":if(r.type=="QUERY_RESULT_HEADER_OR_NULL"){n.promiseResolver(r.data);return}break;case"POLL_PENDING_QUERY":if(r.type=="QUERY_RESULT_HEADER_OR_NULL"){n.promiseResolver(r.data);return}break;case"CANCEL_PENDING_QUERY":if(this._onInstantiationProgress=[],r.type=="SUCCESS"){n.promiseResolver(r.data);return}break;case"FETCH_QUERY_RESULTS":if(r.type=="QUERY_RESULT_CHUNK"){n.promiseResolver(r.data);return}break;case"CREATE_PREPARED":if(r.type=="PREPARED_STATEMENT_ID"){n.promiseResolver(r.data);return}break}n.promiseRejecter(new Error("unexpected response type: ".concat(r.type.toString())))}onError(e){console.error(e),console.error("error in duckdb worker: ".concat(e.message)),this._pendingRequests.clear()}onClose(){if(this._workerShutdownResolver(null),this._pendingRequests.size!=0){console.warn("worker terminated with ".concat(this._pendingRequests.size," pending requests"));return}this._pendingRequests.clear()}async reset(){let e=new oe("RESET",null);return await this.postTask(e)}async ping(){let e=new oe("PING",null);await this.postTask(e)}async dropFile(e){let t=new oe("DROP_FILE",e);return await this.postTask(t)}async dropFiles(){let e=new oe("DROP_FILES",null);return await this.postTask(e)}async flushFiles(){let e=new oe("FLUSH_FILES",null);return await this.postTask(e)}async instantiate(e,t=null,r=n=>{}){this._onInstantiationProgress.push(r);let n=new oe("INSTANTIATE",[e,t]);return await this.postTask(n)}async getVersion(){let e=new oe("GET_VERSION",null);return await this.postTask(e)}async getFeatureFlags(){let e=new oe("GET_FEATURE_FLAGS",null);return await this.postTask(e)}async open(e){let t=new oe("OPEN",e);await this.postTask(t)}async tokenize(e){let t=new oe("TOKENIZE",e);return await this.postTask(t)}async connectInternal(){let e=new oe("CONNECT",null);return await this.postTask(e)}async connect(){let e=await this.connectInternal();return new sZ(this,e)}async disconnect(e){let t=new oe("DISCONNECT",e);await this.postTask(t)}async runQuery(e,t){let r=new oe("RUN_QUERY",[e,t]);return await this.postTask(r)}async startPendingQuery(e,t){let r=new oe("START_PENDING_QUERY",[e,t]);return await this.postTask(r)}async pollPendingQuery(e){let t=new oe("POLL_PENDING_QUERY",e);return await this.postTask(t)}async cancelPendingQuery(e){let t=new oe("CANCEL_PENDING_QUERY",e);return await this.postTask(t)}async fetchQueryResults(e){let t=new oe("FETCH_QUERY_RESULTS",e);return await this.postTask(t)}async getTableNames(e,t){let r=new oe("GET_TABLE_NAMES",[e,t]);return await this.postTask(r)}async createPrepared(e,t){let r=new oe("CREATE_PREPARED",[e,t]);return await this.postTask(r)}async closePrepared(e,t){let r=new oe("CLOSE_PREPARED",[e,t]);await this.postTask(r)}async runPrepared(e,t,r){let n=new oe("RUN_PREPARED",[e,t,r]);return await this.postTask(n)}async sendPrepared(e,t,r){let n=new oe("SEND_PREPARED",[e,t,r]);return await this.postTask(n)}async globFiles(e){let t=new oe("GLOB_FILE_INFOS",e);return await this.postTask(t)}async registerFileText(e,t){let r=uZ.encode(t);await this.registerFileBuffer(e,r)}async registerFileURL(e,t,r,n){t===void 0&&(t=e);let i=new oe("REGISTER_FILE_URL",[e,t,r,n]);await this.postTask(i)}async registerEmptyFileBuffer(e){}async registerFileBuffer(e,t){let r=new oe("REGISTER_FILE_BUFFER",[e,t]);await this.postTask(r,[t.buffer])}async registerFileHandle(e,t,r,n){let i=new oe("REGISTER_FILE_HANDLE",[e,t,r,n]);await this.postTask(i,[])}async collectFileStatistics(e,t){let r=new oe("COLLECT_FILE_STATISTICS",[e,t]);await this.postTask(r,[])}async exportFileStatistics(e){let t=new oe("EXPORT_FILE_STATISTICS",e);return await this.postTask(t,[])}async copyFileToBuffer(e){let t=new oe("COPY_FILE_TO_BUFFER",e);return await this.postTask(t)}async copyFileToPath(e,t){let r=new oe("COPY_FILE_TO_PATH",[e,t]);await this.postTask(r)}async insertArrowFromIPCStream(e,t,r){if(t.length==0)return;let n=new oe("INSERT_ARROW_FROM_IPC_STREAM",[e,t,r]);await this.postTask(n,[t.buffer])}async insertCSVFromPath(e,t,r){if(r.columns!==void 0){let i=[];for(let o in r.columns){let s=r.columns[o];i.push(tM(o,s))}r.columnsFlat=i,delete r.columns}let n=new oe("IMPORT_CSV_FROM_PATH",[e,t,r]);await this.postTask(n)}async insertJSONFromPath(e,t,r){if(r.columns!==void 0){let i=[];for(let o in r.columns){let s=r.columns[o];i.push(tM(o,s))}r.columnsFlat=i,delete r.columns}let n=new oe("IMPORT_JSON_FROM_PATH",[e,t,r]);await this.postTask(n)}};var fZ=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])),dZ=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])),hZ=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])),pZ=()=>(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])),eM={name:"@duckdb/duckdb-wasm",version:"1.29.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":"^17.0.0"},devDependencies:{"@types/emscripten":"^1.39.10","@types/jasmine":"^5.1.4","@typescript-eslint/eslint-plugin":"^6.21.0","@typescript-eslint/parser":"^6.21.0",esbuild:"^0.20.2",eslint:"^8.57.0","eslint-plugin-jasmine":"^4.1.3","eslint-plugin-react":"^7.34.0","fast-glob":"^3.3.2",jasmine:"^5.1.0","jasmine-core":"^5.1.2","jasmine-spec-reporter":"^7.0.0","js-sha256":"^0.11.0",karma:"^6.4.2","karma-chrome-launcher":"^3.2.0","karma-coverage":"^2.2.1","karma-firefox-launcher":"^2.1.3","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.5",puppeteer:"^22.8.0",rimraf:"^5.0.5",s3rver:"^3.7.1",typedoc:"^0.25.13",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/tests-*","!dist/duckdb-browser-mvp.worker.js.map","!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-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":{node:{types:"./dist/duckdb-node-blocking.d.ts",require:"./dist/duckdb-node-blocking.cjs",import:"./dist/duckdb-node-blocking.cjs"},types:"./dist/duckdb-node-blocking.d.ts",import:"./dist/duckdb-node-blocking.mjs",require:"./dist/duckdb-node-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"}}},mZ=eM.name,yZ=eM.version,rM=eM.version.split("."),XMt=rM[0],HMt=rM[1],QMt=rM[2],gZ=()=>typeof navigator>"u";function m5(){let e="https://cdn.jsdelivr.net/npm/".concat(mZ,"@").concat(yZ,"/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 HE=null,QE=null,ZE=null,KE=null,JE=null;async function xZ(){return HE==null&&(HE=typeof BigInt64Array<"u"),QE==null&&(QE=await dZ()),ZE==null&&(ZE=await pZ()),KE==null&&(KE=await hZ()),JE==null&&(JE=await fZ()),{bigInt64Array:HE,crossOriginIsolated:gZ()||globalThis.crossOriginIsolated||!1,wasmExceptions:QE,wasmSIMD:KE,wasmThreads:ZE,wasmBulkMemory:JE}}async function y5(e){let t=await xZ();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 ZMt=ZQ(KQ());function bZ(){let e=new TextDecoder;return t=>(typeof SharedArrayBuffer<"u"&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),e.decode(t))}var KMt=bZ(),_Z=(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))(_Z||{});function vZ(e,t){return new Promise((r,n)=>{e.useUnsafe(async(i,o)=>{try{let s=await i.runQuery(o,t);r(s)}catch(s){n(s)}})})}function g5(e={}){let{duckdb:t,connection:r,...n}=e,i=t,o=r,s;function a(){return s||(s=(i?Promise.resolve(i):SZ(n).then(u=>i=u)).then(u=>u.connect()).then(u=>o=u)),s}async function c(){return i||await a(),i}async function l(){return o||await a(),o}return{getDuckDB:c,getConnection:l,query:async u=>{let{type:f,sql:d}=u,h=await l(),p=await vZ(h,d);return f==="exec"?void 0:f==="arrow"?pc(p):pc(p).toArray()}}}async function SZ({log:e=!1}={}){let t=m5(),r=await y5(t),n=URL.createObjectURL(new Blob([`importScripts("${r.mainWorker}");`],{type:"text/javascript"})),i=new Worker(n),o=e?new d5:new f5,s=new p5(o,i);return await s.instantiate(r.mainModule,r.pthreadWorker),URL.revokeObjectURL(n),s}function bu(e,t,{source:r,clients:n=r?new Set([r]):void 0}){let i=t!==void 0?Yf(e,Er(t)):null;return{meta:{type:"point"},source:r,clients:n,value:t,predicate:i}}function Sa(e,t,{source:r,clients:n=r?new Set([r]):void 0}){let i=null;if(t){let o=t.length&&e.length===1?[cA(e[0],t.map(s=>Er(s[0])))]:t.map(s=>on(s.map((a,c)=>Yf(e[c],Er(a)))));i=t.length===0?Er(!1):o.length>1?Oi(o):o[0]}return{meta:{type:"point"},source:r,clients:n,value:t,predicate:i}}function _u(e,t,{source:r,clients:n=r?new Set([r]):void 0,bin:i,scale:o,pixelSize:s=1}){let a=t!=null?jr(e,t):null;return{meta:{type:"interval",scales:o&&[o],bin:i,pixelSize:s},source:r,clients:n,value:t,predicate:a}}function nM(e,t,{source:r,clients:n=r?new Set([r]):void 0,bin:i,scales:o=[],pixelSize:s=1}){let a=t!=null?on(e.map((l,u)=>jr(l,t[u]))):null;return{meta:{type:"interval",scales:o,bin:i,pixelSize:s},source:r,clients:n,value:t,predicate:a}}var IZ={contains:pA,prefix:mA,suffix:yA,regexp:hA};function iM(e,t,{source:r,clients:n=void 0,method:i="contains"}){let o=IZ[i],s=t?o(e,Er(t)):null;return{meta:{type:"match",method:i},source:r,clients:n,value:t,predicate:s}}function oM(e){return typeof e?.getChild=="function"}function sM(){let e=new Set,t,r=new Promise(n=>t=n);return{pending(n){e.add(n)},ready(n){return e.delete(n),e.size===0},resolve(){r=new Promise(n=>{t(),t=n})},get promise(){return r}}}function Xn(e){return oM(e)?TZ(e):AZ(e)}function TZ(e){let{numRows:t}=e;return{numRows:t,columns:e.toColumns()}}function AZ(e){let t=e.length;if(typeof e[0]=="object"){let r=t?Object.keys(e[0]):[],n={};return r.length>0&&r.forEach(i=>{n[i]=e.map(o=>o[i])}),{numRows:t,columns:n}}else return{numRows:t,values:e}}var aC={};Jn(aC,{Fixed:()=>es,Param:()=>vc,Query:()=>ft,Selection:()=>qo,align:()=>j8,and:()=>on,area:()=>OL,areaX:()=>RL,areaY:()=>DL,argmax:()=>xc,argmin:()=>bc,ariaDescription:()=>Q8,ariaLabel:()=>H8,arrayAgg:()=>TT,arrow:()=>TF,aspectRatio:()=>q8,avg:()=>Xp,axis:()=>V8,axisFx:()=>OF,axisFy:()=>RF,axisX:()=>MF,axisY:()=>NF,barX:()=>kL,barY:()=>BL,bin:()=>I8,cast:()=>qf,cell:()=>PL,cellX:()=>UL,cellY:()=>$L,centroid:()=>tm,centroidX:()=>fA,centroidY:()=>dA,circle:()=>GL,clip:()=>G8,colorBase:()=>LD,colorClamp:()=>wD,colorConstant:()=>CD,colorDomain:()=>bD,colorExponent:()=>FD,colorInterpolate:()=>TD,colorLabel:()=>MD,colorLegend:()=>iC,colorN:()=>vD,colorNice:()=>SD,colorPercent:()=>ND,colorPivot:()=>AD,colorRange:()=>_D,colorReverse:()=>OD,colorScale:()=>xD,colorScheme:()=>ID,colorSymmetric:()=>ED,colorTickFormat:()=>DD,colorZero:()=>RD,column:()=>Gs,contour:()=>fF,coordinator:()=>Li,corr:()=>AT,count:()=>Mr,covarPop:()=>MT,covariance:()=>ET,createSchema:()=>NA,createTable:()=>_c,cume_dist:()=>wA,dateDay:()=>JT,dateMonth:()=>ZT,dateMonthDay:()=>KT,delaunayLink:()=>vF,delaunayMesh:()=>SF,denseLine:()=>uF,dense_rank:()=>bA,density:()=>lF,densityX:()=>aF,densityY:()=>cF,dot:()=>VL,dotX:()=>YL,dotY:()=>WL,entropy:()=>NT,eq:()=>iA,errorbarX:()=>xF,errorbarY:()=>bF,facetGrid:()=>xR,facetLabel:()=>bR,facetMargin:()=>hR,facetMarginBottom:()=>mR,facetMarginLeft:()=>yR,facetMarginRight:()=>gR,facetMarginTop:()=>pR,first:()=>OT,first_value:()=>IA,float32:()=>XT,float64:()=>Ge,frame:()=>EF,from:()=>yW,fxAlign:()=>AR,fxAriaDescription:()=>VR,fxAriaLabel:()=>qR,fxAxis:()=>OR,fxDomain:()=>_R,fxFontVariant:()=>jR,fxGrid:()=>BR,fxInset:()=>vR,fxInsetLeft:()=>SR,fxInsetRight:()=>IR,fxLabel:()=>UR,fxLabelAnchor:()=>$R,fxLabelOffset:()=>zR,fxLine:()=>PR,fxPadding:()=>ER,fxPaddingInner:()=>MR,fxPaddingOuter:()=>NR,fxRange:()=>wR,fxReverse:()=>YR,fxRound:()=>TR,fxTickFormat:()=>CR,fxTickPadding:()=>FR,fxTickRotate:()=>kR,fxTickSize:()=>DR,fxTickSpacing:()=>LR,fxTicks:()=>RR,fyAlign:()=>KR,fyAriaDescription:()=>yD,fyAriaLabel:()=>mD,fyAxis:()=>rD,fyDomain:()=>WR,fyFontVariant:()=>pD,fyGrid:()=>lD,fyInset:()=>XR,fyInsetBottom:()=>QR,fyInsetTop:()=>HR,fyLabel:()=>fD,fyLabelAnchor:()=>dD,fyLabelOffset:()=>hD,fyLine:()=>uD,fyPadding:()=>JR,fyPaddingInner:()=>tD,fyPaddingOuter:()=>eD,fyRange:()=>GR,fyReverse:()=>gD,fyRound:()=>ZR,fyTickFormat:()=>aD,fyTickPadding:()=>sD,fyTickRotate:()=>cD,fyTickSize:()=>iD,fyTickSpacing:()=>oD,fyTicks:()=>nD,geo:()=>kF,geojson:()=>Jp,graticule:()=>PF,grid:()=>W8,gridFx:()=>FF,gridFy:()=>CF,gridX:()=>DF,gridY:()=>LF,gt:()=>Di,gte:()=>oA,hconcat:()=>lW,heatmap:()=>dF,height:()=>B8,hexagon:()=>XL,hexbin:()=>mF,hexgrid:()=>yF,highlight:()=>UF,hspace:()=>dW,hull:()=>IF,image:()=>sF,inset:()=>Y8,int32:()=>ve,intervalX:()=>$F,intervalXY:()=>jF,intervalY:()=>zF,isBetween:()=>jr,isDistinct:()=>sA,isNotBetween:()=>aA,isNotDistinct:()=>Yf,isNotNull:()=>Ri,isNull:()=>Kl,kurtosis:()=>RT,lag:()=>SA,last:()=>CT,last_value:()=>TA,lead:()=>Wf,lengthBase:()=>yL,lengthClamp:()=>dL,lengthConstant:()=>xL,lengthDomain:()=>uL,lengthExponent:()=>gL,lengthNice:()=>hL,lengthPercent:()=>pL,lengthRange:()=>fL,lengthScale:()=>lL,lengthZero:()=>mL,line:()=>LL,lineX:()=>FL,lineY:()=>CL,link:()=>AF,literal:()=>Er,loadCSV:()=>DA,loadExtension:()=>OA,loadJSON:()=>LA,loadObjects:()=>kA,loadParquet:()=>FA,loadSpatial:()=>CA,lt:()=>ze,lte:()=>ri,mad:()=>DT,margin:()=>L8,marginBottom:()=>z8,marginLeft:()=>P8,marginRight:()=>U8,marginTop:()=>$8,margins:()=>D8,max:()=>zr,median:()=>LT,menu:()=>nW,min:()=>zn,mode:()=>FT,name:()=>O8,nearest:()=>qF,nearestX:()=>VF,nearestY:()=>YF,neq:()=>so,not:()=>nA,nth_value:()=>AA,ntile:()=>vA,opacityBase:()=>WD,opacityClamp:()=>UD,opacityConstant:()=>XD,opacityDomain:()=>BD,opacityExponent:()=>GD,opacityLabel:()=>zD,opacityLegend:()=>oC,opacityNice:()=>$D,opacityPercent:()=>jD,opacityRange:()=>PD,opacityReverse:()=>qD,opacityScale:()=>kD,opacityTickFormat:()=>YD,opacityZero:()=>VD,or:()=>Oi,padding:()=>X8,pan:()=>ZF,panX:()=>KF,panY:()=>JF,panZoom:()=>tC,panZoomX:()=>eC,panZoomY:()=>rC,percent_rank:()=>_A,plot:()=>_W,product:()=>kT,projectionClip:()=>NL,projectionDomain:()=>SL,projectionInset:()=>IL,projectionInsetBottom:()=>ML,projectionInsetLeft:()=>TL,projectionInsetRight:()=>AL,projectionInsetTop:()=>EL,projectionParallels:()=>_L,projectionPrecision:()=>wL,projectionRotate:()=>vL,projectionType:()=>bL,quantile:()=>BT,rBase:()=>sL,rClamp:()=>eL,rConstant:()=>cL,rDomain:()=>JD,rExponent:()=>aL,rLabel:()=>nL,rNice:()=>rL,rPercent:()=>iL,rRange:()=>tL,rScale:()=>KD,rZero:()=>oL,rank:()=>xA,raster:()=>hF,rasterTile:()=>pF,rect:()=>zL,rectX:()=>jL,rectY:()=>qL,region:()=>WF,regressionY:()=>gF,row_number:()=>gA,ruleX:()=>KL,ruleY:()=>JL,search:()=>iW,skewness:()=>qT,slider:()=>oW,sphere:()=>BF,spike:()=>oF,sql:()=>tr,stddev:()=>Zp,stddevPop:()=>VT,stringAgg:()=>YT,style:()=>C8,sum:()=>de,symbolDomain:()=>QD,symbolLegend:()=>sC,symbolRange:()=>ZD,symbolScale:()=>HD,table:()=>sW,text:()=>HL,textX:()=>QL,textY:()=>ZL,tickX:()=>tF,tickY:()=>eF,toggle:()=>Tf,toggleColor:()=>QF,toggleX:()=>GF,toggleY:()=>XF,toggleZ:()=>HF,varPop:()=>GT,variance:()=>WT,vconcat:()=>cW,vector:()=>rF,vectorX:()=>nF,vectorY:()=>iF,voronoi:()=>_F,voronoiMesh:()=>wF,vspace:()=>fW,width:()=>k8,xAlign:()=>sO,xAriaDescription:()=>TO,xAriaLabel:()=>IO,xAxis:()=>uO,xBase:()=>NO,xClamp:()=>iO,xConstant:()=>RO,xDomain:()=>K8,xExponent:()=>OO,xFontVariant:()=>SO,xGrid:()=>gO,xInset:()=>eO,xInsetLeft:()=>rO,xInsetRight:()=>nO,xLabel:()=>bO,xLabelAnchor:()=>_O,xLabelArrow:()=>wO,xLabelOffset:()=>vO,xLine:()=>xO,xNice:()=>tO,xPadding:()=>aO,xPaddingInner:()=>cO,xPaddingOuter:()=>lO,xPercent:()=>AO,xRange:()=>J8,xReverse:()=>EO,xRound:()=>oO,xScale:()=>Z8,xTickFormat:()=>mO,xTickPadding:()=>pO,xTickRotate:()=>yO,xTickSize:()=>dO,xTickSpacing:()=>hO,xTicks:()=>fO,xZero:()=>MO,xyDomain:()=>F8,yAlign:()=>zO,yAriaDescription:()=>sR,yAriaLabel:()=>oR,yAxis:()=>YO,yBase:()=>uR,yClamp:()=>UO,yConstant:()=>dR,yDomain:()=>LO,yExponent:()=>fR,yFontVariant:()=>iR,yGrid:()=>KO,yInset:()=>kO,yInsetBottom:()=>PO,yInsetTop:()=>BO,yLabel:()=>tR,yLabelAnchor:()=>eR,yLabelArrow:()=>rR,yLabelOffset:()=>nR,yLine:()=>JO,yNice:()=>CO,yPadding:()=>jO,yPaddingInner:()=>qO,yPaddingOuter:()=>VO,yPercent:()=>aR,yRange:()=>FO,yReverse:()=>cR,yRound:()=>$O,yScale:()=>DO,yTickFormat:()=>QO,yTickPadding:()=>HO,yTickRotate:()=>ZO,yTickSize:()=>GO,yTickSpacing:()=>XO,yTicks:()=>WO,yZero:()=>lR});var es=Symbol("Fixed"),Gr=Symbol("Transient"),oy=Symbol("Transform");var f8={};Jn(f8,{Area:()=>hf,Arrow:()=>w0,BarX:()=>pf,BarY:()=>mf,Cell:()=>yf,Contour:()=>D0,Density:()=>C0,Dot:()=>gf,Frame:()=>p0,Geo:()=>k0,Hexgrid:()=>B0,Image:()=>P0,Line:()=>xf,Link:()=>b0,Mark:()=>vt,Raster:()=>M0,Rect:()=>df,RuleX:()=>o0,RuleY:()=>s0,Text:()=>lf,TickX:()=>I0,TickY:()=>T0,Tip:()=>m0,Vector:()=>ff,WaffleX:()=>$0,WaffleY:()=>z0,area:()=>x0,areaX:()=>Tl,areaY:()=>ac,arrow:()=>mq,auto:()=>Aq,autoSpec:()=>kN,axisFx:()=>zS,axisFy:()=>$S,axisX:()=>c0,axisY:()=>a0,barX:()=>Fs,barY:()=>Cs,bin:()=>sc,binX:()=>Ds,binY:()=>Ls,bollinger:()=>Nl,bollingerX:()=>Dq,bollingerY:()=>Lq,boxX:()=>Fq,boxY:()=>Cq,cell:()=>Al,cellX:()=>gq,cellY:()=>xq,centroid:()=>pI,circle:()=>wq,cluster:()=>LV,column:()=>Br,contour:()=>Vq,crosshair:()=>Gq,crosshairX:()=>Xq,crosshairY:()=>Hq,delaunayLink:()=>Kq,delaunayMesh:()=>Jq,density:()=>iV,differenceX:()=>aV,differenceY:()=>cV,dodgeX:()=>JV,dodgeY:()=>tY,dot:()=>to,dotX:()=>bq,dotY:()=>_q,filter:()=>E$,find:()=>k$,formatIsoDate:()=>aN,formatMonth:()=>zz,formatNumber:()=>sN,formatWeekday:()=>jz,frame:()=>jh,geo:()=>mI,geoCentroid:()=>uV,graticule:()=>dV,gridFx:()=>YS,gridFy:()=>qS,gridX:()=>VS,gridY:()=>jS,group:()=>Zg,groupX:()=>ul,groupY:()=>fl,groupZ:()=>Qg,hexagon:()=>vq,hexbin:()=>hV,hexgrid:()=>pV,hull:()=>tV,identity:()=>G,image:()=>yV,indexOf:()=>Ee,initializer:()=>Ne,interpolateNearest:()=>O0,interpolateNone:()=>hI,interpolatorBarycentric:()=>N0,interpolatorRandomWalk:()=>R0,legend:()=>Bj,line:()=>bf,lineX:()=>El,lineY:()=>Ml,linearRegressionX:()=>bV,linearRegressionY:()=>_V,link:()=>iI,map:()=>Zn,mapX:()=>Xh,mapY:()=>Hh,marks:()=>yr,normalize:()=>II,normalizeX:()=>iY,normalizeY:()=>oY,numberInterval:()=>I4,plot:()=>qh,pointer:()=>gl,pointerX:()=>xl,pointerY:()=>ic,raster:()=>$q,rect:()=>h0,rectX:()=>$h,rectY:()=>zh,reverse:()=>M$,ruleX:()=>vi,ruleY:()=>Si,scale:()=>dl,select:()=>lY,selectFirst:()=>V0,selectLast:()=>Y0,selectMaxX:()=>MI,selectMaxY:()=>NI,selectMinX:()=>AI,selectMinY:()=>EI,shiftX:()=>sY,shiftY:()=>aY,shuffle:()=>N$,sort:()=>cS,sphere:()=>fV,spike:()=>gj,stackX:()=>TN,stackX1:()=>qj,stackX2:()=>Vj,stackY:()=>AN,stackY1:()=>Yj,stackY2:()=>Wj,text:()=>Rs,textX:()=>LS,textY:()=>FS,tickX:()=>uI,tickY:()=>fI,timeInterval:()=>Vg,tip:()=>KS,transform:()=>mr,tree:()=>r8,treeLink:()=>_I,treeNode:()=>U0,utcInterval:()=>Ku,valueof:()=>_t,vector:()=>vN,vectorX:()=>BS,vectorY:()=>PS,voronoi:()=>eV,voronoiMesh:()=>rV,waffleX:()=>UV,waffleY:()=>$V,window:()=>Qh,windowX:()=>Eq,windowY:()=>Mq});function Ft(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function vn(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function To(e){let t,r,n;e.length!==2?(t=Ft,r=(a,c)=>Ft(e(a),c),n=(a,c)=>e(a)-c):(t=e===Ft||e===vn?e:EZ,r=e,n=e);function i(a,c,l=0,u=a.length){if(l<u){if(t(c,c)!==0)return u;do{let f=l+u>>>1;r(a[f],c)<0?l=f+1:u=f}while(l<u)}return l}function o(a,c,l=0,u=a.length){if(l<u){if(t(c,c)!==0)return u;do{let f=l+u>>>1;r(a[f],c)<=0?l=f+1:u=f}while(l<u)}return l}function s(a,c,l=0,u=a.length){let f=i(a,c,l,u-1);return f>l&&n(a[f-1],c)>-n(a[f],c)?f-1:f}return{left:i,center:s,right:o}}function EZ(){return 0}function sy(e){return e===null?NaN:+e}function*x5(e,t){if(t===void 0)for(let r of e)r!=null&&(r=+r)>=r&&(yield r);else{let r=-1;for(let n of e)(n=t(n,++r,e))!=null&&(n=+n)>=n&&(yield n)}}var b5=To(Ft),_5=b5.right,MZ=b5.left,NZ=To(sy).center,Ia=_5;var ay=w5(v5),aM=w5(OZ);function w5(e){return function(t,r,n=r){if(!((r=+r)>=0))throw new RangeError("invalid rx");if(!((n=+n)>=0))throw new RangeError("invalid ry");let{data:i,width:o,height:s}=t;if(!((o=Math.floor(o))>=0))throw new RangeError("invalid width");if(!((s=Math.floor(s!==void 0?s:i.length/o))>=0))throw new RangeError("invalid height");if(!o||!s||!r&&!n)return t;let a=r&&e(r),c=n&&e(n),l=i.slice();return a&&c?(wd(a,l,i,o,s),wd(a,i,l,o,s),wd(a,l,i,o,s),vd(c,i,l,o,s),vd(c,l,i,o,s),vd(c,i,l,o,s)):a?(wd(a,i,l,o,s),wd(a,l,i,o,s),wd(a,i,l,o,s)):c&&(vd(c,i,l,o,s),vd(c,l,i,o,s),vd(c,i,l,o,s)),t}}function wd(e,t,r,n,i){for(let o=0,s=n*i;o<s;)e(t,r,o,o+=n,1)}function vd(e,t,r,n,i){for(let o=0,s=n*i;o<n;++o)e(t,r,o,o+s,n)}function OZ(e){let t=v5(e);return(r,n,i,o,s)=>{i<<=2,o<<=2,s<<=2,t(r,n,i+0,o+0,s),t(r,n,i+1,o+1,s),t(r,n,i+2,o+2,s),t(r,n,i+3,o+3,s)}}function v5(e){let t=Math.floor(e);if(t===e)return RZ(e);let r=e-t,n=2*e+1;return(i,o,s,a,c)=>{if(!((a-=c)>=s))return;let l=t*o[s],u=c*t,f=u+c;for(let d=s,h=s+u;d<h;d+=c)l+=o[Math.min(a,d)];for(let d=s,h=a;d<=h;d+=c)l+=o[Math.min(a,d+u)],i[d]=(l+r*(o[Math.max(s,d-f)]+o[Math.min(a,d+f)]))/n,l-=o[Math.max(s,d-u)]}}function RZ(e){let t=2*e+1;return(r,n,i,o,s)=>{if(!((o-=s)>=i))return;let a=e*n[i],c=s*e;for(let l=i,u=i+c;l<u;l+=s)a+=n[Math.min(o,l)];for(let l=i,u=o;l<=u;l+=s)a+=n[Math.min(o,l+c)],r[l]=a/t,a-=n[Math.max(i,l-c)]}}function rs(e,t){let r=0;if(t===void 0)for(let n of e)n!=null&&(n=+n)>=n&&++r;else{let n=-1;for(let i of e)(i=t(i,++n,e))!=null&&(i=+i)>=i&&++r}return r}function DZ(e){return e.length|0}function LZ(e){return!(e>0)}function FZ(e){return typeof e!="object"||"length"in e?e:Array.from(e)}function CZ(e){return t=>e(...t)}function j_(...e){let t=typeof e[e.length-1]=="function"&&CZ(e.pop());e=e.map(FZ);let r=e.map(DZ),n=e.length-1,i=new Array(n+1).fill(0),o=[];if(n<0||r.some(LZ))return o;for(;;){o.push(i.map((a,c)=>e[c][a]));let s=n;for(;++i[s]===r[s];){if(s===0)return t?o.map(t):o;i[s--]=0}}}function q_(e,t){var r=0,n=0;return Float64Array.from(e,t===void 0?i=>r+=+i||0:i=>r+=+t(i,n++,e)||0)}function Pc(e,t){let r=0,n,i=0,o=0;if(t===void 0)for(let s of e)s!=null&&(s=+s)>=s&&(n=s-i,i+=n/++r,o+=n*(s-i));else{let s=-1;for(let a of e)(a=t(a,++s,e))!=null&&(a=+a)>=a&&(n=a-i,i+=n/++r,o+=n*(a-i))}if(r>1)return o/(r-1)}function zi(e,t){let r=Pc(e,t);return r&&Math.sqrt(r)}function ce(e,t){let r,n;if(t===void 0)for(let i of e)i!=null&&(r===void 0?i>=i&&(r=n=i):(r>i&&(r=i),n<i&&(n=i)));else{let i=-1;for(let o of e)(o=t(o,++i,e))!=null&&(r===void 0?o>=o&&(r=n=o):(r>o&&(r=o),n<o&&(n=o)))}return[r,n]}var Xr=class{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){let r=this._partials,n=0;for(let i=0;i<this._n&&i<32;i++){let o=r[i],s=t+o,a=Math.abs(t)<Math.abs(o)?t-(s-o):o-(s-t);a&&(r[n++]=a),t=s}return r[n]=t,this._n=n+1,this}valueOf(){let t=this._partials,r=this._n,n,i,o,s=0;if(r>0){for(s=t[--r];r>0&&(n=s,i=t[--r],s=n+i,o=i-(s-n),!o););r>0&&(o<0&&t[r-1]<0||o>0&&t[r-1]>0)&&(i=o*2,n=s+i,i==n-s&&(s=n))}return s}};var Sn=class extends Map{constructor(t,r=T5){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(let[n,i]of t)this.set(n,i)}get(t){return super.get(cM(this,t))}has(t){return super.has(cM(this,t))}set(t,r){return super.set(S5(this,t),r)}delete(t){return super.delete(I5(this,t))}},In=class extends Set{constructor(t,r=T5){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(let n of t)this.add(n)}has(t){return super.has(cM(this,t))}add(t){return super.add(S5(this,t))}delete(t){return super.delete(I5(this,t))}};function cM({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):r}function S5({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function I5({_intern:e,_key:t},r){let n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function T5(e){return e!==null&&typeof e=="object"?e.valueOf():e}function cy(e){return e}function Hr(e,...t){return uM(e,cy,cy,t)}function Ao(e,t,...r){return uM(e,cy,t,r)}function lM(e,t,...r){return uM(e,Array.from,t,r)}function uM(e,t,r,n){return function i(o,s){if(s>=n.length)return r(o);let a=new Sn,c=n[s++],l=-1;for(let u of o){let f=c(u,++l,o),d=a.get(f);d?d.push(u):a.set(f,[u])}for(let[u,f]of a)a.set(u,i(f,s));return t(a)}(e,0)}function fM(e,t){return Array.from(t,r=>e[r])}function Ta(e,...t){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");e=Array.from(e);let[r]=t;if(r&&r.length!==2||t.length>1){let n=Uint32Array.from(e,(i,o)=>o);return t.length>1?(t=t.map(i=>e.map(i)),n.sort((i,o)=>{for(let s of t){let a=wu(s[i],s[o]);if(a)return a}})):(r=e.map(r),n.sort((i,o)=>wu(r[i],r[o]))),fM(e,n)}return e.sort(ly(r))}function ly(e=Ft){if(e===Ft)return wu;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,r)=>{let n=e(t,r);return n||n===0?n:(e(r,r)===0)-(e(t,t)===0)}}function wu(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}function Sd(e,t,r){return(t.length!==2?Ta(Ao(e,t,r),([n,i],[o,s])=>Ft(i,s)||Ft(n,o)):Ta(Hr(e,r),([n,i],[o,s])=>t(i,s)||Ft(n,o))).map(([n])=>n)}var kZ=Math.sqrt(50),BZ=Math.sqrt(10),PZ=Math.sqrt(2);function V_(e,t,r){let n=(t-e)/Math.max(0,r),i=Math.floor(Math.log10(n)),o=n/Math.pow(10,i),s=o>=kZ?10:o>=BZ?5:o>=PZ?2:1,a,c,l;return i<0?(l=Math.pow(10,-i)/s,a=Math.round(e*l),c=Math.round(t*l),a/l<e&&++a,c/l>t&&--c,l=-l):(l=Math.pow(10,i)*s,a=Math.round(e/l),c=Math.round(t/l),a*l<e&&++a,c*l>t&&--c),c<a&&.5<=r&&r<2?V_(e,t,r*2):[a,c,l]}function Qr(e,t,r){if(t=+t,e=+e,r=+r,!(r>0))return[];if(e===t)return[e];let n=t<e,[i,o,s]=n?V_(t,e,r):V_(e,t,r);if(!(o>=i))return[];let a=o-i+1,c=new Array(a);if(n)if(s<0)for(let l=0;l<a;++l)c[l]=(o-l)/-s;else for(let l=0;l<a;++l)c[l]=(o-l)*s;else if(s<0)for(let l=0;l<a;++l)c[l]=(i+l)/-s;else for(let l=0;l<a;++l)c[l]=(i+l)*s;return c}function Aa(e,t,r){return t=+t,e=+e,r=+r,V_(e,t,r)[2]}function Id(e,t,r){t=+t,e=+e,r=+r;let n=t<e,i=n?Aa(t,e,r):Aa(e,t,r);return(n?-1:1)*(i<0?1/-i:i)}function Td(e,t,r){let n;for(;;){let i=Aa(e,t,r);if(i===n||i===0||!isFinite(i))return[e,t];i>0?(e=Math.floor(e/i)*i,t=Math.ceil(t/i)*i):i<0&&(e=Math.ceil(e*i)/i,t=Math.floor(t*i)/i),n=i}}function Uc(e){return Math.max(1,Math.ceil(Math.log(rs(e))/Math.LN2)+1)}function Kt(e,t){let r;if(t===void 0)for(let n of e)n!=null&&(r<n||r===void 0&&n>=n)&&(r=n);else{let n=-1;for(let i of e)(i=t(i,++n,e))!=null&&(r<i||r===void 0&&i>=i)&&(r=i)}return r}function Y_(e,t){let r,n=-1,i=-1;if(t===void 0)for(let o of e)++i,o!=null&&(r<o||r===void 0&&o>=o)&&(r=o,n=i);else for(let o of e)(o=t(o,++i,e))!=null&&(r<o||r===void 0&&o>=o)&&(r=o,n=i);return n}function Ht(e,t){let r;if(t===void 0)for(let n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);else{let n=-1;for(let i of e)(i=t(i,++n,e))!=null&&(r>i||r===void 0&&i>=i)&&(r=i)}return r}function W_(e,t){let r,n=-1,i=-1;if(t===void 0)for(let o of e)++i,o!=null&&(r>o||r===void 0&&o>=o)&&(r=o,n=i);else for(let o of e)(o=t(o,++i,e))!=null&&(r>o||r===void 0&&o>=o)&&(r=o,n=i);return n}function G_(e,t,r=0,n=1/0,i){if(t=Math.floor(t),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(e.length-1,n)),!(r<=t&&t<=n))return e;for(i=i===void 0?wu:ly(i);n>r;){if(n-r>600){let c=n-r+1,l=t-r+1,u=Math.log(c),f=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*f*(c-f)/c)*(l-c/2<0?-1:1),h=Math.max(r,Math.floor(t-l*f/c+d)),p=Math.min(n,Math.floor(t+(c-l)*f/c+d));G_(e,t,h,p,i)}let o=e[t],s=r,a=n;for(uy(e,r,t),i(e[n],o)>0&&uy(e,r,n);s<a;){for(uy(e,s,a),++s,--a;i(e[s],o)<0;)++s;for(;i(e[a],o)>0;)--a}i(e[r],o)===0?uy(e,r,a):(++a,uy(e,a,n)),a<=t&&(r=a+1),t<=a&&(n=a-1)}return e}function uy(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}function vu(e,t=Ft){let r,n=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(n?Ft(s,i)>0:Ft(s,s)===0)&&(r=o,i=s,n=!0)}}else for(let i of e)(n?t(i,r)>0:t(i,i)===0)&&(r=i,n=!0);return r}function Tn(e,t,r){if(e=Float64Array.from(x5(e,r)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return Ht(e);if(t>=1)return Kt(e);var n,i=(n-1)*t,o=Math.floor(i),s=Kt(G_(e,o).subarray(0,o+1)),a=Ht(e.subarray(o+1));return s+(a-s)*(i-o)}}function dM(e,t,r=sy){if(!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return+r(e[0],0,e);if(t>=1)return+r(e[n-1],n-1,e);var n,i=(n-1)*t,o=Math.floor(i),s=+r(e[o],o,e),a=+r(e[o+1],o+1,e);return s+(a-s)*(i-o)}}function X_(e,t,r){let n=rs(e),i=Tn(e,.75)-Tn(e,.25);return n&&i?Math.ceil((r-t)/(2*i*Math.pow(n,-1/3))):1}function fy(e,t,r){let n=rs(e),i=zi(e);return n&&i?Math.ceil((r-t)*Math.cbrt(n)/(3.49*i)):1}function Ea(e,t){let r=0,n=0;if(t===void 0)for(let i of e)i!=null&&(i=+i)>=i&&(++r,n+=i);else{let i=-1;for(let o of e)(o=t(o,++i,e))!=null&&(o=+o)>=o&&(++r,n+=o)}if(r)return n/r}function Eo(e,t){return Tn(e,.5,t)}function*$Z(e){for(let t of e)yield*t}function Ad(e){return Array.from($Z(e))}function Ed(e,t){let r=new Sn;if(t===void 0)for(let o of e)o!=null&&o>=o&&r.set(o,(r.get(o)||0)+1);else{let o=-1;for(let s of e)(s=t(s,++o,e))!=null&&s>=s&&r.set(s,(r.get(s)||0)+1)}let n,i=0;for(let[o,s]of r)s>i&&(i=s,n=o);return n}function H_(e,t=zZ){let r=[],n,i=!1;for(let o of e)i&&r.push(t(n,o)),n=o,i=!0;return r}function zZ(e,t){return[e,t]}function er(e,t,r){e=+e,t=+t,r=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+r;for(var n=-1,i=Math.max(0,Math.ceil((t-e)/r))|0,o=new Array(i);++n<i;)o[n]=e+n*r;return o}function dy(e,t=Ft){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");let r=Array.from(e),n=new Float64Array(r.length);t.length!==2&&(r=r.map(t),t=Ft);let i=(a,c)=>t(r[a],r[c]),o,s;return e=Uint32Array.from(r,(a,c)=>c),e.sort(t===Ft?(a,c)=>wu(r[a],r[c]):ly(i)),e.forEach((a,c)=>{let l=i(a,o===void 0?a:o);l>=0?((o===void 0||l>0)&&(o=a,s=c),n[a]=s):n[a]=NaN}),n}function Q_(e,t=Ft){let r,n=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(n?Ft(s,i)<0:Ft(s,s)===0)&&(r=o,i=s,n=!0)}}else for(let i of e)(n?t(i,r)<0:t(i,i)===0)&&(r=i,n=!0);return r}function Zr(e,t){let r=0;if(t===void 0)for(let n of e)(n=+n)&&(r+=n);else{let n=-1;for(let i of e)(i=+t(i,++n,e))&&(r+=i)}return r}function $c(e){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");return Array.from(e).reverse()}function A5(e){return e}var hM=1,pM=2,mM=3,Z_=4,E5=1e-6;function jZ(e){return"translate("+e+",0)"}function qZ(e){return"translate(0,"+e+")"}function VZ(e){return t=>+e(t)}function YZ(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),r=>+e(r)+t}function WZ(){return!this.__axis}function GZ(e,t){var r=[],n=null,i=null,o=6,s=6,a=3,c=typeof window<"u"&&window.devicePixelRatio>1?0:.5,l=e===hM||e===Z_?-1:1,u=e===Z_||e===pM?"x":"y",f=e===hM||e===mM?jZ:qZ;function d(h){var p=n??(t.ticks?t.ticks.apply(t,r):t.domain()),m=i??(t.tickFormat?t.tickFormat.apply(t,r):A5),y=Math.max(o,0)+a,g=t.range(),x=+g[0]+c,b=+g[g.length-1]+c,_=(t.bandwidth?YZ:VZ)(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(),E=T.enter().append("g").attr("class","tick"),N=T.select("line"),I=T.select("text");w=w.merge(w.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),T=T.merge(E),N=N.merge(E.append("line").attr("stroke","currentColor").attr(u+"2",l*o)),I=I.merge(E.append("text").attr("fill","currentColor").attr(u,l*y).attr("dy",e===hM?"0em":e===mM?"0.71em":"0.32em")),h!==v&&(w=w.transition(h),T=T.transition(h),N=N.transition(h),I=I.transition(h),A=A.transition(h).attr("opacity",E5).attr("transform",function(R){return isFinite(R=_(R))?f(R+c):this.getAttribute("transform")}),E.attr("opacity",E5).attr("transform",function(R){var C=this.parentNode.__axis;return f((C&&isFinite(C=C(R))?C:_(R))+c)})),A.remove(),w.attr("d",e===Z_||e===pM?s?"M"+l*s+","+x+"H"+c+"V"+b+"H"+l*s:"M"+c+","+x+"V"+b:s?"M"+x+","+l*s+"V"+c+"H"+b+"V"+l*s:"M"+x+","+c+"H"+b),T.attr("opacity",1).attr("transform",function(R){return f(_(R)+c)}),N.attr(u+"2",l*o),I.attr(u,l*y).text(m),v.filter(WZ).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===pM?"start":e===Z_?"end":"middle"),v.each(function(){this.__axis=_})}return d.scale=function(h){return arguments.length?(t=h,d):t},d.ticks=function(){return r=Array.from(arguments),d},d.tickArguments=function(h){return arguments.length?(r=h==null?[]:Array.from(h),d):r.slice()},d.tickValues=function(h){return arguments.length?(n=h==null?null:Array.from(h),d):n&&n.slice()},d.tickFormat=function(h){return arguments.length?(i=h,d):i},d.tickSize=function(h){return arguments.length?(o=s=+h,d):o},d.tickSizeInner=function(h){return arguments.length?(o=+h,d):o},d.tickSizeOuter=function(h){return arguments.length?(s=+h,d):s},d.tickPadding=function(h){return arguments.length?(a=+h,d):a},d.offset=function(h){return arguments.length?(c=+h,d):c},d}function yM(e){return GZ(mM,e)}var XZ={value:()=>{}};function N5(){for(var e=0,t=arguments.length,r={},n;e<t;++e){if(!(n=arguments[e]+"")||n in r||/[\s.]/.test(n))throw new Error("illegal type: "+n);r[n]=[]}return new K_(r)}function K_(e){this._=e}function HZ(e,t){return e.trim().split(/^|\s+/).map(function(r){var n="",i=r.indexOf(".");if(i>=0&&(n=r.slice(i+1),r=r.slice(0,i)),r&&!t.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:n}})}K_.prototype=N5.prototype={constructor:K_,on:function(e,t){var r=this._,n=HZ(e+"",r),i,o=-1,s=n.length;if(arguments.length<2){for(;++o<s;)if((i=(e=n[o]).type)&&(i=QZ(r[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++o<s;)if(i=(e=n[o]).type)r[i]=M5(r[i],e.name,t);else if(t==null)for(i in r)r[i]=M5(r[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var r in t)e[r]=t[r].slice();return new K_(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var r=new Array(i),n=0,i,o;n<i;++n)r[n]=arguments[n+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(o=this._[e],n=0,i=o.length;n<i;++n)o[n].value.apply(t,r)},apply:function(e,t,r){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var n=this._[e],i=0,o=n.length;i<o;++i)n[i].value.apply(t,r)}};function QZ(e,t){for(var r=0,n=e.length,i;r<n;++r)if((i=e[r]).name===t)return i.value}function M5(e,t,r){for(var n=0,i=e.length;n<i;++n)if(e[n].name===t){e[n]=XZ,e=e.slice(0,n).concat(e.slice(n+1));break}return r!=null&&e.push({name:t,value:r}),e}var Su=N5;var J_="http://www.w3.org/1999/xhtml",An={svg:"http://www.w3.org/2000/svg",xhtml:J_,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ma(e){var t=e+="",r=t.indexOf(":");return r>=0&&(t=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),An.hasOwnProperty(t)?{space:An[t],local:e}:e}function ZZ(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===J_&&t.documentElement.namespaceURI===J_?t.createElement(e):t.createElementNS(r,e)}}function KZ(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Na(e){var t=Ma(e);return(t.local?KZ:ZZ)(t)}function JZ(){}function Iu(e){return e==null?JZ:function(){return this.querySelector(e)}}function O5(e){typeof e!="function"&&(e=Iu(e));for(var t=this._groups,r=t.length,n=new Array(r),i=0;i<r;++i)for(var o=t[i],s=o.length,a=n[i]=new Array(s),c,l,u=0;u<s;++u)(c=o[u])&&(l=e.call(c,c.__data__,u,o))&&("__data__"in c&&(l.__data__=c.__data__),a[u]=l);return new Qe(n,this._parents)}function gM(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function tK(){return[]}function hy(e){return e==null?tK:function(){return this.querySelectorAll(e)}}function eK(e){return function(){return gM(e.apply(this,arguments))}}function R5(e){typeof e=="function"?e=eK(e):e=hy(e);for(var t=this._groups,r=t.length,n=[],i=[],o=0;o<r;++o)for(var s=t[o],a=s.length,c,l=0;l<a;++l)(c=s[l])&&(n.push(e.call(c,c.__data__,l,s)),i.push(c));return new Qe(n,i)}function py(e){return function(){return this.matches(e)}}function tw(e){return function(t){return t.matches(e)}}var rK=Array.prototype.find;function nK(e){return function(){return rK.call(this.children,e)}}function iK(){return this.firstElementChild}function D5(e){return this.select(e==null?iK:nK(typeof e=="function"?e:tw(e)))}var oK=Array.prototype.filter;function sK(){return Array.from(this.children)}function aK(e){return function(){return oK.call(this.children,e)}}function L5(e){return this.selectAll(e==null?sK:aK(typeof e=="function"?e:tw(e)))}function F5(e){typeof e!="function"&&(e=py(e));for(var t=this._groups,r=t.length,n=new Array(r),i=0;i<r;++i)for(var o=t[i],s=o.length,a=n[i]=[],c,l=0;l<s;++l)(c=o[l])&&e.call(c,c.__data__,l,o)&&a.push(c);return new Qe(n,this._parents)}function ew(e){return new Array(e.length)}function C5(){return new Qe(this._enter||this._groups.map(ew),this._parents)}function my(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}my.prototype={constructor:my,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function k5(e){return function(){return e}}function cK(e,t,r,n,i,o){for(var s=0,a,c=t.length,l=o.length;s<l;++s)(a=t[s])?(a.__data__=o[s],n[s]=a):r[s]=new my(e,o[s]);for(;s<c;++s)(a=t[s])&&(i[s]=a)}function lK(e,t,r,n,i,o,s){var a,c,l=new Map,u=t.length,f=o.length,d=new Array(u),h;for(a=0;a<u;++a)(c=t[a])&&(d[a]=h=s.call(c,c.__data__,a,t)+"",l.has(h)?i[a]=c:l.set(h,c));for(a=0;a<f;++a)h=s.call(e,o[a],a,o)+"",(c=l.get(h))?(n[a]=c,c.__data__=o[a],l.delete(h)):r[a]=new my(e,o[a]);for(a=0;a<u;++a)(c=t[a])&&l.get(d[a])===c&&(i[a]=c)}function uK(e){return e.__data__}function B5(e,t){if(!arguments.length)return Array.from(this,uK);var r=t?lK:cK,n=this._parents,i=this._groups;typeof e!="function"&&(e=k5(e));for(var o=i.length,s=new Array(o),a=new Array(o),c=new Array(o),l=0;l<o;++l){var u=n[l],f=i[l],d=f.length,h=fK(e.call(u,u&&u.__data__,l,n)),p=h.length,m=a[l]=new Array(p),y=s[l]=new Array(p),g=c[l]=new Array(d);r(u,f,m,y,g,h,t);for(var x=0,b=0,_,v;x<p;++x)if(_=m[x]){for(x>=b&&(b=x+1);!(v=y[b])&&++b<p;);_._next=v||null}}return s=new Qe(s,n),s._enter=a,s._exit=c,s}function fK(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function P5(){return new Qe(this._exit||this._groups.map(ew),this._parents)}function U5(e,t,r){var n=this.enter(),i=this,o=this.exit();return typeof e=="function"?(n=e(n),n&&(n=n.selection())):n=n.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),r==null?o.remove():r(o),n&&i?n.merge(i).order():i}function $5(e){for(var t=e.selection?e.selection():e,r=this._groups,n=t._groups,i=r.length,o=n.length,s=Math.min(i,o),a=new Array(i),c=0;c<s;++c)for(var l=r[c],u=n[c],f=l.length,d=a[c]=new Array(f),h,p=0;p<f;++p)(h=l[p]||u[p])&&(d[p]=h);for(;c<i;++c)a[c]=r[c];return new Qe(a,this._parents)}function z5(){for(var e=this._groups,t=-1,r=e.length;++t<r;)for(var n=e[t],i=n.length-1,o=n[i],s;--i>=0;)(s=n[i])&&(o&&s.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(s,o),o=s);return this}function j5(e){e||(e=dK);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var r=this._groups,n=r.length,i=new Array(n),o=0;o<n;++o){for(var s=r[o],a=s.length,c=i[o]=new Array(a),l,u=0;u<a;++u)(l=s[u])&&(c[u]=l);c.sort(t)}return new Qe(i,this._parents).order()}function dK(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function q5(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function V5(){return Array.from(this)}function Y5(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var n=e[t],i=0,o=n.length;i<o;++i){var s=n[i];if(s)return s}return null}function W5(){let e=0;for(let t of this)++e;return e}function G5(){return!this.node()}function X5(e){for(var t=this._groups,r=0,n=t.length;r<n;++r)for(var i=t[r],o=0,s=i.length,a;o<s;++o)(a=i[o])&&e.call(a,a.__data__,o,i);return this}function hK(e){return function(){this.removeAttribute(e)}}function pK(e){return function(){this.removeAttributeNS(e.space,e.local)}}function mK(e,t){return function(){this.setAttribute(e,t)}}function yK(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function gK(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function xK(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function H5(e,t){var r=Ma(e);if(arguments.length<2){var n=this.node();return r.local?n.getAttributeNS(r.space,r.local):n.getAttribute(r)}return this.each((t==null?r.local?pK:hK:typeof t=="function"?r.local?xK:gK:r.local?yK:mK)(r,t))}function rw(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function bK(e){return function(){this.style.removeProperty(e)}}function _K(e,t,r){return function(){this.style.setProperty(e,t,r)}}function wK(e,t,r){return function(){var n=t.apply(this,arguments);n==null?this.style.removeProperty(e):this.style.setProperty(e,n,r)}}function Q5(e,t,r){return arguments.length>1?this.each((t==null?bK:typeof t=="function"?wK:_K)(e,t,r??"")):zc(this.node(),e)}function zc(e,t){return e.style.getPropertyValue(t)||rw(e).getComputedStyle(e,null).getPropertyValue(t)}function vK(e){return function(){delete this[e]}}function SK(e,t){return function(){this[e]=t}}function IK(e,t){return function(){var r=t.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function Z5(e,t){return arguments.length>1?this.each((t==null?vK:typeof t=="function"?IK:SK)(e,t)):this.node()[e]}function K5(e){return e.trim().split(/^|\s+/)}function xM(e){return e.classList||new J5(e)}function J5(e){this._node=e,this._names=K5(e.getAttribute("class")||"")}J5.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function t7(e,t){for(var r=xM(e),n=-1,i=t.length;++n<i;)r.add(t[n])}function e7(e,t){for(var r=xM(e),n=-1,i=t.length;++n<i;)r.remove(t[n])}function TK(e){return function(){t7(this,e)}}function AK(e){return function(){e7(this,e)}}function EK(e,t){return function(){(t.apply(this,arguments)?t7:e7)(this,e)}}function r7(e,t){var r=K5(e+"");if(arguments.length<2){for(var n=xM(this.node()),i=-1,o=r.length;++i<o;)if(!n.contains(r[i]))return!1;return!0}return this.each((typeof t=="function"?EK:t?TK:AK)(r,t))}function MK(){this.textContent=""}function NK(e){return function(){this.textContent=e}}function OK(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function n7(e){return arguments.length?this.each(e==null?MK:(typeof e=="function"?OK:NK)(e)):this.node().textContent}function RK(){this.innerHTML=""}function DK(e){return function(){this.innerHTML=e}}function LK(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function i7(e){return arguments.length?this.each(e==null?RK:(typeof e=="function"?LK:DK)(e)):this.node().innerHTML}function FK(){this.nextSibling&&this.parentNode.appendChild(this)}function o7(){return this.each(FK)}function CK(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function s7(){return this.each(CK)}function a7(e){var t=typeof e=="function"?e:Na(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function kK(){return null}function c7(e,t){var r=typeof e=="function"?e:Na(e),n=t==null?kK:typeof t=="function"?t:Iu(t);return this.select(function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)})}function BK(){var e=this.parentNode;e&&e.removeChild(this)}function l7(){return this.each(BK)}function PK(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function UK(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function u7(e){return this.select(e?UK:PK)}function f7(e){return arguments.length?this.property("__data__",e):this.node().__data__}function $K(e){return function(t){e.call(this,t,this.__data__)}}function zK(e){return e.trim().split(/^|\s+/).map(function(t){var r="",n=t.indexOf(".");return n>=0&&(r=t.slice(n+1),t=t.slice(0,n)),{type:t,name:r}})}function jK(e){return function(){var t=this.__on;if(t){for(var r=0,n=-1,i=t.length,o;r<i;++r)o=t[r],(!e.type||o.type===e.type)&&o.name===e.name?this.removeEventListener(o.type,o.listener,o.options):t[++n]=o;++n?t.length=n:delete this.__on}}}function qK(e,t,r){return function(){var n=this.__on,i,o=$K(t);if(n){for(var s=0,a=n.length;s<a;++s)if((i=n[s]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=o,i.options=r),i.value=t;return}}this.addEventListener(e.type,o,r),i={type:e.type,name:e.name,value:t,listener:o,options:r},n?n.push(i):this.__on=[i]}}function d7(e,t,r){var n=zK(e+""),i,o=n.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,u;c<l;++c)for(i=0,u=a[c];i<o;++i)if((s=n[i]).type===u.type&&s.name===u.name)return u.value}return}for(a=t?qK:jK,i=0;i<o;++i)this.each(a(n[i],t,r));return this}function h7(e,t,r){var n=rw(e),i=n.CustomEvent;typeof i=="function"?i=new i(t,r):(i=n.document.createEvent("Event"),r?(i.initEvent(t,r.bubbles,r.cancelable),i.detail=r.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function VK(e,t){return function(){return h7(this,e,t)}}function YK(e,t){return function(){return h7(this,e,t.apply(this,arguments))}}function p7(e,t){return this.each((typeof t=="function"?YK:VK)(e,t))}function*m7(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var n=e[t],i=0,o=n.length,s;i<o;++i)(s=n[i])&&(yield s)}var bM=[null];function Qe(e,t){this._groups=e,this._parents=t}function y7(){return new Qe([[document.documentElement]],bM)}function WK(){return this}Qe.prototype=y7.prototype={constructor:Qe,select:O5,selectAll:R5,selectChild:D5,selectChildren:L5,filter:F5,data:B5,enter:C5,exit:P5,join:U5,merge:$5,selection:WK,order:z5,sort:j5,call:q5,nodes:V5,node:Y5,size:W5,empty:G5,each:X5,attr:H5,style:Q5,property:Z5,classed:r7,text:n7,html:i7,raise:o7,lower:s7,append:a7,insert:c7,remove:l7,clone:u7,datum:f7,on:d7,dispatch:p7,[Symbol.iterator]:m7};var Oa=y7;function Qt(e){return typeof e=="string"?new Qe([[document.querySelector(e)]],[document.documentElement]):new Qe([[e]],bM)}function g7(e){let t;for(;t=e.sourceEvent;)e=t;return e}function an(e,t){if(e=g7(e),t===void 0&&(t=e.currentTarget),t){var r=t.ownerSVGElement||t;if(r.createSVGPoint){var n=r.createSVGPoint();return n.x=e.clientX,n.y=e.clientY,n=n.matrixTransform(t.getScreenCTM().inverse()),[n.x,n.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var nw={capture:!0,passive:!1};function iw(e){e.preventDefault(),e.stopImmediatePropagation()}function yy(e){var t=e.document.documentElement,r=Qt(e).on("dragstart.drag",iw,nw);"onselectstart"in t?r.on("selectstart.drag",iw,nw):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function gy(e,t){var r=e.document.documentElement,n=Qt(e).on("dragstart.drag",null);t&&(n.on("click.drag",iw,nw),setTimeout(function(){n.on("click.drag",null)},0)),"onselectstart"in r?n.on("selectstart.drag",null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect)}function Ra(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function jc(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}function is(){}var qc=.7,Eu=1/qc,Md="\\s*([+-]?\\d+)\\s*",xy="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ns="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",GK=/^#([0-9a-f]{3,8})$/,XK=new RegExp(`^rgb\\(${Md},${Md},${Md}\\)$`),HK=new RegExp(`^rgb\\(${ns},${ns},${ns}\\)$`),QK=new RegExp(`^rgba\\(${Md},${Md},${Md},${xy}\\)$`),ZK=new RegExp(`^rgba\\(${ns},${ns},${ns},${xy}\\)$`),KK=new RegExp(`^hsl\\(${xy},${ns},${ns}\\)$`),JK=new RegExp(`^hsla\\(${xy},${ns},${ns},${xy}\\)$`),x7={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};Ra(is,di,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:b7,formatHex:b7,formatHex8:tJ,formatHsl:eJ,formatRgb:_7,toString:_7});function b7(){return this.rgb().formatHex()}function tJ(){return this.rgb().formatHex8()}function eJ(){return A7(this).formatHsl()}function _7(){return this.rgb().formatRgb()}function di(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=GK.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?w7(t):r===3?new cr(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?ow(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?ow(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=XK.exec(e))?new cr(t[1],t[2],t[3],1):(t=HK.exec(e))?new cr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=QK.exec(e))?ow(t[1],t[2],t[3],t[4]):(t=ZK.exec(e))?ow(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=KK.exec(e))?I7(t[1],t[2]/100,t[3]/100,1):(t=JK.exec(e))?I7(t[1],t[2]/100,t[3]/100,t[4]):x7.hasOwnProperty(e)?w7(x7[e]):e==="transparent"?new cr(NaN,NaN,NaN,0):null}function w7(e){return new cr(e>>16&255,e>>8&255,e&255,1)}function ow(e,t,r,n){return n<=0&&(e=t=r=NaN),new cr(e,t,r,n)}function by(e){return e instanceof is||(e=di(e)),e?(e=e.rgb(),new cr(e.r,e.g,e.b,e.opacity)):new cr}function wr(e,t,r,n){return arguments.length===1?by(e):new cr(e,t,r,n??1)}function cr(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}Ra(cr,wr,jc(is,{brighter(e){return e=e==null?Eu:Math.pow(Eu,e),new cr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?qc:Math.pow(qc,e),new cr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new cr(Au(this.r),Au(this.g),Au(this.b),aw(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:v7,formatHex:v7,formatHex8:rJ,formatRgb:S7,toString:S7}));function v7(){return`#${Tu(this.r)}${Tu(this.g)}${Tu(this.b)}`}function rJ(){return`#${Tu(this.r)}${Tu(this.g)}${Tu(this.b)}${Tu((isNaN(this.opacity)?1:this.opacity)*255)}`}function S7(){let e=aw(this.opacity);return`${e===1?"rgb(":"rgba("}${Au(this.r)}, ${Au(this.g)}, ${Au(this.b)}${e===1?")":`, ${e})`}`}function aw(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Au(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Tu(e){return e=Au(e),(e<16?"0":"")+e.toString(16)}function I7(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new Mo(e,t,r,n)}function A7(e){if(e instanceof Mo)return new Mo(e.h,e.s,e.l,e.opacity);if(e instanceof is||(e=di(e)),!e)return new Mo;if(e instanceof Mo)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),o=Math.max(t,r,n),s=NaN,a=o-i,c=(o+i)/2;return a?(t===o?s=(r-n)/a+(r<n)*6:r===o?s=(n-t)/a+2:s=(t-r)/a+4,a/=c<.5?o+i:2-o-i,s*=60):a=c>0&&c<1?0:s,new Mo(s,a,c,e.opacity)}function _y(e,t,r,n){return arguments.length===1?A7(e):new Mo(e,t,r,n??1)}function Mo(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}Ra(Mo,_y,jc(is,{brighter(e){return e=e==null?Eu:Math.pow(Eu,e),new Mo(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?qc:Math.pow(qc,e),new Mo(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,i=2*r-n;return new cr(_M(e>=240?e-240:e+120,i,n),_M(e,i,n),_M(e<120?e+240:e-120,i,n),this.opacity)},clamp(){return new Mo(T7(this.h),sw(this.s),sw(this.l),aw(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=aw(this.opacity);return`${e===1?"hsl(":"hsla("}${T7(this.h)}, ${sw(this.s)*100}%, ${sw(this.l)*100}%${e===1?")":`, ${e})`}`}}));function T7(e){return e=(e||0)%360,e<0?e+360:e}function sw(e){return Math.max(0,Math.min(1,e||0))}function _M(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}var cw=Math.PI/180,lw=180/Math.PI;var uw=18,E7=.96422,M7=1,N7=.82521,O7=4/29,Nd=6/29,R7=3*Nd*Nd,nJ=Nd*Nd*Nd;function D7(e){if(e instanceof os)return new os(e.l,e.a,e.b,e.opacity);if(e instanceof Da)return L7(e);e instanceof cr||(e=by(e));var t=IM(e.r),r=IM(e.g),n=IM(e.b),i=wM((.2225045*t+.7168786*r+.0606169*n)/M7),o,s;return t===r&&r===n?o=s=i:(o=wM((.4360747*t+.3850649*r+.1430804*n)/E7),s=wM((.0139322*t+.0971045*r+.7141733*n)/N7)),new os(116*i-16,500*(o-i),200*(i-s),e.opacity)}function Od(e,t,r,n){return arguments.length===1?D7(e):new os(e,t,r,n??1)}function os(e,t,r,n){this.l=+e,this.a=+t,this.b=+r,this.opacity=+n}Ra(os,Od,jc(is,{brighter(e){return new os(this.l+uw*(e??1),this.a,this.b,this.opacity)},darker(e){return new os(this.l-uw*(e??1),this.a,this.b,this.opacity)},rgb(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,r=isNaN(this.b)?e:e-this.b/200;return t=E7*vM(t),e=M7*vM(e),r=N7*vM(r),new cr(SM(3.1338561*t-1.6168667*e-.4906146*r),SM(-.9787684*t+1.9161415*e+.033454*r),SM(.0719453*t-.2289914*e+1.4052427*r),this.opacity)}}));function wM(e){return e>nJ?Math.pow(e,1/3):e/R7+O7}function vM(e){return e>Nd?e*e*e:R7*(e-O7)}function SM(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function IM(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function iJ(e){if(e instanceof Da)return new Da(e.h,e.c,e.l,e.opacity);if(e instanceof os||(e=D7(e)),e.a===0&&e.b===0)return new Da(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*lw;return new Da(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function wy(e,t,r,n){return arguments.length===1?iJ(e):new Da(e,t,r,n??1)}function Da(e,t,r,n){this.h=+e,this.c=+t,this.l=+r,this.opacity=+n}function L7(e){if(isNaN(e.h))return new os(e.l,0,0,e.opacity);var t=e.h*cw;return new os(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}Ra(Da,wy,jc(is,{brighter(e){return new Da(this.h,this.c,this.l+uw*(e??1),this.opacity)},darker(e){return new Da(this.h,this.c,this.l-uw*(e??1),this.opacity)},rgb(){return L7(this).rgb()}}));var B7=-.14861,TM=1.78277,AM=-.29227,fw=-.90649,vy=1.97294,F7=vy*fw,C7=vy*TM,k7=TM*AM-fw*B7;function oJ(e){if(e instanceof Mu)return new Mu(e.h,e.s,e.l,e.opacity);e instanceof cr||(e=by(e));var t=e.r/255,r=e.g/255,n=e.b/255,i=(k7*n+F7*t-C7*r)/(k7+F7-C7),o=n-i,s=(vy*(r-i)-AM*o)/fw,a=Math.sqrt(s*s+o*o)/(vy*i*(1-i)),c=a?Math.atan2(s,o)*lw-120:NaN;return new Mu(c<0?c+360:c,a,i,e.opacity)}function En(e,t,r,n){return arguments.length===1?oJ(e):new Mu(e,t,r,n??1)}function Mu(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}Ra(Mu,En,jc(is,{brighter(e){return e=e==null?Eu:Math.pow(Eu,e),new Mu(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?qc:Math.pow(qc,e),new Mu(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*cw,t=+this.l,r=isNaN(this.s)?0:this.s*t*(1-t),n=Math.cos(e),i=Math.sin(e);return new cr(255*(t+r*(B7*n+TM*i)),255*(t+r*(AM*n+fw*i)),255*(t+r*(vy*n)),this.opacity)}}));function EM(e,t,r,n,i){var o=e*e,s=o*e;return((1-3*e+3*o-s)*t+(4-6*o+3*s)*r+(1+3*e+3*o-3*s)*n+s*i)/6}function P7(e){var t=e.length-1;return function(r){var n=r<=0?r=0:r>=1?(r=1,t-1):Math.floor(r*t),i=e[n],o=e[n+1],s=n>0?e[n-1]:2*i-o,a=n<t-1?e[n+2]:2*o-i;return EM((r-n/t)*t,s,i,o,a)}}function U7(e){var t=e.length;return function(r){var n=Math.floor(((r%=1)<0?++r:r)*t),i=e[(n+t-1)%t],o=e[n%t],s=e[(n+1)%t],a=e[(n+2)%t];return EM((r-n/t)*t,i,o,s,a)}}var Rd=e=>()=>e;function $7(e,t){return function(r){return e+r*t}}function sJ(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function Dd(e,t){var r=t-e;return r?$7(e,r>180||r<-180?r-360*Math.round(r/360):r):Rd(isNaN(e)?t:e)}function z7(e){return(e=+e)==1?Be:function(t,r){return r-t?sJ(t,r,e):Rd(isNaN(t)?r:t)}}function Be(e,t){var r=t-e;return r?$7(e,r):Rd(isNaN(e)?t:e)}var ji=function e(t){var r=z7(t);function n(i,o){var s=r((i=wr(i)).r,(o=wr(o)).r),a=r(i.g,o.g),c=r(i.b,o.b),l=Be(i.opacity,o.opacity);return function(u){return i.r=s(u),i.g=a(u),i.b=c(u),i.opacity=l(u),i+""}}return n.gamma=e,n}(1);function j7(e){return function(t){var r=t.length,n=new Array(r),i=new Array(r),o=new Array(r),s,a;for(s=0;s<r;++s)a=wr(t[s]),n[s]=a.r||0,i[s]=a.g||0,o[s]=a.b||0;return n=e(n),i=e(i),o=e(o),a.opacity=1,function(c){return a.r=n(c),a.g=i(c),a.b=o(c),a+""}}}var MM=j7(P7),aJ=j7(U7);function q7(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,n=t.slice(),i;return function(o){for(i=0;i<r;++i)n[i]=e[i]*(1-o)+t[i]*o;return n}}function V7(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Y7(e,t){var r=t?t.length:0,n=e?Math.min(r,e.length):0,i=new Array(n),o=new Array(r),s;for(s=0;s<n;++s)i[s]=hi(e[s],t[s]);for(;s<r;++s)o[s]=t[s];return function(a){for(s=0;s<n;++s)o[s]=i[s](a);return o}}function W7(e,t){var r=new Date;return e=+e,t=+t,function(n){return r.setTime(e*(1-n)+t*n),r}}function Fe(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}function G7(e,t){var r={},n={},i;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(i in t)i in e?r[i]=hi(e[i],t[i]):n[i]=t[i];return function(o){for(i in r)n[i]=r[i](o);return n}}var OM=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,NM=new RegExp(OM.source,"g");function cJ(e){return function(){return e}}function lJ(e){return function(t){return e(t)+""}}function Sy(e,t){var r=OM.lastIndex=NM.lastIndex=0,n,i,o,s=-1,a=[],c=[];for(e=e+"",t=t+"";(n=OM.exec(e))&&(i=NM.exec(t));)(o=i.index)>r&&(o=t.slice(r,o),a[s]?a[s]+=o:a[++s]=o),(n=n[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,c.push({i:s,x:Fe(n,i)})),r=NM.lastIndex;return r<t.length&&(o=t.slice(r),a[s]?a[s]+=o:a[++s]=o),a.length<2?c[0]?lJ(c[0].x):cJ(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 hi(e,t){var r=typeof t,n;return t==null||r==="boolean"?Rd(t):(r==="number"?Fe:r==="string"?(n=di(t))?(t=n,ji):Sy:t instanceof di?ji:t instanceof Date?W7:V7(t)?q7:Array.isArray(t)?Y7:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?G7:Fe)(e,t)}function Nu(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}var X7=180/Math.PI,dw={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function RM(e,t,r,n,i,o){var s,a,c;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(c=e*r+t*n)&&(r-=e*c,n-=t*c),(a=Math.sqrt(r*r+n*n))&&(r/=a,n/=a,c/=a),e*n<t*r&&(e=-e,t=-t,c=-c,s=-s),{translateX:i,translateY:o,rotate:Math.atan2(t,e)*X7,skewX:Math.atan(c)*X7,scaleX:s,scaleY:a}}var hw;function H7(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?dw:RM(t.a,t.b,t.c,t.d,t.e,t.f)}function Q7(e){return e==null?dw:(hw||(hw=document.createElementNS("http://www.w3.org/2000/svg","g")),hw.setAttribute("transform",e),(e=hw.transform.baseVal.consolidate())?(e=e.matrix,RM(e.a,e.b,e.c,e.d,e.e,e.f)):dw)}function Z7(e,t,r,n){function i(l){return l.length?l.pop()+" ":""}function o(l,u,f,d,h,p){if(l!==f||u!==d){var m=h.push("translate(",null,t,null,r);p.push({i:m-4,x:Fe(l,f)},{i:m-2,x:Fe(u,d)})}else(f||d)&&h.push("translate("+f+t+d+r)}function s(l,u,f,d){l!==u?(l-u>180?u+=360:u-l>180&&(l+=360),d.push({i:f.push(i(f)+"rotate(",null,n)-2,x:Fe(l,u)})):u&&f.push(i(f)+"rotate("+u+n)}function a(l,u,f,d){l!==u?d.push({i:f.push(i(f)+"skewX(",null,n)-2,x:Fe(l,u)}):u&&f.push(i(f)+"skewX("+u+n)}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:Fe(l,f)},{i:m-2,x:Fe(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,y;++p<m;)f[(y=d[p]).i]=y.x(h);return f.join("")}}}var DM=Z7(H7,"px, ","px)","deg)"),LM=Z7(Q7,", ",")",")");var uJ=1e-12;function K7(e){return((e=Math.exp(e))+1/e)/2}function fJ(e){return((e=Math.exp(e))-1/e)/2}function dJ(e){return((e=Math.exp(2*e))-1)/(e+1)}var FM=function e(t,r,n){function i(o,s){var a=o[0],c=o[1],l=o[2],u=s[0],f=s[1],d=s[2],h=u-a,p=f-c,m=h*h+p*p,y,g;if(m<uJ)g=Math.log(d/l)/t,y=function(T){return[a+T*h,c+T*p,l*Math.exp(t*T*g)]};else{var x=Math.sqrt(m),b=(d*d-l*l+n*m)/(2*l*r*x),_=(d*d-l*l-n*m)/(2*d*r*x),v=Math.log(Math.sqrt(b*b+1)-b),w=Math.log(Math.sqrt(_*_+1)-_);g=(w-v)/t,y=function(T){var A=T*g,E=K7(v),N=l/(r*x)*(E*dJ(t*A+v)-fJ(v));return[a+N*h,c+N*p,l*E/K7(t*A+v)]}}return y.duration=g*1e3*t/Math.SQRT2,y}return i.rho=function(o){var s=Math.max(.001,+o),a=s*s,c=a*a;return e(s,a,c)},i}(Math.SQRT2,2,4);function J7(e){return function(t,r){var n=e((t=_y(t)).h,(r=_y(r)).h),i=Be(t.s,r.s),o=Be(t.l,r.l),s=Be(t.opacity,r.opacity);return function(a){return t.h=n(a),t.s=i(a),t.l=o(a),t.opacity=s(a),t+""}}}var CM=J7(Dd),hJ=J7(Be);function pw(e,t){var r=Be((e=Od(e)).l,(t=Od(t)).l),n=Be(e.a,t.a),i=Be(e.b,t.b),o=Be(e.opacity,t.opacity);return function(s){return e.l=r(s),e.a=n(s),e.b=i(s),e.opacity=o(s),e+""}}function tP(e){return function(t,r){var n=e((t=wy(t)).h,(r=wy(r)).h),i=Be(t.c,r.c),o=Be(t.l,r.l),s=Be(t.opacity,r.opacity);return function(a){return t.h=n(a),t.c=i(a),t.l=o(a),t.opacity=s(a),t+""}}}var kM=tP(Dd),pJ=tP(Be);function eP(e){return function t(r){r=+r;function n(i,o){var s=e((i=En(i)).h,(o=En(o)).h),a=Be(i.s,o.s),c=Be(i.l,o.l),l=Be(i.opacity,o.opacity);return function(u){return i.h=s(u),i.s=a(u),i.l=c(Math.pow(u,r)),i.opacity=l(u),i+""}}return n.gamma=t,n}(1)}var mJ=eP(Dd),Ld=eP(Be);function ss(e,t){t===void 0&&(t=e,e=hi);for(var r=0,n=t.length-1,i=t[0],o=new Array(n<0?0:n);r<n;)o[r]=e(i,i=t[++r]);return function(s){var a=Math.max(0,Math.min(n-1,Math.floor(s*=n)));return o[a](s-a)}}function cn(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e(n/(t-1));return r}var Fd=0,Ty=0,Iy=0,nP=1e3,mw,Ay,yw=0,Ou=0,gw=0,Ey=typeof performance=="object"&&performance.now?performance:Date,iP=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Ny(){return Ou||(iP(yJ),Ou=Ey.now()+gw)}function yJ(){Ou=0}function My(){this._call=this._time=this._next=null}My.prototype=xw.prototype={constructor:My,restart:function(e,t,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?Ny():+r)+(t==null?0:+t),!this._next&&Ay!==this&&(Ay?Ay._next=this:mw=this,Ay=this),this._call=e,this._time=r,BM()},stop:function(){this._call&&(this._call=null,this._time=1/0,BM())}};function xw(e,t,r){var n=new My;return n.restart(e,t,r),n}function oP(){Ny(),++Fd;for(var e=mw,t;e;)(t=Ou-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Fd}function rP(){Ou=(yw=Ey.now())+gw,Fd=Ty=0;try{oP()}finally{Fd=0,xJ(),Ou=0}}function gJ(){var e=Ey.now(),t=e-yw;t>nP&&(gw-=t,yw=e)}function xJ(){for(var e,t=mw,r,n=1/0;t;)t._call?(n>t._time&&(n=t._time),e=t,t=t._next):(r=t._next,t._next=null,t=e?e._next=r:mw=r);Ay=e,BM(n)}function BM(e){if(!Fd){Ty&&(Ty=clearTimeout(Ty));var t=e-Ou;t>24?(e<1/0&&(Ty=setTimeout(rP,e-Ey.now()-gw)),Iy&&(Iy=clearInterval(Iy))):(Iy||(yw=Ey.now(),Iy=setInterval(gJ,nP)),Fd=1,iP(rP))}}function bw(e,t,r){var n=new My;return t=t==null?0:+t,n.restart(i=>{n.stop(),e(i+t)},t,r),n}var bJ=Su("start","end","cancel","interrupt"),_J=[],cP=0,sP=1,ww=2,_w=3,aP=4,vw=5,Oy=6;function Vc(e,t,r,n,i,o){var s=e.__transition;if(!s)e.__transition={};else if(r in s)return;wJ(e,r,{name:t,index:n,group:i,on:bJ,tween:_J,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:cP})}function Ry(e,t){var r=vr(e,t);if(r.state>cP)throw new Error("too late; already scheduled");return r}function Kr(e,t){var r=vr(e,t);if(r.state>_w)throw new Error("too late; already running");return r}function vr(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw new Error("transition not found");return r}function wJ(e,t,r){var n=e.__transition,i;n[t]=r,r.timer=xw(o,0,r.time);function o(l){r.state=sP,r.timer.restart(s,r.delay,r.time),r.delay<=l&&s(l-r.delay)}function s(l){var u,f,d,h;if(r.state!==sP)return c();for(u in n)if(h=n[u],h.name===r.name){if(h.state===_w)return bw(s);h.state===aP?(h.state=Oy,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete n[u]):+u<t&&(h.state=Oy,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete n[u])}if(bw(function(){r.state===_w&&(r.state=aP,r.timer.restart(a,r.delay,r.time),a(l))}),r.state=ww,r.on.call("start",e,e.__data__,r.index,r.group),r.state===ww){for(r.state=_w,i=new Array(d=r.tween.length),u=0,f=-1;u<d;++u)(h=r.tween[u].value.call(e,e.__data__,r.index,r.group))&&(i[++f]=h);i.length=f+1}}function a(l){for(var u=l<r.duration?r.ease.call(null,l/r.duration):(r.timer.restart(c),r.state=vw,1),f=-1,d=i.length;++f<d;)i[f].call(e,u);r.state===vw&&(r.on.call("end",e,e.__data__,r.index,r.group),c())}function c(){r.state=Oy,r.timer.stop(),delete n[t];for(var l in n)return;delete e.__transition}}function as(e,t){var r=e.__transition,n,i,o=!0,s;if(r){t=t==null?null:t+"";for(s in r){if((n=r[s]).name!==t){o=!1;continue}i=n.state>ww&&n.state<vw,n.state=Oy,n.timer.stop(),n.on.call(i?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete r[s]}o&&delete e.__transition}}function lP(e){return this.each(function(){as(this,e)})}function vJ(e,t){var r,n;return function(){var i=Kr(this,e),o=i.tween;if(o!==r){n=r=o;for(var s=0,a=n.length;s<a;++s)if(n[s].name===t){n=n.slice(),n.splice(s,1);break}}i.tween=n}}function SJ(e,t,r){var n,i;if(typeof r!="function")throw new Error;return function(){var o=Kr(this,e),s=o.tween;if(s!==n){i=(n=s).slice();for(var a={name:t,value:r},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=a;break}c===l&&i.push(a)}o.tween=i}}function uP(e,t){var r=this._id;if(e+="",arguments.length<2){for(var n=vr(this.node(),r).tween,i=0,o=n.length,s;i<o;++i)if((s=n[i]).name===e)return s.value;return null}return this.each((t==null?vJ:SJ)(r,e,t))}function Cd(e,t,r){var n=e._id;return e.each(function(){var i=Kr(this,n);(i.value||(i.value={}))[t]=r.apply(this,arguments)}),function(i){return vr(i,n).value[t]}}function Sw(e,t){var r;return(typeof t=="number"?Fe:t instanceof di?ji:(r=di(t))?(t=r,ji):Sy)(e,t)}function IJ(e){return function(){this.removeAttribute(e)}}function TJ(e){return function(){this.removeAttributeNS(e.space,e.local)}}function AJ(e,t,r){var n,i=r+"",o;return function(){var s=this.getAttribute(e);return s===i?null:s===n?o:o=t(n=s,r)}}function EJ(e,t,r){var n,i=r+"",o;return function(){var s=this.getAttributeNS(e.space,e.local);return s===i?null:s===n?o:o=t(n=s,r)}}function MJ(e,t,r){var n,i,o;return function(){var s,a=r(this),c;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),c=a+"",s===c?null:s===n&&c===i?o:(i=c,o=t(n=s,a)))}}function NJ(e,t,r){var n,i,o;return function(){var s,a=r(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),c=a+"",s===c?null:s===n&&c===i?o:(i=c,o=t(n=s,a)))}}function fP(e,t){var r=Ma(e),n=r==="transform"?LM:Sw;return this.attrTween(e,typeof t=="function"?(r.local?NJ:MJ)(r,n,Cd(this,"attr."+e,t)):t==null?(r.local?TJ:IJ)(r):(r.local?EJ:AJ)(r,n,t))}function OJ(e,t){return function(r){this.setAttribute(e,t.call(this,r))}}function RJ(e,t){return function(r){this.setAttributeNS(e.space,e.local,t.call(this,r))}}function DJ(e,t){var r,n;function i(){var o=t.apply(this,arguments);return o!==n&&(r=(n=o)&&RJ(e,o)),r}return i._value=t,i}function LJ(e,t){var r,n;function i(){var o=t.apply(this,arguments);return o!==n&&(r=(n=o)&&OJ(e,o)),r}return i._value=t,i}function dP(e,t){var r="attr."+e;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;var n=Ma(e);return this.tween(r,(n.local?DJ:LJ)(n,t))}function FJ(e,t){return function(){Ry(this,e).delay=+t.apply(this,arguments)}}function CJ(e,t){return t=+t,function(){Ry(this,e).delay=t}}function hP(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?FJ:CJ)(t,e)):vr(this.node(),t).delay}function kJ(e,t){return function(){Kr(this,e).duration=+t.apply(this,arguments)}}function BJ(e,t){return t=+t,function(){Kr(this,e).duration=t}}function pP(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?kJ:BJ)(t,e)):vr(this.node(),t).duration}function PJ(e,t){if(typeof t!="function")throw new Error;return function(){Kr(this,e).ease=t}}function mP(e){var t=this._id;return arguments.length?this.each(PJ(t,e)):vr(this.node(),t).ease}function UJ(e,t){return function(){var r=t.apply(this,arguments);if(typeof r!="function")throw new Error;Kr(this,e).ease=r}}function yP(e){if(typeof e!="function")throw new Error;return this.each(UJ(this._id,e))}function gP(e){typeof e!="function"&&(e=py(e));for(var t=this._groups,r=t.length,n=new Array(r),i=0;i<r;++i)for(var o=t[i],s=o.length,a=n[i]=[],c,l=0;l<s;++l)(c=o[l])&&e.call(c,c.__data__,l,o)&&a.push(c);return new Mn(n,this._parents,this._name,this._id)}function xP(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,r=e._groups,n=t.length,i=r.length,o=Math.min(n,i),s=new Array(n),a=0;a<o;++a)for(var c=t[a],l=r[a],u=c.length,f=s[a]=new Array(u),d,h=0;h<u;++h)(d=c[h]||l[h])&&(f[h]=d);for(;a<n;++a)s[a]=t[a];return new Mn(s,this._parents,this._name,this._id)}function $J(e){return(e+"").trim().split(/^|\s+/).every(function(t){var r=t.indexOf(".");return r>=0&&(t=t.slice(0,r)),!t||t==="start"})}function zJ(e,t,r){var n,i,o=$J(t)?Ry:Kr;return function(){var s=o(this,e),a=s.on;a!==n&&(i=(n=a).copy()).on(t,r),s.on=i}}function bP(e,t){var r=this._id;return arguments.length<2?vr(this.node(),r).on.on(e):this.each(zJ(r,e,t))}function jJ(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}function _P(){return this.on("end.remove",jJ(this._id))}function wP(e){var t=this._name,r=this._id;typeof e!="function"&&(e=Iu(e));for(var n=this._groups,i=n.length,o=new Array(i),s=0;s<i;++s)for(var a=n[s],c=a.length,l=o[s]=new Array(c),u,f,d=0;d<c;++d)(u=a[d])&&(f=e.call(u,u.__data__,d,a))&&("__data__"in u&&(f.__data__=u.__data__),l[d]=f,Vc(l[d],t,r,d,l,vr(u,r)));return new Mn(o,this._parents,t,r)}function vP(e){var t=this._name,r=this._id;typeof e!="function"&&(e=hy(e));for(var n=this._groups,i=n.length,o=[],s=[],a=0;a<i;++a)for(var c=n[a],l=c.length,u,f=0;f<l;++f)if(u=c[f]){for(var d=e.call(u,u.__data__,f,c),h,p=vr(u,r),m=0,y=d.length;m<y;++m)(h=d[m])&&Vc(h,t,r,m,d,p);o.push(d),s.push(u)}return new Mn(o,s,t,r)}var qJ=Oa.prototype.constructor;function SP(){return new qJ(this._groups,this._parents)}function VJ(e,t){var r,n,i;return function(){var o=zc(this,e),s=(this.style.removeProperty(e),zc(this,e));return o===s?null:o===r&&s===n?i:i=t(r=o,n=s)}}function IP(e){return function(){this.style.removeProperty(e)}}function YJ(e,t,r){var n,i=r+"",o;return function(){var s=zc(this,e);return s===i?null:s===n?o:o=t(n=s,r)}}function WJ(e,t,r){var n,i,o;return function(){var s=zc(this,e),a=r(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),zc(this,e))),s===c?null:s===n&&c===i?o:(i=c,o=t(n=s,a))}}function GJ(e,t){var r,n,i,o="style."+t,s="end."+o,a;return function(){var c=Kr(this,e),l=c.on,u=c.value[o]==null?a||(a=IP(t)):void 0;(l!==r||i!==u)&&(n=(r=l).copy()).on(s,i=u),c.on=n}}function TP(e,t,r){var n=(e+="")=="transform"?DM:Sw;return t==null?this.styleTween(e,VJ(e,n)).on("end.style."+e,IP(e)):typeof t=="function"?this.styleTween(e,WJ(e,n,Cd(this,"style."+e,t))).each(GJ(this._id,e)):this.styleTween(e,YJ(e,n,t),r).on("end.style."+e,null)}function XJ(e,t,r){return function(n){this.style.setProperty(e,t.call(this,n),r)}}function HJ(e,t,r){var n,i;function o(){var s=t.apply(this,arguments);return s!==i&&(n=(i=s)&&XJ(e,s,r)),n}return o._value=t,o}function AP(e,t,r){var n="style."+(e+="");if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;return this.tween(n,HJ(e,t,r??""))}function QJ(e){return function(){this.textContent=e}}function ZJ(e){return function(){var t=e(this);this.textContent=t??""}}function EP(e){return this.tween("text",typeof e=="function"?ZJ(Cd(this,"text",e)):QJ(e==null?"":e+""))}function KJ(e){return function(t){this.textContent=e.call(this,t)}}function JJ(e){var t,r;function n(){var i=e.apply(this,arguments);return i!==r&&(t=(r=i)&&KJ(i)),t}return n._value=e,n}function MP(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,JJ(e))}function NP(){for(var e=this._name,t=this._id,r=Iw(),n=this._groups,i=n.length,o=0;o<i;++o)for(var s=n[o],a=s.length,c,l=0;l<a;++l)if(c=s[l]){var u=vr(c,t);Vc(c,e,r,l,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Mn(n,this._parents,e,r)}function OP(){var e,t,r=this,n=r._id,i=r.size();return new Promise(function(o,s){var a={value:s},c={value:function(){--i===0&&o()}};r.each(function(){var l=Kr(this,n),u=l.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),l.on=t}),i===0&&o()})}var ttt=0;function Mn(e,t,r,n){this._groups=e,this._parents=t,this._name=r,this._id=n}function RP(e){return Oa().transition(e)}function Iw(){return++ttt}var La=Oa.prototype;Mn.prototype=RP.prototype={constructor:Mn,select:wP,selectAll:vP,selectChild:La.selectChild,selectChildren:La.selectChildren,filter:gP,merge:xP,selection:SP,transition:NP,call:La.call,nodes:La.nodes,node:La.node,size:La.size,empty:La.empty,each:La.each,on:bP,attr:fP,attrTween:dP,style:TP,styleTween:AP,text:EP,textTween:MP,remove:_P,tween:uP,delay:hP,duration:pP,ease:mP,easeVarying:yP,end:OP,[Symbol.iterator]:La[Symbol.iterator]};function Tw(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var ett={time:null,delay:0,duration:250,ease:Tw};function rtt(e,t){for(var r;!(r=e.__transition)||!(r=r[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return r}function DP(e){var t,r;e instanceof Mn?(t=e._id,e=e._name):(t=Iw(),(r=ett).time=Ny(),e=e==null?null:e+"");for(var n=this._groups,i=n.length,o=0;o<i;++o)for(var s=n[o],a=s.length,c,l=0;l<a;++l)(c=s[l])&&Vc(c,e,t,l,s,r||rtt(c,t));return new Mn(n,this._parents,e,t)}Oa.prototype.interrupt=lP;Oa.prototype.transition=DP;var Aw=e=>()=>e;function PM(e,{sourceEvent:t,target:r,selection:n,mode:i,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},selection:{value:n,enumerable:!0,configurable:!0},mode:{value:i,enumerable:!0,configurable:!0},_:{value:o}})}function LP(e){e.stopImmediatePropagation()}function Ew(e){e.preventDefault(),e.stopImmediatePropagation()}var FP={name:"drag"},UM={name:"space"},kd={name:"handle"},Bd={name:"center"},{abs:CP,max:ln,min:un}=Math;function kP(e){return[+e[0],+e[1]]}function zM(e){return[kP(e[0]),kP(e[1])]}var Mw={name:"x",handles:["w","e"].map(Dy),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]]}},Nw={name:"y",handles:["n","s"].map(Dy),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]]}},ntt={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(Dy),input:function(e){return e==null?null:zM(e)},output:function(e){return e}},Fa={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"},BP={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},PP={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},itt={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},ott={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function Dy(e){return{type:e}}function stt(e){return!e.ctrlKey&&!e.button}function att(){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 ctt(){return navigator.maxTouchPoints||"ontouchstart"in this}function $M(e){for(;!e.__brush;)if(!(e=e.parentNode))return;return e.__brush}function ltt(e){return e[0][0]===e[1][0]||e[0][1]===e[1][1]}function jM(){return YM(Mw)}function qM(){return YM(Nw)}function VM(){return YM(ntt)}function YM(e){var t=att,r=stt,n=ctt,i=!0,o=Su("start","brush","end"),s=6,a;function c(y){var g=y.property("__brush",m).selectAll(".overlay").data([Dy("overlay")]);g.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",Fa.overlay).merge(g).each(function(){var b=$M(this).extent;Qt(this).attr("x",b[0][0]).attr("y",b[0][1]).attr("width",b[1][0]-b[0][0]).attr("height",b[1][1]-b[0][1])}),y.selectAll(".selection").data([Dy("selection")]).enter().append("rect").attr("class","selection").attr("cursor",Fa.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var x=y.selectAll(".handle").data(e.handles,function(b){return b.type});x.exit().remove(),x.enter().append("rect").attr("class",function(b){return"handle handle--"+b.type}).attr("cursor",function(b){return Fa[b.type]}),y.each(l).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",d).filter(n).on("touchstart.brush",d).on("touchmove.brush",h).on("touchend.brush touchcancel.brush",p).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}c.move=function(y,g,x){y.tween?y.on("start.brush",function(b){u(this,arguments).beforestart().start(b)}).on("interrupt.brush end.brush",function(b){u(this,arguments).end(b)}).tween("brush",function(){var b=this,_=b.__brush,v=u(b,arguments),w=_.selection,T=e.input(typeof g=="function"?g.apply(this,arguments):g,_.extent),A=hi(w,T);function E(N){_.selection=N===1&&T===null?null:A(N),l.call(b),v.brush()}return w!==null&&T!==null?E:E(1)}):y.each(function(){var b=this,_=arguments,v=b.__brush,w=e.input(typeof g=="function"?g.apply(b,_):g,v.extent),T=u(b,_).beforestart();as(b),v.selection=w===null?null:w,l.call(b),T.start(x).brush(x).end(x)})},c.clear=function(y,g){c.move(y,null,g)};function l(){var y=Qt(this),g=$M(this).selection;g?(y.selectAll(".selection").style("display",null).attr("x",g[0][0]).attr("y",g[0][1]).attr("width",g[1][0]-g[0][0]).attr("height",g[1][1]-g[0][1]),y.selectAll(".handle").style("display",null).attr("x",function(x){return x.type[x.type.length-1]==="e"?g[1][0]-s/2:g[0][0]-s/2}).attr("y",function(x){return x.type[0]==="s"?g[1][1]-s/2:g[0][1]-s/2}).attr("width",function(x){return x.type==="n"||x.type==="s"?g[1][0]-g[0][0]+s:s}).attr("height",function(x){return x.type==="e"||x.type==="w"?g[1][1]-g[0][1]+s:s})):y.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function u(y,g,x){var b=y.__brush.emitter;return b&&(!x||!b.clean)?b:new f(y,g,x)}function f(y,g,x){this.that=y,this.args=g,this.state=y.__brush,this.active=0,this.clean=x}f.prototype={beforestart:function(){return++this.active===1&&(this.state.emitter=this,this.starting=!0),this},start:function(y,g){return this.starting?(this.starting=!1,this.emit("start",y,g)):this.emit("brush",y),this},brush:function(y,g){return this.emit("brush",y,g),this},end:function(y,g){return--this.active===0&&(delete this.state.emitter,this.emit("end",y,g)),this},emit:function(y,g,x){var b=Qt(this.that).datum();o.call(y,this.that,new PM(y,{sourceEvent:g,target:c,selection:e.output(this.state.selection),mode:x,dispatch:o}),b)}};function d(y){if(a&&!y.touches||!r.apply(this,arguments))return;var g=this,x=y.target.__data__.type,b=(i&&y.metaKey?x="overlay":x)==="selection"?FP:i&&y.altKey?Bd:kd,_=e===Nw?null:itt[x],v=e===Mw?null:ott[x],w=$M(g),T=w.extent,A=w.selection,E=T[0][0],N,I,R=T[0][1],C,S,M=T[1][0],O,L,B=T[1][1],k,P,U=0,$=0,X,rt=_&&v&&i&&y.shiftKey,ot,at,Y=Array.from(y.touches||[y],tt=>{let ge=tt.identifier;return tt=an(tt,g),tt.point0=tt.slice(),tt.identifier=ge,tt});as(g);var st=u(g,arguments,!0).beforestart();if(x==="overlay"){A&&(X=!0);let tt=[Y[0],Y[1]||Y[0]];w.selection=A=[[N=e===Nw?E:un(tt[0][0],tt[1][0]),C=e===Mw?R:un(tt[0][1],tt[1][1])],[O=e===Nw?M:ln(tt[0][0],tt[1][0]),k=e===Mw?B:ln(tt[0][1],tt[1][1])]],Y.length>1&&Pt(y)}else N=A[0][0],C=A[0][1],O=A[1][0],k=A[1][1];I=N,S=C,L=O,P=k;var q=Qt(g).attr("pointer-events","none"),H=q.selectAll(".overlay").attr("cursor",Fa[x]);if(y.touches)st.moved=z,st.ended=ht;else{var nt=Qt(y.view).on("mousemove.brush",z,!0).on("mouseup.brush",ht,!0);i&&nt.on("keydown.brush",Zt,!0).on("keyup.brush",Jt,!0),yy(y.view)}l.call(g),st.start(y,b.name);function z(tt){for(let ge of tt.changedTouches||[tt])for(let Kn of Y)Kn.identifier===ge.identifier&&(Kn.cur=an(ge,g));if(rt&&!ot&&!at&&Y.length===1){let ge=Y[0];CP(ge.cur[0]-ge[0])>CP(ge.cur[1]-ge[1])?at=!0:ot=!0}for(let ge of Y)ge.cur&&(ge[0]=ge.cur[0],ge[1]=ge.cur[1]);X=!0,Ew(tt),Pt(tt)}function Pt(tt){let ge=Y[0],Kn=ge.point0;var Bo;switch(U=ge[0]-Kn[0],$=ge[1]-Kn[1],b){case UM:case FP:{_&&(U=ln(E-N,un(M-O,U)),I=N+U,L=O+U),v&&($=ln(R-C,un(B-k,$)),S=C+$,P=k+$);break}case kd:{Y[1]?(_&&(I=ln(E,un(M,Y[0][0])),L=ln(E,un(M,Y[1][0])),_=1),v&&(S=ln(R,un(B,Y[0][1])),P=ln(R,un(B,Y[1][1])),v=1)):(_<0?(U=ln(E-N,un(M-N,U)),I=N+U,L=O):_>0&&(U=ln(E-O,un(M-O,U)),I=N,L=O+U),v<0?($=ln(R-C,un(B-C,$)),S=C+$,P=k):v>0&&($=ln(R-k,un(B-k,$)),S=C,P=k+$));break}case Bd:{_&&(I=ln(E,un(M,N-U*_)),L=ln(E,un(M,O+U*_))),v&&(S=ln(R,un(B,C-$*v)),P=ln(R,un(B,k+$*v)));break}}L<I&&(_*=-1,Bo=N,N=O,O=Bo,Bo=I,I=L,L=Bo,x in BP&&H.attr("cursor",Fa[x=BP[x]])),P<S&&(v*=-1,Bo=C,C=k,k=Bo,Bo=S,S=P,P=Bo,x in PP&&H.attr("cursor",Fa[x=PP[x]])),w.selection&&(A=w.selection),ot&&(I=A[0][0],L=A[1][0]),at&&(S=A[0][1],P=A[1][1]),(A[0][0]!==I||A[0][1]!==S||A[1][0]!==L||A[1][1]!==P)&&(w.selection=[[I,S],[L,P]],l.call(g),st.brush(tt,b.name))}function ht(tt){if(LP(tt),tt.touches){if(tt.touches.length)return;a&&clearTimeout(a),a=setTimeout(function(){a=null},500)}else gy(tt.view,X),nt.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);q.attr("pointer-events","all"),H.attr("cursor",Fa.overlay),w.selection&&(A=w.selection),ltt(A)&&(w.selection=null,l.call(g)),st.end(tt,b.name)}function Zt(tt){switch(tt.keyCode){case 16:{rt=_&&v;break}case 18:{b===kd&&(_&&(O=L-U*_,N=I+U*_),v&&(k=P-$*v,C=S+$*v),b=Bd,Pt(tt));break}case 32:{(b===kd||b===Bd)&&(_<0?O=L-U:_>0&&(N=I-U),v<0?k=P-$:v>0&&(C=S-$),b=UM,H.attr("cursor",Fa.selection),Pt(tt));break}default:return}Ew(tt)}function Jt(tt){switch(tt.keyCode){case 16:{rt&&(ot=at=rt=!1,Pt(tt));break}case 18:{b===Bd&&(_<0?O=L:_>0&&(N=I),v<0?k=P:v>0&&(C=S),b=kd,Pt(tt));break}case 32:{b===UM&&(tt.altKey?(_&&(O=L-U*_,N=I+U*_),v&&(k=P-$*v,C=S+$*v),b=Bd):(_<0?O=L:_>0&&(N=I),v<0?k=P:v>0&&(C=S),b=kd),H.attr("cursor",Fa[x]),Pt(tt));break}default:return}Ew(tt)}}function h(y){u(this,arguments).moved(y)}function p(y){u(this,arguments).ended(y)}function m(){var y=this.__brush||{selection:null};return y.extent=zM(t.apply(this,arguments)),y.dim=e,y}return c.extent=function(y){return arguments.length?(t=typeof y=="function"?y:Aw(zM(y)),c):t},c.filter=function(y){return arguments.length?(r=typeof y=="function"?y:Aw(!!y),c):r},c.touchable=function(y){return arguments.length?(n=typeof y=="function"?y:Aw(!!y),c):n},c.handleSize=function(y){return arguments.length?(s=+y,c):s},c.keyModifiers=function(y){return arguments.length?(i=!!y,c):i},c.on=function(){var y=o.on.apply(o,arguments);return y===o?c:y},c}var WM=Math.PI,GM=2*WM,Ru=1e-6,utt=GM-Ru;function UP(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=arguments[t]+e[t]}function ftt(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return UP;let r=10**t;return function(n){this._+=n[0];for(let i=1,o=n.length;i<o;++i)this._+=Math.round(arguments[i]*r)/r+n[i]}}var Yc=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?UP:ftt(t)}moveTo(t,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,r){this._append`L${this._x1=+t},${this._y1=+r}`}quadraticCurveTo(t,r,n,i){this._append`Q${+t},${+r},${this._x1=+n},${this._y1=+i}`}bezierCurveTo(t,r,n,i,o,s){this._append`C${+t},${+r},${+n},${+i},${this._x1=+o},${this._y1=+s}`}arcTo(t,r,n,i,o){if(t=+t,r=+r,n=+n,i=+i,o=+o,o<0)throw new Error(`negative radius: ${o}`);let s=this._x1,a=this._y1,c=n-t,l=i-r,u=s-t,f=a-r,d=u*u+f*f;if(this._x1===null)this._append`M${this._x1=t},${this._y1=r}`;else if(d>Ru)if(!(Math.abs(f*c-l*u)>Ru)||!o)this._append`L${this._x1=t},${this._y1=r}`;else{let h=n-s,p=i-a,m=c*c+l*l,y=h*h+p*p,g=Math.sqrt(m),x=Math.sqrt(d),b=o*Math.tan((WM-Math.acos((m+d-y)/(2*g*x)))/2),_=b/x,v=b/g;Math.abs(_-1)>Ru&&this._append`L${t+_*u},${r+_*f}`,this._append`A${o},${o},0,0,${+(f*h>u*p)},${this._x1=t+v*c},${this._y1=r+v*l}`}}arc(t,r,n,i,o,s){if(t=+t,r=+r,n=+n,s=!!s,n<0)throw new Error(`negative radius: ${n}`);let a=n*Math.cos(i),c=n*Math.sin(i),l=t+a,u=r+c,f=1^s,d=s?i-o:o-i;this._x1===null?this._append`M${l},${u}`:(Math.abs(this._x1-l)>Ru||Math.abs(this._y1-u)>Ru)&&this._append`L${l},${u}`,n&&(d<0&&(d=d%GM+GM),d>utt?this._append`A${n},${n},0,1,${f},${t-a},${r-c}A${n},${n},0,1,${f},${this._x1=l},${this._y1=u}`:d>Ru&&this._append`A${n},${n},0,${+(d>=WM)},${f},${this._x1=t+n*Math.cos(o)},${this._y1=r+n*Math.sin(o)}`)}rect(t,r,n,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}};function $P(){return new Yc}$P.prototype=Yc.prototype;function Nn(e=3){return new Yc(+e)}var dtt=Array.prototype,Ow=dtt.slice;function zP(e,t){return e-t}function jP(e){for(var t=0,r=e.length,n=e[r-1][1]*e[0][0]-e[r-1][0]*e[0][1];++t<r;)n+=e[t-1][1]*e[t][0]-e[t-1][0]*e[t][1];return n}var cs=e=>()=>e;function qP(e,t){for(var r=-1,n=t.length,i;++r<n;)if(i=htt(e,t[r]))return i;return 0}function htt(e,t){for(var r=t[0],n=t[1],i=-1,o=0,s=e.length,a=s-1;o<s;a=o++){var c=e[o],l=c[0],u=c[1],f=e[a],d=f[0],h=f[1];if(ptt(c,f,t))return 0;u>n!=h>n&&r<(d-l)*(n-u)/(h-u)+l&&(i=-i)}return i}function ptt(e,t,r){var n;return mtt(e,t,r)&&ytt(e[n=+(e[0]===t[0])],r[n],t[n])}function mtt(e,t,r){return(t[0]-e[0])*(r[1]-e[1])===(r[0]-e[0])*(t[1]-e[1])}function ytt(e,t,r){return e<=t&&t<=r||r<=t&&t<=e}function VP(){}var Ca=[[],[[[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 Wc(){var e=1,t=1,r=Uc,n=c;function i(l){var u=r(l);if(Array.isArray(u))u=u.slice().sort(zP);else{let f=ce(l,gtt);for(u=Qr(...Td(f[0],f[1],u),u);u[u.length-1]>=f[1];)u.pop();for(;u[1]<f[0];)u.shift()}return u.map(f=>o(l,f))}function o(l,u){let f=u==null?NaN:+u;if(isNaN(f))throw new Error(`invalid value: ${u}`);var d=[],h=[];return s(l,f,function(p){n(p,l,f),jP(p)>0?d.push([p]):h.push(p)}),h.forEach(function(p){for(var m=0,y=d.length,g;m<y;++m)if(qP((g=d[m])[0],p)!==-1){g.push(p);return}}),{type:"MultiPolygon",value:u,coordinates:d}}function s(l,u,f){var d=new Array,h=new Array,p,m,y,g,x,b;for(p=m=-1,g=Du(l[0],u),Ca[g<<1].forEach(_);++p<e-1;)y=g,g=Du(l[p+1],u),Ca[y|g<<1].forEach(_);for(Ca[g<<0].forEach(_);++m<t-1;){for(p=-1,g=Du(l[m*e+e],u),x=Du(l[m*e],u),Ca[g<<1|x<<2].forEach(_);++p<e-1;)y=g,g=Du(l[m*e+e+p+1],u),b=x,x=Du(l[m*e+p+1],u),Ca[y|g<<1|x<<2|b<<3].forEach(_);Ca[g|x<<3].forEach(_)}for(p=-1,x=l[m*e]>=u,Ca[x<<2].forEach(_);++p<e-1;)b=x,x=Du(l[m*e+p+1],u),Ca[x<<2|b<<3].forEach(_);Ca[x<<3].forEach(_);function _(v){var w=[v[0][0]+p,v[0][1]+m],T=[v[1][0]+p,v[1][1]+m],A=a(w),E=a(T),N,I;(N=h[A])?(I=d[E])?(delete h[N.end],delete d[I.start],N===I?(N.ring.push(T),f(N.ring)):d[N.start]=h[I.end]={start:N.start,end:I.end,ring:N.ring.concat(I.ring)}):(delete h[N.end],N.ring.push(T),h[N.end=E]=N):(N=d[E])?(I=h[A])?(delete d[N.start],delete h[I.end],N===I?(N.ring.push(T),f(N.ring)):d[I.start]=h[N.end]={start:I.start,end:N.end,ring:I.ring.concat(N.ring)}):(delete d[N.start],N.ring.unshift(w),d[N.start=A]=N):d[A]=h[E]={start:A,end:E,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,y=p|0,g=XM(u[y*e+m]);h>0&&h<e&&m===h&&(d[0]=YP(h,XM(u[y*e+m-1]),g,f)),p>0&&p<t&&y===p&&(d[1]=YP(p,XM(u[(y-1)*e+m]),g,f))})}return i.contour=o,i.size=function(l){if(!arguments.length)return[e,t];var u=Math.floor(l[0]),f=Math.floor(l[1]);if(!(u>=0&&f>=0))throw new Error("invalid size");return e=u,t=f,i},i.thresholds=function(l){return arguments.length?(r=typeof l=="function"?l:Array.isArray(l)?cs(Ow.call(l)):cs(l),i):r},i.smooth=function(l){return arguments.length?(n=l?c:VP,i):n===c},i}function gtt(e){return isFinite(e)?e:NaN}function Du(e,t){return e==null?!1:+e>=t}function XM(e){return e==null||isNaN(e=+e)?-1/0:e}function YP(e,t,r,n){let i=n-t,o=r-t,s=isFinite(i)||isFinite(o)?i/o:Math.sign(i)/Math.sign(o);return isNaN(s)?e:e+s-.5}function xtt(e){return e[0]}function btt(e){return e[1]}function _tt(){return 1}function HM(){var e=xtt,t=btt,r=_tt,n=960,i=500,o=20,s=2,a=o*3,c=n+a*2>>s,l=i+a*2>>s,u=cs(20);function f(x){var b=new Float32Array(c*l),_=Math.pow(2,-s),v=-1;for(let C of x){var w=(e(C,++v,x)+a)*_,T=(t(C,v,x)+a)*_,A=+r(C,v,x);if(A&&w>=0&&w<c&&T>=0&&T<l){var E=Math.floor(w),N=Math.floor(T),I=w-E-.5,R=T-N-.5;b[E+N*c]+=(1-I)*(1-R)*A,b[E+1+N*c]+=I*(1-R)*A,b[E+1+(N+1)*c]+=I*R*A,b[E+(N+1)*c]+=(1-I)*R*A}}return ay({data:b,width:c,height:l},o*_),b}function d(x){var b=f(x),_=u(b),v=Math.pow(2,2*s);return Array.isArray(_)||(_=Qr(Number.MIN_VALUE,Kt(b)/v,_)),Wc().size([c,l]).thresholds(_.map(w=>w*v))(b).map((w,T)=>(w.value=+_[T],h(w)))}d.contours=function(x){var b=f(x),_=Wc().size([c,l]),v=Math.pow(2,2*s),w=T=>{T=+T;var A=h(_.contour(b,T*v));return A.value=T,A};return Object.defineProperty(w,"max",{get:()=>Kt(b)/v}),w};function h(x){return x.coordinates.forEach(p),x}function p(x){x.forEach(m)}function m(x){x.forEach(y)}function y(x){x[0]=x[0]*Math.pow(2,s)-a,x[1]=x[1]*Math.pow(2,s)-a}function g(){return a=o*3,c=n+a*2>>s,l=i+a*2>>s,d}return d.x=function(x){return arguments.length?(e=typeof x=="function"?x:cs(+x),d):e},d.y=function(x){return arguments.length?(t=typeof x=="function"?x:cs(+x),d):t},d.weight=function(x){return arguments.length?(r=typeof x=="function"?x:cs(+x),d):r},d.size=function(x){if(!arguments.length)return[n,i];var b=+x[0],_=+x[1];if(!(b>=0&&_>=0))throw new Error("invalid size");return n=b,i=_,g()},d.cellSize=function(x){if(!arguments.length)return 1<<s;if(!((x=+x)>=1))throw new Error("invalid cell size");return s=Math.floor(Math.log(x)/Math.LN2),g()},d.thresholds=function(x){return arguments.length?(u=typeof x=="function"?x:Array.isArray(x)?cs(Ow.call(x)):cs(x),d):u},d.bandwidth=function(x){if(!arguments.length)return Math.sqrt(o*(o+1));if(!((x=+x)>=0))throw new Error("invalid bandwidth");return o=(Math.sqrt(4*x*x+1)-1)/2,g()},d}var ne=11102230246251565e-32,lr=134217729,Ly=(3+8*ne)*ne;function Lu(e,t,r,n,i){let o,s,a,c,l=t[0],u=n[0],f=0,d=0;u>l==u>-l?(o=l,l=t[++f]):(o=u,u=n[++d]);let h=0;if(f<e&&d<r)for(u>l==u>-l?(s=l+o,a=o-(s-l),l=t[++f]):(s=u+o,a=o-(s-u),u=n[++d]),o=s,a!==0&&(i[h++]=a);f<e&&d<r;)u>l==u>-l?(s=o+l,c=s-o,a=o-(s-c)+(l-c),l=t[++f]):(s=o+u,c=s-o,a=o-(s-c)+(u-c),u=n[++d]),o=s,a!==0&&(i[h++]=a);for(;f<e;)s=o+l,c=s-o,a=o-(s-c)+(l-c),l=t[++f],o=s,a!==0&&(i[h++]=a);for(;d<r;)s=o+u,c=s-o,a=o-(s-c)+(u-c),u=n[++d],o=s,a!==0&&(i[h++]=a);return(o!==0||h===0)&&(i[h++]=o),h}function Fy(e,t){let r=t[0];for(let n=1;n<e;n++)r+=t[n];return r}function V(e){return new Float64Array(e)}var wtt=(3+16*ne)*ne,vtt=(2+12*ne)*ne,Stt=(9+64*ne)*ne*ne,Pd=V(4),WP=V(8),GP=V(12),XP=V(16),On=V(4);function Itt(e,t,r,n,i,o,s){let a,c,l,u,f,d,h,p,m,y,g,x,b,_,v,w,T,A,E=e-i,N=r-i,I=t-o,R=n-o;_=E*R,d=lr*E,h=d-(d-E),p=E-h,d=lr*R,m=d-(d-R),y=R-m,v=p*y-(_-h*m-p*m-h*y),w=I*N,d=lr*I,h=d-(d-I),p=I-h,d=lr*N,m=d-(d-N),y=N-m,T=p*y-(w-h*m-p*m-h*y),g=v-T,f=v-g,Pd[0]=v-(g+f)+(f-T),x=_+g,f=x-_,b=_-(x-f)+(g-f),g=b-w,f=b-g,Pd[1]=b-(g+f)+(f-w),A=x+g,f=A-x,Pd[2]=x-(A-f)+(g-f),Pd[3]=A;let C=Fy(4,Pd),S=vtt*s;if(C>=S||-C>=S||(f=e-E,a=e-(E+f)+(f-i),f=r-N,l=r-(N+f)+(f-i),f=t-I,c=t-(I+f)+(f-o),f=n-R,u=n-(R+f)+(f-o),a===0&&c===0&&l===0&&u===0)||(S=Stt*s+Ly*Math.abs(C),C+=E*u+R*a-(I*l+N*c),C>=S||-C>=S))return C;_=a*R,d=lr*a,h=d-(d-a),p=a-h,d=lr*R,m=d-(d-R),y=R-m,v=p*y-(_-h*m-p*m-h*y),w=c*N,d=lr*c,h=d-(d-c),p=c-h,d=lr*N,m=d-(d-N),y=N-m,T=p*y-(w-h*m-p*m-h*y),g=v-T,f=v-g,On[0]=v-(g+f)+(f-T),x=_+g,f=x-_,b=_-(x-f)+(g-f),g=b-w,f=b-g,On[1]=b-(g+f)+(f-w),A=x+g,f=A-x,On[2]=x-(A-f)+(g-f),On[3]=A;let M=Lu(4,Pd,4,On,WP);_=E*u,d=lr*E,h=d-(d-E),p=E-h,d=lr*u,m=d-(d-u),y=u-m,v=p*y-(_-h*m-p*m-h*y),w=I*l,d=lr*I,h=d-(d-I),p=I-h,d=lr*l,m=d-(d-l),y=l-m,T=p*y-(w-h*m-p*m-h*y),g=v-T,f=v-g,On[0]=v-(g+f)+(f-T),x=_+g,f=x-_,b=_-(x-f)+(g-f),g=b-w,f=b-g,On[1]=b-(g+f)+(f-w),A=x+g,f=A-x,On[2]=x-(A-f)+(g-f),On[3]=A;let O=Lu(M,WP,4,On,GP);_=a*u,d=lr*a,h=d-(d-a),p=a-h,d=lr*u,m=d-(d-u),y=u-m,v=p*y-(_-h*m-p*m-h*y),w=c*l,d=lr*c,h=d-(d-c),p=c-h,d=lr*l,m=d-(d-l),y=l-m,T=p*y-(w-h*m-p*m-h*y),g=v-T,f=v-g,On[0]=v-(g+f)+(f-T),x=_+g,f=x-_,b=_-(x-f)+(g-f),g=b-w,f=b-g,On[1]=b-(g+f)+(f-w),A=x+g,f=A-x,On[2]=x-(A-f)+(g-f),On[3]=A;let L=Lu(O,GP,4,On,XP);return XP[L-1]}function Ud(e,t,r,n,i,o){let s=(t-o)*(r-i),a=(e-i)*(n-o),c=s-a,l=Math.abs(s+a);return Math.abs(c)>=wtt*l?c:-Itt(e,t,r,n,i,o,l)}var PFt=(7+56*ne)*ne,UFt=(3+28*ne)*ne,$Ft=(26+288*ne)*ne*ne,zFt=V(4),jFt=V(4),qFt=V(4),VFt=V(4),YFt=V(4),WFt=V(4),GFt=V(4),XFt=V(4),HFt=V(4),QFt=V(8),ZFt=V(8),KFt=V(8),JFt=V(4),tCt=V(8),eCt=V(8),rCt=V(8),nCt=V(12),iCt=V(192),oCt=V(192);var cCt=(10+96*ne)*ne,lCt=(4+48*ne)*ne,uCt=(44+576*ne)*ne*ne,fCt=V(4),dCt=V(4),hCt=V(4),pCt=V(4),mCt=V(4),yCt=V(4),gCt=V(4),xCt=V(4),bCt=V(8),_Ct=V(8),wCt=V(8),vCt=V(8),SCt=V(8),ICt=V(8),TCt=V(8),ACt=V(8),ECt=V(8),MCt=V(4),NCt=V(4),OCt=V(4),RCt=V(8),DCt=V(16),LCt=V(16),FCt=V(16),CCt=V(32),kCt=V(32),BCt=V(48),PCt=V(64),UCt=V(1152),$Ct=V(1152);var VCt=(16+224*ne)*ne,YCt=(5+72*ne)*ne,WCt=(71+1408*ne)*ne*ne,GCt=V(4),XCt=V(4),HCt=V(4),QCt=V(4),ZCt=V(4),KCt=V(4),JCt=V(4),tkt=V(4),ekt=V(4),rkt=V(4),nkt=V(24),ikt=V(24),okt=V(24),skt=V(24),akt=V(24),ckt=V(24),lkt=V(24),ukt=V(24),fkt=V(24),dkt=V(24),hkt=V(1152),pkt=V(1152),mkt=V(1152),ykt=V(1152),gkt=V(1152),xkt=V(2304),bkt=V(2304),_kt=V(3456),wkt=V(5760),vkt=V(8),Skt=V(8),Ikt=V(8),Tkt=V(16),Akt=V(24),Ekt=V(48),Mkt=V(48),Nkt=V(96),Okt=V(192),Rkt=V(384),Dkt=V(384),Lkt=V(384),Fkt=V(768);var Ckt=V(96),kkt=V(96),Bkt=V(96),Pkt=V(1152);var QP=Math.pow(2,-52),Rw=new Uint32Array(512),zd=class e{static from(t,r=Ott,n=Rtt){let i=t.length,o=new Float64Array(i*2);for(let s=0;s<i;s++){let a=t[s];o[2*s]=r(a),o[2*s+1]=n(a)}return new e(o)}constructor(t){let r=t.length>>1;if(r>0&&typeof t[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=t;let n=Math.max(2*r-5,0);this._triangles=new Uint32Array(n*3),this._halfedges=new Int32Array(n*3),this._hashSize=Math.ceil(Math.sqrt(r)),this._hullPrev=new Uint32Array(r),this._hullNext=new Uint32Array(r),this._hullTri=new Uint32Array(r),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(r),this._dists=new Float64Array(r),this.update()}update(){let{coords:t,_hullPrev:r,_hullNext:n,_hullTri:i,_hullHash:o}=this,s=t.length>>1,a=1/0,c=1/0,l=-1/0,u=-1/0;for(let E=0;E<s;E++){let N=t[2*E],I=t[2*E+1];N<a&&(a=N),I<c&&(c=I),N>l&&(l=N),I>u&&(u=I),this._ids[E]=E}let f=(a+l)/2,d=(c+u)/2,h,p,m;for(let E=0,N=1/0;E<s;E++){let I=QM(f,d,t[2*E],t[2*E+1]);I<N&&(h=E,N=I)}let y=t[2*h],g=t[2*h+1];for(let E=0,N=1/0;E<s;E++){if(E===h)continue;let I=QM(y,g,t[2*E],t[2*E+1]);I<N&&I>0&&(p=E,N=I)}let x=t[2*p],b=t[2*p+1],_=1/0;for(let E=0;E<s;E++){if(E===h||E===p)continue;let N=Mtt(y,g,x,b,t[2*E],t[2*E+1]);N<_&&(m=E,_=N)}let v=t[2*m],w=t[2*m+1];if(_===1/0){for(let I=0;I<s;I++)this._dists[I]=t[2*I]-t[0]||t[2*I+1]-t[1];$d(this._ids,this._dists,0,s-1);let E=new Uint32Array(s),N=0;for(let I=0,R=-1/0;I<s;I++){let C=this._ids[I],S=this._dists[C];S>R&&(E[N++]=C,R=S)}this.hull=E.subarray(0,N),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(Ud(y,g,x,b,v,w)<0){let E=p,N=x,I=b;p=m,x=v,b=w,m=E,v=N,w=I}let T=Ntt(y,g,x,b,v,w);this._cx=T.x,this._cy=T.y;for(let E=0;E<s;E++)this._dists[E]=QM(t[2*E],t[2*E+1],T.x,T.y);$d(this._ids,this._dists,0,s-1),this._hullStart=h;let A=3;n[h]=r[m]=p,n[p]=r[h]=m,n[m]=r[p]=h,i[h]=0,i[p]=1,i[m]=2,o.fill(-1),o[this._hashKey(y,g)]=h,o[this._hashKey(x,b)]=p,o[this._hashKey(v,w)]=m,this.trianglesLen=0,this._addTriangle(h,p,m,-1,-1,-1);for(let E=0,N,I;E<this._ids.length;E++){let R=this._ids[E],C=t[2*R],S=t[2*R+1];if(E>0&&Math.abs(C-N)<=QP&&Math.abs(S-I)<=QP||(N=C,I=S,R===h||R===p||R===m))continue;let M=0;for(let P=0,U=this._hashKey(C,S);P<this._hashSize&&(M=o[(U+P)%this._hashSize],!(M!==-1&&M!==n[M]));P++);M=r[M];let O=M,L;for(;L=n[O],Ud(C,S,t[2*O],t[2*O+1],t[2*L],t[2*L+1])>=0;)if(O=L,O===M){O=-1;break}if(O===-1)continue;let B=this._addTriangle(O,R,n[O],-1,-1,i[O]);i[R]=this._legalize(B+2),i[O]=B,A++;let k=n[O];for(;L=n[k],Ud(C,S,t[2*k],t[2*k+1],t[2*L],t[2*L+1])<0;)B=this._addTriangle(k,R,L,i[R],-1,i[k]),i[R]=this._legalize(B+2),n[k]=k,A--,k=L;if(O===M)for(;L=r[O],Ud(C,S,t[2*L],t[2*L+1],t[2*O],t[2*O+1])<0;)B=this._addTriangle(L,R,O,-1,i[O],i[L]),this._legalize(B+2),i[L]=B,n[O]=O,A--,O=L;this._hullStart=r[R]=O,n[O]=r[k]=R,n[R]=k,o[this._hashKey(C,S)]=R,o[this._hashKey(t[2*O],t[2*O+1])]=O}this.hull=new Uint32Array(A);for(let E=0,N=this._hullStart;E<A;E++)this.hull[E]=N,N=n[N];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,r){return Math.floor(Att(t-this._cx,r-this._cy)*this._hashSize)%this._hashSize}_legalize(t){let{_triangles:r,_halfedges:n,coords:i}=this,o=0,s=0;for(;;){let a=n[t],c=t-t%3;if(s=c+(t+2)%3,a===-1){if(o===0)break;t=Rw[--o];continue}let l=a-a%3,u=c+(t+1)%3,f=l+(a+2)%3,d=r[s],h=r[t],p=r[u],m=r[f];if(Ett(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])){r[t]=m,r[a]=d;let g=n[f];if(g===-1){let b=this._hullStart;do{if(this._hullTri[b]===f){this._hullTri[b]=t;break}b=this._hullPrev[b]}while(b!==this._hullStart)}this._link(t,g),this._link(a,n[s]),this._link(s,f);let x=l+(a+1)%3;o<Rw.length&&(Rw[o++]=x)}else{if(o===0)break;t=Rw[--o]}}return s}_link(t,r){this._halfedges[t]=r,r!==-1&&(this._halfedges[r]=t)}_addTriangle(t,r,n,i,o,s){let a=this.trianglesLen;return this._triangles[a]=t,this._triangles[a+1]=r,this._triangles[a+2]=n,this._link(a,i),this._link(a+1,o),this._link(a+2,s),this.trianglesLen+=3,a}};function Att(e,t){let r=e/(Math.abs(e)+Math.abs(t));return(t>0?3-r:1+r)/4}function QM(e,t,r,n){let i=e-r,o=t-n;return i*i+o*o}function Ett(e,t,r,n,i,o,s,a){let c=e-s,l=t-a,u=r-s,f=n-a,d=i-s,h=o-a,p=c*c+l*l,m=u*u+f*f,y=d*d+h*h;return c*(f*y-m*h)-l*(u*y-m*d)+p*(u*h-f*d)<0}function Mtt(e,t,r,n,i,o){let s=r-e,a=n-t,c=i-e,l=o-t,u=s*s+a*a,f=c*c+l*l,d=.5/(s*l-a*c),h=(l*u-a*f)*d,p=(s*f-c*u)*d;return h*h+p*p}function Ntt(e,t,r,n,i,o){let s=r-e,a=n-t,c=i-e,l=o-t,u=s*s+a*a,f=c*c+l*l,d=.5/(s*l-a*c),h=e+(l*u-a*f)*d,p=t+(s*f-c*u)*d;return{x:h,y:p}}function $d(e,t,r,n){if(n-r<=20)for(let i=r+1;i<=n;i++){let o=e[i],s=t[o],a=i-1;for(;a>=r&&t[e[a]]>s;)e[a+1]=e[a--];e[a+1]=o}else{let i=r+n>>1,o=r+1,s=n;Cy(e,i,o),t[e[r]]>t[e[n]]&&Cy(e,r,n),t[e[o]]>t[e[n]]&&Cy(e,o,n),t[e[r]]>t[e[o]]&&Cy(e,r,o);let a=e[o],c=t[a];for(;;){do o++;while(t[e[o]]<c);do s--;while(t[e[s]]>c);if(s<o)break;Cy(e,o,s)}e[r+1]=e[s],e[s]=a,n-o+1>=s-r?($d(e,t,o,n),$d(e,t,r,s-1)):($d(e,t,r,s-1),$d(e,t,o,n))}}function Cy(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}function Ott(e){return e[0]}function Rtt(e){return e[1]}var qi=class{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,r){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,r){this._+=`L${this._x1=+t},${this._y1=+r}`}arc(t,r,n){t=+t,r=+r,n=+n;let i=t+n,o=r;if(n<0)throw new Error("negative radius");this._x1===null?this._+=`M${i},${o}`:(Math.abs(this._x1-i)>1e-6||Math.abs(this._y1-o)>1e-6)&&(this._+="L"+i+","+o),n&&(this._+=`A${n},${n},0,1,1,${t-n},${r}A${n},${n},0,1,1,${this._x1=i},${this._y1=o}`)}rect(t,r,n,i){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${+n}v${+i}h${-n}Z`}value(){return this._||null}};var Gc=class{constructor(){this._=[]}moveTo(t,r){this._.push([t,r])}closePath(){this._.push(this._[0].slice())}lineTo(t,r){this._.push([t,r])}value(){return this._.length?this._:null}};var ky=class{constructor(t,[r,n,i,o]=[0,0,960,500]){if(!((i=+i)>=(r=+r))||!((o=+o)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(t.points.length*2),this.vectors=new Float64Array(t.points.length*2),this.xmax=i,this.xmin=r,this.ymax=o,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){let{delaunay:{points:t,hull:r,triangles:n},vectors:i}=this,o,s,a=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let m=0,y=0,g=n.length,x,b;m<g;m+=3,y+=2){let _=n[m]*2,v=n[m+1]*2,w=n[m+2]*2,T=t[_],A=t[_+1],E=t[v],N=t[v+1],I=t[w],R=t[w+1],C=E-T,S=N-A,M=I-T,O=R-A,L=(C*O-S*M)*2;if(Math.abs(L)<1e-9){if(o===void 0){o=s=0;for(let k of r)o+=t[k*2],s+=t[k*2+1];o/=r.length,s/=r.length}let B=1e9*Math.sign((o-T)*O-(s-A)*M);x=(T+I)/2-B*O,b=(A+R)/2+B*M}else{let B=1/L,k=C*C+S*S,P=M*M+O*O;x=T+(O*k-S*P)*B,b=A+(C*P-M*k)*B}a[y]=x,a[y+1]=b}let c=r[r.length-1],l,u=c*4,f,d=t[2*c],h,p=t[2*c+1];i.fill(0);for(let m=0;m<r.length;++m)c=r[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 r=t==null?t=new qi:void 0,{delaunay:{halfedges:n,inedges:i,hull:o},circumcenters:s,vectors:a}=this;if(o.length<=1)return null;for(let u=0,f=n.length;u<f;++u){let d=n[u];if(d<u)continue;let h=Math.floor(u/3)*2,p=Math.floor(d/3)*2,m=s[h],y=s[h+1],g=s[p],x=s[p+1];this._renderSegment(m,y,g,x,t)}let c,l=o[o.length-1];for(let u=0;u<o.length;++u){c=l,l=o[u];let f=Math.floor(i[l]/3)*2,d=s[f],h=s[f+1],p=c*4,m=this._project(d,h,a[p+2],a[p+3]);m&&this._renderSegment(d,h,m[0],m[1],t)}return r&&r.value()}renderBounds(t){let r=t==null?t=new qi:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),r&&r.value()}renderCell(t,r){let n=r==null?r=new qi:void 0,i=this._clip(t);if(i===null||!i.length)return;r.moveTo(i[0],i[1]);let o=i.length;for(;i[0]===i[o-2]&&i[1]===i[o-1]&&o>1;)o-=2;for(let s=2;s<o;s+=2)(i[s]!==i[s-2]||i[s+1]!==i[s-1])&&r.lineTo(i[s],i[s+1]);return r.closePath(),n&&n.value()}*cellPolygons(){let{delaunay:{points:t}}=this;for(let r=0,n=t.length/2;r<n;++r){let i=this.cellPolygon(r);i&&(i.index=r,yield i)}}cellPolygon(t){let r=new Gc;return this.renderCell(t,r),r.value()}_renderSegment(t,r,n,i,o){let s,a=this._regioncode(t,r),c=this._regioncode(n,i);a===0&&c===0?(o.moveTo(t,r),o.lineTo(n,i)):(s=this._clipSegment(t,r,n,i,a,c))&&(o.moveTo(s[0],s[1]),o.lineTo(s[2],s[3]))}contains(t,r,n){return r=+r,r!==r||(n=+n,n!==n)?!1:this.delaunay._step(t,r,n)===t}*neighbors(t){let r=this._clip(t);if(r)for(let n of this.delaunay.neighbors(t)){let i=this._clip(n);if(i){t:for(let o=0,s=r.length;o<s;o+=2)for(let a=0,c=i.length;a<c;a+=2)if(r[o]===i[a]&&r[o+1]===i[a+1]&&r[(o+2)%s]===i[(a+c-2)%c]&&r[(o+3)%s]===i[(a+c-1)%c]){yield n;break t}}}}_cell(t){let{circumcenters:r,delaunay:{inedges:n,halfedges:i,triangles:o}}=this,s=n[t];if(s===-1)return null;let a=[],c=s;do{let l=Math.floor(c/3);if(a.push(r[l*2],r[l*2+1]),c=c%3===2?c-2:c+1,o[c]!==t)break;c=i[c]}while(c!==s&&c!==-1);return a}_clip(t){if(t===0&&this.delaunay.hull.length===1)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];let r=this._cell(t);if(r===null)return null;let{vectors:n}=this,i=t*4;return this._simplify(n[i]||n[i+1]?this._clipInfinite(t,r,n[i],n[i+1],n[i+2],n[i+3]):this._clipFinite(t,r))}_clipFinite(t,r){let n=r.length,i=null,o,s,a=r[n-2],c=r[n-1],l,u=this._regioncode(a,c),f,d=0;for(let h=0;h<n;h+=2)if(o=a,s=c,a=r[h],c=r[h+1],l=u,u=this._regioncode(a,c),l===0&&u===0)f=d,d=0,i?i.push(a,c):i=[a,c];else{let p,m,y,g,x;if(l===0){if((p=this._clipSegment(o,s,a,c,l,u))===null)continue;[m,y,g,x]=p}else{if((p=this._clipSegment(a,c,o,s,u,l))===null)continue;[g,x,m,y]=p,f=d,d=this._edgecode(m,y),f&&d&&this._edge(t,f,d,i,i.length),i?i.push(m,y):i=[m,y]}f=d,d=this._edgecode(g,x),f&&d&&this._edge(t,f,d,i,i.length),i?i.push(g,x):i=[g,x]}if(i)f=d,d=this._edgecode(i[0],i[1]),f&&d&&this._edge(t,f,d,i,i.length);else if(this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return i}_clipSegment(t,r,n,i,o,s){let a=o<s;for(a&&([t,r,n,i,o,s]=[n,i,t,r,s,o]);;){if(o===0&&s===0)return a?[n,i,t,r]:[t,r,n,i];if(o&s)return null;let c,l,u=o||s;u&8?(c=t+(n-t)*(this.ymax-r)/(i-r),l=this.ymax):u&4?(c=t+(n-t)*(this.ymin-r)/(i-r),l=this.ymin):u&2?(l=r+(i-r)*(this.xmax-t)/(n-t),c=this.xmax):(l=r+(i-r)*(this.xmin-t)/(n-t),c=this.xmin),o?(t=c,r=l,o=this._regioncode(t,r)):(n=c,i=l,s=this._regioncode(n,i))}}_clipInfinite(t,r,n,i,o,s){let a=Array.from(r),c;if((c=this._project(a[0],a[1],n,i))&&a.unshift(c[0],c[1]),(c=this._project(a[a.length-2],a[a.length-1],o,s))&&a.push(c[0],c[1]),a=this._clipFinite(t,a))for(let l=0,u=a.length,f,d=this._edgecode(a[u-2],a[u-1]);l<u;l+=2)f=d,d=this._edgecode(a[l],a[l+1]),f&&d&&(l=this._edge(t,f,d,a,l),u=a.length);else this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(a=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return a}_edge(t,r,n,i,o){for(;r!==n;){let s,a;switch(r){case 5:r=4;continue;case 4:r=6,s=this.xmax,a=this.ymin;break;case 6:r=2;continue;case 2:r=10,s=this.xmax,a=this.ymax;break;case 10:r=8;continue;case 8:r=9,s=this.xmin,a=this.ymax;break;case 9:r=1;continue;case 1:r=5,s=this.xmin,a=this.ymin;break}(i[o]!==s||i[o+1]!==a)&&this.contains(t,s,a)&&(i.splice(o,0,s,a),o+=2)}return o}_project(t,r,n,i){let o=1/0,s,a,c;if(i<0){if(r<=this.ymin)return null;(s=(this.ymin-r)/i)<o&&(c=this.ymin,a=t+(o=s)*n)}else if(i>0){if(r>=this.ymax)return null;(s=(this.ymax-r)/i)<o&&(c=this.ymax,a=t+(o=s)*n)}if(n>0){if(t>=this.xmax)return null;(s=(this.xmax-t)/n)<o&&(a=this.xmax,c=r+(o=s)*i)}else if(n<0){if(t<=this.xmin)return null;(s=(this.xmin-t)/n)<o&&(a=this.xmin,c=r+(o=s)*i)}return[a,c]}_edgecode(t,r){return(t===this.xmin?1:t===this.xmax?2:0)|(r===this.ymin?4:r===this.ymax?8:0)}_regioncode(t,r){return(t<this.xmin?1:t>this.xmax?2:0)|(r<this.ymin?4:r>this.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let r=0;r<t.length;r+=2){let n=(r+2)%t.length,i=(r+4)%t.length;(t[r]===t[n]&&t[n]===t[i]||t[r+1]===t[n+1]&&t[n+1]===t[i+1])&&(t.splice(n,2),r-=2)}t.length||(t=null)}return t}};var Dtt=2*Math.PI,jd=Math.pow;function Ltt(e){return e[0]}function Ftt(e){return e[1]}function Ctt(e){let{triangles:t,coords:r}=e;for(let n=0;n<t.length;n+=3){let i=2*t[n],o=2*t[n+1],s=2*t[n+2];if((r[s]-r[i])*(r[o+1]-r[i+1])-(r[o]-r[i])*(r[s+1]-r[i+1])>1e-10)return!1}return!0}function ktt(e,t,r){return[e+Math.sin(e+t)*r,t+Math.cos(e-t)*r]}var Vi=class e{static from(t,r=Ltt,n=Ftt,i){return new e("length"in t?Btt(t,r,n,i):Float64Array.from(Ptt(t,r,n,i)))}constructor(t){this._delaunator=new zd(t),this.inedges=new Int32Array(t.length/2),this._hullIndex=new Int32Array(t.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){let t=this._delaunator,r=this.points;if(t.hull&&t.hull.length>2&&Ctt(t)){this.collinear=Int32Array.from({length:r.length/2},(d,h)=>h).sort((d,h)=>r[2*d]-r[2*h]||r[2*d+1]-r[2*h+1]);let c=this.collinear[0],l=this.collinear[this.collinear.length-1],u=[r[2*c],r[2*c+1],r[2*l],r[2*l+1]],f=1e-8*Math.hypot(u[3]-u[1],u[2]-u[0]);for(let d=0,h=r.length/2;d<h;++d){let p=ktt(r[2*d],r[2*d+1],f);r[2*d]=p[0],r[2*d+1]=p[1]}this._delaunator=new zd(r)}else delete this.collinear;let n=this.halfedges=this._delaunator.halfedges,i=this.hull=this._delaunator.hull,o=this.triangles=this._delaunator.triangles,s=this.inedges.fill(-1),a=this._hullIndex.fill(-1);for(let c=0,l=n.length;c<l;++c){let u=o[c%3===2?c-2:c+1];(n[c]===-1||s[u]===-1)&&(s[u]=c)}for(let c=0,l=i.length;c<l;++c)a[i[c]]=c;i.length<=2&&i.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=i[0],s[i[0]]=1,i.length===2&&(s[i[1]]=0,this.triangles[1]=i[1],this.triangles[2]=i[1]))}voronoi(t){return new ky(this,t)}*neighbors(t){let{inedges:r,hull:n,_hullIndex:i,halfedges:o,triangles:s,collinear:a}=this;if(a){let f=a.indexOf(t);f>0&&(yield a[f-1]),f<a.length-1&&(yield a[f+1]);return}let c=r[t];if(c===-1)return;let l=c,u=-1;do{if(yield u=s[l],l=l%3===2?l-2:l+1,s[l]!==t)return;if(l=o[l],l===-1){let f=n[(i[t]+1)%n.length];f!==u&&(yield f);return}}while(l!==c)}find(t,r,n=0){if(t=+t,t!==t||(r=+r,r!==r))return-1;let i=n,o;for(;(o=this._step(n,t,r))>=0&&o!==n&&o!==i;)n=o;return o}_step(t,r,n){let{inedges:i,hull:o,_hullIndex:s,halfedges:a,triangles:c,points:l}=this;if(i[t]===-1||!l.length)return(t+1)%(l.length>>1);let u=t,f=jd(r-l[t*2],2)+jd(n-l[t*2+1],2),d=i[t],h=d;do{let p=c[h],m=jd(r-l[p*2],2)+jd(n-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&&jd(r-l[h*2],2)+jd(n-l[h*2+1],2)<f)return h;break}}while(h!==d);return u}render(t){let r=t==null?t=new qi:void 0,{points:n,halfedges:i,triangles:o}=this;for(let s=0,a=i.length;s<a;++s){let c=i[s];if(c<s)continue;let l=o[s]*2,u=o[c]*2;t.moveTo(n[l],n[l+1]),t.lineTo(n[u],n[u+1])}return this.renderHull(t),r&&r.value()}renderPoints(t,r){r===void 0&&(!t||typeof t.moveTo!="function")&&(r=t,t=null),r=r==null?2:+r;let n=t==null?t=new qi:void 0,{points:i}=this;for(let o=0,s=i.length;o<s;o+=2){let a=i[o],c=i[o+1];t.moveTo(a+r,c),t.arc(a,c,r,0,Dtt)}return n&&n.value()}renderHull(t){let r=t==null?t=new qi:void 0,{hull:n,points:i}=this,o=n[0]*2,s=n.length;t.moveTo(i[o],i[o+1]);for(let a=1;a<s;++a){let c=2*n[a];t.lineTo(i[c],i[c+1])}return t.closePath(),r&&r.value()}hullPolygon(){let t=new Gc;return this.renderHull(t),t.value()}renderTriangle(t,r){let n=r==null?r=new qi:void 0,{points:i,triangles:o}=this,s=o[t*=3]*2,a=o[t+1]*2,c=o[t+2]*2;return r.moveTo(i[s],i[s+1]),r.lineTo(i[a],i[a+1]),r.lineTo(i[c],i[c+1]),r.closePath(),n&&n.value()}*trianglePolygons(){let{triangles:t}=this;for(let r=0,n=t.length/3;r<n;++r)yield this.trianglePolygon(r)}trianglePolygon(t){let r=new Gc;return this.renderTriangle(t,r),r.value()}};function Btt(e,t,r,n){let i=e.length,o=new Float64Array(i*2);for(let s=0;s<i;++s){let a=e[s];o[s*2]=t.call(n,a,s,e),o[s*2+1]=r.call(n,a,s,e)}return o}function*Ptt(e,t,r,n){let i=0;for(let o of e)yield t.call(n,o,i,e),yield r.call(n,o,i,e),++i}function ZP(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Fu(e,t){if((r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var r,n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function ls(e){return e=Fu(Math.abs(e)),e?e[1]:NaN}function KP(e,t){return function(r,n){for(var i=r.length,o=[],s=0,a=e[0],c=0;i>0&&a>0&&(c+a+1>n&&(a=Math.max(1,n-c)),o.push(r.substring(i-=a,i+a)),!((c+=a+1)>n));)a=e[s=(s+1)%e.length];return o.reverse().join(t)}}function JP(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var Utt=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function us(e){if(!(t=Utt.exec(e)))throw new Error("invalid format: "+e);var t;return new Dw({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]})}us.prototype=Dw.prototype;function Dw(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+""}Dw.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 t9(e){t:for(var t=e.length,r=1,n=-1,i;r<t;++r)switch(e[r]){case".":n=i=r;break;case"0":n===0&&(n=r),i=r;break;default:if(!+e[r])break t;n>0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(i+1):e}var ZM;function e9(e,t){var r=Fu(e,t);if(!r)return e+"";var n=r[0],i=r[1],o=i-(ZM=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,s=n.length;return o===s?n:o>s?n+new Array(o-s+1).join("0"):o>0?n.slice(0,o)+"."+n.slice(o):"0."+new Array(1-o).join("0")+Fu(e,Math.max(0,t+o-1))[0]}function KM(e,t){var r=Fu(e,t);if(!r)return e+"";var n=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+new Array(i-n.length+2).join("0")}var JM={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:ZP,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)=>KM(e*100,t),r:KM,s:e9,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function t3(e){return e}var r9=Array.prototype.map,n9=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function i9(e){var t=e.grouping===void 0||e.thousands===void 0?t3:KP(r9.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",o=e.numerals===void 0?t3:JP(r9.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=us(f);var d=f.fill,h=f.align,p=f.sign,m=f.symbol,y=f.zero,g=f.width,x=f.comma,b=f.precision,_=f.trim,v=f.type;v==="n"?(x=!0,v="g"):JM[v]||(b===void 0&&(b=12),_=!0,v="g"),(y||d==="0"&&h==="=")&&(y=!0,d="0",h="=");var w=m==="$"?r:m==="#"&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",T=m==="$"?n:/[%p]/.test(v)?s:"",A=JM[v],E=/[defgprs%]/.test(v);b=b===void 0?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b));function N(I){var R=w,C=T,S,M,O;if(v==="c")C=A(I)+C,I="";else{I=+I;var L=I<0||1/I<0;if(I=isNaN(I)?c:A(Math.abs(I),b),_&&(I=t9(I)),L&&+I==0&&p!=="+"&&(L=!1),R=(L?p==="("?p:a:p==="-"||p==="("?"":p)+R,C=(v==="s"?n9[8+ZM/3]:"")+C+(L&&p==="("?")":""),E){for(S=-1,M=I.length;++S<M;)if(O=I.charCodeAt(S),48>O||O>57){C=(O===46?i+I.slice(S+1):I.slice(S))+C,I=I.slice(0,S);break}}}x&&!y&&(I=t(I,1/0));var B=R.length+I.length+C.length,k=B<g?new Array(g-B+1).join(d):"";switch(x&&y&&(I=t(k+I,k.length?g-C.length:1/0),k=""),h){case"<":I=R+I+C+k;break;case"=":I=R+k+I+C;break;case"^":I=k.slice(0,B=k.length>>1)+R+I+C+k.slice(B);break;default:I=k+R+I+C;break}return o(I)}return N.toString=function(){return f+""},N}function u(f,d){var h=l((f=us(f),f.type="f",f)),p=Math.max(-8,Math.min(8,Math.floor(ls(d)/3)))*3,m=Math.pow(10,-p),y=n9[8+p/3];return function(g){return h(m*g)+y}}return{format:l,formatPrefix:u}}var Lw,Yi,Fw;e3({thousands:",",grouping:[3],currency:["$",""]});function e3(e){return Lw=i9(e),Yi=Lw.format,Fw=Lw.formatPrefix,Lw}function r3(e){return Math.max(0,-ls(Math.abs(e)))}function n3(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(ls(t)/3)))*3-ls(Math.abs(e)))}function i3(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,ls(t)-ls(e))+1}var et=1e-6,Cu=1e-12,Ct=Math.PI,Te=Ct/2,o3=Ct/4,Rr=Ct*2,Ze=180/Ct,Yt=Ct/180,$t=Math.abs,Wi=Math.atan,ur=Math.atan2,J=Math.cos,By=Math.ceil,Cw=Math.exp;var kw=Math.hypot,ku=Math.log,Bw=Math.pow,Z=Math.sin,fn=Math.sign||function(e){return e>0?1:e<0?-1:0},Ae=Math.sqrt,qd=Math.tan;function Pw(e){return e>1?0:e<-1?Ct:Math.acos(e)}function Ce(e){return e>1?Te:e<-1?-Te:Math.asin(e)}function fr(){}function Uw(e,t){e&&s9.hasOwnProperty(e.type)&&s9[e.type](e,t)}var o9={Feature:function(e,t){Uw(e.geometry,t)},FeatureCollection:function(e,t){for(var r=e.features,n=-1,i=r.length;++n<i;)Uw(r[n].geometry,t)}},s9={Sphere:function(e,t){t.sphere()},Point:function(e,t){e=e.coordinates,t.point(e[0],e[1],e[2])},MultiPoint:function(e,t){for(var r=e.coordinates,n=-1,i=r.length;++n<i;)e=r[n],t.point(e[0],e[1],e[2])},LineString:function(e,t){s3(e.coordinates,t,0)},MultiLineString:function(e,t){for(var r=e.coordinates,n=-1,i=r.length;++n<i;)s3(r[n],t,0)},Polygon:function(e,t){a9(e.coordinates,t)},MultiPolygon:function(e,t){for(var r=e.coordinates,n=-1,i=r.length;++n<i;)a9(r[n],t)},GeometryCollection:function(e,t){for(var r=e.geometries,n=-1,i=r.length;++n<i;)Uw(r[n],t)}};function s3(e,t,r){var n=-1,i=e.length-r,o;for(t.lineStart();++n<i;)o=e[n],t.point(o[0],o[1],o[2]);t.lineEnd()}function a9(e,t){var r=-1,n=e.length;for(t.polygonStart();++r<n;)s3(e[r],t,1);t.polygonEnd()}function pi(e,t){e&&o9.hasOwnProperty(e.type)?o9[e.type](e,t):Uw(e,t)}function Py(e){return[ur(e[1],e[0]),Ce(e[2])]}function fs(e){var t=e[0],r=e[1],n=J(r);return[n*J(t),n*Z(t),Z(r)]}function Uy(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Vd(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 $w(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function $y(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function zy(e){var t=Ae(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var jy,zw,jw,qw,Vw,Yw,Ww,Gw,a3,c3,l3,u9,f9,Rn,Dn,Ln,No={sphere:fr,point:u3,lineStart:c9,lineEnd:l9,polygonStart:function(){No.lineStart=jtt,No.lineEnd=qtt},polygonEnd:function(){No.lineStart=c9,No.lineEnd=l9}};function u3(e,t){e*=Yt,t*=Yt;var r=J(t);qy(r*J(e),r*Z(e),Z(t))}function qy(e,t,r){++jy,jw+=(e-jw)/jy,qw+=(t-qw)/jy,Vw+=(r-Vw)/jy}function c9(){No.point=$tt}function $tt(e,t){e*=Yt,t*=Yt;var r=J(t);Rn=r*J(e),Dn=r*Z(e),Ln=Z(t),No.point=ztt,qy(Rn,Dn,Ln)}function ztt(e,t){e*=Yt,t*=Yt;var r=J(t),n=r*J(e),i=r*Z(e),o=Z(t),s=ur(Ae((s=Dn*o-Ln*i)*s+(s=Ln*n-Rn*o)*s+(s=Rn*i-Dn*n)*s),Rn*n+Dn*i+Ln*o);zw+=s,Yw+=s*(Rn+(Rn=n)),Ww+=s*(Dn+(Dn=i)),Gw+=s*(Ln+(Ln=o)),qy(Rn,Dn,Ln)}function l9(){No.point=u3}function jtt(){No.point=Vtt}function qtt(){d9(u9,f9),No.point=u3}function Vtt(e,t){u9=e,f9=t,e*=Yt,t*=Yt,No.point=d9;var r=J(t);Rn=r*J(e),Dn=r*Z(e),Ln=Z(t),qy(Rn,Dn,Ln)}function d9(e,t){e*=Yt,t*=Yt;var r=J(t),n=r*J(e),i=r*Z(e),o=Z(t),s=Dn*o-Ln*i,a=Ln*n-Rn*o,c=Rn*i-Dn*n,l=kw(s,a,c),u=Ce(l),f=l&&-u/l;a3.add(f*s),c3.add(f*a),l3.add(f*c),zw+=u,Yw+=u*(Rn+(Rn=n)),Ww+=u*(Dn+(Dn=i)),Gw+=u*(Ln+(Ln=o)),qy(Rn,Dn,Ln)}function f3(e){jy=zw=jw=qw=Vw=Yw=Ww=Gw=0,a3=new Xr,c3=new Xr,l3=new Xr,pi(e,No);var t=+a3,r=+c3,n=+l3,i=kw(t,r,n);return i<Cu&&(t=Yw,r=Ww,n=Gw,zw<et&&(t=jw,r=qw,n=Vw),i=kw(t,r,n),i<Cu)?[NaN,NaN]:[ur(r,t)*Ze,Ce(n/i)*Ze]}function Vy(e,t){function r(n,i){return n=e(n,i),t(n[0],n[1])}return e.invert&&t.invert&&(r.invert=function(n,i){return n=t.invert(n,i),n&&e.invert(n[0],n[1])}),r}function d3(e,t){return $t(e)>Ct&&(e-=Math.round(e/Rr)*Rr),[e,t]}d3.invert=d3;function h3(e,t,r){return(e%=Rr)?t||r?Vy(p9(e),m9(t,r)):p9(e):t||r?m9(t,r):d3}function h9(e){return function(t,r){return t+=e,$t(t)>Ct&&(t-=Math.round(t/Rr)*Rr),[t,r]}}function p9(e){var t=h9(e);return t.invert=h9(-e),t}function m9(e,t){var r=J(e),n=Z(e),i=J(t),o=Z(t);function s(a,c){var l=J(c),u=J(a)*l,f=Z(a)*l,d=Z(c),h=d*r+u*n;return[ur(f*i-h*o,u*r-d*n),Ce(h*i+f*o)]}return s.invert=function(a,c){var l=J(c),u=J(a)*l,f=Z(a)*l,d=Z(c),h=d*i-f*o;return[ur(f*i+d*o,u*r+h*n),Ce(h*r-u*n)]},s}function y9(e){e=h3(e[0]*Yt,e[1]*Yt,e.length>2?e[2]*Yt:0);function t(r){return r=e(r[0]*Yt,r[1]*Yt),r[0]*=Ze,r[1]*=Ze,r}return t.invert=function(r){return r=e.invert(r[0]*Yt,r[1]*Yt),r[0]*=Ze,r[1]*=Ze,r},t}function x9(e,t,r,n,i,o){if(r){var s=J(t),a=Z(t),c=n*r;i==null?(i=t+n*Rr,o=t-c/2):(i=g9(s,i),o=g9(s,o),(n>0?i<o:i>o)&&(i+=n*Rr));for(var l,u=i;n>0?u>o:u<o;u-=c)l=Py([s,-a*J(u),-a*Z(u)]),e.point(l[0],l[1])}}function g9(e,t){t=fs(t),t[0]-=e,zy(t);var r=Pw(-t[1]);return((-t[2]<0?-r:r)+Rr-et)%Rr}function Xw(){var e=[],t;return{point:function(r,n,i){t.push([r,n,i])},lineStart:function(){e.push(t=[])},lineEnd:fr,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var r=e;return e=[],t=null,r}}}function Yd(e,t){return $t(e[0]-t[0])<et&&$t(e[1]-t[1])<et}function Hw(e,t,r,n){this.x=e,this.z=t,this.o=r,this.e=n,this.v=!1,this.n=this.p=null}function Qw(e,t,r,n,i){var o=[],s=[],a,c;if(e.forEach(function(p){if(!((m=p.length-1)<=0)){var m,y=p[0],g=p[m],x;if(Yd(y,g)){if(!y[2]&&!g[2]){for(i.lineStart(),a=0;a<m;++a)i.point((y=p[a])[0],y[1]);i.lineEnd();return}g[0]+=2*et}o.push(x=new Hw(y,p,null,!0)),s.push(x.o=new Hw(y,null,x,!1)),o.push(x=new Hw(g,p,null,!1)),s.push(x.o=new Hw(g,null,x,!0))}}),!!o.length){for(s.sort(t),b9(o),b9(s),a=0,c=s.length;a<c;++a)s[a].e=r=!r;for(var l=o[0],u,f;;){for(var d=l,h=!0;d.v;)if((d=d.n)===l)return;u=d.z,i.lineStart();do{if(d.v=d.o.v=!0,d.e){if(h)for(a=0,c=u.length;a<c;++a)i.point((f=u[a])[0],f[1]);else n(d.x,d.n.x,1,i);d=d.n}else{if(h)for(u=d.p.z,a=u.length-1;a>=0;--a)i.point((f=u[a])[0],f[1]);else n(d.x,d.p.x,-1,i);d=d.p}d=d.o,u=d.z,h=!h}while(!d.v);i.lineEnd()}}}function b9(e){if(t=e.length){for(var t,r=0,n=e[0],i;++r<t;)n.n=i=e[r],i.p=n,n=i;n.n=i=e[0],i.p=n}}function p3(e){return $t(e[0])<=Ct?e[0]:fn(e[0])*(($t(e[0])+Ct)%Rr-Ct)}function _9(e,t){var r=p3(t),n=t[1],i=Z(n),o=[Z(r),-J(r),0],s=0,a=0,c=new Xr;i===1?n=Te+et:i===-1&&(n=-Te-et);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=p3(h),m=h[1]/2+o3,y=Z(m),g=J(m),x=0;x<d;++x,p=_,y=w,g=T,h=b){var b=f[x],_=p3(b),v=b[1]/2+o3,w=Z(v),T=J(v),A=_-p,E=A>=0?1:-1,N=E*A,I=N>Ct,R=y*w;if(c.add(ur(R*E*Z(N),g*T+R*J(N))),s+=I?A+E*Rr:A,I^p>=r^_>=r){var C=Vd(fs(h),fs(b));zy(C);var S=Vd(o,C);zy(S);var M=(I^A>=0?-1:1)*Ce(S[2]);(n>M||n===M&&(C[0]||C[1]))&&(a+=I^A>=0?1:-1)}}return(s<-et||s<et&&c<-Cu)^a&1}function Zw(e,t,r,n){return function(i){var o=t(i),s=Xw(),a=t(s),c=!1,l,u,f,d={point:h,lineStart:m,lineEnd:y,polygonStart:function(){d.point=g,d.lineStart=x,d.lineEnd=b,u=[],l=[]},polygonEnd:function(){d.point=h,d.lineStart=m,d.lineEnd=y,u=Ad(u);var _=_9(l,n);u.length?(c||(i.polygonStart(),c=!0),Qw(u,Wtt,_,r,i)):_&&(c||(i.polygonStart(),c=!0),i.lineStart(),r(null,null,1,i),i.lineEnd()),c&&(i.polygonEnd(),c=!1),u=l=null},sphere:function(){i.polygonStart(),i.lineStart(),r(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function h(_,v){e(_,v)&&i.point(_,v)}function p(_,v){o.point(_,v)}function m(){d.point=p,o.lineStart()}function y(){d.point=h,o.lineEnd()}function g(_,v){f.push([_,v]),a.point(_,v)}function x(){a.lineStart(),f=[]}function b(){g(f[0][0],f[0][1]),a.lineEnd();var _=a.clean(),v=s.result(),w,T=v.length,A,E,N;if(f.pop(),l.push(f),f=null,!!T){if(_&1){if(E=v[0],(A=E.length-1)>0){for(c||(i.polygonStart(),c=!0),i.lineStart(),w=0;w<A;++w)i.point((N=E[w])[0],N[1]);i.lineEnd()}return}T>1&&_&2&&v.push(v.pop().concat(v.shift())),u.push(v.filter(Ytt))}}return d}}function Ytt(e){return e.length>1}function Wtt(e,t){return((e=e.x)[0]<0?e[1]-Te-et:Te-e[1])-((t=t.x)[0]<0?t[1]-Te-et:Te-t[1])}var m3=Zw(function(){return!0},Gtt,Htt,[-Ct,-Te]);function Gtt(e){var t=NaN,r=NaN,n=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(o,s){var a=o>0?Ct:-Ct,c=$t(o-t);$t(c-Ct)<et?(e.point(t,r=(r+s)/2>0?Te:-Te),e.point(n,r),e.lineEnd(),e.lineStart(),e.point(a,r),e.point(o,r),i=0):n!==a&&c>=Ct&&($t(t-n)<et&&(t-=n*et),$t(o-a)<et&&(o-=a*et),r=Xtt(t,r,o,s),e.point(n,r),e.lineEnd(),e.lineStart(),e.point(a,r),i=0),e.point(t=o,r=s),n=a},lineEnd:function(){e.lineEnd(),t=r=NaN},clean:function(){return 2-i}}}function Xtt(e,t,r,n){var i,o,s=Z(e-r);return $t(s)>et?Wi((Z(t)*(o=J(n))*Z(r)-Z(n)*(i=J(t))*Z(e))/(i*o*s)):(t+n)/2}function Htt(e,t,r,n){var i;if(e==null)i=r*Te,n.point(-Ct,i),n.point(0,i),n.point(Ct,i),n.point(Ct,0),n.point(Ct,-i),n.point(0,-i),n.point(-Ct,-i),n.point(-Ct,0),n.point(-Ct,i);else if($t(e[0]-t[0])>et){var o=e[0]<t[0]?Ct:-Ct;i=r*o/2,n.point(-o,i),n.point(0,i),n.point(o,i)}else n.point(t[0],t[1])}function w9(e){var t=J(e),r=2*Yt,n=t>0,i=$t(t)>et;function o(u,f,d,h){x9(h,e,r,d,u,f)}function s(u,f){return J(u)*J(f)>t}function a(u){var f,d,h,p,m;return{lineStart:function(){p=h=!1,m=1},point:function(y,g){var x=[y,g],b,_=s(y,g),v=n?_?0:l(y,g):_?l(y+(y<0?Ct:-Ct),g):0;if(!f&&(p=h=_)&&u.lineStart(),_!==h&&(b=c(f,x),(!b||Yd(f,b)||Yd(x,b))&&(x[2]=1)),_!==h)m=0,_?(u.lineStart(),b=c(x,f),u.point(b[0],b[1])):(b=c(f,x),u.point(b[0],b[1],2),u.lineEnd()),f=b;else if(i&&f&&n^_){var w;!(v&d)&&(w=c(x,f,!0))&&(m=0,n?(u.lineStart(),u.point(w[0][0],w[0][1]),u.point(w[1][0],w[1][1]),u.lineEnd()):(u.point(w[1][0],w[1][1]),u.lineEnd(),u.lineStart(),u.point(w[0][0],w[0][1],3)))}_&&(!f||!Yd(f,x))&&u.point(x[0],x[1]),f=x,h=_,d=v},lineEnd:function(){h&&u.lineEnd(),f=null},clean:function(){return m|(p&&h)<<1}}}function c(u,f,d){var h=fs(u),p=fs(f),m=[1,0,0],y=Vd(h,p),g=Uy(y,y),x=y[0],b=g-x*x;if(!b)return!d&&u;var _=t*g/b,v=-t*x/b,w=Vd(m,y),T=$y(m,_),A=$y(y,v);$w(T,A);var E=w,N=Uy(T,E),I=Uy(E,E),R=N*N-I*(Uy(T,T)-1);if(!(R<0)){var C=Ae(R),S=$y(E,(-N-C)/I);if($w(S,T),S=Py(S),!d)return S;var M=u[0],O=f[0],L=u[1],B=f[1],k;O<M&&(k=M,M=O,O=k);var P=O-M,U=$t(P-Ct)<et,$=U||P<et;if(!U&&B<L&&(k=L,L=B,B=k),$?U?L+B>0^S[1]<($t(S[0]-M)<et?L:B):L<=S[1]&&S[1]<=B:P>Ct^(M<=S[0]&&S[0]<=O)){var X=$y(E,(-N+C)/I);return $w(X,T),[S,Py(X)]}}}function l(u,f){var d=n?e:Ct-e,h=0;return u<-d?h|=1:u>d&&(h|=2),f<-d?h|=4:f>d&&(h|=8),h}return Zw(s,a,o,n?[0,-e]:[-Ct,e-Ct])}function v9(e,t,r,n,i,o){var s=e[0],a=e[1],c=t[0],l=t[1],u=0,f=1,d=c-s,h=l-a,p;if(p=r-s,!(!d&&p>0)){if(p/=d,d<0){if(p<u)return;p<f&&(f=p)}else if(d>0){if(p>f)return;p>u&&(u=p)}if(p=i-s,!(!d&&p<0)){if(p/=d,d<0){if(p>f)return;p>u&&(u=p)}else if(d>0){if(p<u)return;p<f&&(f=p)}if(p=n-a,!(!h&&p>0)){if(p/=h,h<0){if(p<u)return;p<f&&(f=p)}else if(h>0){if(p>f)return;p>u&&(u=p)}if(p=o-a,!(!h&&p<0)){if(p/=h,h<0){if(p>f)return;p>u&&(u=p)}else if(h>0){if(p<u)return;p<f&&(f=p)}return u>0&&(e[0]=s+u*d,e[1]=a+u*h),f<1&&(t[0]=s+f*d,t[1]=a+f*h),!0}}}}}var Yy=1e9,Kw=-Yy;function Wd(e,t,r,n){function i(l,u){return e<=l&&l<=r&&t<=u&&u<=n}function o(l,u,f,d){var h=0,p=0;if(l==null||(h=s(l,f))!==(p=s(u,f))||c(l,u)<0^f>0)do d.point(h===0||h===3?e:r,h>1?n:t);while((h=(h+f+4)%4)!==p);else d.point(u[0],u[1])}function s(l,u){return $t(l[0]-e)<et?u>0?0:3:$t(l[0]-r)<et?u>0?2:1:$t(l[1]-t)<et?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=Xw(),d,h,p,m,y,g,x,b,_,v,w,T={point:A,lineStart:R,lineEnd:C,polygonStart:N,polygonEnd:I};function A(M,O){i(M,O)&&u.point(M,O)}function E(){for(var M=0,O=0,L=h.length;O<L;++O)for(var B=h[O],k=1,P=B.length,U=B[0],$,X,rt=U[0],ot=U[1];k<P;++k)$=rt,X=ot,U=B[k],rt=U[0],ot=U[1],X<=n?ot>n&&(rt-$)*(n-X)>(ot-X)*(e-$)&&++M:ot<=n&&(rt-$)*(n-X)<(ot-X)*(e-$)&&--M;return M}function N(){u=f,d=[],h=[],w=!0}function I(){var M=E(),O=w&&M,L=(d=Ad(d)).length;(O||L)&&(l.polygonStart(),O&&(l.lineStart(),o(null,null,1,l),l.lineEnd()),L&&Qw(d,a,M,o,l),l.polygonEnd()),u=l,d=h=p=null}function R(){T.point=S,h&&h.push(p=[]),v=!0,_=!1,x=b=NaN}function C(){d&&(S(m,y),g&&_&&f.rejoin(),d.push(f.result())),T.point=A,_&&u.lineEnd()}function S(M,O){var L=i(M,O);if(h&&p.push([M,O]),v)m=M,y=O,g=L,v=!1,L&&(u.lineStart(),u.point(M,O));else if(L&&_)u.point(M,O);else{var B=[x=Math.max(Kw,Math.min(Yy,x)),b=Math.max(Kw,Math.min(Yy,b))],k=[M=Math.max(Kw,Math.min(Yy,M)),O=Math.max(Kw,Math.min(Yy,O))];v9(B,k,e,t,r,n)?(_||(u.lineStart(),u.point(B[0],B[1])),u.point(k[0],k[1]),L||u.lineEnd(),w=!1):L&&(u.lineStart(),u.point(M,O),w=!1)}x=M,b=O,_=L}return T}}function S9(e,t,r){var n=er(e,t-et,r).concat(t);return function(i){return n.map(function(o){return[i,o]})}}function I9(e,t,r){var n=er(e,t-et,r).concat(t);return function(i){return n.map(function(o){return[o,i]})}}function y3(){var e,t,r,n,i,o,s,a,c=10,l=c,u=90,f=360,d,h,p,m,y=2.5;function g(){return{type:"MultiLineString",coordinates:x()}}function x(){return er(By(n/u)*u,r,u).map(p).concat(er(By(a/f)*f,s,f).map(m)).concat(er(By(t/c)*c,e,c).filter(function(b){return $t(b%u)>et}).map(d)).concat(er(By(o/l)*l,i,l).filter(function(b){return $t(b%f)>et}).map(h))}return g.lines=function(){return x().map(function(b){return{type:"LineString",coordinates:b}})},g.outline=function(){return{type:"Polygon",coordinates:[p(n).concat(m(s).slice(1),p(r).reverse().slice(1),m(a).reverse().slice(1))]}},g.extent=function(b){return arguments.length?g.extentMajor(b).extentMinor(b):g.extentMinor()},g.extentMajor=function(b){return arguments.length?(n=+b[0][0],r=+b[1][0],a=+b[0][1],s=+b[1][1],n>r&&(b=n,n=r,r=b),a>s&&(b=a,a=s,s=b),g.precision(y)):[[n,a],[r,s]]},g.extentMinor=function(b){return arguments.length?(t=+b[0][0],e=+b[1][0],o=+b[0][1],i=+b[1][1],t>e&&(b=t,t=e,e=b),o>i&&(b=o,o=i,i=b),g.precision(y)):[[t,o],[e,i]]},g.step=function(b){return arguments.length?g.stepMajor(b).stepMinor(b):g.stepMinor()},g.stepMajor=function(b){return arguments.length?(u=+b[0],f=+b[1],g):[u,f]},g.stepMinor=function(b){return arguments.length?(c=+b[0],l=+b[1],g):[c,l]},g.precision=function(b){return arguments.length?(y=+b,d=S9(o,i,90),h=I9(t,e,y),p=S9(a,s,90),m=I9(n,r,y),g):y},g.extentMajor([[-180,-90+et],[180,90-et]]).extentMinor([[-180,-80-et],[180,80+et]])}function g3(){return y3()()}var Wy=e=>e;var x3=new Xr,b3=new Xr,T9,A9,_3,w3,Xc={point:fr,lineStart:fr,lineEnd:fr,polygonStart:function(){Xc.lineStart=Qtt,Xc.lineEnd=Ktt},polygonEnd:function(){Xc.lineStart=Xc.lineEnd=Xc.point=fr,x3.add($t(b3)),b3=new Xr},result:function(){var e=x3/2;return x3=new Xr,e}};function Qtt(){Xc.point=Ztt}function Ztt(e,t){Xc.point=E9,T9=_3=e,A9=w3=t}function E9(e,t){b3.add(w3*e-_3*t),_3=e,w3=t}function Ktt(){E9(T9,A9)}var v3=Xc;var Gd=1/0,Jw=Gd,Gy=-Gd,tv=Gy,Jtt={point:tet,lineStart:fr,lineEnd:fr,polygonStart:fr,polygonEnd:fr,result:function(){var e=[[Gd,Jw],[Gy,tv]];return Gy=tv=-(Jw=Gd=1/0),e}};function tet(e,t){e<Gd&&(Gd=e),e>Gy&&(Gy=e),t<Jw&&(Jw=t),t>tv&&(tv=t)}var Xd=Jtt;var S3=0,I3=0,Xy=0,ev=0,rv=0,Hd=0,T3=0,A3=0,Hy=0,O9,R9,ds,hs,Oo={point:Bu,lineStart:M9,lineEnd:N9,polygonStart:function(){Oo.lineStart=net,Oo.lineEnd=iet},polygonEnd:function(){Oo.point=Bu,Oo.lineStart=M9,Oo.lineEnd=N9},result:function(){var e=Hy?[T3/Hy,A3/Hy]:Hd?[ev/Hd,rv/Hd]:Xy?[S3/Xy,I3/Xy]:[NaN,NaN];return S3=I3=Xy=ev=rv=Hd=T3=A3=Hy=0,e}};function Bu(e,t){S3+=e,I3+=t,++Xy}function M9(){Oo.point=eet}function eet(e,t){Oo.point=ret,Bu(ds=e,hs=t)}function ret(e,t){var r=e-ds,n=t-hs,i=Ae(r*r+n*n);ev+=i*(ds+e)/2,rv+=i*(hs+t)/2,Hd+=i,Bu(ds=e,hs=t)}function N9(){Oo.point=Bu}function net(){Oo.point=oet}function iet(){D9(O9,R9)}function oet(e,t){Oo.point=D9,Bu(O9=ds=e,R9=hs=t)}function D9(e,t){var r=e-ds,n=t-hs,i=Ae(r*r+n*n);ev+=i*(ds+e)/2,rv+=i*(hs+t)/2,Hd+=i,i=hs*e-ds*t,T3+=i*(ds+e),A3+=i*(hs+t),Hy+=i*3,Bu(ds=e,hs=t)}var E3=Oo;function nv(e){this._context=e}nv.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,Rr);break}}},result:fr};var N3=new Xr,M3,L9,F9,Qy,Zy,iv={point:fr,lineStart:function(){iv.point=set},lineEnd:function(){M3&&C9(L9,F9),iv.point=fr},polygonStart:function(){M3=!0},polygonEnd:function(){M3=null},result:function(){var e=+N3;return N3=new Xr,e}};function set(e,t){iv.point=C9,L9=Qy=e,F9=Zy=t}function C9(e,t){Qy-=e,Zy-=t,N3.add(Ae(Qy*Qy+Zy*Zy)),Qy=e,Zy=t}var O3=iv;var k9,ov,B9,P9,Qd=class{constructor(t){this._append=t==null?U9:aet(t),this._radius=4.5,this._=""}pointRadius(t){return this._radius=+t,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){this._line===0&&(this._+="Z"),this._point=NaN}point(t,r){switch(this._point){case 0:{this._append`M${t},${r}`,this._point=1;break}case 1:{this._append`L${t},${r}`;break}default:{if(this._append`M${t},${r}`,this._radius!==B9||this._append!==ov){let n=this._radius,i=this._;this._="",this._append`m0,${n}a${n},${n} 0 1,1 0,${-2*n}a${n},${n} 0 1,1 0,${2*n}z`,B9=n,ov=this._append,P9=this._,this._=i}this._+=P9;break}}}result(){let t=this._;return this._="",t.length?t:null}};function U9(e){let t=1;this._+=e[0];for(let r=e.length;t<r;++t)this._+=arguments[t]+e[t]}function aet(e){let t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return U9;if(t!==k9){let r=10**t;k9=t,ov=function(i){let o=1;this._+=i[0];for(let s=i.length;o<s;++o)this._+=Math.round(arguments[o]*r)/r+i[o]}}return ov}function Dr(e,t){let r=3,n=4.5,i,o;function s(a){return a&&(typeof n=="function"&&o.pointRadius(+n.apply(this,arguments)),pi(a,i(o))),o.result()}return s.area=function(a){return pi(a,i(v3)),v3.result()},s.measure=function(a){return pi(a,i(O3)),O3.result()},s.bounds=function(a){return pi(a,i(Xd)),Xd.result()},s.centroid=function(a){return pi(a,i(E3)),E3.result()},s.projection=function(a){return arguments.length?(i=a==null?(e=null,Wy):(e=a).stream,s):e},s.context=function(a){return arguments.length?(o=a==null?(t=null,new Qd(r)):new nv(t=a),typeof n!="function"&&o.pointRadius(n),s):t},s.pointRadius=function(a){return arguments.length?(n=typeof a=="function"?a:(o.pointRadius(+a),+a),s):n},s.digits=function(a){if(!arguments.length)return r;if(a==null)r=null;else{let c=Math.floor(a);if(!(c>=0))throw new RangeError(`invalid digits: ${a}`);r=c}return t===null&&(o=new Qd(r)),s},s.projection(e).digits(r).context(t)}function Pu(e){return{stream:Zd(e)}}function Zd(e){return function(t){var r=new R3;for(var n in e)r[n]=e[n];return r.stream=t,r}}function R3(){}R3.prototype={constructor:R3,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 D3(e,t,r){var n=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),n!=null&&e.clipExtent(null),pi(r,e.stream(Xd)),t(Xd.result()),n!=null&&e.clipExtent(n),e}function Ky(e,t,r){return D3(e,function(n){var i=t[1][0]-t[0][0],o=t[1][1]-t[0][1],s=Math.min(i/(n[1][0]-n[0][0]),o/(n[1][1]-n[0][1])),a=+t[0][0]+(i-s*(n[1][0]+n[0][0]))/2,c=+t[0][1]+(o-s*(n[1][1]+n[0][1]))/2;e.scale(150*s).translate([a,c])},r)}function sv(e,t,r){return Ky(e,[[0,0],t],r)}function av(e,t,r){return D3(e,function(n){var i=+t,o=i/(n[1][0]-n[0][0]),s=(i-o*(n[1][0]+n[0][0]))/2,a=-o*n[0][1];e.scale(150*o).translate([s,a])},r)}function cv(e,t,r){return D3(e,function(n){var i=+t,o=i/(n[1][1]-n[0][1]),s=-o*n[0][0],a=(i-o*(n[1][1]+n[0][1]))/2;e.scale(150*o).translate([s,a])},r)}var $9=16,cet=J(30*Yt);function L3(e,t){return+t?fet(e,t):uet(e)}function uet(e){return Zd({point:function(t,r){t=e(t,r),this.stream.point(t[0],t[1])}})}function fet(e,t){function r(n,i,o,s,a,c,l,u,f,d,h,p,m,y){var g=l-n,x=u-i,b=g*g+x*x;if(b>4*t&&m--){var _=s+d,v=a+h,w=c+p,T=Ae(_*_+v*v+w*w),A=Ce(w/=T),E=$t($t(w)-1)<et||$t(o-f)<et?(o+f)/2:ur(v,_),N=e(E,A),I=N[0],R=N[1],C=I-n,S=R-i,M=x*C-g*S;(M*M/b>t||$t((g*C+x*S)/b-.5)>.3||s*d+a*h+c*p<cet)&&(r(n,i,o,s,a,c,I,R,E,_/=T,v/=T,w,m,y),y.point(I,R),r(I,R,E,_,v,w,l,u,f,d,h,p,m,y))}}return function(n){var i,o,s,a,c,l,u,f,d,h,p,m,y={point:g,lineStart:x,lineEnd:_,polygonStart:function(){n.polygonStart(),y.lineStart=v},polygonEnd:function(){n.polygonEnd(),y.lineStart=x}};function g(A,E){A=e(A,E),n.point(A[0],A[1])}function x(){f=NaN,y.point=b,n.lineStart()}function b(A,E){var N=fs([A,E]),I=e(A,E);r(f,d,u,h,p,m,f=I[0],d=I[1],u=A,h=N[0],p=N[1],m=N[2],$9,n),n.point(f,d)}function _(){y.point=g,n.lineEnd()}function v(){x(),y.point=w,y.lineEnd=T}function w(A,E){b(i=A,E),o=f,s=d,a=h,c=p,l=m,y.point=b}function T(){r(f,d,u,h,p,m,o,s,i,a,c,l,$9,n),y.lineEnd=_,_()}return y}}var det=Zd({point:function(e,t){this.stream.point(e*Yt,t*Yt)}});function het(e){return Zd({point:function(t,r){var n=e(t,r);return this.stream.point(n[0],n[1])}})}function pet(e,t,r,n,i){function o(s,a){return s*=n,a*=i,[t+e*s,r-e*a]}return o.invert=function(s,a){return[(s-t)/e*n,(r-a)/e*i]},o}function z9(e,t,r,n,i,o){if(!o)return pet(e,t,r,n,i);var s=J(o),a=Z(o),c=s*e,l=a*e,u=s/e,f=a/e,d=(a*r-s*t)/e,h=(a*t+s*r)/e;function p(m,y){return m*=n,y*=i,[c*m-l*y+t,r-l*m-c*y]}return p.invert=function(m,y){return[n*(u*m-f*y+d),i*(h-f*m-u*y)]},p}function Jr(e){return F3(function(){return e})()}function F3(e){var t,r=150,n=480,i=250,o=0,s=0,a=0,c=0,l=0,u,f=0,d=1,h=1,p=null,m=m3,y=null,g,x,b,_=Wy,v=.5,w,T,A,E,N;function I(M){return A(M[0]*Yt,M[1]*Yt)}function R(M){return M=A.invert(M[0],M[1]),M&&[M[0]*Ze,M[1]*Ze]}I.stream=function(M){return E&&N===M?E:E=det(het(u)(m(w(_(N=M)))))},I.preclip=function(M){return arguments.length?(m=M,p=void 0,S()):m},I.postclip=function(M){return arguments.length?(_=M,y=g=x=b=null,S()):_},I.clipAngle=function(M){return arguments.length?(m=+M?w9(p=M*Yt):(p=null,m3),S()):p*Ze},I.clipExtent=function(M){return arguments.length?(_=M==null?(y=g=x=b=null,Wy):Wd(y=+M[0][0],g=+M[0][1],x=+M[1][0],b=+M[1][1]),S()):y==null?null:[[y,g],[x,b]]},I.scale=function(M){return arguments.length?(r=+M,C()):r},I.translate=function(M){return arguments.length?(n=+M[0],i=+M[1],C()):[n,i]},I.center=function(M){return arguments.length?(o=M[0]%360*Yt,s=M[1]%360*Yt,C()):[o*Ze,s*Ze]},I.rotate=function(M){return arguments.length?(a=M[0]%360*Yt,c=M[1]%360*Yt,l=M.length>2?M[2]%360*Yt:0,C()):[a*Ze,c*Ze,l*Ze]},I.angle=function(M){return arguments.length?(f=M%360*Yt,C()):f*Ze},I.reflectX=function(M){return arguments.length?(d=M?-1:1,C()):d<0},I.reflectY=function(M){return arguments.length?(h=M?-1:1,C()):h<0},I.precision=function(M){return arguments.length?(w=L3(T,v=M*M),S()):Ae(v)},I.fitExtent=function(M,O){return Ky(I,M,O)},I.fitSize=function(M,O){return sv(I,M,O)},I.fitWidth=function(M,O){return av(I,M,O)},I.fitHeight=function(M,O){return cv(I,M,O)};function C(){var M=z9(r,0,0,d,h,f).apply(null,t(o,s)),O=z9(r,n-M[0],i-M[1],d,h,f);return u=h3(a,c,l),T=Vy(t,O),A=Vy(u,T),w=L3(T,v),S()}function S(){return E=N=null,I}return function(){return t=e.apply(this,arguments),I.invert=t.invert&&R,C()}}function Kd(e){var t=0,r=Ct/3,n=F3(e),i=n(t,r);return i.parallels=function(o){return arguments.length?n(t=o[0]*Yt,r=o[1]*Yt):[t*Ze,r*Ze]},i}function j9(e){var t=J(e);function r(n,i){return[n*t,Z(i)/t]}return r.invert=function(n,i){return[n/t,Ce(i*t)]},r}function q9(e,t){var r=Z(e),n=(r+Z(t))/2;if($t(n)<et)return j9(e);var i=1+r*(2*n-r),o=Ae(i)/n;function s(a,c){var l=Ae(i-2*n*Z(c))/n;return[l*Z(a*=n),o-l*J(a)]}return s.invert=function(a,c){var l=o-c,u=ur(a,$t(l))*fn(l);return l*n<0&&(u-=Ct*fn(a)*fn(l)),[u/n,Ce((i-(a*a+l*l)*n*n)/(2*n))]},s}function Hc(){return Kd(q9).scale(155.424).center([0,33.6442])}function Jy(){return Hc().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function met(e){var t=e.length;return{point:function(r,n){for(var i=-1;++i<t;)e[i].point(r,n)},sphere:function(){for(var r=-1;++r<t;)e[r].sphere()},lineStart:function(){for(var r=-1;++r<t;)e[r].lineStart()},lineEnd:function(){for(var r=-1;++r<t;)e[r].lineEnd()},polygonStart:function(){for(var r=-1;++r<t;)e[r].polygonStart()},polygonEnd:function(){for(var r=-1;++r<t;)e[r].polygonEnd()}}}function C3(){var e,t,r=Jy(),n,i=Hc().rotate([154,0]).center([-2,58.5]).parallels([55,65]),o,s=Hc().rotate([157,0]).center([-3,19.9]).parallels([8,18]),a,c,l={point:function(d,h){c=[d,h]}};function u(d){var h=d[0],p=d[1];return c=null,n.point(h,p),c||(o.point(h,p),c)||(a.point(h,p),c)}u.invert=function(d){var h=r.scale(),p=r.translate(),m=(d[0]-p[0])/h,y=(d[1]-p[1])/h;return(y>=.12&&y<.234&&m>=-.425&&m<-.214?i:y>=.166&&y<.234&&m>=-.214&&m<-.115?s:r).invert(d)},u.stream=function(d){return e&&t===d?e:e=met([r.stream(t=d),i.stream(d),s.stream(d)])},u.precision=function(d){return arguments.length?(r.precision(d),i.precision(d),s.precision(d),f()):r.precision()},u.scale=function(d){return arguments.length?(r.scale(d),i.scale(d*.35),s.scale(d),u.translate(r.translate())):r.scale()},u.translate=function(d){if(!arguments.length)return r.translate();var h=r.scale(),p=+d[0],m=+d[1];return n=r.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+et,m+.12*h+et],[p-.214*h-et,m+.234*h-et]]).stream(l),a=s.translate([p-.205*h,m+.212*h]).clipExtent([[p-.214*h+et,m+.166*h+et],[p-.115*h-et,m+.234*h-et]]).stream(l),f()},u.fitExtent=function(d,h){return Ky(u,d,h)},u.fitSize=function(d,h){return sv(u,d,h)},u.fitWidth=function(d,h){return av(u,d,h)},u.fitHeight=function(d,h){return cv(u,d,h)};function f(){return e=t=null,u}return u.scale(1070)}function lv(e){return function(t,r){var n=J(t),i=J(r),o=e(n*i);return o===1/0?[2,0]:[o*i*Z(t),o*Z(r)]}}function ps(e){return function(t,r){var n=Ae(t*t+r*r),i=e(n),o=Z(i),s=J(i);return[ur(t*o,n*s),Ce(n&&r*o/n)]}}var k3=lv(function(e){return Ae(2/(1+e))});k3.invert=ps(function(e){return 2*Ce(e/2)});function B3(){return Jr(k3).scale(124.75).clipAngle(180-.001)}var P3=lv(function(e){return(e=Pw(e))&&e/Z(e)});P3.invert=ps(function(e){return e});function U3(){return Jr(P3).scale(79.4188).clipAngle(180-.001)}function Jd(e,t){return[e,ku(qd((Te+t)/2))]}Jd.invert=function(e,t){return[e,2*Wi(Cw(t))-Te]};function $3(){return z3(Jd).scale(961/Rr)}function z3(e){var t=Jr(e),r=t.center,n=t.scale,i=t.translate,o=t.clipExtent,s=null,a,c,l;t.scale=function(f){return arguments.length?(n(f),u()):n()},t.translate=function(f){return arguments.length?(i(f),u()):i()},t.center=function(f){return arguments.length?(r(f),u()):r()},t.clipExtent=function(f){return arguments.length?(f==null?s=a=c=l=null:(s=+f[0][0],a=+f[0][1],c=+f[1][0],l=+f[1][1]),u()):s==null?null:[[s,a],[c,l]]};function u(){var f=Ct*n(),d=t(y9(t.rotate()).invert([0,0]));return o(s==null?[[d[0]-f,d[1]-f],[d[0]+f,d[1]+f]]:e===Jd?[[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 uv(e){return qd((Te+e)/2)}function V9(e,t){var r=J(e),n=e===t?Z(e):ku(r/J(t))/ku(uv(t)/uv(e)),i=r*Bw(uv(e),n)/n;if(!n)return Jd;function o(s,a){i>0?a<-Te+et&&(a=-Te+et):a>Te-et&&(a=Te-et);var c=i/Bw(uv(a),n);return[c*Z(n*s),i-c*J(n*s)]}return o.invert=function(s,a){var c=i-a,l=fn(n)*Ae(s*s+c*c),u=ur(s,$t(c))*fn(c);return c*n<0&&(u-=Ct*fn(s)*fn(c)),[u/n,2*Wi(Bw(i/l,1/n))-Te]},o}function j3(){return Kd(V9).scale(109.5).parallels([30,30])}function th(e,t){return[e,t]}th.invert=th;function q3(){return Jr(th).scale(152.63)}function Y9(e,t){var r=J(e),n=e===t?Z(e):(r-J(t))/(t-e),i=r/n+e;if($t(n)<et)return th;function o(s,a){var c=i-a,l=n*s;return[c*Z(l),i-c*J(l)]}return o.invert=function(s,a){var c=i-a,l=ur(s,$t(c))*fn(c);return c*n<0&&(l-=Ct*fn(s)*fn(c)),[l/n,i-fn(n)*Ae(s*s+c*c)]},o}function V3(){return Kd(Y9).scale(131.154).center([0,13.9389])}var tg=1.340264,eg=-.081106,rg=893e-6,ng=.003796,fv=Ae(3)/2,yet=12;function Y3(e,t){var r=Ce(fv*Z(t)),n=r*r,i=n*n*n;return[e*J(r)/(fv*(tg+3*eg*n+i*(7*rg+9*ng*n))),r*(tg+eg*n+i*(rg+ng*n))]}Y3.invert=function(e,t){for(var r=t,n=r*r,i=n*n*n,o=0,s,a,c;o<yet&&(a=r*(tg+eg*n+i*(rg+ng*n))-t,c=tg+3*eg*n+i*(7*rg+9*ng*n),r-=s=a/c,n=r*r,i=n*n*n,!($t(s)<Cu));++o);return[fv*e*(tg+3*eg*n+i*(7*rg+9*ng*n))/J(r),Ce(Z(r)/fv)]};function W3(){return Jr(Y3).scale(177.158)}function G3(e,t){var r=J(t),n=J(e)*r;return[r*Z(e)/n,Z(t)/n]}G3.invert=ps(Wi);function X3(){return Jr(G3).scale(144.049).clipAngle(60)}function H3(e,t){return[J(t)*Z(e),Z(t)]}H3.invert=ps(Ce);function Q3(){return Jr(H3).scale(249.5).clipAngle(90+et)}function Z3(e,t){var r=J(t),n=1+J(e)*r;return[r*Z(e)/n,Z(t)/n]}Z3.invert=ps(function(e){return 2*Wi(e)});function K3(){return Jr(Z3).scale(250).clipAngle(142)}function J3(e,t){return[ku(qd((Te+t)/2)),-e]}J3.invert=function(e,t){return[-t,2*Wi(Cw(e))-Te]};function t6(){var e=z3(J3),t=e.center,r=e.rotate;return e.center=function(n){return arguments.length?t([-n[1],n[0]]):(n=t(),[n[1],-n[0]])},e.rotate=function(n){return arguments.length?r([n[0],n[1],n.length>2?n[2]+90:90]):(n=r(),[n[0],n[1],n[2]-90])},r([0,0,90]).scale(159.155)}function get(e,t){return e.parent===t.parent?1:2}function xet(e){return e.reduce(bet,0)/e.length}function bet(e,t){return e+t.x}function _et(e){return 1+e.reduce(wet,0)}function wet(e,t){return Math.max(e,t.y)}function vet(e){for(var t;t=e.children;)e=t[0];return e}function Iet(e){for(var t;t=e.children;)e=t[t.length-1];return e}function dv(){var e=get,t=1,r=1,n=!1;function i(o){var s,a=0;o.eachAfter(function(d){var h=d.children;h?(d.x=xet(h),d.y=_et(h)):(d.x=s?a+=e(d,s):0,d.y=0,s=d)});var c=vet(o),l=Iet(o),u=c.x-e(c,l)/2,f=l.x+e(l,c)/2;return o.eachAfter(n?function(d){d.x=(d.x-o.x)*t,d.y=(o.y-d.y)*r}:function(d){d.x=(d.x-u)/(f-u)*t,d.y=(1-(o.y?d.y/o.y:1))*r})}return i.separation=function(o){return arguments.length?(e=o,i):e},i.size=function(o){return arguments.length?(n=!1,t=+o[0],r=+o[1],i):n?null:[t,r]},i.nodeSize=function(o){return arguments.length?(n=!0,t=+o[0],r=+o[1],i):n?[t,r]:null},i}function Tet(e){var t=0,r=e.children,n=r&&r.length;if(!n)t=1;else for(;--n>=0;)t+=r[n].value;e.value=t}function W9(){return this.eachAfter(Tet)}function G9(e,t){let r=-1;for(let n of this)e.call(t,n,++r,this);return this}function X9(e,t){for(var r=this,n=[r],i,o,s=-1;r=n.pop();)if(e.call(t,r,++s,this),i=r.children)for(o=i.length-1;o>=0;--o)n.push(i[o]);return this}function H9(e,t){for(var r=this,n=[r],i=[],o,s,a,c=-1;r=n.pop();)if(i.push(r),o=r.children)for(s=0,a=o.length;s<a;++s)n.push(o[s]);for(;r=i.pop();)e.call(t,r,++c,this);return this}function Q9(e,t){let r=-1;for(let n of this)if(e.call(t,n,++r,this))return n}function Z9(e){return this.eachAfter(function(t){for(var r=+e(t.data)||0,n=t.children,i=n&&n.length;--i>=0;)r+=n[i].value;t.value=r})}function K9(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function J9(e){for(var t=this,r=Aet(t,e),n=[t];t!==r;)t=t.parent,n.push(t);for(var i=n.length;e!==r;)n.splice(i,0,e),e=e.parent;return n}function Aet(e,t){if(e===t)return e;var r=e.ancestors(),n=t.ancestors(),i=null;for(e=r.pop(),t=n.pop();e===t;)i=e,e=r.pop(),t=n.pop();return i}function tU(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function eU(){return Array.from(this)}function rU(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function nU(){var e=this,t=[];return e.each(function(r){r!==e&&t.push({source:r.parent,target:r})}),t}function*iU(){var e=this,t,r=[e],n,i,o;do for(t=r.reverse(),r=[];e=t.pop();)if(yield e,n=e.children)for(i=0,o=n.length;i<o;++i)r.push(n[i]);while(r.length)}function e6(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=Net)):t===void 0&&(t=Met);for(var r=new Qc(e),n,i=[r],o,s,a,c;n=i.pop();)if((s=t(n.data))&&(c=(s=Array.from(s)).length))for(n.children=s,a=c-1;a>=0;--a)i.push(o=s[a]=new Qc(s[a])),o.parent=n,o.depth=n.depth+1;return r.eachBefore(r6)}function Eet(){return e6(this).eachBefore(Oet)}function Met(e){return e.children}function Net(e){return Array.isArray(e)?e[1]:null}function Oet(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function r6(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function Qc(e){this.data=e,this.depth=this.height=0,this.parent=null}Qc.prototype=e6.prototype={constructor:Qc,count:W9,each:G9,eachAfter:H9,eachBefore:X9,find:Q9,sum:Z9,sort:K9,path:J9,ancestors:tU,descendants:eU,leaves:rU,links:nU,copy:Eet,[Symbol.iterator]:iU};function hv(e){return e==null?null:Ret(e)}function Ret(e){if(typeof e!="function")throw new Error;return e}var Det={depth:-1},oU={},n6={};function Let(e){return e.id}function Fet(e){return e.parentId}function pv(){var e=Let,t=Fet,r;function n(i){var o=Array.from(i),s=e,a=t,c,l,u,f,d,h,p,m,y=new Map;if(r!=null){let g=o.map((_,v)=>Cet(r(_,v,i))),x=g.map(sU),b=new Set(g).add("");for(let _ of x)b.has(_)||(b.add(_),g.push(_),x.push(sU(_)),o.push(n6));s=(_,v)=>g[v],a=(_,v)=>x[v]}for(u=0,c=o.length;u<c;++u)l=o[u],h=o[u]=new Qc(l),(p=s(l,u,i))!=null&&(p+="")&&(m=h.id=p,y.set(m,y.has(m)?oU: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=y.get(p),!d)throw new Error("missing: "+p);if(d===oU)throw new Error("ambiguous: "+p);d.children?d.children.push(h):d.children=[h],h.parent=d}else{if(f)throw new Error("multiple roots");f=h}if(!f)throw new Error("no root");if(r!=null){for(;f.data===n6&&f.children.length===1;)f=f.children[0],--c;for(let g=o.length-1;g>=0&&(h=o[g],h.data===n6);--g)h.data=null}if(f.parent=Det,f.eachBefore(function(g){g.depth=g.parent.depth+1,--c}).eachBefore(r6),f.parent=null,c>0)throw new Error("cycle");return f}return n.id=function(i){return arguments.length?(e=hv(i),n):e},n.parentId=function(i){return arguments.length?(t=hv(i),n):t},n.path=function(i){return arguments.length?(r=hv(i),n):r},n}function Cet(e){e=`${e}`;let t=e.length;return i6(e,t-1)&&!i6(e,t-2)&&(e=e.slice(0,-1)),e[0]==="/"?e:`/${e}`}function sU(e){let t=e.length;if(t<2)return"";for(;--t>1&&!i6(e,t););return e.slice(0,t)}function i6(e,t){if(e[t]==="/"){let r=0;for(;t>0&&e[--t]==="\\";)++r;if(!(r&1))return!0}return!1}function ket(e,t){return e.parent===t.parent?1:2}function o6(e){var t=e.children;return t?t[0]:e.t}function s6(e){var t=e.children;return t?t[t.length-1]:e.t}function Bet(e,t,r){var n=r/(t.i-e.i);t.c-=n,t.s+=r,e.c+=n,t.z+=r,t.m+=r}function Pet(e){for(var t=0,r=0,n=e.children,i=n.length,o;--i>=0;)o=n[i],o.z+=t,o.m+=t,t+=o.s+(r+=o.c)}function Uet(e,t,r){return e.a.parent===t.parent?e.a:r}function mv(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}mv.prototype=Object.create(Qc.prototype);function $et(e){for(var t=new mv(e,0),r,n=[t],i,o,s,a;r=n.pop();)if(o=r._.children)for(r.children=new Array(a=o.length),s=a-1;s>=0;--s)n.push(i=r.children[s]=new mv(o[s],s)),i.parent=r;return(t.parent=new mv(null,0)).children=[t],t}function Uu(){var e=ket,t=1,r=1,n=null;function i(l){var u=$et(l);if(u.eachAfter(o),u.parent.m=-u.z,u.eachBefore(s),n)l.eachBefore(c);else{var f=l,d=l,h=l;l.eachBefore(function(x){x.x<f.x&&(f=x),x.x>d.x&&(d=x),x.depth>h.depth&&(h=x)});var p=f===d?1:e(f,d)/2,m=p-f.x,y=t/(d.x+p+m),g=r/(h.depth||1);l.eachBefore(function(x){x.x=(x.x+m)*y,x.y=x.depth*g})}return l}function o(l){var u=l.children,f=l.parent.children,d=l.i?f[l.i-1]:null;if(u){Pet(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],y=d.m,g=h.m,x=p.m,b=m.m,_;p=s6(p),d=o6(d),p&&d;)m=o6(m),h=s6(h),h.a=l,_=p.z+x-d.z-y+e(p._,d._),_>0&&(Bet(Uet(p,l,f),l,_),y+=_,g+=_),x+=p.m,y+=d.m,b+=m.m,g+=h.m;p&&!s6(h)&&(h.t=p,h.m+=x-g),d&&!o6(m)&&(m.t=d,m.m+=y-b,f=l)}return f}function c(l){l.x*=t,l.y=l.depth*r}return i.separation=function(l){return arguments.length?(e=l,i):e},i.size=function(l){return arguments.length?(n=!1,t=+l[0],r=+l[1],i):n?null:[t,r]},i.nodeSize=function(l){return arguments.length?(n=!0,t=+l[0],r=+l[1],i):n?[t,r]:null},i}var aU=23283064365386963e-26;function $u(e=Math.random()){let t=(0<=e&&e<1?e/aU:Math.abs(e))|0;return()=>(t=1664525*t+1013904223|0,aU*(t>>>0))}function dr(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function ig(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 og=Symbol("implicit");function zu(){var e=new Sn,t=[],r=[],n=og;function i(o){let s=e.get(o);if(s===void 0){if(n!==og)return n;e.set(o,s=t.push(o)-1)}return r[s%r.length]}return i.domain=function(o){if(!arguments.length)return t.slice();t=[],e=new Sn;for(let s of o)e.has(s)||e.set(s,t.push(s)-1);return i},i.range=function(o){return arguments.length?(r=Array.from(o),i):r.slice()},i.unknown=function(o){return arguments.length?(n=o,i):n},i.copy=function(){return zu(t,r).unknown(n)},dr.apply(i,arguments),i}function Zc(){var e=zu().unknown(void 0),t=e.domain,r=e.range,n=0,i=1,o,s,a=!1,c=0,l=0,u=.5;delete e.unknown;function f(){var d=t().length,h=i<n,p=h?i:n,m=h?n: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 y=er(d).map(function(g){return p+o*g});return r(h?y.reverse():y)}return e.domain=function(d){return arguments.length?(t(d),f()):t()},e.range=function(d){return arguments.length?([n,i]=d,n=+n,i=+i,f()):[n,i]},e.rangeRound=function(d){return[n,i]=d,n=+n,i=+i,a=!0,f()},e.bandwidth=function(){return s},e.step=function(){return o},e.round=function(d){return arguments.length?(a=!!d,f()):a},e.padding=function(d){return arguments.length?(c=Math.min(1,l=+d),f()):c},e.paddingInner=function(d){return arguments.length?(c=Math.min(1,d),f()):c},e.paddingOuter=function(d){return arguments.length?(l=+d,f()):l},e.align=function(d){return arguments.length?(u=Math.max(0,Math.min(1,d)),f()):u},e.copy=function(){return Zc(t(),[n,i]).round(a).paddingInner(c).paddingOuter(l).align(u)},dr.apply(f(),arguments)}function cU(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return cU(t())},e}function a6(){return cU(Zc.apply(null,arguments).paddingInner(1))}function c6(e){return function(){return e}}function eh(e){return+e}var lU=[0,1];function Hn(e){return e}function l6(e,t){return(t-=e=+e)?function(r){return(r-e)/t}:c6(isNaN(t)?NaN:.5)}function zet(e,t){var r;return e>t&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function jet(e,t,r){var n=e[0],i=e[1],o=t[0],s=t[1];return i<n?(n=l6(i,n),o=r(s,o)):(n=l6(n,i),o=r(o,s)),function(a){return o(n(a))}}function qet(e,t,r){var n=Math.min(e.length,t.length)-1,i=new Array(n),o=new Array(n),s=-1;for(e[n]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++s<n;)i[s]=l6(e[s],e[s+1]),o[s]=r(t[s],t[s+1]);return function(a){var c=Ia(e,a,1,n)-1;return o[c](i[c](a))}}function ms(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function ju(){var e=lU,t=lU,r=hi,n,i,o,s=Hn,a,c,l;function u(){var d=Math.min(e.length,t.length);return s!==Hn&&(s=zet(e[0],e[d-1])),a=d>2?qet:jet,c=l=null,f}function f(d){return d==null||isNaN(d=+d)?o:(c||(c=a(e.map(n),t,r)))(n(s(d)))}return f.invert=function(d){return s(i((l||(l=a(t,e.map(n),Fe)))(d)))},f.domain=function(d){return arguments.length?(e=Array.from(d,eh),u()):e.slice()},f.range=function(d){return arguments.length?(t=Array.from(d),u()):t.slice()},f.rangeRound=function(d){return t=Array.from(d),r=Nu,u()},f.clamp=function(d){return arguments.length?(s=d?!0:Hn,u()):s!==Hn},f.interpolate=function(d){return arguments.length?(r=d,u()):r},f.unknown=function(d){return arguments.length?(o=d,f):o},function(d,h){return n=d,i=h,u()}}function sg(){return ju()(Hn,Hn)}function u6(e,t,r,n){var i=Id(e,t,r),o;switch(n=us(n??",f"),n.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(o=n3(i,s))&&(n.precision=o),Fw(n,s)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(o=i3(i,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=o-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(o=r3(i))&&(n.precision=o-(n.type==="%")*2);break}}return Yi(n)}function ka(e){var t=e.domain;return e.ticks=function(r){var n=t();return Qr(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var i=t();return u6(i[0],i[i.length-1],r??10,n)},e.nice=function(r){r==null&&(r=10);var n=t(),i=0,o=n.length-1,s=n[i],a=n[o],c,l,u=10;for(a<s&&(l=s,s=a,a=l,l=i,i=o,o=l);u-- >0;){if(l=Aa(s,a,r),l===c)return n[i]=s,n[o]=a,t(n);if(l>0)s=Math.floor(s/l)*l,a=Math.ceil(a/l)*l;else if(l<0)s=Math.ceil(s*l)/l,a=Math.floor(a*l)/l;else break;c=l}return e},e}function Ba(){var e=sg();return e.copy=function(){return ms(e,Ba())},dr.apply(e,arguments),ka(e)}function ag(e){var t;function r(n){return n==null||isNaN(n=+n)?t:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(e=Array.from(n,eh),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return ag(e).unknown(t)},e=arguments.length?Array.from(e,eh):[0,1],ka(r)}function cg(e,t){e=e.slice();var r=0,n=e.length-1,i=e[r],o=e[n],s;return o<i&&(s=r,r=n,n=s,s=i,i=o,o=s),e[r]=t.floor(i),e[n]=t.ceil(o),e}function uU(e){return Math.log(e)}function fU(e){return Math.exp(e)}function Vet(e){return-Math.log(-e)}function Yet(e){return-Math.exp(-e)}function Wet(e){return isFinite(e)?+("1e"+e):e<0?0:e}function Get(e){return e===10?Wet:e===Math.E?Math.exp:t=>Math.pow(e,t)}function Xet(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 dU(e){return(t,r)=>-e(-t,r)}function f6(e){let t=e(uU,fU),r=t.domain,n=10,i,o;function s(){return i=Xet(n),o=Get(n),r()[0]<0?(i=dU(i),o=dU(o),e(Vet,Yet)):e(uU,fU),t}return t.base=function(a){return arguments.length?(n=+a,s()):n},t.domain=function(a){return arguments.length?(r(a),s()):r()},t.ticks=a=>{let c=r(),l=c[0],u=c[c.length-1],f=u<l;f&&([l,u]=[u,l]);let d=i(l),h=i(u),p,m,y=a==null?10:+a,g=[];if(!(n%1)&&h-d<y){if(d=Math.floor(d),h=Math.ceil(h),l>0){for(;d<=h;++d)for(p=1;p<n;++p)if(m=d<0?p/o(-d):p*o(d),!(m<l)){if(m>u)break;g.push(m)}}else for(;d<=h;++d)for(p=n-1;p>=1;--p)if(m=d>0?p/o(-d):p*o(d),!(m<l)){if(m>u)break;g.push(m)}g.length*2<y&&(g=Qr(l,u,y))}else g=Qr(d,h,Math.min(h-d,y)).map(o);return f?g.reverse():g},t.tickFormat=(a,c)=>{if(a==null&&(a=10),c==null&&(c=n===10?"s":","),typeof c!="function"&&(!(n%1)&&(c=us(c)).precision==null&&(c.trim=!0),c=Yi(c)),a===1/0)return c;let l=Math.max(1,n*a/t.ticks().length);return u=>{let f=u/o(Math.round(i(u)));return f*n<n-.5&&(f*=n),f<=l?c(u):""}},t.nice=()=>r(cg(r(),{floor:a=>o(Math.floor(i(a))),ceil:a=>o(Math.ceil(i(a)))})),t}function lg(){let e=f6(ju()).domain([1,10]);return e.copy=()=>ms(e,lg()).base(e.base()),dr.apply(e,arguments),e}function hU(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function pU(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function d6(e){var t=1,r=e(hU(t),pU(t));return r.constant=function(n){return arguments.length?e(hU(t=+n),pU(t)):t},ka(r)}function ug(){var e=d6(ju());return e.copy=function(){return ms(e,ug()).constant(e.constant())},dr.apply(e,arguments)}function mU(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Het(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function Qet(e){return e<0?-e*e:e*e}function h6(e){var t=e(Hn,Hn),r=1;function n(){return r===1?e(Hn,Hn):r===.5?e(Het,Qet):e(mU(r),mU(1/r))}return t.exponent=function(i){return arguments.length?(r=+i,n()):r},ka(t)}function fg(){var e=h6(ju());return e.copy=function(){return ms(e,fg()).exponent(e.exponent())},dr.apply(e,arguments),e}function dg(){var e=[],t=[],r=[],n;function i(){var s=0,a=Math.max(1,t.length);for(r=new Array(a-1);++s<a;)r[s-1]=dM(e,s/a);return o}function o(s){return s==null||isNaN(s=+s)?n:t[Ia(r,s)]}return o.invertExtent=function(s){var a=t.indexOf(s);return a<0?[NaN,NaN]:[a>0?r[a-1]:e[0],a<r.length?r[a]:e[e.length-1]]},o.domain=function(s){if(!arguments.length)return e.slice();e=[];for(let a of s)a!=null&&!isNaN(a=+a)&&e.push(a);return e.sort(Ft),i()},o.range=function(s){return arguments.length?(t=Array.from(s),i()):t.slice()},o.unknown=function(s){return arguments.length?(n=s,o):n},o.quantiles=function(){return r.slice()},o.copy=function(){return dg().domain(e).range(t).unknown(n)},dr.apply(o,arguments)}function hg(){var e=[.5],t=[0,1],r,n=1;function i(o){return o!=null&&o<=o?t[Ia(e,o,0,n)]:r}return i.domain=function(o){return arguments.length?(e=Array.from(o),n=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(o){return arguments.length?(t=Array.from(o),n=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(o){var s=t.indexOf(o);return[e[s-1],e[s]]},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return hg().domain(e).range(t).unknown(r)},dr.apply(i,arguments)}var p6=new Date,m6=new Date;function Me(e,t,r,n){function i(o){return e(o=arguments.length===0?new Date:new Date(+o)),o}return i.floor=o=>(e(o=new Date(+o)),o),i.ceil=o=>(e(o=new Date(o-1)),t(o,1),e(o),o),i.round=o=>{let s=i(o),a=i.ceil(o);return o-s<a-o?s:a},i.offset=(o,s)=>(t(o=new Date(+o),s==null?1:Math.floor(s)),o),i.range=(o,s,a)=>{let c=[];if(o=i.ceil(o),a=a==null?1:Math.floor(a),!(o<s)||!(a>0))return c;let l;do c.push(l=new Date(+o)),t(o,a),e(o);while(l<o&&o<s);return c},i.filter=o=>Me(s=>{if(s>=s)for(;e(s),!o(s);)s.setTime(s-1)},(s,a)=>{if(s>=s)if(a<0)for(;++a<=0;)for(;t(s,-1),!o(s););else for(;--a>=0;)for(;t(s,1),!o(s););}),r&&(i.count=(o,s)=>(p6.setTime(+o),m6.setTime(+s),e(p6),e(m6),Math.floor(r(p6,m6))),i.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?i.filter(n?s=>n(s)%o===0:s=>i.count(0,s)%o===0):i)),i}var pg=Me(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);pg.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Me(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):pg);var XUt=pg.range;var Lr=Me(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*1e3)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds()),yU=Lr.range;var Pa=Me(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getMinutes()),Zet=Pa.range,Ua=Me(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes()),Ket=Ua.range;var $a=Me(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()),Jet=$a.range,za=Me(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours()),trt=za.range;var Gi=Me(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),ert=Gi.range,Yu=Me(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1),rrt=Yu.range,Wu=Me(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>Math.floor(e/864e5)),nrt=Wu.range;function Gu(e){return Me(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,r)=>{t.setDate(t.getDate()+r*7)},(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/6048e5)}var mi=Gu(0),Kc=Gu(1),yv=Gu(2),gv=Gu(3),gs=Gu(4),xv=Gu(5),bv=Gu(6),xU=mi.range,irt=Kc.range,ort=yv.range,srt=gv.range,art=gs.range,crt=xv.range,lrt=bv.range;function Xu(e){return Me(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r*7)},(t,r)=>(r-t)/6048e5)}var yi=Xu(0),Jc=Xu(1),_v=Xu(2),wv=Xu(3),xs=Xu(4),vv=Xu(5),Sv=Xu(6),bU=yi.range,urt=Jc.range,frt=_v.range,drt=wv.range,hrt=xs.range,prt=vv.range,mrt=Sv.range;var ja=Me(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()),yrt=ja.range,qa=Me(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()),grt=qa.range;var dn=Me(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());dn.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Me(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r*e)});var xrt=dn.range,hn=Me(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());hn.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Me(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r*e)});var brt=hn.range;function wU(e,t,r,n,i,o){let s=[[Lr,1,1e3],[Lr,5,5*1e3],[Lr,15,15*1e3],[Lr,30,30*1e3],[o,1,6e4],[o,5,5*6e4],[o,15,15*6e4],[o,30,30*6e4],[i,1,36e5],[i,3,3*36e5],[i,6,6*36e5],[i,12,12*36e5],[n,1,864e5],[n,2,2*864e5],[r,1,6048e5],[t,1,2592e6],[t,3,3*2592e6],[e,1,31536e6]];function a(l,u,f){let d=u<l;d&&([l,u]=[u,l]);let h=f&&typeof f.range=="function"?f:c(l,u,f),p=h?h.range(l,+u+1):[];return d?p.reverse():p}function c(l,u,f){let d=Math.abs(u-l)/f,h=To(([,,y])=>y).right(s,d);if(h===s.length)return e.every(Id(l/31536e6,u/31536e6,f));if(h===0)return pg.every(Math.max(Id(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[y6,yg]=wU(hn,qa,yi,Wu,za,Ua),[g6,x6]=wU(dn,ja,mi,Gi,$a,Pa);function b6(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 _6(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 gg(e,t,r){return{y:e,m:t,d:r,H:0,M:0,S:0,L:0}}function w6(e){var t=e.dateTime,r=e.date,n=e.time,i=e.periods,o=e.days,s=e.shortDays,a=e.months,c=e.shortMonths,l=xg(i),u=bg(i),f=xg(o),d=bg(o),h=xg(s),p=bg(s),m=xg(a),y=bg(a),g=xg(c),x=bg(c),b={a:L,A:B,b:k,B:P,c:null,d:EU,e:EU,f:qrt,g:Jrt,G:ent,H:$rt,I:zrt,j:jrt,L:DU,m:Vrt,M:Yrt,p:U,q:$,Q:OU,s:RU,S:Wrt,u:Grt,U:Xrt,V:Hrt,w:Qrt,W:Zrt,x:null,X:null,y:Krt,Y:tnt,Z:rnt,"%":NU},_={a:X,A:rt,b:ot,B:at,c:null,d:MU,e:MU,f:snt,g:ynt,G:xnt,H:nnt,I:int,j:ont,L:FU,m:ant,M:cnt,p:Y,q:st,Q:OU,s:RU,S:lnt,u:unt,U:fnt,V:dnt,w:hnt,W:pnt,x:null,X:null,y:mnt,Y:gnt,Z:bnt,"%":NU},v={a:N,A:I,b:R,B:C,c:S,d:TU,e:TU,f:krt,g:IU,G:SU,H:AU,I:AU,j:Drt,L:Crt,m:Rrt,M:Lrt,p:E,q:Ort,Q:Prt,s:Urt,S:Frt,u:Trt,U:Art,V:Ert,w:Irt,W:Mrt,x:M,X:O,y:IU,Y:SU,Z:Nrt,"%":Brt};b.x=w(r,b),b.X=w(n,b),b.c=w(t,b),_.x=w(r,_),_.X=w(n,_),_.c=w(t,_);function w(q,H){return function(nt){var z=[],Pt=-1,ht=0,Zt=q.length,Jt,tt,ge;for(nt instanceof Date||(nt=new Date(+nt));++Pt<Zt;)q.charCodeAt(Pt)===37&&(z.push(q.slice(ht,Pt)),(tt=vU[Jt=q.charAt(++Pt)])!=null?Jt=q.charAt(++Pt):tt=Jt==="e"?" ":"0",(ge=H[Jt])&&(Jt=ge(nt,tt)),z.push(Jt),ht=Pt+1);return z.push(q.slice(ht,Pt)),z.join("")}}function T(q,H){return function(nt){var z=gg(1900,void 0,1),Pt=A(z,q,nt+="",0),ht,Zt;if(Pt!=nt.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?(ht=_6(gg(z.y,0,1)),Zt=ht.getUTCDay(),ht=Zt>4||Zt===0?Jc.ceil(ht):Jc(ht),ht=Yu.offset(ht,(z.V-1)*7),z.y=ht.getUTCFullYear(),z.m=ht.getUTCMonth(),z.d=ht.getUTCDate()+(z.w+6)%7):(ht=b6(gg(z.y,0,1)),Zt=ht.getDay(),ht=Zt>4||Zt===0?Kc.ceil(ht):Kc(ht),ht=Gi.offset(ht,(z.V-1)*7),z.y=ht.getFullYear(),z.m=ht.getMonth(),z.d=ht.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),Zt="Z"in z?_6(gg(z.y,0,1)).getUTCDay():b6(gg(z.y,0,1)).getDay(),z.m=0,z.d="W"in z?(z.w+6)%7+z.W*7-(Zt+5)%7:z.w+z.U*7-(Zt+6)%7);return"Z"in z?(z.H+=z.Z/100|0,z.M+=z.Z%100,_6(z)):b6(z)}}function A(q,H,nt,z){for(var Pt=0,ht=H.length,Zt=nt.length,Jt,tt;Pt<ht;){if(z>=Zt)return-1;if(Jt=H.charCodeAt(Pt++),Jt===37){if(Jt=H.charAt(Pt++),tt=v[Jt in vU?H.charAt(Pt++):Jt],!tt||(z=tt(q,nt,z))<0)return-1}else if(Jt!=nt.charCodeAt(z++))return-1}return z}function E(q,H,nt){var z=l.exec(H.slice(nt));return z?(q.p=u.get(z[0].toLowerCase()),nt+z[0].length):-1}function N(q,H,nt){var z=h.exec(H.slice(nt));return z?(q.w=p.get(z[0].toLowerCase()),nt+z[0].length):-1}function I(q,H,nt){var z=f.exec(H.slice(nt));return z?(q.w=d.get(z[0].toLowerCase()),nt+z[0].length):-1}function R(q,H,nt){var z=g.exec(H.slice(nt));return z?(q.m=x.get(z[0].toLowerCase()),nt+z[0].length):-1}function C(q,H,nt){var z=m.exec(H.slice(nt));return z?(q.m=y.get(z[0].toLowerCase()),nt+z[0].length):-1}function S(q,H,nt){return A(q,t,H,nt)}function M(q,H,nt){return A(q,r,H,nt)}function O(q,H,nt){return A(q,n,H,nt)}function L(q){return s[q.getDay()]}function B(q){return o[q.getDay()]}function k(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 rt(q){return o[q.getUTCDay()]}function ot(q){return c[q.getUTCMonth()]}function at(q){return a[q.getUTCMonth()]}function Y(q){return i[+(q.getUTCHours()>=12)]}function st(q){return 1+~~(q.getUTCMonth()/3)}return{format:function(q){var H=w(q+="",b);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 vU={"-":"",_:" ",0:"0"},Fr=/^\s*\d+/,wrt=/^%/,vrt=/[\\^$*+?|[\]().{}]/g;function le(e,t,r){var n=e<0?"-":"",i=(n?-e:e)+"",o=i.length;return n+(o<r?new Array(r-o+1).join(t)+i:i)}function Srt(e){return e.replace(vrt,"\\$&")}function xg(e){return new RegExp("^(?:"+e.map(Srt).join("|")+")","i")}function bg(e){return new Map(e.map((t,r)=>[t.toLowerCase(),r]))}function Irt(e,t,r){var n=Fr.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function Trt(e,t,r){var n=Fr.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function Art(e,t,r){var n=Fr.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function Ert(e,t,r){var n=Fr.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function Mrt(e,t,r){var n=Fr.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function SU(e,t,r){var n=Fr.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function IU(e,t,r){var n=Fr.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function Nrt(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function Ort(e,t,r){var n=Fr.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function Rrt(e,t,r){var n=Fr.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function TU(e,t,r){var n=Fr.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function Drt(e,t,r){var n=Fr.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function AU(e,t,r){var n=Fr.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function Lrt(e,t,r){var n=Fr.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function Frt(e,t,r){var n=Fr.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function Crt(e,t,r){var n=Fr.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function krt(e,t,r){var n=Fr.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function Brt(e,t,r){var n=wrt.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function Prt(e,t,r){var n=Fr.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function Urt(e,t,r){var n=Fr.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function EU(e,t){return le(e.getDate(),t,2)}function $rt(e,t){return le(e.getHours(),t,2)}function zrt(e,t){return le(e.getHours()%12||12,t,2)}function jrt(e,t){return le(1+Gi.count(dn(e),e),t,3)}function DU(e,t){return le(e.getMilliseconds(),t,3)}function qrt(e,t){return DU(e,t)+"000"}function Vrt(e,t){return le(e.getMonth()+1,t,2)}function Yrt(e,t){return le(e.getMinutes(),t,2)}function Wrt(e,t){return le(e.getSeconds(),t,2)}function Grt(e){var t=e.getDay();return t===0?7:t}function Xrt(e,t){return le(mi.count(dn(e)-1,e),t,2)}function LU(e){var t=e.getDay();return t>=4||t===0?gs(e):gs.ceil(e)}function Hrt(e,t){return e=LU(e),le(gs.count(dn(e),e)+(dn(e).getDay()===4),t,2)}function Qrt(e){return e.getDay()}function Zrt(e,t){return le(Kc.count(dn(e)-1,e),t,2)}function Krt(e,t){return le(e.getFullYear()%100,t,2)}function Jrt(e,t){return e=LU(e),le(e.getFullYear()%100,t,2)}function tnt(e,t){return le(e.getFullYear()%1e4,t,4)}function ent(e,t){var r=e.getDay();return e=r>=4||r===0?gs(e):gs.ceil(e),le(e.getFullYear()%1e4,t,4)}function rnt(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+le(t/60|0,"0",2)+le(t%60,"0",2)}function MU(e,t){return le(e.getUTCDate(),t,2)}function nnt(e,t){return le(e.getUTCHours(),t,2)}function int(e,t){return le(e.getUTCHours()%12||12,t,2)}function ont(e,t){return le(1+Yu.count(hn(e),e),t,3)}function FU(e,t){return le(e.getUTCMilliseconds(),t,3)}function snt(e,t){return FU(e,t)+"000"}function ant(e,t){return le(e.getUTCMonth()+1,t,2)}function cnt(e,t){return le(e.getUTCMinutes(),t,2)}function lnt(e,t){return le(e.getUTCSeconds(),t,2)}function unt(e){var t=e.getUTCDay();return t===0?7:t}function fnt(e,t){return le(yi.count(hn(e)-1,e),t,2)}function CU(e){var t=e.getUTCDay();return t>=4||t===0?xs(e):xs.ceil(e)}function dnt(e,t){return e=CU(e),le(xs.count(hn(e),e)+(hn(e).getUTCDay()===4),t,2)}function hnt(e){return e.getUTCDay()}function pnt(e,t){return le(Jc.count(hn(e)-1,e),t,2)}function mnt(e,t){return le(e.getUTCFullYear()%100,t,2)}function ynt(e,t){return e=CU(e),le(e.getUTCFullYear()%100,t,2)}function gnt(e,t){return le(e.getUTCFullYear()%1e4,t,4)}function xnt(e,t){var r=e.getUTCDay();return e=r>=4||r===0?xs(e):xs.ceil(e),le(e.getUTCFullYear()%1e4,t,4)}function bnt(){return"+0000"}function NU(){return"%"}function OU(e){return+e}function RU(e){return Math.floor(+e/1e3)}var rh,nh,kU,bs,BU;v6({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 v6(e){return rh=w6(e),nh=rh.format,kU=rh.parse,bs=rh.utcFormat,BU=rh.utcParse,rh}function _nt(e){return new Date(e)}function wnt(e){return e instanceof Date?+e:+new Date(+e)}function Iv(e,t,r,n,i,o,s,a,c,l){var u=sg(),f=u.invert,d=u.domain,h=l(".%L"),p=l(":%S"),m=l("%I:%M"),y=l("%I %p"),g=l("%a %d"),x=l("%b %d"),b=l("%B"),_=l("%Y");function v(w){return(c(w)<w?h:a(w)<w?p:s(w)<w?m:o(w)<w?y:n(w)<w?i(w)<w?g:x:r(w)<w?b:_)(w)}return u.invert=function(w){return new Date(f(w))},u.domain=function(w){return arguments.length?d(Array.from(w,wnt)):d().map(_nt)},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(cg(T,w)):u},u.copy=function(){return ms(u,Iv(e,t,r,n,i,o,s,a,c,l))},u}function Tv(){return dr.apply(Iv(g6,x6,dn,ja,mi,Gi,$a,Pa,Lr,nh).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function Av(){return dr.apply(Iv(y6,yg,hn,qa,yi,Yu,za,Ua,Lr,bs).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function _g(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function Ev(){var e=0,t=.5,r=1,n=1,i,o,s,a,c,l=Hn,u,f=!1,d;function h(m){return isNaN(m=+m)?d:(m=.5+((m=+u(m))-o)*(n*m<n*o?a:c),l(f?Math.max(0,Math.min(1,m)):m))}h.domain=function(m){return arguments.length?([e,t,r]=m,i=u(e=+e),o=u(t=+t),s=u(r=+r),a=i===o?0:.5/(o-i),c=o===s?0:.5/(s-o),n=o<i?-1:1,h):[e,t,r]},h.clamp=function(m){return arguments.length?(f=!!m,h):f},h.interpolator=function(m){return arguments.length?(l=m,h):l};function p(m){return function(y){var g,x,b;return arguments.length?([g,x,b]=y,l=ss(m,[g,x,b]),h):[l(0),l(.5),l(1)]}}return h.range=p(hi),h.rangeRound=p(Nu),h.unknown=function(m){return arguments.length?(d=m,h):d},function(m){return u=m,i=m(e),o=m(t),s=m(r),a=i===o?0:.5/(o-i),c=o===s?0:.5/(s-o),n=o<i?-1:1,h}}function wg(){var e=ka(Ev()(Hn));return e.copy=function(){return _g(e,wg())},ig.apply(e,arguments)}function Mv(){var e=f6(Ev()).domain([.1,1,10]);return e.copy=function(){return _g(e,Mv()).base(e.base())},ig.apply(e,arguments)}function Nv(){var e=d6(Ev());return e.copy=function(){return _g(e,Nv()).constant(e.constant())},ig.apply(e,arguments)}function Ov(){var e=h6(Ev());return e.copy=function(){return _g(e,Ov()).exponent(e.exponent())},ig.apply(e,arguments)}function W(e){for(var t=e.length/6|0,r=new Array(t),n=0;n<t;)r[n]="#"+e.slice(n*6,++n*6);return r}var S6=W("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");var I6=W("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666");var T6=W("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666");var A6=W("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0");var E6=W("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");var M6=W("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2");var N6=W("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc");var O6=W("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999");var R6=W("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3");var D6=W("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");var L6=W("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");var pt=e=>MM(e[e.length-1]);var Rv=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(W),Dv=pt(Rv);var Lv=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(W),Fv=pt(Lv);var Cv=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(W),kv=pt(Cv);var Bv=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(W),Pv=pt(Bv);var vg=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(W),ih=pt(vg);var Uv=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(W),$v=pt(Uv);var Sg=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(W),oh=pt(Sg);var zv=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(W),jv=pt(zv);var qv=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(W),Vv=pt(qv);var Yv=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(W),Wv=pt(Yv);var Gv=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(W),Xv=pt(Gv);var Hv=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(W),Qv=pt(Hv);var Zv=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(W),Kv=pt(Zv);var Jv=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(W),t2=pt(Jv);var e2=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(W),r2=pt(e2);var n2=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(W),i2=pt(n2);var o2=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(W),s2=pt(o2);var a2=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(W),c2=pt(a2);var l2=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(W),u2=pt(l2);var f2=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(W),d2=pt(f2);var h2=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(W),p2=pt(h2);var m2=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(W),y2=pt(m2);var g2=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(W),x2=pt(g2);var b2=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(W),_2=pt(b2);var w2=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(W),v2=pt(w2);var S2=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(W),I2=pt(S2);var T2=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(W),A2=pt(T2);function E2(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 M2=Ld(En(300,.5,0),En(-240,.5,1));var O2=Ld(En(-100,.75,.35),En(80,1.5,.8)),R2=Ld(En(260,.75,.35),En(80,1.5,.8)),N2=En();function D2(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return N2.h=360*e-100,N2.s=1.5-1.5*t,N2.l=.8-.9*t,N2+""}var L2=wr(),vnt=Math.PI/3,Snt=Math.PI*2/3;function F2(e){var t;return e=(.5-e)*Math.PI,L2.r=255*(t=Math.sin(e))*t,L2.g=255*(t=Math.sin(e+vnt))*t,L2.b=255*(t=Math.sin(e+Snt))*t,L2+""}function C2(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 k2(e){var t=e.length;return function(r){return e[Math.max(0,Math.min(t-1,Math.floor(r*t)))]}}var B2=k2(W("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),P2=k2(W("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),U2=k2(W("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),$2=k2(W("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function hr(e){return function(){return e}}var F6=Math.cos;var sh=Math.min,Ig=Math.sin,ue=Math.sqrt,C6=1e-12,Hu=Math.PI,bVt=Hu/2,ah=2*Hu;function z2(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{let n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new Yc(t)}var SVt=Array.prototype.slice;function j2(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function PU(e){this._context=e}PU.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 Va(e){return new PU(e)}function q2(e){return e[0]}function V2(e){return e[1]}function Tg(e,t){var r=hr(!0),n=null,i=Va,o=null,s=z2(a);e=typeof e=="function"?e:e===void 0?q2:hr(e),t=typeof t=="function"?t:t===void 0?V2:hr(t);function a(c){var l,u=(c=j2(c)).length,f,d=!1,h;for(n==null&&(o=i(h=s())),l=0;l<=u;++l)!(l<u&&r(f=c[l],l,c))===d&&((d=!d)?o.lineStart():o.lineEnd()),d&&o.point(+e(f,l,c),+t(f,l,c));if(h)return o=null,h+""||null}return a.x=function(c){return arguments.length?(e=typeof c=="function"?c:hr(+c),a):e},a.y=function(c){return arguments.length?(t=typeof c=="function"?c:hr(+c),a):t},a.defined=function(c){return arguments.length?(r=typeof c=="function"?c:hr(!!c),a):r},a.curve=function(c){return arguments.length?(i=c,n!=null&&(o=i(n)),a):i},a.context=function(c){return arguments.length?(c==null?n=o=null:o=i(n=c),a):n},a}function ch(e,t,r){var n=null,i=hr(!0),o=null,s=Va,a=null,c=z2(l);e=typeof e=="function"?e:e===void 0?q2:hr(+e),t=typeof t=="function"?t:t===void 0?hr(0):hr(+t),r=typeof r=="function"?r:r===void 0?V2:hr(+r);function l(f){var d,h,p,m=(f=j2(f)).length,y,g=!1,x,b=new Array(m),_=new Array(m);for(o==null&&(a=s(x=c())),d=0;d<=m;++d){if(!(d<m&&i(y=f[d],d,f))===g)if(g=!g)h=d,a.areaStart(),a.lineStart();else{for(a.lineEnd(),a.lineStart(),p=d-1;p>=h;--p)a.point(b[p],_[p]);a.lineEnd(),a.areaEnd()}g&&(b[d]=+e(y,d,f),_[d]=+t(y,d,f),a.point(n?+n(y,d,f):b[d],r?+r(y,d,f):_[d]))}if(x)return a=null,x+""||null}function u(){return Tg().defined(i).curve(s).context(o)}return l.x=function(f){return arguments.length?(e=typeof f=="function"?f:hr(+f),n=null,l):e},l.x0=function(f){return arguments.length?(e=typeof f=="function"?f:hr(+f),l):e},l.x1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:hr(+f),l):n},l.y=function(f){return arguments.length?(t=typeof f=="function"?f:hr(+f),r=null,l):t},l.y0=function(f){return arguments.length?(t=typeof f=="function"?f:hr(+f),l):t},l.y1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:hr(+f),l):r},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(r)},l.lineX1=function(){return u().x(n).y(t)},l.defined=function(f){return arguments.length?(i=typeof f=="function"?f:hr(!!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 Y2=class{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}};function k6(e){return new Y2(e,!0)}function B6(e){return new Y2(e,!1)}var Int=ue(3),Ag={draw(e,t){let r=ue(t+sh(t/28,.75))*.59436,n=r/2,i=n*Int;e.moveTo(0,r),e.lineTo(0,-r),e.moveTo(-i,-n),e.lineTo(i,n),e.moveTo(-i,n),e.lineTo(i,-n)}};var Ya={draw(e,t){let r=ue(t/Hu);e.moveTo(r,0),e.arc(0,0,r,0,ah)}};var Eg={draw(e,t){let r=ue(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}};var UU=ue(1/3),Tnt=UU*2,Mg={draw(e,t){let r=ue(t/Tnt),n=r*UU;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}};var Ng={draw(e,t){let r=ue(t)*.62625;e.moveTo(0,-r),e.lineTo(r,0),e.lineTo(0,r),e.lineTo(-r,0),e.closePath()}};var Og={draw(e,t){let r=ue(t-sh(t/7,2))*.87559;e.moveTo(-r,0),e.lineTo(r,0),e.moveTo(0,r),e.lineTo(0,-r)}};var Rg={draw(e,t){let r=ue(t),n=-r/2;e.rect(n,n,r,r)}};var Dg={draw(e,t){let r=ue(t)*.4431;e.moveTo(r,r),e.lineTo(r,-r),e.lineTo(-r,-r),e.lineTo(-r,r),e.closePath()}};var Ant=.8908130915292852,$U=Ig(Hu/10)/Ig(7*Hu/10),Ent=Ig(ah/10)*$U,Mnt=-F6(ah/10)*$U,Lg={draw(e,t){let r=ue(t*Ant),n=Ent*r,i=Mnt*r;e.moveTo(0,-r),e.lineTo(n,i);for(let o=1;o<5;++o){let s=ah*o/5,a=F6(s),c=Ig(s);e.lineTo(c*r,-a*r),e.lineTo(a*n-c*i,c*n+a*i)}e.closePath()}};var P6=ue(3),Fg={draw(e,t){let r=-ue(t/(P6*3));e.moveTo(0,r*2),e.lineTo(-P6*r,-r),e.lineTo(P6*r,-r),e.closePath()}};var Nnt=ue(3),Cg={draw(e,t){let r=ue(t)*.6824,n=r/2,i=r*Nnt/2;e.moveTo(0,-r),e.lineTo(i,n),e.lineTo(-i,n),e.closePath()}};var Xi=-.5,Hi=ue(3)/2,U6=1/ue(12),Ont=(U6/2+1)*3,kg={draw(e,t){let r=ue(t/Ont),n=r/2,i=r*U6,o=n,s=r*U6+r,a=-o,c=s;e.moveTo(n,i),e.lineTo(o,s),e.lineTo(a,c),e.lineTo(Xi*n-Hi*i,Hi*n+Xi*i),e.lineTo(Xi*o-Hi*s,Hi*o+Xi*s),e.lineTo(Xi*a-Hi*c,Hi*a+Xi*c),e.lineTo(Xi*n+Hi*i,Xi*i-Hi*n),e.lineTo(Xi*o+Hi*s,Xi*s-Hi*o),e.lineTo(Xi*a+Hi*c,Xi*c-Hi*a),e.closePath()}};var lh={draw(e,t){let r=ue(t-sh(t/6,1.7))*.6189;e.moveTo(-r,-r),e.lineTo(r,r),e.moveTo(-r,r),e.lineTo(r,-r)}};var W2=[Ya,Eg,Mg,Rg,Lg,Fg,kg],$6=[Ya,Og,lh,Cg,Ag,Dg,Ng];function Qi(){}function uh(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function Bg(e){this._context=e}Bg.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:uh(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:uh(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function z6(e){return new Bg(e)}function zU(e){this._context=e}zU.prototype={areaStart:Qi,areaEnd:Qi,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:uh(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function j6(e){return new zU(e)}function jU(e){this._context=e}jU.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:uh(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function q6(e){return new jU(e)}function qU(e,t){this._basis=new Bg(e),this._beta=t}qU.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,r=e.length-1;if(r>0)for(var n=e[0],i=t[0],o=e[r]-n,s=t[r]-i,a=-1,c;++a<=r;)c=a/r,this._basis.point(this._beta*e[a]+(1-this._beta)*(n+c*o),this._beta*t[a]+(1-this._beta)*(i+c*s));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};var V6=function e(t){function r(n){return t===1?new Bg(n):new qU(n,t)}return r.beta=function(n){return e(+n)},r}(.85);function fh(e,t,r){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-r),e._x2,e._y2)}function G2(e,t){this._context=e,this._k=(1-t)/6}G2.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:fh(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:fh(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 Y6=function e(t){function r(n){return new G2(n,t)}return r.tension=function(n){return e(+n)},r}(0);function X2(e,t){this._context=e,this._k=(1-t)/6}X2.prototype={areaStart:Qi,areaEnd:Qi,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:fh(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 W6=function e(t){function r(n){return new X2(n,t)}return r.tension=function(n){return e(+n)},r}(0);function H2(e,t){this._context=e,this._k=(1-t)/6}H2.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:fh(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 G6=function e(t){function r(n){return new H2(n,t)}return r.tension=function(n){return e(+n)},r}(0);function Pg(e,t,r){var n=e._x1,i=e._y1,o=e._x2,s=e._y2;if(e._l01_a>C6){var a=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,c=3*e._l01_a*(e._l01_a+e._l12_a);n=(n*a-e._x0*e._l12_2a+e._x2*e._l01_2a)/c,i=(i*a-e._y0*e._l12_2a+e._y2*e._l01_2a)/c}if(e._l23_a>C6){var l=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,u=3*e._l23_a*(e._l23_a+e._l12_a);o=(o*l+e._x1*e._l23_2a-t*e._l12_2a)/u,s=(s*l+e._y1*e._l23_2a-r*e._l12_2a)/u}e._context.bezierCurveTo(n,i,o,s,e._x2,e._y2)}function VU(e,t){this._context=e,this._alpha=t}VU.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var r=this._x2-e,n=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:Pg(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 X6=function e(t){function r(n){return t?new VU(n,t):new G2(n,0)}return r.alpha=function(n){return e(+n)},r}(.5);function YU(e,t){this._context=e,this._alpha=t}YU.prototype={areaStart:Qi,areaEnd:Qi,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){if(e=+e,t=+t,this._point){var r=this._x2-e,n=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:Pg(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 H6=function e(t){function r(n){return t?new YU(n,t):new X2(n,0)}return r.alpha=function(n){return e(+n)},r}(.5);function WU(e,t){this._context=e,this._alpha=t}WU.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var r=this._x2-e,n=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Pg(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 Q6=function e(t){function r(n){return t?new WU(n,t):new H2(n,0)}return r.alpha=function(n){return e(+n)},r}(.5);function GU(e){this._context=e}GU.prototype={areaStart:Qi,areaEnd:Qi,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 Z6(e){return new GU(e)}function XU(e){return e<0?-1:1}function HU(e,t,r){var n=e._x1-e._x0,i=t-e._x1,o=(e._y1-e._y0)/(n||i<0&&-0),s=(r-e._y1)/(i||n<0&&-0),a=(o*i+s*n)/(n+i);return(XU(o)+XU(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(a))||0}function QU(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function K6(e,t,r){var n=e._x0,i=e._y0,o=e._x1,s=e._y1,a=(o-n)/3;e._context.bezierCurveTo(n+a,i+a*t,o-a,s-a*r,o,s)}function Q2(e){this._context=e}Q2.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:K6(this,this._t0,QU(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,K6(this,QU(this,r=HU(this,e,t)),r);break;default:K6(this,this._t0,r=HU(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function ZU(e){this._context=new KU(e)}(ZU.prototype=Object.create(Q2.prototype)).point=function(e,t){Q2.prototype.point.call(this,t,e)};function KU(e){this._context=e}KU.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,i,o){this._context.bezierCurveTo(t,e,n,r,o,i)}};function J6(e){return new Q2(e)}function t4(e){return new ZU(e)}function t$(e){this._context=e}t$.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=JU(e),i=JU(t),o=0,s=1;s<r;++o,++s)this._context.bezierCurveTo(n[0][o],i[0][o],n[1][o],i[1][o],e[s],t[s]);(this._line||this._line!==0&&r===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function JU(e){var t,r=e.length-1,n,i=new Array(r),o=new Array(r),s=new Array(r);for(i[0]=0,o[0]=2,s[0]=e[0]+2*e[1],t=1;t<r-1;++t)i[t]=1,o[t]=4,s[t]=4*e[t]+2*e[t+1];for(i[r-1]=2,o[r-1]=7,s[r-1]=8*e[r-1]+e[r],t=1;t<r;++t)n=i[t]/o[t-1],o[t]-=n,s[t]-=n*s[t-1];for(i[r-1]=s[r-1]/o[r-1],t=r-2;t>=0;--t)i[t]=(s[t]-i[t+1])/o[t];for(o[r-1]=(e[r]+i[r-1])/2,t=0;t<r-1;++t)o[t]=2*e[t+1]-i[t+1];return[i,o]}function e4(e){return new t$(e)}function Z2(e,t){this._context=e,this._t=t}Z2.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function r4(e){return new Z2(e,.5)}function n4(e){return new Z2(e,0)}function i4(e){return new Z2(e,1)}var Ug=e=>()=>e;function o4(e,{sourceEvent:t,target:r,transform:n,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:n,enumerable:!0,configurable:!0},_:{value:i}})}function gi(e,t,r){this.k=e,this.x=t,this.y=r}gi.prototype={constructor:gi,scale:function(e){return e===1?this:new gi(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new gi(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var $g=new gi(1,0,0);s4.prototype=gi.prototype;function s4(e){for(;!e.__zoom;)if(!(e=e.parentNode))return $g;return e.__zoom}function K2(e){e.stopImmediatePropagation()}function dh(e){e.preventDefault(),e.stopImmediatePropagation()}function Rnt(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Dnt(){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 e$(){return this.__zoom||$g}function Lnt(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Fnt(){return navigator.maxTouchPoints||"ontouchstart"in this}function Cnt(e,t,r){var n=e.invertX(t[0][0])-r[0][0],i=e.invertX(t[1][0])-r[1][0],o=e.invertY(t[0][1])-r[0][1],s=e.invertY(t[1][1])-r[1][1];return e.translate(i>n?(n+i)/2:Math.min(0,n)||Math.max(0,i),s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s))}function a4(){var e=Rnt,t=Dnt,r=Cnt,n=Lnt,i=Fnt,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=FM,l=Su("start","zoom","end"),u,f,d,h=500,p=150,m=0,y=10;function g(S){S.property("__zoom",e$).on("wheel.zoom",A,{passive:!1}).on("mousedown.zoom",E).on("dblclick.zoom",N).filter(i).on("touchstart.zoom",I).on("touchmove.zoom",R).on("touchend.zoom touchcancel.zoom",C).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(S,M,O,L){var B=S.selection?S.selection():S;B.property("__zoom",e$),S!==B?v(S,M,O,L):B.interrupt().each(function(){w(this,arguments).event(L).start().zoom(null,typeof M=="function"?M.apply(this,arguments):M).end()})},g.scaleBy=function(S,M,O,L){g.scaleTo(S,function(){var B=this.__zoom.k,k=typeof M=="function"?M.apply(this,arguments):M;return B*k},O,L)},g.scaleTo=function(S,M,O,L){g.transform(S,function(){var B=t.apply(this,arguments),k=this.__zoom,P=O==null?_(B):typeof O=="function"?O.apply(this,arguments):O,U=k.invert(P),$=typeof M=="function"?M.apply(this,arguments):M;return r(b(x(k,$),P,U),B,s)},O,L)},g.translateBy=function(S,M,O,L){g.transform(S,function(){return r(this.__zoom.translate(typeof M=="function"?M.apply(this,arguments):M,typeof O=="function"?O.apply(this,arguments):O),t.apply(this,arguments),s)},null,L)},g.translateTo=function(S,M,O,L,B){g.transform(S,function(){var k=t.apply(this,arguments),P=this.__zoom,U=L==null?_(k):typeof L=="function"?L.apply(this,arguments):L;return r($g.translate(U[0],U[1]).scale(P.k).translate(typeof M=="function"?-M.apply(this,arguments):-M,typeof O=="function"?-O.apply(this,arguments):-O),k,s)},L,B)};function x(S,M){return M=Math.max(o[0],Math.min(o[1],M)),M===S.k?S:new gi(M,S.x,S.y)}function b(S,M,O){var L=M[0]-O[0]*S.k,B=M[1]-O[1]*S.k;return L===S.x&&B===S.y?S:new gi(S.k,L,B)}function _(S){return[(+S[0][0]+ +S[1][0])/2,(+S[0][1]+ +S[1][1])/2]}function v(S,M,O,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,k=arguments,P=w(B,k).event(L),U=t.apply(B,k),$=O==null?_(U):typeof O=="function"?O.apply(B,k):O,X=Math.max(U[1][0]-U[0][0],U[1][1]-U[0][1]),rt=B.__zoom,ot=typeof M=="function"?M.apply(B,k):M,at=c(rt.invert($).concat(X/rt.k),ot.invert($).concat(X/ot.k));return function(Y){if(Y===1)Y=ot;else{var st=at(Y),q=X/st[2];Y=new gi(q,$[0]-st[0]*q,$[1]-st[1]*q)}P.zoom(null,Y)}})}function w(S,M,O){return!O&&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=Qt(this.that).datum();l.call(S,this.that,new o4(S,{sourceEvent:this.sourceEvent,target:g,type:S,transform:this.that.__zoom,dispatch:l}),M)}};function A(S,...M){if(!e.apply(this,arguments))return;var O=w(this,M).event(S),L=this.__zoom,B=Math.max(o[0],Math.min(o[1],L.k*Math.pow(2,n.apply(this,arguments)))),k=an(S);if(O.wheel)(O.mouse[0][0]!==k[0]||O.mouse[0][1]!==k[1])&&(O.mouse[1]=L.invert(O.mouse[0]=k)),clearTimeout(O.wheel);else{if(L.k===B)return;O.mouse=[k,L.invert(k)],as(this),O.start()}dh(S),O.wheel=setTimeout(P,p),O.zoom("mouse",r(b(x(L,B),O.mouse[0],O.mouse[1]),O.extent,s));function P(){O.wheel=null,O.end()}}function E(S,...M){if(d||!e.apply(this,arguments))return;var O=S.currentTarget,L=w(this,M,!0).event(S),B=Qt(S.view).on("mousemove.zoom",$,!0).on("mouseup.zoom",X,!0),k=an(S,O),P=S.clientX,U=S.clientY;yy(S.view),K2(S),L.mouse=[k,this.__zoom.invert(k)],as(this),L.start();function $(rt){if(dh(rt),!L.moved){var ot=rt.clientX-P,at=rt.clientY-U;L.moved=ot*ot+at*at>m}L.event(rt).zoom("mouse",r(b(L.that.__zoom,L.mouse[0]=an(rt,O),L.mouse[1]),L.extent,s))}function X(rt){B.on("mousemove.zoom mouseup.zoom",null),gy(rt.view,L.moved),dh(rt),L.event(rt).end()}}function N(S,...M){if(e.apply(this,arguments)){var O=this.__zoom,L=an(S.changedTouches?S.changedTouches[0]:S,this),B=O.invert(L),k=O.k*(S.shiftKey?.5:2),P=r(b(x(O,k),L,B),t.apply(this,M),s);dh(S),a>0?Qt(this).transition().duration(a).call(v,P,L,S):Qt(this).call(g.transform,P,L,S)}}function I(S,...M){if(e.apply(this,arguments)){var O=S.touches,L=O.length,B=w(this,M,S.changedTouches.length===L).event(S),k,P,U,$;for(K2(S),P=0;P<L;++P)U=O[P],$=an(U,this),$=[$,this.__zoom.invert($),U.identifier],B.touch0?!B.touch1&&B.touch0[2]!==$[2]&&(B.touch1=$,B.taps=0):(B.touch0=$,k=!0,B.taps=1+!!u);u&&(u=clearTimeout(u)),k&&(B.taps<2&&(f=$[0],u=setTimeout(function(){u=null},h)),as(this),B.start())}}function R(S,...M){if(this.__zooming){var O=w(this,M).event(S),L=S.changedTouches,B=L.length,k,P,U,$;for(dh(S),k=0;k<B;++k)P=L[k],U=an(P,this),O.touch0&&O.touch0[2]===P.identifier?O.touch0[0]=U:O.touch1&&O.touch1[2]===P.identifier&&(O.touch1[0]=U);if(P=O.that.__zoom,O.touch1){var X=O.touch0[0],rt=O.touch0[1],ot=O.touch1[0],at=O.touch1[1],Y=(Y=ot[0]-X[0])*Y+(Y=ot[1]-X[1])*Y,st=(st=at[0]-rt[0])*st+(st=at[1]-rt[1])*st;P=x(P,Math.sqrt(Y/st)),U=[(X[0]+ot[0])/2,(X[1]+ot[1])/2],$=[(rt[0]+at[0])/2,(rt[1]+at[1])/2]}else if(O.touch0)U=O.touch0[0],$=O.touch0[1];else return;O.zoom("touch",r(b(P,U,$),O.extent,s))}}function C(S,...M){if(this.__zooming){var O=w(this,M).event(S),L=S.changedTouches,B=L.length,k,P;for(K2(S),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),k=0;k<B;++k)P=L[k],O.touch0&&O.touch0[2]===P.identifier?delete O.touch0:O.touch1&&O.touch1[2]===P.identifier&&delete O.touch1;if(O.touch1&&!O.touch0&&(O.touch0=O.touch1,delete O.touch1),O.touch0)O.touch0[1]=this.__zoom.invert(O.touch0[0]);else if(O.end(),O.taps===2&&(P=an(P,this),Math.hypot(f[0]-P[0],f[1]-P[1])<y)){var U=Qt(this).on("dblclick.zoom");U&&U.apply(this,arguments)}}}return g.wheelDelta=function(S){return arguments.length?(n=typeof S=="function"?S:Ug(+S),g):n},g.filter=function(S){return arguments.length?(e=typeof S=="function"?S:Ug(!!S),g):e},g.touchable=function(S){return arguments.length?(i=typeof S=="function"?S:Ug(!!S),g):i},g.extent=function(S){return arguments.length?(t=typeof S=="function"?S:Ug([[+S[0][0],+S[0][1]],[+S[1][0],+S[1][1]]]),g):t},g.scaleExtent=function(S){return arguments.length?(o[0]=+S[0],o[1]=+S[1],g):[o[0],o[1]]},g.translateExtent=function(S){return arguments.length?(s[0][0]=+S[0][0],s[1][0]=+S[1][0],s[0][1]=+S[0][1],s[1][1]=+S[1][1],g):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},g.constrain=function(S){return arguments.length?(r=S,g):r},g.duration=function(S){return arguments.length?(a=+S,g):a},g.interpolate=function(S){return arguments.length?(c=S,g):c},g.on=function(){var S=l.on.apply(l,arguments);return S===l?g:S},g.clickDistance=function(S){return arguments.length?(m=(S=+S)*S,g):Math.sqrt(m)},g.tapDistance=function(S){return arguments.length?(y=+S,g):y},g}function Pe(e){return e!=null&&!Number.isNaN(e)}function Cr(e,t){return+Pe(t)-+Pe(e)||Ft(e,t)}function Qu(e,t){return+Pe(t)-+Pe(e)||vn(e,t)}function zg(e){return e!=null&&`${e}`!=""}function hh(e){return isFinite(e)?e:NaN}function Fn(e){return e>0&&isFinite(e)?e:NaN}function tl(e){return e<0&&isFinite(e)?e:NaN}function ph(e,t){if(e instanceof Date||(e=new Date(+e)),isNaN(e))return typeof t=="function"?t(e):t;let r=e.getUTCHours(),n=e.getUTCMinutes(),i=e.getUTCSeconds(),o=e.getUTCMilliseconds();return`${knt(e.getUTCFullYear(),4)}-${Wa(e.getUTCMonth()+1,2)}-${Wa(e.getUTCDate(),2)}${r||n||i||o?`T${Wa(r,2)}:${Wa(n,2)}${i||o?`:${Wa(i,2)}${o?`.${Wa(o,3)}`:""}`:""}Z`:""}`}function knt(e){return e<0?`-${Wa(-e,6)}`:e>9999?`+${Wa(e,6)}`:Wa(e,4)}function Wa(e,t){return`${e}`.padStart(t,"0")}var Bnt=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function jg(e,t){return Bnt.test(e+="")?new Date(e):typeof t=="function"?t(e):t}function Ga(e){if(e==null)return;let t=e[0],r=e[e.length-1];return vn(t,r)}var yh=1e3,rl=yh*60,nl=rl*60,ws=nl*24,_s=ws*7,Zu=ws*30,el=ws*365,c4=[["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",yh],["5 seconds",5*yh],["15 seconds",15*yh],["30 seconds",30*yh],["minute",rl],["5 minutes",5*rl],["15 minutes",15*rl],["30 minutes",30*rl],["hour",nl],["3 hours",3*nl],["6 hours",6*nl],["12 hours",12*nl],["day",ws],["2 days",2*ws],["week",_s],["2 weeks",2*_s],["month",Zu],["3 months",3*Zu],["6 months",6*Zu],["year",el],["2 years",2*el],["5 years",5*el],["10 years",10*el],["20 years",20*el],["50 years",50*el],["100 years",100*el]],l4=new Map([["second",yh],["minute",rl],["hour",nl],["day",ws],["monday",_s],["tuesday",_s],["wednesday",_s],["thursday",_s],["friday",_s],["saturday",_s],["sunday",_s],["week",_s],["month",Zu],["year",el]]),n$=new Map([["second",Lr],["minute",Pa],["hour",$a],["day",Gi],["monday",Kc],["tuesday",yv],["wednesday",gv],["thursday",gs],["friday",xv],["saturday",bv],["sunday",mi],["week",mi],["month",ja],["year",dn]]),u4=new Map([["second",Lr],["minute",Ua],["hour",za],["day",Wu],["monday",Jc],["tuesday",_v],["wednesday",wv],["thursday",xs],["friday",vv],["saturday",Sv],["sunday",yi],["week",yi],["month",qa],["year",hn]]),gh=Symbol("intervalDuration"),tS=Symbol("intervalType");for(let[e,t]of n$)t[gh]=l4.get(e),t[tS]="time";for(let[e,t]of u4)t[gh]=l4.get(e),t[tS]="utc";var qg=[["year",hn,"utc"],["month",qa,"utc"],["day",Wu,"utc",6*Zu],["hour",za,"utc",3*ws],["minute",Ua,"utc",6*nl],["second",Lr,"utc",30*rl]],J2=[["year",dn,"time"],["month",ja,"time"],["day",Gi,"time",6*Zu],["hour",$a,"time",3*ws],["minute",Pa,"time",6*nl],["second",Lr,"time",30*rl]],Pnt=[qg[0],J2[0],qg[1],J2[1],qg[2],J2[2],...qg.slice(3)];function eS(e){let t=`${e}`.toLowerCase();t.endsWith("s")&&(t=t.slice(0,-1));let r=1,n=/^(?:(\d+)\s+)/.exec(t);switch(n&&(t=t.slice(n[0].length),r=+n[1]),t){case"quarter":t="month",r*=3;break;case"half":t="month",r*=6;break}let i=u4.get(t);if(!i)throw new Error(`unknown interval: ${e}`);if(r>1&&!i.every)throw new Error(`non-periodic interval: ${t}`);return[t,r]}function Vg(e){return i$(eS(e),"time")}function Ku(e){return i$(eS(e),"utc")}function i$([e,t],r){let n=(r==="time"?n$:u4).get(e);return t>1&&(n=n.every(t),n[gh]=l4.get(e)*t,n[tS]=r),n}function f4(e,t){if(!(t>1))return;let r=e[gh];if(!c4.some(([,i])=>i===r)||r%ws===0&&ws<r&&r<Zu)return;let[n]=c4[To(([,i])=>Math.log(i)).center(c4,Math.log(r*t))];return(e[tS]==="time"?Vg:Ku)(n)}function r$(e,t,r){let n=t==="time"?nh:bs;if(r==null)return n(e==="year"?"%Y":e==="month"?"%Y-%m":e==="day"?"%Y-%m-%d":e==="hour"||e==="minute"?"%Y-%m-%dT%H:%M":e==="second"?"%Y-%m-%dT%H:%M:%S":"%Y-%m-%dT%H:%M:%S.%L");let i=Unt(r);switch(e){case"millisecond":return mh(n(".%L"),n(":%M:%S"),i);case"second":return mh(n(":%S"),n("%-I:%M"),i);case"minute":return mh(n("%-I:%M"),n("%p"),i);case"hour":return mh(n("%-I %p"),n("%b %-d"),i);case"day":return mh(n("%-d"),n("%b"),i);case"month":return mh(n("%b"),n("%Y"),i);case"year":return n("%Y")}throw new Error("unable to format time ticks")}function Unt(e){return e==="left"||e==="right"?(t,r)=>`
11
+ ]`}concat(...t){let r=this.schema,n=this.data.concat(t.flatMap(({data:i})=>i));return new e(r,n.map(i=>new He(r,i)))}slice(t,r){let n=this.schema;[t,r]=Im({length:this.numRows},t,r);let i=r_(this.data,this._offsets,t,r);return new e(n,i.map(o=>new He(n,o)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(r=>r.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let r=this.data.map(n=>n.children[t]);if(r.length===0){let{type:n}=this.schema.fields[t],i=Dt({type:n,length:0,nullCount:0});r.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new Gt(r)}return null}setChild(t,r){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),r)}setChildAt(t,r){let n=this.schema,i=[...this.batches];if(t>-1&&t<this.numCols){r||(r=new Gt([Dt({type:new bn,length:this.numRows})]));let o=n.fields.slice(),s=o[t].clone({type:r.type}),a=this.schema.fields.map((c,l)=>this.getChildAt(l));[o[t],a[t]]=[s,r],[n,i]=O_(n,a)}return new e(n,i)}select(t){let r=this.schema.fields.reduce((n,i,o)=>n.set(i.name,o),new Map);return this.selectAt(t.map(n=>r.get(n)).filter(n=>n>-1))}selectAt(t){let r=this.schema.selectAt(t),n=this.batches.map(i=>i.selectAt(t));return new e(r,n)}assign(t){let r=this.schema.fields,[n,i]=t.schema.fields.reduce((a,c,l)=>{let[u,f]=a,d=r.findIndex(h=>h.name===c.name);return~d?f[d]=l:u.push(l),a},[[],[]]),o=this.schema.assign(t.schema),s=[...r.map((a,c)=>[c,i[c]]).map(([a,c])=>c===void 0?this.getChildAt(a):t.getChildAt(c)),...n.map(a=>t.getChildAt(a))].filter(Boolean);return new e(...O_(o,s))}};$B=Symbol.toStringTag;wn[$B]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e.isValid=sd(Em),e.get=sd(sr.getVisitFn(D.Struct)),e.set=n_(Vr.getVisitFn(D.Struct)),e.indexOf=i_(au.getVisitFn(D.Struct)),"Table"))(wn.prototype);var jB,He=class e{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof me))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=Dt({nullCount:0,type:new Re(this.schema.fields),children:this.schema.fields.map(r=>Dt({type:r.type,nullCount:0}))})]=t,!(this.data instanceof ae))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=zB(this.schema,this.data.children);break}case 1:{let[r]=t,{fields:n,children:i,length:o}=Object.keys(r).reduce((c,l,u)=>(c.children[u]=r[l],c.length=Math.max(c.length,r[l].length),c.fields[u]=jt.new({name:l,type:r[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),s=new me(n),a=Dt({type:new Re(n),length:o,children:i,nullCount:0});[this.schema,this.data]=zB(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=qB(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 sr.visit(this.data,t)}at(t){return this.get(nu(t,this.numRows))}set(t,r){return Vr.visit(this.data,t,r)}indexOf(t,r){return au.visit(this.data,t,r)}[Symbol.iterator](){return ad.visit(new Gt([this.data]))}toArray(){return[...this]}concat(...t){return new wn(this.schema,[this,...t])}slice(t,r){let[n]=new Gt([this.data]).slice(t,r).data;return new e(this.schema,n)}getChild(t){var r;return this.getChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new Gt([this.data.children[t]]):null}setChild(t,r){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),r)}setChildAt(t,r){let n=this.schema,i=this.data;if(t>-1&&t<this.numCols){r||(r=new Gt([Dt({type:new bn,length:this.numRows})]));let o=n.fields.slice(),s=i.children.slice(),a=o[t].clone({type:r.type});[o[t],s[t]]=[a,r.data[0]],n=new me(o,new Map(this.schema.metadata)),i=Dt({type:new Re(o),children:s})}return new e(n,i)}select(t){let r=this.schema.select(t),n=new Re(r.fields),i=[];for(let o of t){let s=this.schema.fields.findIndex(a=>a.name===o);~s&&(i[s]=this.data.children[s])}return new e(r,Dt({type:n,length:this.numRows,children:i}))}selectAt(t){let r=this.schema.selectAt(t),n=t.map(o=>this.data.children[o]).filter(Boolean),i=Dt({type:new Re(r.fields),length:this.numRows,children:n});return new e(r,i)}};jB=Symbol.toStringTag;He[jB]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(He.prototype);function zB(e,t,r=t.reduce((n,i)=>Math.max(n,i.length),0)){var n;let i=[...e.fields],o=[...t],s=(r+63&-64)>>3;for(let[a,c]of e.fields.entries()){let l=t[a];(!l||l.length!==r)&&(i[a]=c.clone({nullable:!0}),o[a]=(n=l?._changeLengthAndBackfillNullBitmap(r))!==null&&n!==void 0?n:Dt({type:c.type,length:r,nullCount:r,nullBitmap:new Uint8Array(s)}))}return[e.assign(i),Dt({type:new Re(i),length:r,children:o})]}function qB(e,t,r=new Map){var n,i;if(((n=e?.length)!==null&&n!==void 0?n:0)>0&&e?.length===t?.length)for(let o=-1,s=e.length;++o<s;){let{type:a}=e[o],c=t[o];for(let l of[c,...((i=c?.dictionary)===null||i===void 0?void 0:i.data)||[]])qB(a.children,l?.children,r);if(K.isDictionary(a)){let{id:l}=a;if(!r.has(l))c?.dictionary&&r.set(l,c.dictionary);else if(r.get(l)!==c.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return r}var yu=class extends He{constructor(t){let r=t.fields.map(i=>Dt({type:i.type})),n=Dt({type:new Re(t.fields),nullCount:0,children:r});super(t,n)}};var So=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsMessage(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):he.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):Vt.NONE}header(t){let r=this.bb.__offset(this.bb_pos,8);return r?this.bb.__union(t,this.bb_pos+r):null}bodyLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,12);return n?(r||new br).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,r){t.addFieldInt16(0,r,he.V1)}static addHeaderType(t,r){t.addFieldInt8(1,r,Vt.NONE)}static addHeader(t,r){t.addFieldOffset(2,r,0)}static addBodyLength(t,r){t.addFieldInt64(3,r,BigInt("0"))}static addCustomMetadata(t,r){t.addFieldOffset(4,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,r){t.finish(r)}static finishSizePrefixedMessageBuffer(t,r){t.finish(r,void 0,!0)}static createMessage(t,r,n,i,o,s){return e.startMessage(t),e.addVersion(t,r),e.addHeaderType(t,n),e.addHeader(t,i),e.addBodyLength(t,o),e.addCustomMetadata(t,s),e.endMessage(t)}};var kE=class extends mt{visit(t,r){return t==null||r==null?void 0:super.visit(t,r)}visitNull(t,r){return xm.startNull(r),xm.endNull(r)}visitInt(t,r){return ho.startInt(r),ho.addBitWidth(r,t.bitWidth),ho.addIsSigned(r,t.isSigned),ho.endInt(r)}visitFloat(t,r){return Mc.startFloatingPoint(r),Mc.addPrecision(r,t.precision),Mc.endFloatingPoint(r)}visitBinary(t,r){return hm.startBinary(r),hm.endBinary(r)}visitLargeBinary(t,r){return mm.startLargeBinary(r),mm.endLargeBinary(r)}visitBool(t,r){return pm.startBool(r),pm.endBool(r)}visitUtf8(t,r){return _m.startUtf8(r),_m.endUtf8(r)}visitLargeUtf8(t,r){return ym.startLargeUtf8(r),ym.endLargeUtf8(r)}visitDecimal(t,r){return Xo.startDecimal(r),Xo.addScale(r,t.scale),Xo.addPrecision(r,t.precision),Xo.addBitWidth(r,t.bitWidth),Xo.endDecimal(r)}visitDate(t,r){return Ic.startDate(r),Ic.addUnit(r,t.unit),Ic.endDate(r)}visitTime(t,r){return Ks.startTime(r),Ks.addUnit(r,t.unit),Ks.addBitWidth(r,t.bitWidth),Ks.endTime(r)}visitTimestamp(t,r){let n=t.timezone&&r.createString(t.timezone)||void 0;return Js.startTimestamp(r),Js.addUnit(r,t.unit),n!==void 0&&Js.addTimezone(r,n),Js.endTimestamp(r)}visitInterval(t,r){return Nc.startInterval(r),Nc.addUnit(r,t.unit),Nc.endInterval(r)}visitDuration(t,r){return Tc.startDuration(r),Tc.addUnit(r,t.unit),Tc.endDuration(r)}visitList(t,r){return gm.startList(r),gm.endList(r)}visitStruct(t,r){return bm.startStruct_(r),bm.endStruct_(r)}visitUnion(t,r){po.startTypeIdsVector(r,t.typeIds.length);let n=po.createTypeIdsVector(r,t.typeIds);return po.startUnion(r),po.addMode(r,t.mode),po.addTypeIds(r,n),po.endUnion(r)}visitDictionary(t,r){let n=this.visit(t.indices,r);return Go.startDictionaryEncoding(r),Go.addId(r,BigInt(t.id)),Go.addIsOrdered(r,t.isOrdered),n!==void 0&&Go.addIndexType(r,n),Go.endDictionaryEncoding(r)}visitFixedSizeBinary(t,r){return Ac.startFixedSizeBinary(r),Ac.addByteWidth(r,t.byteWidth),Ac.endFixedSizeBinary(r)}visitFixedSizeList(t,r){return Ec.startFixedSizeList(r),Ec.addListSize(r,t.listSize),Ec.endFixedSizeList(r)}visitMap(t,r){return Oc.startMap(r),Oc.addKeysSorted(r,t.keysSorted),Oc.endMap(r)}},R_=new kE;function GB(e,t=new Map){return new me(fQ(e,t),D_(e.metadata),t)}function BE(e){return new Yr(e.count,HB(e.columns),QB(e.columns))}function XB(e){return new Wn(BE(e.data),e.id,e.isDelta)}function fQ(e,t){return(e.fields||[]).filter(Boolean).map(r=>jt.fromJSON(r,t))}function VB(e,t){return(e.children||[]).filter(Boolean).map(r=>jt.fromJSON(r,t))}function HB(e){return(e||[]).reduce((t,r)=>[...t,new $i(r.count,dQ(r.VALIDITY)),...HB(r.children)],[])}function QB(e,t=[]){for(let r=-1,n=(e||[]).length;++r<n;){let i=e[r];i.VALIDITY&&t.push(new Yn(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new Yn(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new Yn(t.length,i.OFFSET.length)),i.DATA&&t.push(new Yn(t.length,i.DATA.length)),t=QB(i.children,t)}return t}function dQ(e){return(e||[]).reduce((t,r)=>t+ +(r===0),0)}function ZB(e,t){let r,n,i,o,s,a;return!t||!(o=e.dictionary)?(s=WB(e,VB(e,t)),i=new jt(e.name,s,e.nullable,D_(e.metadata))):t.has(r=o.id)?(n=(n=o.indexType)?YB(n):new Ho,a=new li(t.get(r),n,r,o.isOrdered),i=new jt(e.name,a,e.nullable,D_(e.metadata))):(n=(n=o.indexType)?YB(n):new Ho,t.set(r,s=WB(e,VB(e,t))),a=new li(s,n,r,o.isOrdered),i=new jt(e.name,a,e.nullable,D_(e.metadata))),i||null}function D_(e=[]){return new Map(e.map(({key:t,value:r})=>[t,r]))}function YB(e){return new _r(e.isSigned,e.bitWidth)}function WB(e,t){let r=e.type.name;switch(r){case"NONE":return new bn;case"null":return new bn;case"binary":return new ta;case"largebinary":return new ea;case"utf8":return new ra;case"largeutf8":return new na;case"bool":return new ia;case"list":return new go((t||[])[0]);case"struct":return new Re(t||[]);case"struct_":return new Re(t||[])}switch(r){case"int":{let n=e.type;return new _r(n.isSigned,n.bitWidth)}case"floatingpoint":{let n=e.type;return new Bi(be[n.precision])}case"decimal":{let n=e.type;return new oa(n.scale,n.precision,n.bitWidth)}case"date":{let n=e.type;return new sa(Xe[n.unit])}case"time":{let n=e.type;return new aa(ct[n.unit],n.bitWidth)}case"timestamp":{let n=e.type;return new ca(ct[n.unit],n.timezone)}case"interval":{let n=e.type;return new la(xr[n.unit])}case"duration":{let n=e.type;return new ua(ct[n.unit])}case"union":{let n=e.type,[i,...o]=(n.mode+"").toLowerCase(),s=i.toUpperCase()+o.join("");return new xo(Se[s],n.typeIds||[],t||[])}case"fixedsizebinary":{let n=e.type;return new fa(n.byteWidth)}case"fixedsizelist":{let n=e.type;return new bo(n.listSize,(t||[])[0])}case"map":{let n=e.type;return new _o((t||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${r}"`)}var hQ=ru,pQ=ai,Gn=class e{static fromJSON(t,r){let n=new e(0,he.V5,r);return n._createHeader=mQ(t,r),n}static decode(t){t=new pQ(It(t));let r=So.getRootAsMessage(t),n=r.bodyLength(),i=r.version(),o=r.headerType(),s=new e(n,i,o);return s._createHeader=yQ(r,o),s}static encode(t){let r=new hQ,n=-1;return t.isSchema()?n=me.encode(r,t.header()):t.isRecordBatch()?n=Yr.encode(r,t.header()):t.isDictionaryBatch()&&(n=Wn.encode(r,t.header())),So.startMessage(r),So.addVersion(r,he.V5),So.addHeader(r,n),So.addHeaderType(r,t.headerType),So.addBodyLength(r,BigInt(t.bodyLength)),So.finishMessageBuffer(r,So.endMessage(r)),r.asUint8Array()}static from(t,r=0){if(t instanceof me)return new e(0,he.V5,Vt.Schema,t);if(t instanceof Yr)return new e(r,he.V5,Vt.RecordBatch,t);if(t instanceof Wn)return new e(r,he.V5,Vt.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===Vt.Schema}isRecordBatch(){return this.headerType===Vt.RecordBatch}isDictionaryBatch(){return this.headerType===Vt.DictionaryBatch}constructor(t,r,n,i){this._version=r,this._headerType=n,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=re(t)}},Yr=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,r,n){this._nodes=r,this._buffers=n,this._length=re(t)}},Wn=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,r,n=!1){this._data=t,this._isDelta=n,this._id=re(r)}},Yn=class{constructor(t,r){this.offset=re(t),this.length=re(r)}},$i=class{constructor(t,r){this.length=re(t),this.nullCount=re(r)}};function mQ(e,t){return()=>{switch(t){case Vt.Schema:return me.fromJSON(e);case Vt.RecordBatch:return Yr.fromJSON(e);case Vt.DictionaryBatch:return Wn.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${Vt[t]}, type: ${t} }`)}}function yQ(e,t){return()=>{switch(t){case Vt.Schema:return me.decode(e.header(new qn),new Map,e.version());case Vt.RecordBatch:return Yr.decode(e.header(new ci),e.version());case Vt.DictionaryBatch:return Wn.decode(e.header(new Zs),e.version())}throw new Error(`Unrecognized Message type: { name: ${Vt[t]}, type: ${t} }`)}}jt.encode=EQ;jt.decode=TQ;jt.fromJSON=ZB;me.encode=AQ;me.decode=gQ;me.fromJSON=GB;Yr.encode=MQ;Yr.decode=xQ;Yr.fromJSON=BE;Wn.encode=NQ;Wn.decode=bQ;Wn.fromJSON=XB;$i.encode=OQ;$i.decode=wQ;Yn.encode=RQ;Yn.decode=_Q;function gQ(e,t=new Map,r=he.V5){let n=IQ(e,t);return new me(n,L_(e),t,r)}function xQ(e,t=he.V5){if(e.compression()!==null)throw new Error("Record batch compression not implemented");return new Yr(e.length(),vQ(e),SQ(e,t))}function bQ(e,t=he.V5){return new Wn(Yr.decode(e.data(),t),e.id(),e.isDelta())}function _Q(e){return new Yn(e.offset(),e.length())}function wQ(e){return new $i(e.length(),e.nullCount())}function vQ(e){let t=[];for(let r,n=-1,i=-1,o=e.nodesLength();++n<o;)(r=e.nodes(n))&&(t[++i]=$i.decode(r));return t}function SQ(e,t){let r=[];for(let n,i=-1,o=-1,s=e.buffersLength();++i<s;)(n=e.buffers(i))&&(t<he.V4&&(n.bb_pos+=8*(i+1)),r[++o]=Yn.decode(n));return r}function IQ(e,t){let r=[];for(let n,i=-1,o=-1,s=e.fieldsLength();++i<s;)(n=e.fields(i))&&(r[++o]=jt.decode(n,t));return r}function KB(e,t){let r=[];for(let n,i=-1,o=-1,s=e.childrenLength();++i<s;)(n=e.children(i))&&(r[++o]=jt.decode(n,t));return r}function TQ(e,t){let r,n,i,o,s,a;return!t||!(a=e.dictionary())?(i=t5(e,KB(e,t)),n=new jt(e.name(),i,e.nullable(),L_(e))):t.has(r=re(a.id()))?(o=(o=a.indexType())?JB(o):new Ho,s=new li(t.get(r),o,r,a.isOrdered()),n=new jt(e.name(),s,e.nullable(),L_(e))):(o=(o=a.indexType())?JB(o):new Ho,t.set(r,i=t5(e,KB(e,t))),s=new li(i,o,r,a.isOrdered()),n=new jt(e.name(),s,e.nullable(),L_(e))),n||null}function L_(e){let t=new Map;if(e)for(let r,n,i=-1,o=Math.trunc(e.customMetadataLength());++i<o;)(r=e.customMetadata(i))&&(n=r.key())!=null&&t.set(n,r.value());return t}function JB(e){return new _r(e.isSigned(),e.bitWidth())}function t5(e,t){let r=e.typeType();switch(r){case Ie.NONE:return new bn;case Ie.Null:return new bn;case Ie.Binary:return new ta;case Ie.LargeBinary:return new ea;case Ie.Utf8:return new ra;case Ie.LargeUtf8:return new na;case Ie.Bool:return new ia;case Ie.List:return new go((t||[])[0]);case Ie.Struct_:return new Re(t||[])}switch(r){case Ie.Int:{let n=e.type(new ho);return new _r(n.isSigned(),n.bitWidth())}case Ie.FloatingPoint:{let n=e.type(new Mc);return new Bi(n.precision())}case Ie.Decimal:{let n=e.type(new Xo);return new oa(n.scale(),n.precision(),n.bitWidth())}case Ie.Date:{let n=e.type(new Ic);return new sa(n.unit())}case Ie.Time:{let n=e.type(new Ks);return new aa(n.unit(),n.bitWidth())}case Ie.Timestamp:{let n=e.type(new Js);return new ca(n.unit(),n.timezone())}case Ie.Interval:{let n=e.type(new Nc);return new la(n.unit())}case Ie.Duration:{let n=e.type(new Tc);return new ua(n.unit())}case Ie.Union:{let n=e.type(new po);return new xo(n.mode(),n.typeIdsArray()||[],t||[])}case Ie.FixedSizeBinary:{let n=e.type(new Ac);return new fa(n.byteWidth())}case Ie.FixedSizeList:{let n=e.type(new Ec);return new bo(n.listSize(),(t||[])[0])}case Ie.Map:{let n=e.type(new Oc);return new _o((t||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${Ie[r]}" (${r})`)}function AQ(e,t){let r=t.fields.map(o=>jt.encode(e,o));qn.startFieldsVector(e,r.length);let n=qn.createFieldsVector(e,r),i=t.metadata&&t.metadata.size>0?qn.createCustomMetadataVector(e,[...t.metadata].map(([o,s])=>{let a=e.createString(`${o}`),c=e.createString(`${s}`);return br.startKeyValue(e),br.addKey(e,a),br.addValue(e,c),br.endKeyValue(e)})):-1;return qn.startSchema(e),qn.addFields(e,n),qn.addEndianness(e,DQ?Sc.Little:Sc.Big),i!==-1&&qn.addCustomMetadata(e,i),qn.endSchema(e)}function EQ(e,t){let r=-1,n=-1,i=-1,o=t.type,s=t.typeId;K.isDictionary(o)?(s=o.dictionary.typeId,i=R_.visit(o,e),n=R_.visit(o.dictionary,e)):n=R_.visit(o,e);let a=(o.children||[]).map(u=>jt.encode(e,u)),c=sn.createChildrenVector(e,a),l=t.metadata&&t.metadata.size>0?sn.createCustomMetadataVector(e,[...t.metadata].map(([u,f])=>{let d=e.createString(`${u}`),h=e.createString(`${f}`);return br.startKeyValue(e),br.addKey(e,d),br.addValue(e,h),br.endKeyValue(e)})):-1;return t.name&&(r=e.createString(t.name)),sn.startField(e),sn.addType(e,n),sn.addTypeType(e,s),sn.addChildren(e,c),sn.addNullable(e,!!t.nullable),r!==-1&&sn.addName(e,r),i!==-1&&sn.addDictionary(e,i),l!==-1&&sn.addCustomMetadata(e,l),sn.endField(e)}function MQ(e,t){let r=t.nodes||[],n=t.buffers||[];ci.startNodesVector(e,r.length);for(let s of r.slice().reverse())$i.encode(e,s);let i=e.endVector();ci.startBuffersVector(e,n.length);for(let s of n.slice().reverse())Yn.encode(e,s);let o=e.endVector();return ci.startRecordBatch(e),ci.addLength(e,BigInt(t.length)),ci.addNodes(e,i),ci.addBuffers(e,o),ci.endRecordBatch(e)}function NQ(e,t){let r=Yr.encode(e,t.data);return Zs.startDictionaryBatch(e),Zs.addId(e,BigInt(t.id)),Zs.addIsDelta(e,t.isDelta),Zs.addData(e,r),Zs.endDictionaryBatch(e)}function OQ(e,t){return Zf.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function RQ(e,t){return Qf.createBuffer(e,BigInt(t.offset),BigInt(t.length))}var DQ=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})();var UE=e=>`Expected ${Vt[e]} Message in stream, but was null or length 0.`,$E=e=>`Header pointer of flatbuffer-encoded ${Vt[e]} Message is null or length 0.`,e5=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,r5=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,md=class{constructor(t){this.source=t instanceof Ko?t:new Ko(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?De:t.value===-1&&(t=this.readMetadataLength()).done?De:(t=this.readMetadata(t.value)).done?De:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let r;if((r=this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(UE(t));return r.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let r=It(this.source.read(t));if(r.byteLength<t)throw new Error(r5(t,r.byteLength));return r.byteOffset%8===0&&r.byteOffset+r.byteLength<=r.buffer.byteLength?r:r.slice()}readSchema(t=!1){let r=Vt.Schema,n=this.readMessage(r),i=n?.header();if(t&&!i)throw new Error($E(r));return i}readMetadataLength(){let t=this.source.read(F_),r=t&&new ai(t),n=r?.readInt32(0)||0;return{done:n===0,value:n}}readMetadata(t){let r=this.source.read(t);if(!r)return De;if(r.byteLength<t)throw new Error(e5(t,r.byteLength));return{done:!1,value:Gn.decode(r)}}},ry=class{constructor(t,r){this.source=t instanceof Pi?t:h1(t)?new Cc(t,r):new Pi(t)}[Symbol.asyncIterator](){return this}next(){return Q(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?De:t.value===-1&&(t=yield this.readMetadataLength()).done?De:(t=yield this.readMetadata(t.value)).done?De:t})}throw(t){return Q(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return Q(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return Q(this,void 0,void 0,function*(){let r;if((r=yield this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(UE(t));return r.value})}readMessageBody(t){return Q(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let r=It(yield this.source.read(t));if(r.byteLength<t)throw new Error(r5(t,r.byteLength));return r.byteOffset%8===0&&r.byteOffset+r.byteLength<=r.buffer.byteLength?r:r.slice()})}readSchema(){return Q(this,arguments,void 0,function*(t=!1){let r=Vt.Schema,n=yield this.readMessage(r),i=n?.header();if(t&&!i)throw new Error($E(r));return i})}readMetadataLength(){return Q(this,void 0,void 0,function*(){let t=yield this.source.read(F_),r=t&&new ai(t),n=r?.readInt32(0)||0;return{done:n===0,value:n}})}readMetadata(t){return Q(this,void 0,void 0,function*(){let r=yield this.source.read(t);if(!r)return De;if(r.byteLength<t)throw new Error(e5(t,r.byteLength));return{done:!1,value:Gn.decode(r)}})}},ny=class extends md{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof Mm?t:new Mm(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:Gn.fromJSON(t.schema,Vt.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let r=t.dictionaries[this._dictionaryIndex++];return this._body=r.data.columns,{done:!1,value:Gn.fromJSON(r,Vt.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let r=t.batches[this._batchIndex++];return this._body=r.columns,{done:!1,value:Gn.fromJSON(r,Vt.RecordBatch)}}return this._body=[],De}readMessageBody(t){return r(this._body);function r(n){return(n||[]).reduce((i,o)=>[...i,...o.VALIDITY&&[o.VALIDITY]||[],...o.TYPE_ID&&[o.TYPE_ID]||[],...o.OFFSET&&[o.OFFSET]||[],...o.DATA&&[o.DATA]||[],...r(o.children)],[])}}readMessage(t){let r;if((r=this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(UE(t));return r.value}readSchema(){let t=Vt.Schema,r=this.readMessage(t),n=r?.header();if(!r||!n)throw new Error($E(t));return n}},F_=4,PE="ARROW1",yd=new Uint8Array(PE.length);for(let e=0;e<PE.length;e+=1)yd[e]=PE.codePointAt(e);function C_(e,t=0){for(let r=-1,n=yd.length;++r<n;)if(yd[r]!==e[t+r])return!1;return!0}var gd=yd.length,zE=gd+F_,n5=gd*2+F_;var Wr=class e extends lu{constructor(t){super(),this._impl=t}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(t){return this._impl.throw(t)}return(t){return this._impl.return(t)}cancel(){return this._impl.cancel()}reset(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}open(t){let r=this._impl.open(t);return co(r)?r.then(()=>this):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return qr.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return qr.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,r){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof e?t:f1(t)?FQ(t):h1(t)?BQ(t):co(t)?Q(this,void 0,void 0,function*(){return yield e.from(yield t)}):p1(t)||am(t)||y1(t)||Fi(t)?kQ(new Pi(t)):CQ(new Ko(t))}static readAll(t){return t instanceof e?t.isSync()?i5(t):o5(t):f1(t)||ArrayBuffer.isView(t)||lo(t)||d1(t)?i5(t):o5(t)}},ts=class extends Wr{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return oi(this,arguments,function*(){yield Ut(yield*Xf(ao(this[Symbol.iterator]())))})}},kc=class extends Wr{constructor(t){super(t),this._impl=t}readAll(){return Q(this,void 0,void 0,function*(){var t,r,n,i;let o=new Array;try{for(var s=!0,a=ao(this),c;c=yield a.next(),t=c.done,!t;s=!0){i=c.value,s=!1;let l=i;o.push(l)}}catch(l){r={error:l}}finally{try{!s&&!t&&(n=a.return)&&(yield n.call(a))}finally{if(r)throw r.error}}return o})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},Bc=class extends ts{constructor(t){super(t),this._impl=t}},iy=class extends kc{constructor(t){super(t),this._impl=t}},k_=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,r){let n=this._loadVectors(t,r,this.schema.fields),i=Dt({type:new Re(this.schema.fields),length:t.length,children:n});return new He(this.schema,i)}_loadDictionaryBatch(t,r){let{id:n,isDelta:i}=t,{dictionaries:o,schema:s}=this,a=o.get(n),c=s.dictionaries.get(n),l=this._loadVectors(t.data,r,[c]);return(a&&i?a.concat(new Gt(l)):new Gt(l)).memoize()}_loadVectors(t,r,n){return new Dm(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}},xd=class extends k_{constructor(t,r){super(r),this._reader=f1(t)?new ny(this._handle=t):new md(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=s5(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):De}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):De}next(){if(this.closed)return De;let t,{_reader:r}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=r.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=r.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new yu(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},bd=class extends k_{constructor(t,r){super(r),this._reader=new ry(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return Q(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 Q(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=s5(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return Q(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):De})}return(t){return Q(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):De})}next(){return Q(this,void 0,void 0,function*(){if(this.closed)return De;let t,{_reader:r}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=yield r.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=yield r.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new yu(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return Q(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},B_=class extends xd{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,r){super(t instanceof Nm?t:new Nm(t),r)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let r of this._footer.dictionaryBatches())r&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var r;if(this.closed)return null;this._footer||this.open();let n=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(Vt.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s)}}return null}_readDictionaryBatch(t){var r;let n=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(Vt.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}}_readFooter(){let{_handle:t}=this,r=t.size-zE,n=t.readInt32(r),i=t.readAt(r-n,n);return pa.decode(i)}_readNextMessageAndValidate(t){var r;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let n=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(this._recordBatchIndex);if(n&&this._handle.seek(n.offset))return this._reader.readMessage(t)}return null}},jE=class extends bd{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,...r){let n=typeof r[0]!="number"?r.shift():void 0,i=r[0]instanceof Map?r.shift():void 0;super(t instanceof Cc?t:new Cc(t,n),i)}isFile(){return!0}isAsync(){return!0}open(t){let r=Object.create(null,{open:{get:()=>super.open}});return Q(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let n of this._footer.dictionaryBatches())n&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield r.open.call(this,t)})}readRecordBatch(t){return Q(this,void 0,void 0,function*(){var r;if(this.closed)return null;this._footer||(yield this.open());let n=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(Vt.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s)}}return null})}_readDictionaryBatch(t){return Q(this,void 0,void 0,function*(){var r;let n=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(Vt.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 Q(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let r=t.size-zE,n=yield t.readInt32(r),i=yield t.readAt(r-n,n);return pa.decode(i)})}_readNextMessageAndValidate(t){return Q(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let r=this._footer.getRecordBatch(this._recordBatchIndex);if(r&&(yield this._handle.seek(r.offset)))return yield this._reader.readMessage(t)}return null})}},qE=class extends xd{constructor(t,r){super(t,r)}_loadVectors(t,r,n){return new c_(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}};function s5(e,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:e.autoDestroy}function*i5(e){let t=Wr.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function o5(e){return oi(this,arguments,function*(){let r=yield Ut(Wr.from(e));try{if(!(yield Ut(r.open({autoDestroy:!1}))).closed)do yield yield Ut(r);while(!(yield Ut(r.reset().open())).closed)}finally{yield Ut(r.cancel())}})}function FQ(e){return new ts(new qE(e))}function CQ(e){let t=e.peek(gd+7&-8);return t&&t.byteLength>=4?C_(t)?new Bc(new B_(e.read())):new ts(new xd(e)):new ts(new xd(function*(){}()))}function kQ(e){return Q(this,void 0,void 0,function*(){let t=yield e.peek(gd+7&-8);return t&&t.byteLength>=4?C_(t)?new Bc(new B_(yield e.read())):new kc(new bd(e)):new kc(new bd(function(){return oi(this,arguments,function*(){})}()))})}function BQ(e){return Q(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),r=new Cc(e,t);return t>=n5&&C_(yield r.readAt(0,gd+7&-8))?new iy(new jE(r)):new kc(new bd(r))})}var ke=class e extends mt{static assemble(...t){let r=i=>i.flatMap(o=>Array.isArray(o)?r(o):o instanceof He?o.data.children:o.data),n=new e;return n.visitMany(r(t)),n}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof Gt)return this.visitMany(t.data),this;let{type:r}=t;if(!K.isDictionary(r)){let{length:n}=t;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(K.isUnion(r))this.nodes.push(new $i(n,0));else{let{nullCount:i}=t;K.isNull(r)||Io.call(this,i<=0?new Uint8Array(0):ou(t.offset,n,t.nullBitmap)),this.nodes.push(new $i(n,i))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}};function Io(e){let t=e.byteLength+7&-8;return this.buffers.push(e),this.bufferRegions.push(new Yn(this._byteLength,t)),this._byteLength+=t,this}function PQ(e){var t;let{type:r,length:n,typeIds:i,valueOffsets:o}=e;if(Io.call(this,i),r.mode===Se.Sparse)return VE.call(this,e);if(r.mode===Se.Dense){if(e.offset<=0)return Io.call(this,o),VE.call(this,e);{let s=new Int32Array(n),a=Object.create(null),c=Object.create(null);for(let l,u,f=-1;++f<n;)(l=i[f])!==void 0&&((u=a[l])===void 0&&(u=a[l]=o[f]),s[f]=o[f]-u,c[l]=((t=c[l])!==null&&t!==void 0?t:0)+1);Io.call(this,s),this.visitMany(e.children.map((l,u)=>{let f=r.typeIds[u],d=a[f],h=c[f];return l.slice(d,Math.min(n,h))}))}}return this}function UQ(e){let t;return e.nullCount>=e.length?Io.call(this,new Uint8Array(0)):(t=e.values)instanceof Uint8Array?Io.call(this,ou(e.offset,e.length,t)):Io.call(this,su(e.values))}function va(e){return Io.call(this,e.values.subarray(0,e.length*e.stride))}function P_(e){let{length:t,values:r,valueOffsets:n}=e,i=re(n[0]),o=re(n[t]),s=Math.min(o-i,r.byteLength-i);return Io.call(this,x1(-i,t+1,n)),Io.call(this,r.subarray(i,i+s)),this}function YE(e){let{length:t,valueOffsets:r}=e;if(r){let{[0]:n,[t]:i}=r;return Io.call(this,x1(-n,t+1,r)),this.visit(e.children[0].slice(n,i-n))}return this.visit(e.children[0])}function VE(e){return this.visitMany(e.type.children.map((t,r)=>e.children[r]).filter(Boolean))[0]}ke.prototype.visitBool=UQ;ke.prototype.visitInt=va;ke.prototype.visitFloat=va;ke.prototype.visitUtf8=P_;ke.prototype.visitLargeUtf8=P_;ke.prototype.visitBinary=P_;ke.prototype.visitLargeBinary=P_;ke.prototype.visitFixedSizeBinary=va;ke.prototype.visitDate=va;ke.prototype.visitTimestamp=va;ke.prototype.visitTime=va;ke.prototype.visitDecimal=va;ke.prototype.visitList=YE;ke.prototype.visitStruct=VE;ke.prototype.visitUnion=PQ;ke.prototype.visitInterval=va;ke.prototype.visitDuration=va;ke.prototype.visitFixedSizeList=YE;ke.prototype.visitMap=YE;var gu=class extends lu{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,r){throw new Error('"throughDOM" not available in this environment')}constructor(t){super(),this._position=0,this._started=!1,this._sink=new Zo,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,xn(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 co(t)?t.then(r=>this.writeAll(r)):Fi(t)?GE(this,t):WE(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,r=null){return t===this._sink||t instanceof Zo?this._sink=t:(this._sink=new Zo,t&&vk(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&Sk(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,(!r||!mu(r,this._schema))&&(r==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=r,this._writeSchema(r))),this}write(t){let r=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof wn&&!(r=t.schema))return this.finish()&&void 0;if(t instanceof He&&!(r=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(r&&!mu(r,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,r)}t instanceof He?t instanceof yu||this._writeRecordBatch(t):t instanceof wn?this.writeAll(t.batches):lo(t)&&this.writeAll(t)}_writeMessage(t,r=8){let n=r-1,i=Gn.encode(t),o=i.byteLength,s=this._writeLegacyIpcFormat?4:8,a=o+s+n&~n,c=a-o-s;return t.headerType===Vt.RecordBatch?this._recordBatchBlocks.push(new ma(a,t.bodyLength,this._position)):t.headerType===Vt.DictionaryBatch&&this._dictionaryBlocks.push(new ma(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-s)),o>0&&this._write(i),this._writePadding(c)}_write(t){if(this._started){let r=It(t);r&&r.byteLength>0&&(this._sink.write(r),this._position+=r.byteLength)}return this}_writeSchema(t){return this._writeMessage(Gn.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(yd)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:r,nodes:n,bufferRegions:i,buffers:o}=ke.assemble(t),s=new Yr(t.numRows,n,i),a=Gn.from(s,r);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(o)}_writeDictionaryBatch(t,r,n=!1){let{byteLength:i,nodes:o,bufferRegions:s,buffers:a}=ke.assemble(new Gt([t])),c=new Yr(t.length,o,s),l=new Wn(c,r,n),u=Gn.from(l,i);return this._writeMessage(u)._writeBodyBuffers(a)}_writeBodyBuffers(t){let r,n,i;for(let o=-1,s=t.length;++o<s;)(r=t[o])&&(n=r.byteLength)>0&&(this._write(r),(i=(n+7&-8)-n)>0&&this._writePadding(i));return this}_writeDictionaries(t){var r,n;for(let[i,o]of t.dictionaries){let s=(r=o?.data)!==null&&r!==void 0?r:[],a=this._seenDictionaries.get(i),c=(n=this._dictionaryDeltaOffsets.get(i))!==null&&n!==void 0?n:0;if(!a||a.data[0]!==s[0])for(let[l,u]of s.entries())this._writeDictionaryBatch(u,i,l>0);else if(c<s.length)for(let l of s.slice(c))this._writeDictionaryBatch(l,i,!0);this._seenDictionaries.set(i,o),this._dictionaryDeltaOffsets.set(i,s.length)}return this}},xu=class e extends gu{static writeAll(t,r){let n=new e(r);return co(t)?t.then(i=>n.writeAll(i)):Fi(t)?GE(n,t):WE(n,t)}},bu=class e extends gu{static writeAll(t){let r=new e;return co(t)?t.then(n=>r.writeAll(n)):Fi(t)?GE(r,t):WE(r,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(t,r,n=!1){if(!n&&this._seenDictionaries.has(r))throw new Error("The Arrow File format does not support replacement dictionaries. ");return super._writeDictionaryBatch(t,r,n)}_writeFooter(t){let r=pa.encode(new pa(t,he.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(r)._write(Int32Array.of(r.byteLength))._writeMagic()}};function WE(e,t){let r=t;t instanceof wn&&(r=t.batches,e.reset(void 0,t.schema));for(let n of r)e.write(n);return e.finish()}function GE(e,t){return Q(this,void 0,void 0,function*(){var r,n,i,o,s,a,c;try{for(r=!0,n=ao(t);i=yield n.next(),o=i.done,!o;r=!0){c=i.value,r=!1;let l=c;e.write(l)}}catch(l){s={error:l}}finally{try{!r&&!o&&(a=n.return)&&(yield a.call(n))}finally{if(s)throw s.error}}return e.finish()})}function a5(e,t){if(Fi(e))return zQ(e,t);if(lo(e))return $Q(e,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function $Q(e,t){let r=null,n=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){o(s,r||(r=e[Symbol.iterator]()))},pull(s){r?o(s,r):s.close()},cancel(){(r?.return&&r.return()||!0)&&(r=null)}}),Object.assign({highWaterMark:n?i:void 0},t));function o(s,a){let c,l=null,u=s.desiredSize||null;for(;!(l=a.next(n?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=It(l.value))&&(u!=null&&n&&(u=u-c.byteLength+1),l.value=c),s.enqueue(l.value),u!=null&&--u<=0)return;s.close()}}function zQ(e,t){let r=null,n=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){return Q(this,void 0,void 0,function*(){yield o(s,r||(r=e[Symbol.asyncIterator]()))})},pull(s){return Q(this,void 0,void 0,function*(){r?yield o(s,r):s.close()})},cancel(){return Q(this,void 0,void 0,function*(){(r?.return&&(yield r.return())||!0)&&(r=null)})}}),Object.assign({highWaterMark:n?i:void 0},t));function o(s,a){return Q(this,void 0,void 0,function*(){let c,l=null,u=s.desiredSize||null;for(;!(l=yield a.next(n?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=It(l.value))&&(u!=null&&n&&(u=u-c.byteLength+1),l.value=c),s.enqueue(l.value),u!=null&&--u<=0)return;s.close()})}}function u5(e){return new XE(e)}var XE=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:r,["writableStrategy"]:n,["queueingStrategy"]:i="count"}=t,o=_k(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=fu(o),this._getSize=i!=="bytes"?c5:l5;let{["highWaterMark"]:s=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},r),{["highWaterMark"]:a=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},n);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:c=>{this._maybeFlush(this._builder,this._controller=c)},start:c=>{this._maybeFlush(this._builder,this._controller=c)}},{highWaterMark:s,size:i!=="bytes"?c5:l5}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:a,size:c=>this._writeValueAndReturnChunkSize(c)})}_writeValueAndReturnChunkSize(t){let r=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-r}_maybeFlush(t,r){r!=null&&(this._bufferedSize>=r.desiredSize&&++this._numChunks&&this._enqueue(r,t.toVector()),t.finished&&((t.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(r,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(r,null)))}_enqueue(t,r){this._bufferedSize=0,this._controller=null,r==null?t.close():t.enqueue(r)}},c5=e=>{var t;return(t=e?.length)!==null&&t!==void 0?t:0},l5=e=>{var t;return(t=e?.byteLength)!==null&&t!==void 0?t:0};function U_(e,t){let r=new Zo,n=null,i=new ReadableStream({cancel(){return Q(this,void 0,void 0,function*(){yield r.close()})},start(a){return Q(this,void 0,void 0,function*(){yield s(a,n||(n=yield o()))})},pull(a){return Q(this,void 0,void 0,function*(){n?yield s(a,n):a.close()})}});return{writable:new WritableStream(r,Object.assign({highWaterMark:Math.pow(2,14)},e)),readable:i};function o(){return Q(this,void 0,void 0,function*(){return yield(yield Wr.from(r)).open(t)})}function s(a,c){return Q(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 $_(e,t){let r=new this(e),n=new Pi(r),i=new ReadableStream({cancel(){return Q(this,void 0,void 0,function*(){yield n.cancel()})},pull(s){return Q(this,void 0,void 0,function*(){yield o(s)})},start(s){return Q(this,void 0,void 0,function*(){yield o(s)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(r,e),readable:i};function o(s){return Q(this,void 0,void 0,function*(){let a=null,c=s.desiredSize;for(;a=yield n.read(c||null);)if(s.enqueue(a),c!=null&&(c-=a.byteLength)<=0)return;s.close()})}}function z_(e,t="stream"){return(t==="stream"?xu:bu).writeAll(e).toUint8Array(!0)}var YQ=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},sE),RE),vE),aE),JA),wE),rE),{compareSchemas:mu,compareFields:PB,compareTypes:UB});qr.toDOMStream=a5;Le.throughDOM=u5;Wr.throughDOM=U_;Bc.throughDOM=U_;ts.throughDOM=U_;gu.throughDOM=$_;bu.throughDOM=$_;xu.throughDOM=$_;var WQ=Object.create,d5=Object.defineProperty,GQ=Object.getOwnPropertyDescriptor,XQ=Object.getOwnPropertyNames,HQ=Object.getPrototypeOf,QQ=Object.prototype.hasOwnProperty,ZQ=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),KQ=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of XQ(t))!QQ.call(e,i)&&i!==r&&d5(e,i,{get:()=>t[i],enumerable:!(n=GQ(t,i))||n.enumerable});return e},JQ=(e,t,r)=>(r=e!=null?WQ(HQ(e)):{},KQ(t||!e||!e.__esModule?d5(r,"default",{value:e,enumerable:!0}):r,e)),tZ=ZQ((e,t)=>{t.exports=Worker}),eZ=(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))(eZ||{}),rZ=(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))(rZ||{}),nZ=(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))(nZ||{}),iZ=(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))(iZ||{}),oZ=(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))(oZ||{}),sZ=(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))(sZ||{}),h5=class{log(e){}},p5=class{constructor(e=2){this.level=e}log(e){e.level>=this.level&&console.log(e)}};var aZ=(e=>(e[e.SUCCESS=0]="SUCCESS",e))(aZ||{}),cZ=class{constructor(e,t){this._bindings=e,this._conn=t}get bindings(){return this._bindings}async close(){return this._bindings.disconnect(this._conn)}useUnsafe(e){return e(this._bindings,this._conn)}async query(e){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:e});let t=await this._bindings.runQuery(this._conn,e),r=Wr.from(t);return console.assert(r.isSync(),"Reader is not sync"),console.assert(r.isFile(),"Reader is not file"),new wn(r)}async send(e){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:e});let t=await this._bindings.startPendingQuery(this._conn,e);for(;t==null;)t=await this._bindings.pollPendingQuery(this._conn);let r=new m5(this._bindings,this._conn,t),n=await Wr.from(r);return console.assert(n.isAsync()),console.assert(n.isStream()),n}async cancelSent(){return await this._bindings.cancelPendingQuery(this._conn)}async getTableNames(e){return await this._bindings.getTableNames(this._conn,e)}async prepare(e){let t=await this._bindings.createPrepared(this._conn,e);return new lZ(this._bindings,this._conn,t)}async insertArrowTable(e,t){let r=z_(e,"stream");await this.insertArrowFromIPCStream(r,t)}async insertArrowFromIPCStream(e,t){await this._bindings.insertArrowFromIPCStream(this._conn,e,t)}async insertCSVFromPath(e,t){await this._bindings.insertCSVFromPath(this._conn,e,t)}async insertJSONFromPath(e,t){await this._bindings.insertJSONFromPath(this._conn,e,t)}},m5=class{constructor(e,t,r){this.db=e,this.conn=t,this.header=r,this._first=!0,this._depleted=!1,this._inFlight=null}async next(){if(this._first)return this._first=!1,{done:!1,value:this.header};if(this._depleted)return{done:!0,value:null};let e;return this._inFlight!=null?(e=await this._inFlight,this._inFlight=null):e=await this.db.fetchQueryResults(this.conn),this._depleted=e.length==0,this._depleted||(this._inFlight=this.db.fetchQueryResults(this.conn)),{done:this._depleted,value:e}}[Symbol.asyncIterator](){return this}},lZ=class{constructor(e,t,r){this.bindings=e,this.connectionId=t,this.statementId=r}async close(){await this.bindings.closePrepared(this.connectionId,this.statementId)}async query(...e){let t=await this.bindings.runPrepared(this.connectionId,this.statementId,e),r=Wr.from(t);return console.assert(r.isSync()),console.assert(r.isFile()),new wn(r)}async send(...e){let t=await this.bindings.sendPrepared(this.connectionId,this.statementId,e),r=new m5(this.bindings,this.connectionId,t),n=await Wr.from(r);return console.assert(n.isAsync()),console.assert(n.isStream()),n}},uZ=(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))(uZ||{}),fZ=(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))(fZ||{}),oe=class{constructor(e,t){this.promiseResolver=()=>{},this.promiseRejecter=()=>{},this.type=e,this.data=t,this.promise=new Promise((r,n)=>{this.promiseResolver=r,this.promiseRejecter=n})}};function j_(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:j_(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=>tM(t.name,t.type))};case D.Map:{let t=e;return{sqlType:"map",keyType:j_(t.keyType),valueType:j_(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 tM(e,t){let r=j_(t);return r.name=e,r}var dZ=new TextEncoder,y5=class{constructor(e,t=null){this._onInstantiationProgress=[],this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{},this._nextMessageId=0,this._pendingRequests=new Map,this._logger=e,this._onMessageHandler=this.onMessage.bind(this),this._onErrorHandler=this.onError.bind(this),this._onCloseHandler=this.onClose.bind(this),t!=null&&this.attach(t)}get logger(){return this._logger}attach(e){this._worker=e,this._worker.addEventListener("message",this._onMessageHandler),this._worker.addEventListener("error",this._onErrorHandler),this._worker.addEventListener("close",this._onCloseHandler),this._workerShutdownPromise=new Promise((t,r)=>{this._workerShutdownResolver=t})}detach(){this._worker&&(this._worker.removeEventListener("message",this._onMessageHandler),this._worker.removeEventListener("error",this._onErrorHandler),this._worker.removeEventListener("close",this._onCloseHandler),this._worker=null,this._workerShutdownResolver(null),this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async terminate(){this._worker&&(this._worker.terminate(),this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async postTask(e,t=[]){if(!this._worker){console.error("cannot send a message since the worker is not set!");return}let r=this._nextMessageId++;return this._pendingRequests.set(r,e),this._worker.postMessage({messageId:r,type:e.type,data:e.data},t),await e.promise}onMessage(e){var t;let r=e.data;switch(r.type){case"LOG":{this._logger.log(r.data);return}case"INSTANTIATE_PROGRESS":{for(let i of this._onInstantiationProgress)i(r.data);return}}let n=this._pendingRequests.get(r.requestId);if(!n){console.warn("unassociated response: [".concat(r.requestId,", ").concat(r.type.toString(),"]"));return}if(this._pendingRequests.delete(r.requestId),r.type=="ERROR"){let i=new Error(r.data.message);i.name=r.data.name,(t=Object.getOwnPropertyDescriptor(i,"stack"))!=null&&t.writable&&(i.stack=r.data.stack),n.promiseRejecter(i);return}switch(n.type){case"CLOSE_PREPARED":case"COLLECT_FILE_STATISTICS":case"COPY_FILE_TO_PATH":case"DISCONNECT":case"DROP_FILE":case"DROP_FILES":case"FLUSH_FILES":case"INSERT_ARROW_FROM_IPC_STREAM":case"IMPORT_CSV_FROM_PATH":case"IMPORT_JSON_FROM_PATH":case"OPEN":case"PING":case"REGISTER_FILE_BUFFER":case"REGISTER_FILE_HANDLE":case"REGISTER_FILE_URL":case"RESET":if(r.type=="OK"){n.promiseResolver(r.data);return}break;case"INSTANTIATE":if(this._onInstantiationProgress=[],r.type=="OK"){n.promiseResolver(r.data);return}break;case"GLOB_FILE_INFOS":if(r.type=="FILE_INFOS"){n.promiseResolver(r.data);return}break;case"GET_VERSION":if(r.type=="VERSION_STRING"){n.promiseResolver(r.data);return}break;case"GET_FEATURE_FLAGS":if(r.type=="FEATURE_FLAGS"){n.promiseResolver(r.data);return}break;case"GET_TABLE_NAMES":if(r.type=="TABLE_NAMES"){n.promiseResolver(r.data);return}break;case"TOKENIZE":if(r.type=="SCRIPT_TOKENS"){n.promiseResolver(r.data);return}break;case"COPY_FILE_TO_BUFFER":if(r.type=="FILE_BUFFER"){n.promiseResolver(r.data);return}break;case"EXPORT_FILE_STATISTICS":if(r.type=="FILE_STATISTICS"){n.promiseResolver(r.data);return}break;case"CONNECT":if(r.type=="CONNECTION_INFO"){n.promiseResolver(r.data);return}break;case"RUN_PREPARED":case"RUN_QUERY":if(r.type=="QUERY_RESULT"){n.promiseResolver(r.data);return}break;case"SEND_PREPARED":if(r.type=="QUERY_RESULT_HEADER"){n.promiseResolver(r.data);return}break;case"START_PENDING_QUERY":if(r.type=="QUERY_RESULT_HEADER_OR_NULL"){n.promiseResolver(r.data);return}break;case"POLL_PENDING_QUERY":if(r.type=="QUERY_RESULT_HEADER_OR_NULL"){n.promiseResolver(r.data);return}break;case"CANCEL_PENDING_QUERY":if(this._onInstantiationProgress=[],r.type=="SUCCESS"){n.promiseResolver(r.data);return}break;case"FETCH_QUERY_RESULTS":if(r.type=="QUERY_RESULT_CHUNK"){n.promiseResolver(r.data);return}break;case"CREATE_PREPARED":if(r.type=="PREPARED_STATEMENT_ID"){n.promiseResolver(r.data);return}break}n.promiseRejecter(new Error("unexpected response type: ".concat(r.type.toString())))}onError(e){console.error(e),console.error("error in duckdb worker: ".concat(e.message)),this._pendingRequests.clear()}onClose(){if(this._workerShutdownResolver(null),this._pendingRequests.size!=0){console.warn("worker terminated with ".concat(this._pendingRequests.size," pending requests"));return}this._pendingRequests.clear()}async reset(){let e=new oe("RESET",null);return await this.postTask(e)}async ping(){let e=new oe("PING",null);await this.postTask(e)}async dropFile(e){let t=new oe("DROP_FILE",e);return await this.postTask(t)}async dropFiles(){let e=new oe("DROP_FILES",null);return await this.postTask(e)}async flushFiles(){let e=new oe("FLUSH_FILES",null);return await this.postTask(e)}async instantiate(e,t=null,r=n=>{}){this._onInstantiationProgress.push(r);let n=new oe("INSTANTIATE",[e,t]);return await this.postTask(n)}async getVersion(){let e=new oe("GET_VERSION",null);return await this.postTask(e)}async getFeatureFlags(){let e=new oe("GET_FEATURE_FLAGS",null);return await this.postTask(e)}async open(e){let t=new oe("OPEN",e);await this.postTask(t)}async tokenize(e){let t=new oe("TOKENIZE",e);return await this.postTask(t)}async connectInternal(){let e=new oe("CONNECT",null);return await this.postTask(e)}async connect(){let e=await this.connectInternal();return new cZ(this,e)}async disconnect(e){let t=new oe("DISCONNECT",e);await this.postTask(t)}async runQuery(e,t){let r=new oe("RUN_QUERY",[e,t]);return await this.postTask(r)}async startPendingQuery(e,t){let r=new oe("START_PENDING_QUERY",[e,t]);return await this.postTask(r)}async pollPendingQuery(e){let t=new oe("POLL_PENDING_QUERY",e);return await this.postTask(t)}async cancelPendingQuery(e){let t=new oe("CANCEL_PENDING_QUERY",e);return await this.postTask(t)}async fetchQueryResults(e){let t=new oe("FETCH_QUERY_RESULTS",e);return await this.postTask(t)}async getTableNames(e,t){let r=new oe("GET_TABLE_NAMES",[e,t]);return await this.postTask(r)}async createPrepared(e,t){let r=new oe("CREATE_PREPARED",[e,t]);return await this.postTask(r)}async closePrepared(e,t){let r=new oe("CLOSE_PREPARED",[e,t]);await this.postTask(r)}async runPrepared(e,t,r){let n=new oe("RUN_PREPARED",[e,t,r]);return await this.postTask(n)}async sendPrepared(e,t,r){let n=new oe("SEND_PREPARED",[e,t,r]);return await this.postTask(n)}async globFiles(e){let t=new oe("GLOB_FILE_INFOS",e);return await this.postTask(t)}async registerFileText(e,t){let r=dZ.encode(t);await this.registerFileBuffer(e,r)}async registerFileURL(e,t,r,n){t===void 0&&(t=e);let i=new oe("REGISTER_FILE_URL",[e,t,r,n]);await this.postTask(i)}async registerEmptyFileBuffer(e){}async registerFileBuffer(e,t){let r=new oe("REGISTER_FILE_BUFFER",[e,t]);await this.postTask(r,[t.buffer])}async registerFileHandle(e,t,r,n){let i=new oe("REGISTER_FILE_HANDLE",[e,t,r,n]);await this.postTask(i,[])}async collectFileStatistics(e,t){let r=new oe("COLLECT_FILE_STATISTICS",[e,t]);await this.postTask(r,[])}async exportFileStatistics(e){let t=new oe("EXPORT_FILE_STATISTICS",e);return await this.postTask(t,[])}async copyFileToBuffer(e){let t=new oe("COPY_FILE_TO_BUFFER",e);return await this.postTask(t)}async copyFileToPath(e,t){let r=new oe("COPY_FILE_TO_PATH",[e,t]);await this.postTask(r)}async insertArrowFromIPCStream(e,t,r){if(t.length==0)return;let n=new oe("INSERT_ARROW_FROM_IPC_STREAM",[e,t,r]);await this.postTask(n,[t.buffer])}async insertCSVFromPath(e,t,r){if(r.columns!==void 0){let i=[];for(let o in r.columns){let s=r.columns[o];i.push(tM(o,s))}r.columnsFlat=i,delete r.columns}let n=new oe("IMPORT_CSV_FROM_PATH",[e,t,r]);await this.postTask(n)}async insertJSONFromPath(e,t,r){if(r.columns!==void 0){let i=[];for(let o in r.columns){let s=r.columns[o];i.push(tM(o,s))}r.columnsFlat=i,delete r.columns}let n=new oe("IMPORT_JSON_FROM_PATH",[e,t,r]);await this.postTask(n)}};var hZ=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])),pZ=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])),mZ=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])),yZ=()=>(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])),eM={name:"@duckdb/duckdb-wasm",version:"1.29.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":"^17.0.0"},devDependencies:{"@types/emscripten":"^1.39.10","@types/jasmine":"^5.1.4","@typescript-eslint/eslint-plugin":"^6.21.0","@typescript-eslint/parser":"^6.21.0",esbuild:"^0.20.2",eslint:"^8.57.0","eslint-plugin-jasmine":"^4.1.3","eslint-plugin-react":"^7.34.0","fast-glob":"^3.3.2",jasmine:"^5.1.0","jasmine-core":"^5.1.2","jasmine-spec-reporter":"^7.0.0","js-sha256":"^0.11.0",karma:"^6.4.2","karma-chrome-launcher":"^3.2.0","karma-coverage":"^2.2.1","karma-firefox-launcher":"^2.1.3","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.5",puppeteer:"^22.8.0",rimraf:"^5.0.5",s3rver:"^3.7.1",typedoc:"^0.25.13",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/tests-*","!dist/duckdb-browser-mvp.worker.js.map","!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-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":{node:{types:"./dist/duckdb-node-blocking.d.ts",require:"./dist/duckdb-node-blocking.cjs",import:"./dist/duckdb-node-blocking.cjs"},types:"./dist/duckdb-node-blocking.d.ts",import:"./dist/duckdb-node-blocking.mjs",require:"./dist/duckdb-node-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"}}},gZ=eM.name,xZ=eM.version,rM=eM.version.split("."),QMt=rM[0],ZMt=rM[1],KMt=rM[2],bZ=()=>typeof navigator>"u";function g5(){let e="https://cdn.jsdelivr.net/npm/".concat(gZ,"@").concat(xZ,"/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 HE=null,QE=null,ZE=null,KE=null,JE=null;async function _Z(){return HE==null&&(HE=typeof BigInt64Array<"u"),QE==null&&(QE=await pZ()),ZE==null&&(ZE=await yZ()),KE==null&&(KE=await mZ()),JE==null&&(JE=await hZ()),{bigInt64Array:HE,crossOriginIsolated:bZ()||globalThis.crossOriginIsolated||!1,wasmExceptions:QE,wasmSIMD:KE,wasmThreads:ZE,wasmBulkMemory:JE}}async function x5(e){let t=await _Z();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 JMt=JQ(tZ());function wZ(){let e=new TextDecoder;return t=>(typeof SharedArrayBuffer<"u"&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),e.decode(t))}var t3t=wZ(),vZ=(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))(vZ||{});function IZ(e,t){return new Promise((r,n)=>{e.useUnsafe(async(i,o)=>{try{let s=await i.runQuery(o,t);r(s)}catch(s){n(s)}})})}function b5(e={}){let{duckdb:t,connection:r,...n}=e,i=t,o=r,s;function a(){return s||(s=(i?Promise.resolve(i):TZ(n).then(u=>i=u)).then(u=>u.connect()).then(u=>o=u)),s}async function c(){return i||await a(),i}async function l(){return o||await a(),o}return{getDuckDB:c,getConnection:l,query:async u=>{let{type:f,sql:d}=u,h=await l(),p=await IZ(h,d);return f==="exec"?void 0:f==="arrow"?pc(p):pc(p).toArray()}}}async function TZ({log:e=!1}={}){let t=g5(),r=await x5(t),n=URL.createObjectURL(new Blob([`importScripts("${r.mainWorker}");`],{type:"text/javascript"})),i=new Worker(n),o=e?new p5:new h5,s=new y5(o,i);return await s.instantiate(r.mainModule,r.pthreadWorker),URL.revokeObjectURL(n),s}function Pc(e,t,{source:r,clients:n=r?new Set([r]):void 0}){let i=t!==void 0?Xb(e,[Er(t)]):null;return{meta:{type:"point"},source:r,clients:n,value:t,predicate:i}}function Sa(e,t,{source:r,clients:n=r?new Set([r]):void 0}){let i=null;if(t){let o=t.length&&e.length===1?[Xb(e[0],t.map(s=>Er(s[0])))]:t.map(s=>on(s.map((a,c)=>Kp(e[c],Er(a)))));i=t.length===0?Er(!1):o.length>1?Oi(o):o[0]}return{meta:{type:"point"},source:r,clients:n,value:t,predicate:i}}function _u(e,t,{source:r,clients:n=r?new Set([r]):void 0,bin:i,scale:o,pixelSize:s=1}){let a=t!=null?jr(e,t):null;return{meta:{type:"interval",scales:o&&[o],bin:i,pixelSize:s},source:r,clients:n,value:t,predicate:a}}function nM(e,t,{source:r,clients:n=r?new Set([r]):void 0,bin:i,scales:o=[],pixelSize:s=1}){let a=t!=null?on(e.map((l,u)=>jr(l,t[u]))):null;return{meta:{type:"interval",scales:o,bin:i,pixelSize:s},source:r,clients:n,value:t,predicate:a}}var AZ={contains:pA,prefix:mA,suffix:yA,regexp:hA};function iM(e,t,{source:r,clients:n=void 0,method:i="contains"}){let o=AZ[i],s=t?o(e,Er(t)):null;return{meta:{type:"match",method:i},source:r,clients:n,value:t,predicate:s}}function oM(e){return typeof e?.getChild=="function"}function sM(){let e=new Set,t,r=new Promise(n=>t=n);return{pending(n){e.add(n)},ready(n){return e.delete(n),e.size===0},resolve(){r=new Promise(n=>{t(),t=n})},get promise(){return r}}}function Xn(e){return oM(e)?EZ(e):MZ(e)}function EZ(e){let{numRows:t}=e;return{numRows:t,columns:e.toColumns()}}function MZ(e){let t=e.length;if(typeof e[0]=="object"){let r=t?Object.keys(e[0]):[],n={};return r.length>0&&r.forEach(i=>{n[i]=e.map(o=>o[i])}),{numRows:t,columns:n}}else return{numRows:t,values:e}}var lC={};Jn(lC,{Fixed:()=>es,Param:()=>vc,Query:()=>ft,Selection:()=>qo,align:()=>j8,and:()=>on,area:()=>OL,areaX:()=>RL,areaY:()=>DL,argmax:()=>xc,argmin:()=>bc,ariaDescription:()=>Q8,ariaLabel:()=>H8,arrayAgg:()=>AT,arrow:()=>TF,aspectRatio:()=>q8,avg:()=>Gp,axis:()=>V8,axisFx:()=>OF,axisFy:()=>RF,axisX:()=>MF,axisY:()=>NF,barX:()=>kL,barY:()=>BL,bin:()=>I8,cast:()=>qf,cell:()=>PL,cellX:()=>UL,cellY:()=>$L,centroid:()=>tm,centroidX:()=>fA,centroidY:()=>dA,circle:()=>GL,clip:()=>G8,colorBase:()=>LD,colorClamp:()=>wD,colorConstant:()=>CD,colorDomain:()=>bD,colorExponent:()=>FD,colorInterpolate:()=>TD,colorLabel:()=>MD,colorLegend:()=>sC,colorN:()=>vD,colorNice:()=>SD,colorPercent:()=>ND,colorPivot:()=>AD,colorRange:()=>_D,colorReverse:()=>OD,colorScale:()=>xD,colorScheme:()=>ID,colorSymmetric:()=>ED,colorTickFormat:()=>DD,colorZero:()=>RD,column:()=>Gs,contour:()=>fF,coordinator:()=>Li,corr:()=>ET,count:()=>Mr,covarPop:()=>NT,covariance:()=>MT,createSchema:()=>NA,createTable:()=>_c,cume_dist:()=>wA,dateDay:()=>tA,dateMonth:()=>KT,dateMonthDay:()=>JT,delaunayLink:()=>vF,delaunayMesh:()=>SF,denseLine:()=>uF,dense_rank:()=>bA,density:()=>lF,densityX:()=>aF,densityY:()=>cF,dot:()=>VL,dotX:()=>YL,dotY:()=>WL,entropy:()=>OT,eq:()=>oA,errorbarX:()=>xF,errorbarY:()=>bF,facetGrid:()=>xR,facetLabel:()=>bR,facetMargin:()=>hR,facetMarginBottom:()=>mR,facetMarginLeft:()=>yR,facetMarginRight:()=>gR,facetMarginTop:()=>pR,first:()=>RT,first_value:()=>IA,float32:()=>HT,float64:()=>Ge,frame:()=>EF,from:()=>xW,fxAlign:()=>AR,fxAriaDescription:()=>VR,fxAriaLabel:()=>qR,fxAxis:()=>OR,fxDomain:()=>_R,fxFontVariant:()=>jR,fxGrid:()=>BR,fxInset:()=>vR,fxInsetLeft:()=>SR,fxInsetRight:()=>IR,fxLabel:()=>UR,fxLabelAnchor:()=>$R,fxLabelOffset:()=>zR,fxLine:()=>PR,fxPadding:()=>ER,fxPaddingInner:()=>MR,fxPaddingOuter:()=>NR,fxRange:()=>wR,fxReverse:()=>YR,fxRound:()=>TR,fxTickFormat:()=>CR,fxTickPadding:()=>FR,fxTickRotate:()=>kR,fxTickSize:()=>DR,fxTickSpacing:()=>LR,fxTicks:()=>RR,fyAlign:()=>KR,fyAriaDescription:()=>yD,fyAriaLabel:()=>mD,fyAxis:()=>rD,fyDomain:()=>WR,fyFontVariant:()=>pD,fyGrid:()=>lD,fyInset:()=>XR,fyInsetBottom:()=>QR,fyInsetTop:()=>HR,fyLabel:()=>fD,fyLabelAnchor:()=>dD,fyLabelOffset:()=>hD,fyLine:()=>uD,fyPadding:()=>JR,fyPaddingInner:()=>tD,fyPaddingOuter:()=>eD,fyRange:()=>GR,fyReverse:()=>gD,fyRound:()=>ZR,fyTickFormat:()=>aD,fyTickPadding:()=>sD,fyTickRotate:()=>cD,fyTickSize:()=>iD,fyTickSpacing:()=>oD,fyTicks:()=>nD,geo:()=>kF,geojson:()=>Jp,graticule:()=>PF,grid:()=>W8,gridFx:()=>FF,gridFy:()=>CF,gridX:()=>DF,gridY:()=>LF,gt:()=>Di,gte:()=>sA,hconcat:()=>fW,heatmap:()=>dF,height:()=>B8,hexagon:()=>XL,hexbin:()=>mF,hexgrid:()=>yF,highlight:()=>zF,hspace:()=>pW,hull:()=>IF,image:()=>sF,inset:()=>Y8,int32:()=>ve,intervalX:()=>jF,intervalXY:()=>VF,intervalY:()=>qF,isBetween:()=>jr,isDistinct:()=>aA,isNotBetween:()=>cA,isNotDistinct:()=>Kp,isNotNull:()=>Ri,isNull:()=>Jl,kurtosis:()=>DT,lag:()=>SA,last:()=>kT,last_value:()=>TA,lead:()=>Yf,lengthBase:()=>yL,lengthClamp:()=>dL,lengthConstant:()=>xL,lengthDomain:()=>uL,lengthExponent:()=>gL,lengthNice:()=>hL,lengthPercent:()=>pL,lengthRange:()=>fL,lengthScale:()=>lL,lengthZero:()=>mL,line:()=>LL,lineX:()=>FL,lineY:()=>CL,link:()=>AF,literal:()=>Er,loadCSV:()=>DA,loadExtension:()=>OA,loadJSON:()=>LA,loadObjects:()=>kA,loadParquet:()=>FA,loadSpatial:()=>CA,lt:()=>ze,lte:()=>ri,mad:()=>LT,margin:()=>L8,marginBottom:()=>z8,marginLeft:()=>P8,marginRight:()=>U8,marginTop:()=>$8,margins:()=>D8,max:()=>zr,median:()=>FT,menu:()=>oW,min:()=>zn,mode:()=>CT,name:()=>O8,nearest:()=>YF,nearestX:()=>WF,nearestY:()=>GF,neq:()=>so,not:()=>iA,nth_value:()=>AA,ntile:()=>vA,opacityBase:()=>WD,opacityClamp:()=>UD,opacityConstant:()=>XD,opacityDomain:()=>BD,opacityExponent:()=>GD,opacityLabel:()=>zD,opacityLegend:()=>aC,opacityNice:()=>$D,opacityPercent:()=>jD,opacityRange:()=>PD,opacityReverse:()=>qD,opacityScale:()=>kD,opacityTickFormat:()=>YD,opacityZero:()=>VD,or:()=>Oi,padding:()=>X8,pan:()=>JF,panX:()=>tC,panY:()=>eC,panZoom:()=>rC,panZoomX:()=>nC,panZoomY:()=>iC,percent_rank:()=>_A,plot:()=>vW,product:()=>BT,projectionClip:()=>NL,projectionDomain:()=>SL,projectionInset:()=>IL,projectionInsetBottom:()=>ML,projectionInsetLeft:()=>TL,projectionInsetRight:()=>AL,projectionInsetTop:()=>EL,projectionParallels:()=>_L,projectionPrecision:()=>wL,projectionRotate:()=>vL,projectionType:()=>bL,quantile:()=>PT,rBase:()=>sL,rClamp:()=>eL,rConstant:()=>cL,rDomain:()=>JD,rExponent:()=>aL,rLabel:()=>nL,rNice:()=>rL,rPercent:()=>iL,rRange:()=>tL,rScale:()=>KD,rZero:()=>oL,rank:()=>xA,raster:()=>hF,rasterTile:()=>pF,rect:()=>zL,rectX:()=>jL,rectY:()=>qL,region:()=>XF,regressionY:()=>gF,row_number:()=>gA,ruleX:()=>KL,ruleY:()=>JL,search:()=>sW,skewness:()=>VT,slider:()=>aW,sphere:()=>BF,spike:()=>oF,sql:()=>tr,stddev:()=>Qp,stddevPop:()=>YT,stringAgg:()=>WT,style:()=>C8,sum:()=>de,symbolDomain:()=>QD,symbolLegend:()=>cC,symbolRange:()=>ZD,symbolScale:()=>HD,table:()=>cW,text:()=>HL,textX:()=>QL,textY:()=>ZL,tickX:()=>tF,tickY:()=>eF,toggle:()=>Tf,toggleColor:()=>KF,toggleX:()=>HF,toggleY:()=>QF,toggleZ:()=>ZF,varPop:()=>XT,variance:()=>GT,vconcat:()=>uW,vector:()=>rF,vectorX:()=>nF,vectorY:()=>iF,voronoi:()=>_F,voronoiMesh:()=>wF,vspace:()=>hW,waffleX:()=>UF,waffleY:()=>$F,width:()=>k8,xAlign:()=>sO,xAriaDescription:()=>TO,xAriaLabel:()=>IO,xAxis:()=>uO,xBase:()=>NO,xClamp:()=>iO,xConstant:()=>RO,xDomain:()=>K8,xExponent:()=>OO,xFontVariant:()=>SO,xGrid:()=>gO,xInset:()=>eO,xInsetLeft:()=>rO,xInsetRight:()=>nO,xLabel:()=>bO,xLabelAnchor:()=>_O,xLabelArrow:()=>wO,xLabelOffset:()=>vO,xLine:()=>xO,xNice:()=>tO,xPadding:()=>aO,xPaddingInner:()=>cO,xPaddingOuter:()=>lO,xPercent:()=>AO,xRange:()=>J8,xReverse:()=>EO,xRound:()=>oO,xScale:()=>Z8,xTickFormat:()=>mO,xTickPadding:()=>pO,xTickRotate:()=>yO,xTickSize:()=>dO,xTickSpacing:()=>hO,xTicks:()=>fO,xZero:()=>MO,xyDomain:()=>F8,yAlign:()=>zO,yAriaDescription:()=>sR,yAriaLabel:()=>oR,yAxis:()=>YO,yBase:()=>uR,yClamp:()=>UO,yConstant:()=>dR,yDomain:()=>LO,yExponent:()=>fR,yFontVariant:()=>iR,yGrid:()=>KO,yInset:()=>kO,yInsetBottom:()=>PO,yInsetTop:()=>BO,yLabel:()=>tR,yLabelAnchor:()=>eR,yLabelArrow:()=>rR,yLabelOffset:()=>nR,yLine:()=>JO,yNice:()=>CO,yPadding:()=>jO,yPaddingInner:()=>qO,yPaddingOuter:()=>VO,yPercent:()=>aR,yRange:()=>FO,yReverse:()=>cR,yRound:()=>$O,yScale:()=>DO,yTickFormat:()=>QO,yTickPadding:()=>HO,yTickRotate:()=>ZO,yTickSize:()=>GO,yTickSpacing:()=>XO,yTicks:()=>WO,yZero:()=>lR});var es=Symbol("Fixed"),Gr=Symbol("Transient"),oy=Symbol("Transform");var f8={};Jn(f8,{Area:()=>hf,Arrow:()=>w0,BarX:()=>pf,BarY:()=>mf,Cell:()=>yf,Contour:()=>D0,Density:()=>C0,Dot:()=>gf,Frame:()=>p0,Geo:()=>k0,Hexgrid:()=>B0,Image:()=>P0,Line:()=>xf,Link:()=>b0,Mark:()=>vt,Raster:()=>M0,Rect:()=>df,RuleX:()=>o0,RuleY:()=>s0,Text:()=>lf,TickX:()=>I0,TickY:()=>T0,Tip:()=>m0,Vector:()=>ff,WaffleX:()=>$0,WaffleY:()=>z0,area:()=>x0,areaX:()=>Al,areaY:()=>ac,arrow:()=>gq,auto:()=>Mq,autoSpec:()=>kN,axisFx:()=>jS,axisFy:()=>zS,axisX:()=>c0,axisY:()=>a0,barX:()=>Fs,barY:()=>Cs,bin:()=>sc,binX:()=>Ds,binY:()=>Ls,bollinger:()=>Ol,bollingerX:()=>Fq,bollingerY:()=>Cq,boxX:()=>kq,boxY:()=>Bq,cell:()=>El,cellX:()=>bq,cellY:()=>_q,centroid:()=>mI,circle:()=>Sq,cluster:()=>CV,column:()=>Br,contour:()=>Wq,crosshair:()=>Hq,crosshairX:()=>Qq,crosshairY:()=>Zq,delaunayLink:()=>tV,delaunayMesh:()=>eV,density:()=>sV,differenceX:()=>lV,differenceY:()=>uV,dodgeX:()=>eY,dodgeY:()=>rY,dot:()=>to,dotX:()=>wq,dotY:()=>vq,filter:()=>N$,find:()=>P$,formatIsoDate:()=>aN,formatMonth:()=>qz,formatNumber:()=>sN,formatWeekday:()=>Vz,frame:()=>zh,geo:()=>yI,geoCentroid:()=>dV,graticule:()=>pV,gridFx:()=>WS,gridFy:()=>VS,gridX:()=>YS,gridY:()=>qS,group:()=>Zg,groupX:()=>fl,groupY:()=>dl,groupZ:()=>Qg,hexagon:()=>Iq,hexbin:()=>mV,hexgrid:()=>yV,hull:()=>rV,identity:()=>G,image:()=>xV,indexOf:()=>Ee,initializer:()=>Ne,interpolateNearest:()=>O0,interpolateNone:()=>pI,interpolatorBarycentric:()=>N0,interpolatorRandomWalk:()=>R0,legend:()=>Uj,line:()=>bf,lineX:()=>Ml,lineY:()=>Nl,linearRegressionX:()=>wV,linearRegressionY:()=>vV,link:()=>oI,map:()=>Zn,mapX:()=>Gh,mapY:()=>Xh,marks:()=>yr,normalize:()=>TI,normalizeX:()=>sY,normalizeY:()=>aY,numberInterval:()=>I4,plot:()=>jh,pointer:()=>xl,pointerX:()=>bl,pointerY:()=>ic,raster:()=>jq,rect:()=>h0,rectX:()=>Uh,rectY:()=>$h,reverse:()=>O$,ruleX:()=>vi,ruleY:()=>Si,scale:()=>hl,select:()=>fY,selectFirst:()=>V0,selectLast:()=>Y0,selectMaxX:()=>NI,selectMaxY:()=>OI,selectMinX:()=>EI,selectMinY:()=>MI,shiftX:()=>cY,shiftY:()=>lY,shuffle:()=>R$,sort:()=>lS,sphere:()=>hV,spike:()=>bj,stackX:()=>TN,stackX1:()=>Yj,stackX2:()=>Wj,stackY:()=>AN,stackY1:()=>Gj,stackY2:()=>Xj,text:()=>Rs,textX:()=>FS,textY:()=>CS,tickX:()=>fI,tickY:()=>dI,timeInterval:()=>Vg,tip:()=>JS,transform:()=>mr,tree:()=>r8,treeLink:()=>wI,treeNode:()=>U0,utcInterval:()=>Ku,valueof:()=>_t,vector:()=>vN,vectorX:()=>PS,vectorY:()=>US,voronoi:()=>nV,voronoiMesh:()=>iV,waffleX:()=>zV,waffleY:()=>jV,window:()=>Hh,windowX:()=>Nq,windowY:()=>Oq});function Ft(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function vn(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function To(e){let t,r,n;e.length!==2?(t=Ft,r=(a,c)=>Ft(e(a),c),n=(a,c)=>e(a)-c):(t=e===Ft||e===vn?e:NZ,r=e,n=e);function i(a,c,l=0,u=a.length){if(l<u){if(t(c,c)!==0)return u;do{let f=l+u>>>1;r(a[f],c)<0?l=f+1:u=f}while(l<u)}return l}function o(a,c,l=0,u=a.length){if(l<u){if(t(c,c)!==0)return u;do{let f=l+u>>>1;r(a[f],c)<=0?l=f+1:u=f}while(l<u)}return l}function s(a,c,l=0,u=a.length){let f=i(a,c,l,u-1);return f>l&&n(a[f-1],c)>-n(a[f],c)?f-1:f}return{left:i,center:s,right:o}}function NZ(){return 0}function sy(e){return e===null?NaN:+e}function*_5(e,t){if(t===void 0)for(let r of e)r!=null&&(r=+r)>=r&&(yield r);else{let r=-1;for(let n of e)(n=t(n,++r,e))!=null&&(n=+n)>=n&&(yield n)}}var w5=To(Ft),v5=w5.right,OZ=w5.left,RZ=To(sy).center,Ia=v5;var ay=S5(I5),aM=S5(DZ);function S5(e){return function(t,r,n=r){if(!((r=+r)>=0))throw new RangeError("invalid rx");if(!((n=+n)>=0))throw new RangeError("invalid ry");let{data:i,width:o,height:s}=t;if(!((o=Math.floor(o))>=0))throw new RangeError("invalid width");if(!((s=Math.floor(s!==void 0?s:i.length/o))>=0))throw new RangeError("invalid height");if(!o||!s||!r&&!n)return t;let a=r&&e(r),c=n&&e(n),l=i.slice();return a&&c?(_d(a,l,i,o,s),_d(a,i,l,o,s),_d(a,l,i,o,s),wd(c,i,l,o,s),wd(c,l,i,o,s),wd(c,i,l,o,s)):a?(_d(a,i,l,o,s),_d(a,l,i,o,s),_d(a,i,l,o,s)):c&&(wd(c,i,l,o,s),wd(c,l,i,o,s),wd(c,i,l,o,s)),t}}function _d(e,t,r,n,i){for(let o=0,s=n*i;o<s;)e(t,r,o,o+=n,1)}function wd(e,t,r,n,i){for(let o=0,s=n*i;o<n;++o)e(t,r,o,o+s,n)}function DZ(e){let t=I5(e);return(r,n,i,o,s)=>{i<<=2,o<<=2,s<<=2,t(r,n,i+0,o+0,s),t(r,n,i+1,o+1,s),t(r,n,i+2,o+2,s),t(r,n,i+3,o+3,s)}}function I5(e){let t=Math.floor(e);if(t===e)return LZ(e);let r=e-t,n=2*e+1;return(i,o,s,a,c)=>{if(!((a-=c)>=s))return;let l=t*o[s],u=c*t,f=u+c;for(let d=s,h=s+u;d<h;d+=c)l+=o[Math.min(a,d)];for(let d=s,h=a;d<=h;d+=c)l+=o[Math.min(a,d+u)],i[d]=(l+r*(o[Math.max(s,d-f)]+o[Math.min(a,d+f)]))/n,l-=o[Math.max(s,d-u)]}}function LZ(e){let t=2*e+1;return(r,n,i,o,s)=>{if(!((o-=s)>=i))return;let a=e*n[i],c=s*e;for(let l=i,u=i+c;l<u;l+=s)a+=n[Math.min(o,l)];for(let l=i,u=o;l<=u;l+=s)a+=n[Math.min(o,l+c)],r[l]=a/t,a-=n[Math.max(i,l-c)]}}function rs(e,t){let r=0;if(t===void 0)for(let n of e)n!=null&&(n=+n)>=n&&++r;else{let n=-1;for(let i of e)(i=t(i,++n,e))!=null&&(i=+i)>=i&&++r}return r}function FZ(e){return e.length|0}function CZ(e){return!(e>0)}function kZ(e){return typeof e!="object"||"length"in e?e:Array.from(e)}function BZ(e){return t=>e(...t)}function q_(...e){let t=typeof e[e.length-1]=="function"&&BZ(e.pop());e=e.map(kZ);let r=e.map(FZ),n=e.length-1,i=new Array(n+1).fill(0),o=[];if(n<0||r.some(CZ))return o;for(;;){o.push(i.map((a,c)=>e[c][a]));let s=n;for(;++i[s]===r[s];){if(s===0)return t?o.map(t):o;i[s--]=0}}}function V_(e,t){var r=0,n=0;return Float64Array.from(e,t===void 0?i=>r+=+i||0:i=>r+=+t(i,n++,e)||0)}function Uc(e,t){let r=0,n,i=0,o=0;if(t===void 0)for(let s of e)s!=null&&(s=+s)>=s&&(n=s-i,i+=n/++r,o+=n*(s-i));else{let s=-1;for(let a of e)(a=t(a,++s,e))!=null&&(a=+a)>=a&&(n=a-i,i+=n/++r,o+=n*(a-i))}if(r>1)return o/(r-1)}function zi(e,t){let r=Uc(e,t);return r&&Math.sqrt(r)}function ce(e,t){let r,n;if(t===void 0)for(let i of e)i!=null&&(r===void 0?i>=i&&(r=n=i):(r>i&&(r=i),n<i&&(n=i)));else{let i=-1;for(let o of e)(o=t(o,++i,e))!=null&&(r===void 0?o>=o&&(r=n=o):(r>o&&(r=o),n<o&&(n=o)))}return[r,n]}var Xr=class{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){let r=this._partials,n=0;for(let i=0;i<this._n&&i<32;i++){let o=r[i],s=t+o,a=Math.abs(t)<Math.abs(o)?t-(s-o):o-(s-t);a&&(r[n++]=a),t=s}return r[n]=t,this._n=n+1,this}valueOf(){let t=this._partials,r=this._n,n,i,o,s=0;if(r>0){for(s=t[--r];r>0&&(n=s,i=t[--r],s=n+i,o=i-(s-n),!o););r>0&&(o<0&&t[r-1]<0||o>0&&t[r-1]>0)&&(i=o*2,n=s+i,i==n-s&&(s=n))}return s}};var Sn=class extends Map{constructor(t,r=E5){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(let[n,i]of t)this.set(n,i)}get(t){return super.get(cM(this,t))}has(t){return super.has(cM(this,t))}set(t,r){return super.set(T5(this,t),r)}delete(t){return super.delete(A5(this,t))}},In=class extends Set{constructor(t,r=E5){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(let n of t)this.add(n)}has(t){return super.has(cM(this,t))}add(t){return super.add(T5(this,t))}delete(t){return super.delete(A5(this,t))}};function cM({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):r}function T5({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function A5({_intern:e,_key:t},r){let n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function E5(e){return e!==null&&typeof e=="object"?e.valueOf():e}function cy(e){return e}function Hr(e,...t){return uM(e,cy,cy,t)}function Ao(e,t,...r){return uM(e,cy,t,r)}function lM(e,t,...r){return uM(e,Array.from,t,r)}function uM(e,t,r,n){return function i(o,s){if(s>=n.length)return r(o);let a=new Sn,c=n[s++],l=-1;for(let u of o){let f=c(u,++l,o),d=a.get(f);d?d.push(u):a.set(f,[u])}for(let[u,f]of a)a.set(u,i(f,s));return t(a)}(e,0)}function fM(e,t){return Array.from(t,r=>e[r])}function Ta(e,...t){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");e=Array.from(e);let[r]=t;if(r&&r.length!==2||t.length>1){let n=Uint32Array.from(e,(i,o)=>o);return t.length>1?(t=t.map(i=>e.map(i)),n.sort((i,o)=>{for(let s of t){let a=wu(s[i],s[o]);if(a)return a}})):(r=e.map(r),n.sort((i,o)=>wu(r[i],r[o]))),fM(e,n)}return e.sort(ly(r))}function ly(e=Ft){if(e===Ft)return wu;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,r)=>{let n=e(t,r);return n||n===0?n:(e(r,r)===0)-(e(t,t)===0)}}function wu(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}function vd(e,t,r){return(t.length!==2?Ta(Ao(e,t,r),([n,i],[o,s])=>Ft(i,s)||Ft(n,o)):Ta(Hr(e,r),([n,i],[o,s])=>t(i,s)||Ft(n,o))).map(([n])=>n)}var PZ=Math.sqrt(50),UZ=Math.sqrt(10),$Z=Math.sqrt(2);function Y_(e,t,r){let n=(t-e)/Math.max(0,r),i=Math.floor(Math.log10(n)),o=n/Math.pow(10,i),s=o>=PZ?10:o>=UZ?5:o>=$Z?2:1,a,c,l;return i<0?(l=Math.pow(10,-i)/s,a=Math.round(e*l),c=Math.round(t*l),a/l<e&&++a,c/l>t&&--c,l=-l):(l=Math.pow(10,i)*s,a=Math.round(e/l),c=Math.round(t/l),a*l<e&&++a,c*l>t&&--c),c<a&&.5<=r&&r<2?Y_(e,t,r*2):[a,c,l]}function Qr(e,t,r){if(t=+t,e=+e,r=+r,!(r>0))return[];if(e===t)return[e];let n=t<e,[i,o,s]=n?Y_(t,e,r):Y_(e,t,r);if(!(o>=i))return[];let a=o-i+1,c=new Array(a);if(n)if(s<0)for(let l=0;l<a;++l)c[l]=(o-l)/-s;else for(let l=0;l<a;++l)c[l]=(o-l)*s;else if(s<0)for(let l=0;l<a;++l)c[l]=(i+l)/-s;else for(let l=0;l<a;++l)c[l]=(i+l)*s;return c}function Aa(e,t,r){return t=+t,e=+e,r=+r,Y_(e,t,r)[2]}function Sd(e,t,r){t=+t,e=+e,r=+r;let n=t<e,i=n?Aa(t,e,r):Aa(e,t,r);return(n?-1:1)*(i<0?1/-i:i)}function Id(e,t,r){let n;for(;;){let i=Aa(e,t,r);if(i===n||i===0||!isFinite(i))return[e,t];i>0?(e=Math.floor(e/i)*i,t=Math.ceil(t/i)*i):i<0&&(e=Math.ceil(e*i)/i,t=Math.floor(t*i)/i),n=i}}function $c(e){return Math.max(1,Math.ceil(Math.log(rs(e))/Math.LN2)+1)}function Kt(e,t){let r;if(t===void 0)for(let n of e)n!=null&&(r<n||r===void 0&&n>=n)&&(r=n);else{let n=-1;for(let i of e)(i=t(i,++n,e))!=null&&(r<i||r===void 0&&i>=i)&&(r=i)}return r}function W_(e,t){let r,n=-1,i=-1;if(t===void 0)for(let o of e)++i,o!=null&&(r<o||r===void 0&&o>=o)&&(r=o,n=i);else for(let o of e)(o=t(o,++i,e))!=null&&(r<o||r===void 0&&o>=o)&&(r=o,n=i);return n}function Ht(e,t){let r;if(t===void 0)for(let n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);else{let n=-1;for(let i of e)(i=t(i,++n,e))!=null&&(r>i||r===void 0&&i>=i)&&(r=i)}return r}function G_(e,t){let r,n=-1,i=-1;if(t===void 0)for(let o of e)++i,o!=null&&(r>o||r===void 0&&o>=o)&&(r=o,n=i);else for(let o of e)(o=t(o,++i,e))!=null&&(r>o||r===void 0&&o>=o)&&(r=o,n=i);return n}function X_(e,t,r=0,n=1/0,i){if(t=Math.floor(t),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(e.length-1,n)),!(r<=t&&t<=n))return e;for(i=i===void 0?wu:ly(i);n>r;){if(n-r>600){let c=n-r+1,l=t-r+1,u=Math.log(c),f=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*f*(c-f)/c)*(l-c/2<0?-1:1),h=Math.max(r,Math.floor(t-l*f/c+d)),p=Math.min(n,Math.floor(t+(c-l)*f/c+d));X_(e,t,h,p,i)}let o=e[t],s=r,a=n;for(uy(e,r,t),i(e[n],o)>0&&uy(e,r,n);s<a;){for(uy(e,s,a),++s,--a;i(e[s],o)<0;)++s;for(;i(e[a],o)>0;)--a}i(e[r],o)===0?uy(e,r,a):(++a,uy(e,a,n)),a<=t&&(r=a+1),t<=a&&(n=a-1)}return e}function uy(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}function vu(e,t=Ft){let r,n=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(n?Ft(s,i)>0:Ft(s,s)===0)&&(r=o,i=s,n=!0)}}else for(let i of e)(n?t(i,r)>0:t(i,i)===0)&&(r=i,n=!0);return r}function Tn(e,t,r){if(e=Float64Array.from(_5(e,r)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return Ht(e);if(t>=1)return Kt(e);var n,i=(n-1)*t,o=Math.floor(i),s=Kt(X_(e,o).subarray(0,o+1)),a=Ht(e.subarray(o+1));return s+(a-s)*(i-o)}}function dM(e,t,r=sy){if(!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return+r(e[0],0,e);if(t>=1)return+r(e[n-1],n-1,e);var n,i=(n-1)*t,o=Math.floor(i),s=+r(e[o],o,e),a=+r(e[o+1],o+1,e);return s+(a-s)*(i-o)}}function H_(e,t,r){let n=rs(e),i=Tn(e,.75)-Tn(e,.25);return n&&i?Math.ceil((r-t)/(2*i*Math.pow(n,-1/3))):1}function fy(e,t,r){let n=rs(e),i=zi(e);return n&&i?Math.ceil((r-t)*Math.cbrt(n)/(3.49*i)):1}function Ea(e,t){let r=0,n=0;if(t===void 0)for(let i of e)i!=null&&(i=+i)>=i&&(++r,n+=i);else{let i=-1;for(let o of e)(o=t(o,++i,e))!=null&&(o=+o)>=o&&(++r,n+=o)}if(r)return n/r}function Eo(e,t){return Tn(e,.5,t)}function*jZ(e){for(let t of e)yield*t}function Td(e){return Array.from(jZ(e))}function Ad(e,t){let r=new Sn;if(t===void 0)for(let o of e)o!=null&&o>=o&&r.set(o,(r.get(o)||0)+1);else{let o=-1;for(let s of e)(s=t(s,++o,e))!=null&&s>=s&&r.set(s,(r.get(s)||0)+1)}let n,i=0;for(let[o,s]of r)s>i&&(i=s,n=o);return n}function Q_(e,t=qZ){let r=[],n,i=!1;for(let o of e)i&&r.push(t(n,o)),n=o,i=!0;return r}function qZ(e,t){return[e,t]}function er(e,t,r){e=+e,t=+t,r=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+r;for(var n=-1,i=Math.max(0,Math.ceil((t-e)/r))|0,o=new Array(i);++n<i;)o[n]=e+n*r;return o}function dy(e,t=Ft){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");let r=Array.from(e),n=new Float64Array(r.length);t.length!==2&&(r=r.map(t),t=Ft);let i=(a,c)=>t(r[a],r[c]),o,s;return e=Uint32Array.from(r,(a,c)=>c),e.sort(t===Ft?(a,c)=>wu(r[a],r[c]):ly(i)),e.forEach((a,c)=>{let l=i(a,o===void 0?a:o);l>=0?((o===void 0||l>0)&&(o=a,s=c),n[a]=s):n[a]=NaN}),n}function Z_(e,t=Ft){let r,n=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(n?Ft(s,i)<0:Ft(s,s)===0)&&(r=o,i=s,n=!0)}}else for(let i of e)(n?t(i,r)<0:t(i,i)===0)&&(r=i,n=!0);return r}function Zr(e,t){let r=0;if(t===void 0)for(let n of e)(n=+n)&&(r+=n);else{let n=-1;for(let i of e)(i=+t(i,++n,e))&&(r+=i)}return r}function zc(e){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");return Array.from(e).reverse()}function M5(e){return e}var hM=1,pM=2,mM=3,K_=4,N5=1e-6;function VZ(e){return"translate("+e+",0)"}function YZ(e){return"translate(0,"+e+")"}function WZ(e){return t=>+e(t)}function GZ(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),r=>+e(r)+t}function XZ(){return!this.__axis}function HZ(e,t){var r=[],n=null,i=null,o=6,s=6,a=3,c=typeof window<"u"&&window.devicePixelRatio>1?0:.5,l=e===hM||e===K_?-1:1,u=e===K_||e===pM?"x":"y",f=e===hM||e===mM?VZ:YZ;function d(h){var p=n??(t.ticks?t.ticks.apply(t,r):t.domain()),m=i??(t.tickFormat?t.tickFormat.apply(t,r):M5),y=Math.max(o,0)+a,g=t.range(),x=+g[0]+c,b=+g[g.length-1]+c,_=(t.bandwidth?GZ:WZ)(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(),E=T.enter().append("g").attr("class","tick"),N=T.select("line"),I=T.select("text");w=w.merge(w.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),T=T.merge(E),N=N.merge(E.append("line").attr("stroke","currentColor").attr(u+"2",l*o)),I=I.merge(E.append("text").attr("fill","currentColor").attr(u,l*y).attr("dy",e===hM?"0em":e===mM?"0.71em":"0.32em")),h!==v&&(w=w.transition(h),T=T.transition(h),N=N.transition(h),I=I.transition(h),A=A.transition(h).attr("opacity",N5).attr("transform",function(R){return isFinite(R=_(R))?f(R+c):this.getAttribute("transform")}),E.attr("opacity",N5).attr("transform",function(R){var C=this.parentNode.__axis;return f((C&&isFinite(C=C(R))?C:_(R))+c)})),A.remove(),w.attr("d",e===K_||e===pM?s?"M"+l*s+","+x+"H"+c+"V"+b+"H"+l*s:"M"+c+","+x+"V"+b:s?"M"+x+","+l*s+"V"+c+"H"+b+"V"+l*s:"M"+x+","+c+"H"+b),T.attr("opacity",1).attr("transform",function(R){return f(_(R)+c)}),N.attr(u+"2",l*o),I.attr(u,l*y).text(m),v.filter(XZ).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===pM?"start":e===K_?"end":"middle"),v.each(function(){this.__axis=_})}return d.scale=function(h){return arguments.length?(t=h,d):t},d.ticks=function(){return r=Array.from(arguments),d},d.tickArguments=function(h){return arguments.length?(r=h==null?[]:Array.from(h),d):r.slice()},d.tickValues=function(h){return arguments.length?(n=h==null?null:Array.from(h),d):n&&n.slice()},d.tickFormat=function(h){return arguments.length?(i=h,d):i},d.tickSize=function(h){return arguments.length?(o=s=+h,d):o},d.tickSizeInner=function(h){return arguments.length?(o=+h,d):o},d.tickSizeOuter=function(h){return arguments.length?(s=+h,d):s},d.tickPadding=function(h){return arguments.length?(a=+h,d):a},d.offset=function(h){return arguments.length?(c=+h,d):c},d}function yM(e){return HZ(mM,e)}var QZ={value:()=>{}};function R5(){for(var e=0,t=arguments.length,r={},n;e<t;++e){if(!(n=arguments[e]+"")||n in r||/[\s.]/.test(n))throw new Error("illegal type: "+n);r[n]=[]}return new J_(r)}function J_(e){this._=e}function ZZ(e,t){return e.trim().split(/^|\s+/).map(function(r){var n="",i=r.indexOf(".");if(i>=0&&(n=r.slice(i+1),r=r.slice(0,i)),r&&!t.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:n}})}J_.prototype=R5.prototype={constructor:J_,on:function(e,t){var r=this._,n=ZZ(e+"",r),i,o=-1,s=n.length;if(arguments.length<2){for(;++o<s;)if((i=(e=n[o]).type)&&(i=KZ(r[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++o<s;)if(i=(e=n[o]).type)r[i]=O5(r[i],e.name,t);else if(t==null)for(i in r)r[i]=O5(r[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var r in t)e[r]=t[r].slice();return new J_(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var r=new Array(i),n=0,i,o;n<i;++n)r[n]=arguments[n+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(o=this._[e],n=0,i=o.length;n<i;++n)o[n].value.apply(t,r)},apply:function(e,t,r){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var n=this._[e],i=0,o=n.length;i<o;++i)n[i].value.apply(t,r)}};function KZ(e,t){for(var r=0,n=e.length,i;r<n;++r)if((i=e[r]).name===t)return i.value}function O5(e,t,r){for(var n=0,i=e.length;n<i;++n)if(e[n].name===t){e[n]=QZ,e=e.slice(0,n).concat(e.slice(n+1));break}return r!=null&&e.push({name:t,value:r}),e}var Su=R5;var tw="http://www.w3.org/1999/xhtml",An={svg:"http://www.w3.org/2000/svg",xhtml:tw,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ma(e){var t=e+="",r=t.indexOf(":");return r>=0&&(t=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),An.hasOwnProperty(t)?{space:An[t],local:e}:e}function JZ(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===tw&&t.documentElement.namespaceURI===tw?t.createElement(e):t.createElementNS(r,e)}}function tK(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Na(e){var t=Ma(e);return(t.local?tK:JZ)(t)}function eK(){}function Iu(e){return e==null?eK:function(){return this.querySelector(e)}}function D5(e){typeof e!="function"&&(e=Iu(e));for(var t=this._groups,r=t.length,n=new Array(r),i=0;i<r;++i)for(var o=t[i],s=o.length,a=n[i]=new Array(s),c,l,u=0;u<s;++u)(c=o[u])&&(l=e.call(c,c.__data__,u,o))&&("__data__"in c&&(l.__data__=c.__data__),a[u]=l);return new Qe(n,this._parents)}function gM(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function rK(){return[]}function hy(e){return e==null?rK:function(){return this.querySelectorAll(e)}}function nK(e){return function(){return gM(e.apply(this,arguments))}}function L5(e){typeof e=="function"?e=nK(e):e=hy(e);for(var t=this._groups,r=t.length,n=[],i=[],o=0;o<r;++o)for(var s=t[o],a=s.length,c,l=0;l<a;++l)(c=s[l])&&(n.push(e.call(c,c.__data__,l,s)),i.push(c));return new Qe(n,i)}function py(e){return function(){return this.matches(e)}}function ew(e){return function(t){return t.matches(e)}}var iK=Array.prototype.find;function oK(e){return function(){return iK.call(this.children,e)}}function sK(){return this.firstElementChild}function F5(e){return this.select(e==null?sK:oK(typeof e=="function"?e:ew(e)))}var aK=Array.prototype.filter;function cK(){return Array.from(this.children)}function lK(e){return function(){return aK.call(this.children,e)}}function C5(e){return this.selectAll(e==null?cK:lK(typeof e=="function"?e:ew(e)))}function k5(e){typeof e!="function"&&(e=py(e));for(var t=this._groups,r=t.length,n=new Array(r),i=0;i<r;++i)for(var o=t[i],s=o.length,a=n[i]=[],c,l=0;l<s;++l)(c=o[l])&&e.call(c,c.__data__,l,o)&&a.push(c);return new Qe(n,this._parents)}function rw(e){return new Array(e.length)}function B5(){return new Qe(this._enter||this._groups.map(rw),this._parents)}function my(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}my.prototype={constructor:my,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 P5(e){return function(){return e}}function uK(e,t,r,n,i,o){for(var s=0,a,c=t.length,l=o.length;s<l;++s)(a=t[s])?(a.__data__=o[s],n[s]=a):r[s]=new my(e,o[s]);for(;s<c;++s)(a=t[s])&&(i[s]=a)}function fK(e,t,r,n,i,o,s){var a,c,l=new Map,u=t.length,f=o.length,d=new Array(u),h;for(a=0;a<u;++a)(c=t[a])&&(d[a]=h=s.call(c,c.__data__,a,t)+"",l.has(h)?i[a]=c:l.set(h,c));for(a=0;a<f;++a)h=s.call(e,o[a],a,o)+"",(c=l.get(h))?(n[a]=c,c.__data__=o[a],l.delete(h)):r[a]=new my(e,o[a]);for(a=0;a<u;++a)(c=t[a])&&l.get(d[a])===c&&(i[a]=c)}function dK(e){return e.__data__}function U5(e,t){if(!arguments.length)return Array.from(this,dK);var r=t?fK:uK,n=this._parents,i=this._groups;typeof e!="function"&&(e=P5(e));for(var o=i.length,s=new Array(o),a=new Array(o),c=new Array(o),l=0;l<o;++l){var u=n[l],f=i[l],d=f.length,h=hK(e.call(u,u&&u.__data__,l,n)),p=h.length,m=a[l]=new Array(p),y=s[l]=new Array(p),g=c[l]=new Array(d);r(u,f,m,y,g,h,t);for(var x=0,b=0,_,v;x<p;++x)if(_=m[x]){for(x>=b&&(b=x+1);!(v=y[b])&&++b<p;);_._next=v||null}}return s=new Qe(s,n),s._enter=a,s._exit=c,s}function hK(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function $5(){return new Qe(this._exit||this._groups.map(rw),this._parents)}function z5(e,t,r){var n=this.enter(),i=this,o=this.exit();return typeof e=="function"?(n=e(n),n&&(n=n.selection())):n=n.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),r==null?o.remove():r(o),n&&i?n.merge(i).order():i}function j5(e){for(var t=e.selection?e.selection():e,r=this._groups,n=t._groups,i=r.length,o=n.length,s=Math.min(i,o),a=new Array(i),c=0;c<s;++c)for(var l=r[c],u=n[c],f=l.length,d=a[c]=new Array(f),h,p=0;p<f;++p)(h=l[p]||u[p])&&(d[p]=h);for(;c<i;++c)a[c]=r[c];return new Qe(a,this._parents)}function q5(){for(var e=this._groups,t=-1,r=e.length;++t<r;)for(var n=e[t],i=n.length-1,o=n[i],s;--i>=0;)(s=n[i])&&(o&&s.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(s,o),o=s);return this}function V5(e){e||(e=pK);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var r=this._groups,n=r.length,i=new Array(n),o=0;o<n;++o){for(var s=r[o],a=s.length,c=i[o]=new Array(a),l,u=0;u<a;++u)(l=s[u])&&(c[u]=l);c.sort(t)}return new Qe(i,this._parents).order()}function pK(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Y5(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function W5(){return Array.from(this)}function G5(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var n=e[t],i=0,o=n.length;i<o;++i){var s=n[i];if(s)return s}return null}function X5(){let e=0;for(let t of this)++e;return e}function H5(){return!this.node()}function Q5(e){for(var t=this._groups,r=0,n=t.length;r<n;++r)for(var i=t[r],o=0,s=i.length,a;o<s;++o)(a=i[o])&&e.call(a,a.__data__,o,i);return this}function mK(e){return function(){this.removeAttribute(e)}}function yK(e){return function(){this.removeAttributeNS(e.space,e.local)}}function gK(e,t){return function(){this.setAttribute(e,t)}}function xK(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function bK(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function _K(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function Z5(e,t){var r=Ma(e);if(arguments.length<2){var n=this.node();return r.local?n.getAttributeNS(r.space,r.local):n.getAttribute(r)}return this.each((t==null?r.local?yK:mK:typeof t=="function"?r.local?_K:bK:r.local?xK:gK)(r,t))}function nw(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function wK(e){return function(){this.style.removeProperty(e)}}function vK(e,t,r){return function(){this.style.setProperty(e,t,r)}}function SK(e,t,r){return function(){var n=t.apply(this,arguments);n==null?this.style.removeProperty(e):this.style.setProperty(e,n,r)}}function K5(e,t,r){return arguments.length>1?this.each((t==null?wK:typeof t=="function"?SK:vK)(e,t,r??"")):jc(this.node(),e)}function jc(e,t){return e.style.getPropertyValue(t)||nw(e).getComputedStyle(e,null).getPropertyValue(t)}function IK(e){return function(){delete this[e]}}function TK(e,t){return function(){this[e]=t}}function AK(e,t){return function(){var r=t.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function J5(e,t){return arguments.length>1?this.each((t==null?IK:typeof t=="function"?AK:TK)(e,t)):this.node()[e]}function t7(e){return e.trim().split(/^|\s+/)}function xM(e){return e.classList||new e7(e)}function e7(e){this._node=e,this._names=t7(e.getAttribute("class")||"")}e7.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 r7(e,t){for(var r=xM(e),n=-1,i=t.length;++n<i;)r.add(t[n])}function n7(e,t){for(var r=xM(e),n=-1,i=t.length;++n<i;)r.remove(t[n])}function EK(e){return function(){r7(this,e)}}function MK(e){return function(){n7(this,e)}}function NK(e,t){return function(){(t.apply(this,arguments)?r7:n7)(this,e)}}function i7(e,t){var r=t7(e+"");if(arguments.length<2){for(var n=xM(this.node()),i=-1,o=r.length;++i<o;)if(!n.contains(r[i]))return!1;return!0}return this.each((typeof t=="function"?NK:t?EK:MK)(r,t))}function OK(){this.textContent=""}function RK(e){return function(){this.textContent=e}}function DK(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function o7(e){return arguments.length?this.each(e==null?OK:(typeof e=="function"?DK:RK)(e)):this.node().textContent}function LK(){this.innerHTML=""}function FK(e){return function(){this.innerHTML=e}}function CK(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function s7(e){return arguments.length?this.each(e==null?LK:(typeof e=="function"?CK:FK)(e)):this.node().innerHTML}function kK(){this.nextSibling&&this.parentNode.appendChild(this)}function a7(){return this.each(kK)}function BK(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function c7(){return this.each(BK)}function l7(e){var t=typeof e=="function"?e:Na(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function PK(){return null}function u7(e,t){var r=typeof e=="function"?e:Na(e),n=t==null?PK:typeof t=="function"?t:Iu(t);return this.select(function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)})}function UK(){var e=this.parentNode;e&&e.removeChild(this)}function f7(){return this.each(UK)}function $K(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function zK(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function d7(e){return this.select(e?zK:$K)}function h7(e){return arguments.length?this.property("__data__",e):this.node().__data__}function jK(e){return function(t){e.call(this,t,this.__data__)}}function qK(e){return e.trim().split(/^|\s+/).map(function(t){var r="",n=t.indexOf(".");return n>=0&&(r=t.slice(n+1),t=t.slice(0,n)),{type:t,name:r}})}function VK(e){return function(){var t=this.__on;if(t){for(var r=0,n=-1,i=t.length,o;r<i;++r)o=t[r],(!e.type||o.type===e.type)&&o.name===e.name?this.removeEventListener(o.type,o.listener,o.options):t[++n]=o;++n?t.length=n:delete this.__on}}}function YK(e,t,r){return function(){var n=this.__on,i,o=jK(t);if(n){for(var s=0,a=n.length;s<a;++s)if((i=n[s]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=o,i.options=r),i.value=t;return}}this.addEventListener(e.type,o,r),i={type:e.type,name:e.name,value:t,listener:o,options:r},n?n.push(i):this.__on=[i]}}function p7(e,t,r){var n=qK(e+""),i,o=n.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,u;c<l;++c)for(i=0,u=a[c];i<o;++i)if((s=n[i]).type===u.type&&s.name===u.name)return u.value}return}for(a=t?YK:VK,i=0;i<o;++i)this.each(a(n[i],t,r));return this}function m7(e,t,r){var n=nw(e),i=n.CustomEvent;typeof i=="function"?i=new i(t,r):(i=n.document.createEvent("Event"),r?(i.initEvent(t,r.bubbles,r.cancelable),i.detail=r.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function WK(e,t){return function(){return m7(this,e,t)}}function GK(e,t){return function(){return m7(this,e,t.apply(this,arguments))}}function y7(e,t){return this.each((typeof t=="function"?GK:WK)(e,t))}function*g7(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var n=e[t],i=0,o=n.length,s;i<o;++i)(s=n[i])&&(yield s)}var bM=[null];function Qe(e,t){this._groups=e,this._parents=t}function x7(){return new Qe([[document.documentElement]],bM)}function XK(){return this}Qe.prototype=x7.prototype={constructor:Qe,select:D5,selectAll:L5,selectChild:F5,selectChildren:C5,filter:k5,data:U5,enter:B5,exit:$5,join:z5,merge:j5,selection:XK,order:q5,sort:V5,call:Y5,nodes:W5,node:G5,size:X5,empty:H5,each:Q5,attr:Z5,style:K5,property:J5,classed:i7,text:o7,html:s7,raise:a7,lower:c7,append:l7,insert:u7,remove:f7,clone:d7,datum:h7,on:p7,dispatch:y7,[Symbol.iterator]:g7};var Oa=x7;function Qt(e){return typeof e=="string"?new Qe([[document.querySelector(e)]],[document.documentElement]):new Qe([[e]],bM)}function b7(e){let t;for(;t=e.sourceEvent;)e=t;return e}function an(e,t){if(e=b7(e),t===void 0&&(t=e.currentTarget),t){var r=t.ownerSVGElement||t;if(r.createSVGPoint){var n=r.createSVGPoint();return n.x=e.clientX,n.y=e.clientY,n=n.matrixTransform(t.getScreenCTM().inverse()),[n.x,n.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var iw={capture:!0,passive:!1};function ow(e){e.preventDefault(),e.stopImmediatePropagation()}function yy(e){var t=e.document.documentElement,r=Qt(e).on("dragstart.drag",ow,iw);"onselectstart"in t?r.on("selectstart.drag",ow,iw):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function gy(e,t){var r=e.document.documentElement,n=Qt(e).on("dragstart.drag",null);t&&(n.on("click.drag",ow,iw),setTimeout(function(){n.on("click.drag",null)},0)),"onselectstart"in r?n.on("selectstart.drag",null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect)}function Ra(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function qc(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}function is(){}var Vc=.7,Eu=1/Vc,Ed="\\s*([+-]?\\d+)\\s*",xy="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ns="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",HK=/^#([0-9a-f]{3,8})$/,QK=new RegExp(`^rgb\\(${Ed},${Ed},${Ed}\\)$`),ZK=new RegExp(`^rgb\\(${ns},${ns},${ns}\\)$`),KK=new RegExp(`^rgba\\(${Ed},${Ed},${Ed},${xy}\\)$`),JK=new RegExp(`^rgba\\(${ns},${ns},${ns},${xy}\\)$`),tJ=new RegExp(`^hsl\\(${xy},${ns},${ns}\\)$`),eJ=new RegExp(`^hsla\\(${xy},${ns},${ns},${xy}\\)$`),_7={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};Ra(is,di,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:w7,formatHex:w7,formatHex8:rJ,formatHsl:nJ,formatRgb:v7,toString:v7});function w7(){return this.rgb().formatHex()}function rJ(){return this.rgb().formatHex8()}function nJ(){return M7(this).formatHsl()}function v7(){return this.rgb().formatRgb()}function di(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=HK.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?S7(t):r===3?new cr(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?sw(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?sw(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=QK.exec(e))?new cr(t[1],t[2],t[3],1):(t=ZK.exec(e))?new cr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=KK.exec(e))?sw(t[1],t[2],t[3],t[4]):(t=JK.exec(e))?sw(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=tJ.exec(e))?A7(t[1],t[2]/100,t[3]/100,1):(t=eJ.exec(e))?A7(t[1],t[2]/100,t[3]/100,t[4]):_7.hasOwnProperty(e)?S7(_7[e]):e==="transparent"?new cr(NaN,NaN,NaN,0):null}function S7(e){return new cr(e>>16&255,e>>8&255,e&255,1)}function sw(e,t,r,n){return n<=0&&(e=t=r=NaN),new cr(e,t,r,n)}function by(e){return e instanceof is||(e=di(e)),e?(e=e.rgb(),new cr(e.r,e.g,e.b,e.opacity)):new cr}function wr(e,t,r,n){return arguments.length===1?by(e):new cr(e,t,r,n??1)}function cr(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}Ra(cr,wr,qc(is,{brighter(e){return e=e==null?Eu:Math.pow(Eu,e),new cr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Vc:Math.pow(Vc,e),new cr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new cr(Au(this.r),Au(this.g),Au(this.b),cw(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:I7,formatHex:I7,formatHex8:iJ,formatRgb:T7,toString:T7}));function I7(){return`#${Tu(this.r)}${Tu(this.g)}${Tu(this.b)}`}function iJ(){return`#${Tu(this.r)}${Tu(this.g)}${Tu(this.b)}${Tu((isNaN(this.opacity)?1:this.opacity)*255)}`}function T7(){let e=cw(this.opacity);return`${e===1?"rgb(":"rgba("}${Au(this.r)}, ${Au(this.g)}, ${Au(this.b)}${e===1?")":`, ${e})`}`}function cw(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Au(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Tu(e){return e=Au(e),(e<16?"0":"")+e.toString(16)}function A7(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new Mo(e,t,r,n)}function M7(e){if(e instanceof Mo)return new Mo(e.h,e.s,e.l,e.opacity);if(e instanceof is||(e=di(e)),!e)return new Mo;if(e instanceof Mo)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),o=Math.max(t,r,n),s=NaN,a=o-i,c=(o+i)/2;return a?(t===o?s=(r-n)/a+(r<n)*6:r===o?s=(n-t)/a+2:s=(t-r)/a+4,a/=c<.5?o+i:2-o-i,s*=60):a=c>0&&c<1?0:s,new Mo(s,a,c,e.opacity)}function _y(e,t,r,n){return arguments.length===1?M7(e):new Mo(e,t,r,n??1)}function Mo(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}Ra(Mo,_y,qc(is,{brighter(e){return e=e==null?Eu:Math.pow(Eu,e),new Mo(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Vc:Math.pow(Vc,e),new Mo(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,i=2*r-n;return new cr(_M(e>=240?e-240:e+120,i,n),_M(e,i,n),_M(e<120?e+240:e-120,i,n),this.opacity)},clamp(){return new Mo(E7(this.h),aw(this.s),aw(this.l),cw(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=cw(this.opacity);return`${e===1?"hsl(":"hsla("}${E7(this.h)}, ${aw(this.s)*100}%, ${aw(this.l)*100}%${e===1?")":`, ${e})`}`}}));function E7(e){return e=(e||0)%360,e<0?e+360:e}function aw(e){return Math.max(0,Math.min(1,e||0))}function _M(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}var lw=Math.PI/180,uw=180/Math.PI;var fw=18,N7=.96422,O7=1,R7=.82521,D7=4/29,Md=6/29,L7=3*Md*Md,oJ=Md*Md*Md;function F7(e){if(e instanceof os)return new os(e.l,e.a,e.b,e.opacity);if(e instanceof Da)return C7(e);e instanceof cr||(e=by(e));var t=IM(e.r),r=IM(e.g),n=IM(e.b),i=wM((.2225045*t+.7168786*r+.0606169*n)/O7),o,s;return t===r&&r===n?o=s=i:(o=wM((.4360747*t+.3850649*r+.1430804*n)/N7),s=wM((.0139322*t+.0971045*r+.7141733*n)/R7)),new os(116*i-16,500*(o-i),200*(i-s),e.opacity)}function Nd(e,t,r,n){return arguments.length===1?F7(e):new os(e,t,r,n??1)}function os(e,t,r,n){this.l=+e,this.a=+t,this.b=+r,this.opacity=+n}Ra(os,Nd,qc(is,{brighter(e){return new os(this.l+fw*(e??1),this.a,this.b,this.opacity)},darker(e){return new os(this.l-fw*(e??1),this.a,this.b,this.opacity)},rgb(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,r=isNaN(this.b)?e:e-this.b/200;return t=N7*vM(t),e=O7*vM(e),r=R7*vM(r),new cr(SM(3.1338561*t-1.6168667*e-.4906146*r),SM(-.9787684*t+1.9161415*e+.033454*r),SM(.0719453*t-.2289914*e+1.4052427*r),this.opacity)}}));function wM(e){return e>oJ?Math.pow(e,1/3):e/L7+D7}function vM(e){return e>Md?e*e*e:L7*(e-D7)}function SM(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function IM(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function sJ(e){if(e instanceof Da)return new Da(e.h,e.c,e.l,e.opacity);if(e instanceof os||(e=F7(e)),e.a===0&&e.b===0)return new Da(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*uw;return new Da(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function wy(e,t,r,n){return arguments.length===1?sJ(e):new Da(e,t,r,n??1)}function Da(e,t,r,n){this.h=+e,this.c=+t,this.l=+r,this.opacity=+n}function C7(e){if(isNaN(e.h))return new os(e.l,0,0,e.opacity);var t=e.h*lw;return new os(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}Ra(Da,wy,qc(is,{brighter(e){return new Da(this.h,this.c,this.l+fw*(e??1),this.opacity)},darker(e){return new Da(this.h,this.c,this.l-fw*(e??1),this.opacity)},rgb(){return C7(this).rgb()}}));var U7=-.14861,TM=1.78277,AM=-.29227,dw=-.90649,vy=1.97294,k7=vy*dw,B7=vy*TM,P7=TM*AM-dw*U7;function aJ(e){if(e instanceof Mu)return new Mu(e.h,e.s,e.l,e.opacity);e instanceof cr||(e=by(e));var t=e.r/255,r=e.g/255,n=e.b/255,i=(P7*n+k7*t-B7*r)/(P7+k7-B7),o=n-i,s=(vy*(r-i)-AM*o)/dw,a=Math.sqrt(s*s+o*o)/(vy*i*(1-i)),c=a?Math.atan2(s,o)*uw-120:NaN;return new Mu(c<0?c+360:c,a,i,e.opacity)}function En(e,t,r,n){return arguments.length===1?aJ(e):new Mu(e,t,r,n??1)}function Mu(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}Ra(Mu,En,qc(is,{brighter(e){return e=e==null?Eu:Math.pow(Eu,e),new Mu(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Vc:Math.pow(Vc,e),new Mu(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*lw,t=+this.l,r=isNaN(this.s)?0:this.s*t*(1-t),n=Math.cos(e),i=Math.sin(e);return new cr(255*(t+r*(U7*n+TM*i)),255*(t+r*(AM*n+dw*i)),255*(t+r*(vy*n)),this.opacity)}}));function EM(e,t,r,n,i){var o=e*e,s=o*e;return((1-3*e+3*o-s)*t+(4-6*o+3*s)*r+(1+3*e+3*o-3*s)*n+s*i)/6}function $7(e){var t=e.length-1;return function(r){var n=r<=0?r=0:r>=1?(r=1,t-1):Math.floor(r*t),i=e[n],o=e[n+1],s=n>0?e[n-1]:2*i-o,a=n<t-1?e[n+2]:2*o-i;return EM((r-n/t)*t,s,i,o,a)}}function z7(e){var t=e.length;return function(r){var n=Math.floor(((r%=1)<0?++r:r)*t),i=e[(n+t-1)%t],o=e[n%t],s=e[(n+1)%t],a=e[(n+2)%t];return EM((r-n/t)*t,i,o,s,a)}}var Od=e=>()=>e;function j7(e,t){return function(r){return e+r*t}}function cJ(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function Rd(e,t){var r=t-e;return r?j7(e,r>180||r<-180?r-360*Math.round(r/360):r):Od(isNaN(e)?t:e)}function q7(e){return(e=+e)==1?Be:function(t,r){return r-t?cJ(t,r,e):Od(isNaN(t)?r:t)}}function Be(e,t){var r=t-e;return r?j7(e,r):Od(isNaN(e)?t:e)}var ji=function e(t){var r=q7(t);function n(i,o){var s=r((i=wr(i)).r,(o=wr(o)).r),a=r(i.g,o.g),c=r(i.b,o.b),l=Be(i.opacity,o.opacity);return function(u){return i.r=s(u),i.g=a(u),i.b=c(u),i.opacity=l(u),i+""}}return n.gamma=e,n}(1);function V7(e){return function(t){var r=t.length,n=new Array(r),i=new Array(r),o=new Array(r),s,a;for(s=0;s<r;++s)a=wr(t[s]),n[s]=a.r||0,i[s]=a.g||0,o[s]=a.b||0;return n=e(n),i=e(i),o=e(o),a.opacity=1,function(c){return a.r=n(c),a.g=i(c),a.b=o(c),a+""}}}var MM=V7($7),lJ=V7(z7);function Y7(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,n=t.slice(),i;return function(o){for(i=0;i<r;++i)n[i]=e[i]*(1-o)+t[i]*o;return n}}function W7(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function G7(e,t){var r=t?t.length:0,n=e?Math.min(r,e.length):0,i=new Array(n),o=new Array(r),s;for(s=0;s<n;++s)i[s]=hi(e[s],t[s]);for(;s<r;++s)o[s]=t[s];return function(a){for(s=0;s<n;++s)o[s]=i[s](a);return o}}function X7(e,t){var r=new Date;return e=+e,t=+t,function(n){return r.setTime(e*(1-n)+t*n),r}}function Fe(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}function H7(e,t){var r={},n={},i;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(i in t)i in e?r[i]=hi(e[i],t[i]):n[i]=t[i];return function(o){for(i in r)n[i]=r[i](o);return n}}var OM=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,NM=new RegExp(OM.source,"g");function uJ(e){return function(){return e}}function fJ(e){return function(t){return e(t)+""}}function Sy(e,t){var r=OM.lastIndex=NM.lastIndex=0,n,i,o,s=-1,a=[],c=[];for(e=e+"",t=t+"";(n=OM.exec(e))&&(i=NM.exec(t));)(o=i.index)>r&&(o=t.slice(r,o),a[s]?a[s]+=o:a[++s]=o),(n=n[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,c.push({i:s,x:Fe(n,i)})),r=NM.lastIndex;return r<t.length&&(o=t.slice(r),a[s]?a[s]+=o:a[++s]=o),a.length<2?c[0]?fJ(c[0].x):uJ(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 hi(e,t){var r=typeof t,n;return t==null||r==="boolean"?Od(t):(r==="number"?Fe:r==="string"?(n=di(t))?(t=n,ji):Sy:t instanceof di?ji:t instanceof Date?X7:W7(t)?Y7:Array.isArray(t)?G7:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?H7:Fe)(e,t)}function Nu(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}var Q7=180/Math.PI,hw={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function RM(e,t,r,n,i,o){var s,a,c;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(c=e*r+t*n)&&(r-=e*c,n-=t*c),(a=Math.sqrt(r*r+n*n))&&(r/=a,n/=a,c/=a),e*n<t*r&&(e=-e,t=-t,c=-c,s=-s),{translateX:i,translateY:o,rotate:Math.atan2(t,e)*Q7,skewX:Math.atan(c)*Q7,scaleX:s,scaleY:a}}var pw;function Z7(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?hw:RM(t.a,t.b,t.c,t.d,t.e,t.f)}function K7(e){return e==null?hw:(pw||(pw=document.createElementNS("http://www.w3.org/2000/svg","g")),pw.setAttribute("transform",e),(e=pw.transform.baseVal.consolidate())?(e=e.matrix,RM(e.a,e.b,e.c,e.d,e.e,e.f)):hw)}function J7(e,t,r,n){function i(l){return l.length?l.pop()+" ":""}function o(l,u,f,d,h,p){if(l!==f||u!==d){var m=h.push("translate(",null,t,null,r);p.push({i:m-4,x:Fe(l,f)},{i:m-2,x:Fe(u,d)})}else(f||d)&&h.push("translate("+f+t+d+r)}function s(l,u,f,d){l!==u?(l-u>180?u+=360:u-l>180&&(l+=360),d.push({i:f.push(i(f)+"rotate(",null,n)-2,x:Fe(l,u)})):u&&f.push(i(f)+"rotate("+u+n)}function a(l,u,f,d){l!==u?d.push({i:f.push(i(f)+"skewX(",null,n)-2,x:Fe(l,u)}):u&&f.push(i(f)+"skewX("+u+n)}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:Fe(l,f)},{i:m-2,x:Fe(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,y;++p<m;)f[(y=d[p]).i]=y.x(h);return f.join("")}}}var DM=J7(Z7,"px, ","px)","deg)"),LM=J7(K7,", ",")",")");var dJ=1e-12;function tP(e){return((e=Math.exp(e))+1/e)/2}function hJ(e){return((e=Math.exp(e))-1/e)/2}function pJ(e){return((e=Math.exp(2*e))-1)/(e+1)}var FM=function e(t,r,n){function i(o,s){var a=o[0],c=o[1],l=o[2],u=s[0],f=s[1],d=s[2],h=u-a,p=f-c,m=h*h+p*p,y,g;if(m<dJ)g=Math.log(d/l)/t,y=function(T){return[a+T*h,c+T*p,l*Math.exp(t*T*g)]};else{var x=Math.sqrt(m),b=(d*d-l*l+n*m)/(2*l*r*x),_=(d*d-l*l-n*m)/(2*d*r*x),v=Math.log(Math.sqrt(b*b+1)-b),w=Math.log(Math.sqrt(_*_+1)-_);g=(w-v)/t,y=function(T){var A=T*g,E=tP(v),N=l/(r*x)*(E*pJ(t*A+v)-hJ(v));return[a+N*h,c+N*p,l*E/tP(t*A+v)]}}return y.duration=g*1e3*t/Math.SQRT2,y}return i.rho=function(o){var s=Math.max(.001,+o),a=s*s,c=a*a;return e(s,a,c)},i}(Math.SQRT2,2,4);function eP(e){return function(t,r){var n=e((t=_y(t)).h,(r=_y(r)).h),i=Be(t.s,r.s),o=Be(t.l,r.l),s=Be(t.opacity,r.opacity);return function(a){return t.h=n(a),t.s=i(a),t.l=o(a),t.opacity=s(a),t+""}}}var CM=eP(Rd),mJ=eP(Be);function mw(e,t){var r=Be((e=Nd(e)).l,(t=Nd(t)).l),n=Be(e.a,t.a),i=Be(e.b,t.b),o=Be(e.opacity,t.opacity);return function(s){return e.l=r(s),e.a=n(s),e.b=i(s),e.opacity=o(s),e+""}}function rP(e){return function(t,r){var n=e((t=wy(t)).h,(r=wy(r)).h),i=Be(t.c,r.c),o=Be(t.l,r.l),s=Be(t.opacity,r.opacity);return function(a){return t.h=n(a),t.c=i(a),t.l=o(a),t.opacity=s(a),t+""}}}var kM=rP(Rd),yJ=rP(Be);function nP(e){return function t(r){r=+r;function n(i,o){var s=e((i=En(i)).h,(o=En(o)).h),a=Be(i.s,o.s),c=Be(i.l,o.l),l=Be(i.opacity,o.opacity);return function(u){return i.h=s(u),i.s=a(u),i.l=c(Math.pow(u,r)),i.opacity=l(u),i+""}}return n.gamma=t,n}(1)}var gJ=nP(Rd),Dd=nP(Be);function ss(e,t){t===void 0&&(t=e,e=hi);for(var r=0,n=t.length-1,i=t[0],o=new Array(n<0?0:n);r<n;)o[r]=e(i,i=t[++r]);return function(s){var a=Math.max(0,Math.min(n-1,Math.floor(s*=n)));return o[a](s-a)}}function cn(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e(n/(t-1));return r}var Ld=0,Ty=0,Iy=0,oP=1e3,yw,Ay,gw=0,Ou=0,xw=0,Ey=typeof performance=="object"&&performance.now?performance:Date,sP=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Ny(){return Ou||(sP(xJ),Ou=Ey.now()+xw)}function xJ(){Ou=0}function My(){this._call=this._time=this._next=null}My.prototype=bw.prototype={constructor:My,restart:function(e,t,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?Ny():+r)+(t==null?0:+t),!this._next&&Ay!==this&&(Ay?Ay._next=this:yw=this,Ay=this),this._call=e,this._time=r,BM()},stop:function(){this._call&&(this._call=null,this._time=1/0,BM())}};function bw(e,t,r){var n=new My;return n.restart(e,t,r),n}function aP(){Ny(),++Ld;for(var e=yw,t;e;)(t=Ou-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ld}function iP(){Ou=(gw=Ey.now())+xw,Ld=Ty=0;try{aP()}finally{Ld=0,_J(),Ou=0}}function bJ(){var e=Ey.now(),t=e-gw;t>oP&&(xw-=t,gw=e)}function _J(){for(var e,t=yw,r,n=1/0;t;)t._call?(n>t._time&&(n=t._time),e=t,t=t._next):(r=t._next,t._next=null,t=e?e._next=r:yw=r);Ay=e,BM(n)}function BM(e){if(!Ld){Ty&&(Ty=clearTimeout(Ty));var t=e-Ou;t>24?(e<1/0&&(Ty=setTimeout(iP,e-Ey.now()-xw)),Iy&&(Iy=clearInterval(Iy))):(Iy||(gw=Ey.now(),Iy=setInterval(bJ,oP)),Ld=1,sP(iP))}}function _w(e,t,r){var n=new My;return t=t==null?0:+t,n.restart(i=>{n.stop(),e(i+t)},t,r),n}var wJ=Su("start","end","cancel","interrupt"),vJ=[],uP=0,cP=1,vw=2,ww=3,lP=4,Sw=5,Oy=6;function Yc(e,t,r,n,i,o){var s=e.__transition;if(!s)e.__transition={};else if(r in s)return;SJ(e,r,{name:t,index:n,group:i,on:wJ,tween:vJ,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:uP})}function Ry(e,t){var r=vr(e,t);if(r.state>uP)throw new Error("too late; already scheduled");return r}function Kr(e,t){var r=vr(e,t);if(r.state>ww)throw new Error("too late; already running");return r}function vr(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw new Error("transition not found");return r}function SJ(e,t,r){var n=e.__transition,i;n[t]=r,r.timer=bw(o,0,r.time);function o(l){r.state=cP,r.timer.restart(s,r.delay,r.time),r.delay<=l&&s(l-r.delay)}function s(l){var u,f,d,h;if(r.state!==cP)return c();for(u in n)if(h=n[u],h.name===r.name){if(h.state===ww)return _w(s);h.state===lP?(h.state=Oy,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete n[u]):+u<t&&(h.state=Oy,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete n[u])}if(_w(function(){r.state===ww&&(r.state=lP,r.timer.restart(a,r.delay,r.time),a(l))}),r.state=vw,r.on.call("start",e,e.__data__,r.index,r.group),r.state===vw){for(r.state=ww,i=new Array(d=r.tween.length),u=0,f=-1;u<d;++u)(h=r.tween[u].value.call(e,e.__data__,r.index,r.group))&&(i[++f]=h);i.length=f+1}}function a(l){for(var u=l<r.duration?r.ease.call(null,l/r.duration):(r.timer.restart(c),r.state=Sw,1),f=-1,d=i.length;++f<d;)i[f].call(e,u);r.state===Sw&&(r.on.call("end",e,e.__data__,r.index,r.group),c())}function c(){r.state=Oy,r.timer.stop(),delete n[t];for(var l in n)return;delete e.__transition}}function as(e,t){var r=e.__transition,n,i,o=!0,s;if(r){t=t==null?null:t+"";for(s in r){if((n=r[s]).name!==t){o=!1;continue}i=n.state>vw&&n.state<Sw,n.state=Oy,n.timer.stop(),n.on.call(i?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete r[s]}o&&delete e.__transition}}function fP(e){return this.each(function(){as(this,e)})}function IJ(e,t){var r,n;return function(){var i=Kr(this,e),o=i.tween;if(o!==r){n=r=o;for(var s=0,a=n.length;s<a;++s)if(n[s].name===t){n=n.slice(),n.splice(s,1);break}}i.tween=n}}function TJ(e,t,r){var n,i;if(typeof r!="function")throw new Error;return function(){var o=Kr(this,e),s=o.tween;if(s!==n){i=(n=s).slice();for(var a={name:t,value:r},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=a;break}c===l&&i.push(a)}o.tween=i}}function dP(e,t){var r=this._id;if(e+="",arguments.length<2){for(var n=vr(this.node(),r).tween,i=0,o=n.length,s;i<o;++i)if((s=n[i]).name===e)return s.value;return null}return this.each((t==null?IJ:TJ)(r,e,t))}function Fd(e,t,r){var n=e._id;return e.each(function(){var i=Kr(this,n);(i.value||(i.value={}))[t]=r.apply(this,arguments)}),function(i){return vr(i,n).value[t]}}function Iw(e,t){var r;return(typeof t=="number"?Fe:t instanceof di?ji:(r=di(t))?(t=r,ji):Sy)(e,t)}function AJ(e){return function(){this.removeAttribute(e)}}function EJ(e){return function(){this.removeAttributeNS(e.space,e.local)}}function MJ(e,t,r){var n,i=r+"",o;return function(){var s=this.getAttribute(e);return s===i?null:s===n?o:o=t(n=s,r)}}function NJ(e,t,r){var n,i=r+"",o;return function(){var s=this.getAttributeNS(e.space,e.local);return s===i?null:s===n?o:o=t(n=s,r)}}function OJ(e,t,r){var n,i,o;return function(){var s,a=r(this),c;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),c=a+"",s===c?null:s===n&&c===i?o:(i=c,o=t(n=s,a)))}}function RJ(e,t,r){var n,i,o;return function(){var s,a=r(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),c=a+"",s===c?null:s===n&&c===i?o:(i=c,o=t(n=s,a)))}}function hP(e,t){var r=Ma(e),n=r==="transform"?LM:Iw;return this.attrTween(e,typeof t=="function"?(r.local?RJ:OJ)(r,n,Fd(this,"attr."+e,t)):t==null?(r.local?EJ:AJ)(r):(r.local?NJ:MJ)(r,n,t))}function DJ(e,t){return function(r){this.setAttribute(e,t.call(this,r))}}function LJ(e,t){return function(r){this.setAttributeNS(e.space,e.local,t.call(this,r))}}function FJ(e,t){var r,n;function i(){var o=t.apply(this,arguments);return o!==n&&(r=(n=o)&&LJ(e,o)),r}return i._value=t,i}function CJ(e,t){var r,n;function i(){var o=t.apply(this,arguments);return o!==n&&(r=(n=o)&&DJ(e,o)),r}return i._value=t,i}function pP(e,t){var r="attr."+e;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;var n=Ma(e);return this.tween(r,(n.local?FJ:CJ)(n,t))}function kJ(e,t){return function(){Ry(this,e).delay=+t.apply(this,arguments)}}function BJ(e,t){return t=+t,function(){Ry(this,e).delay=t}}function mP(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?kJ:BJ)(t,e)):vr(this.node(),t).delay}function PJ(e,t){return function(){Kr(this,e).duration=+t.apply(this,arguments)}}function UJ(e,t){return t=+t,function(){Kr(this,e).duration=t}}function yP(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?PJ:UJ)(t,e)):vr(this.node(),t).duration}function $J(e,t){if(typeof t!="function")throw new Error;return function(){Kr(this,e).ease=t}}function gP(e){var t=this._id;return arguments.length?this.each($J(t,e)):vr(this.node(),t).ease}function zJ(e,t){return function(){var r=t.apply(this,arguments);if(typeof r!="function")throw new Error;Kr(this,e).ease=r}}function xP(e){if(typeof e!="function")throw new Error;return this.each(zJ(this._id,e))}function bP(e){typeof e!="function"&&(e=py(e));for(var t=this._groups,r=t.length,n=new Array(r),i=0;i<r;++i)for(var o=t[i],s=o.length,a=n[i]=[],c,l=0;l<s;++l)(c=o[l])&&e.call(c,c.__data__,l,o)&&a.push(c);return new Mn(n,this._parents,this._name,this._id)}function _P(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,r=e._groups,n=t.length,i=r.length,o=Math.min(n,i),s=new Array(n),a=0;a<o;++a)for(var c=t[a],l=r[a],u=c.length,f=s[a]=new Array(u),d,h=0;h<u;++h)(d=c[h]||l[h])&&(f[h]=d);for(;a<n;++a)s[a]=t[a];return new Mn(s,this._parents,this._name,this._id)}function jJ(e){return(e+"").trim().split(/^|\s+/).every(function(t){var r=t.indexOf(".");return r>=0&&(t=t.slice(0,r)),!t||t==="start"})}function qJ(e,t,r){var n,i,o=jJ(t)?Ry:Kr;return function(){var s=o(this,e),a=s.on;a!==n&&(i=(n=a).copy()).on(t,r),s.on=i}}function wP(e,t){var r=this._id;return arguments.length<2?vr(this.node(),r).on.on(e):this.each(qJ(r,e,t))}function VJ(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}function vP(){return this.on("end.remove",VJ(this._id))}function SP(e){var t=this._name,r=this._id;typeof e!="function"&&(e=Iu(e));for(var n=this._groups,i=n.length,o=new Array(i),s=0;s<i;++s)for(var a=n[s],c=a.length,l=o[s]=new Array(c),u,f,d=0;d<c;++d)(u=a[d])&&(f=e.call(u,u.__data__,d,a))&&("__data__"in u&&(f.__data__=u.__data__),l[d]=f,Yc(l[d],t,r,d,l,vr(u,r)));return new Mn(o,this._parents,t,r)}function IP(e){var t=this._name,r=this._id;typeof e!="function"&&(e=hy(e));for(var n=this._groups,i=n.length,o=[],s=[],a=0;a<i;++a)for(var c=n[a],l=c.length,u,f=0;f<l;++f)if(u=c[f]){for(var d=e.call(u,u.__data__,f,c),h,p=vr(u,r),m=0,y=d.length;m<y;++m)(h=d[m])&&Yc(h,t,r,m,d,p);o.push(d),s.push(u)}return new Mn(o,s,t,r)}var YJ=Oa.prototype.constructor;function TP(){return new YJ(this._groups,this._parents)}function WJ(e,t){var r,n,i;return function(){var o=jc(this,e),s=(this.style.removeProperty(e),jc(this,e));return o===s?null:o===r&&s===n?i:i=t(r=o,n=s)}}function AP(e){return function(){this.style.removeProperty(e)}}function GJ(e,t,r){var n,i=r+"",o;return function(){var s=jc(this,e);return s===i?null:s===n?o:o=t(n=s,r)}}function XJ(e,t,r){var n,i,o;return function(){var s=jc(this,e),a=r(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),jc(this,e))),s===c?null:s===n&&c===i?o:(i=c,o=t(n=s,a))}}function HJ(e,t){var r,n,i,o="style."+t,s="end."+o,a;return function(){var c=Kr(this,e),l=c.on,u=c.value[o]==null?a||(a=AP(t)):void 0;(l!==r||i!==u)&&(n=(r=l).copy()).on(s,i=u),c.on=n}}function EP(e,t,r){var n=(e+="")=="transform"?DM:Iw;return t==null?this.styleTween(e,WJ(e,n)).on("end.style."+e,AP(e)):typeof t=="function"?this.styleTween(e,XJ(e,n,Fd(this,"style."+e,t))).each(HJ(this._id,e)):this.styleTween(e,GJ(e,n,t),r).on("end.style."+e,null)}function QJ(e,t,r){return function(n){this.style.setProperty(e,t.call(this,n),r)}}function ZJ(e,t,r){var n,i;function o(){var s=t.apply(this,arguments);return s!==i&&(n=(i=s)&&QJ(e,s,r)),n}return o._value=t,o}function MP(e,t,r){var n="style."+(e+="");if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;return this.tween(n,ZJ(e,t,r??""))}function KJ(e){return function(){this.textContent=e}}function JJ(e){return function(){var t=e(this);this.textContent=t??""}}function NP(e){return this.tween("text",typeof e=="function"?JJ(Fd(this,"text",e)):KJ(e==null?"":e+""))}function ttt(e){return function(t){this.textContent=e.call(this,t)}}function ett(e){var t,r;function n(){var i=e.apply(this,arguments);return i!==r&&(t=(r=i)&&ttt(i)),t}return n._value=e,n}function OP(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,ett(e))}function RP(){for(var e=this._name,t=this._id,r=Tw(),n=this._groups,i=n.length,o=0;o<i;++o)for(var s=n[o],a=s.length,c,l=0;l<a;++l)if(c=s[l]){var u=vr(c,t);Yc(c,e,r,l,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Mn(n,this._parents,e,r)}function DP(){var e,t,r=this,n=r._id,i=r.size();return new Promise(function(o,s){var a={value:s},c={value:function(){--i===0&&o()}};r.each(function(){var l=Kr(this,n),u=l.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),l.on=t}),i===0&&o()})}var rtt=0;function Mn(e,t,r,n){this._groups=e,this._parents=t,this._name=r,this._id=n}function LP(e){return Oa().transition(e)}function Tw(){return++rtt}var La=Oa.prototype;Mn.prototype=LP.prototype={constructor:Mn,select:SP,selectAll:IP,selectChild:La.selectChild,selectChildren:La.selectChildren,filter:bP,merge:_P,selection:TP,transition:RP,call:La.call,nodes:La.nodes,node:La.node,size:La.size,empty:La.empty,each:La.each,on:wP,attr:hP,attrTween:pP,style:EP,styleTween:MP,text:NP,textTween:OP,remove:vP,tween:dP,delay:mP,duration:yP,ease:gP,easeVarying:xP,end:DP,[Symbol.iterator]:La[Symbol.iterator]};function Aw(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var ntt={time:null,delay:0,duration:250,ease:Aw};function itt(e,t){for(var r;!(r=e.__transition)||!(r=r[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return r}function FP(e){var t,r;e instanceof Mn?(t=e._id,e=e._name):(t=Tw(),(r=ntt).time=Ny(),e=e==null?null:e+"");for(var n=this._groups,i=n.length,o=0;o<i;++o)for(var s=n[o],a=s.length,c,l=0;l<a;++l)(c=s[l])&&Yc(c,e,t,l,s,r||itt(c,t));return new Mn(n,this._parents,e,t)}Oa.prototype.interrupt=fP;Oa.prototype.transition=FP;var Ew=e=>()=>e;function PM(e,{sourceEvent:t,target:r,selection:n,mode:i,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},selection:{value:n,enumerable:!0,configurable:!0},mode:{value:i,enumerable:!0,configurable:!0},_:{value:o}})}function CP(e){e.stopImmediatePropagation()}function Mw(e){e.preventDefault(),e.stopImmediatePropagation()}var kP={name:"drag"},UM={name:"space"},Cd={name:"handle"},kd={name:"center"},{abs:BP,max:ln,min:un}=Math;function PP(e){return[+e[0],+e[1]]}function zM(e){return[PP(e[0]),PP(e[1])]}var Nw={name:"x",handles:["w","e"].map(Dy),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]]}},Ow={name:"y",handles:["n","s"].map(Dy),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]]}},ott={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(Dy),input:function(e){return e==null?null:zM(e)},output:function(e){return e}},Fa={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"},UP={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},$P={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},stt={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},att={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function Dy(e){return{type:e}}function ctt(e){return!e.ctrlKey&&!e.button}function ltt(){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 utt(){return navigator.maxTouchPoints||"ontouchstart"in this}function $M(e){for(;!e.__brush;)if(!(e=e.parentNode))return;return e.__brush}function ftt(e){return e[0][0]===e[1][0]||e[0][1]===e[1][1]}function jM(){return YM(Nw)}function qM(){return YM(Ow)}function VM(){return YM(ott)}function YM(e){var t=ltt,r=ctt,n=utt,i=!0,o=Su("start","brush","end"),s=6,a;function c(y){var g=y.property("__brush",m).selectAll(".overlay").data([Dy("overlay")]);g.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",Fa.overlay).merge(g).each(function(){var b=$M(this).extent;Qt(this).attr("x",b[0][0]).attr("y",b[0][1]).attr("width",b[1][0]-b[0][0]).attr("height",b[1][1]-b[0][1])}),y.selectAll(".selection").data([Dy("selection")]).enter().append("rect").attr("class","selection").attr("cursor",Fa.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var x=y.selectAll(".handle").data(e.handles,function(b){return b.type});x.exit().remove(),x.enter().append("rect").attr("class",function(b){return"handle handle--"+b.type}).attr("cursor",function(b){return Fa[b.type]}),y.each(l).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",d).filter(n).on("touchstart.brush",d).on("touchmove.brush",h).on("touchend.brush touchcancel.brush",p).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}c.move=function(y,g,x){y.tween?y.on("start.brush",function(b){u(this,arguments).beforestart().start(b)}).on("interrupt.brush end.brush",function(b){u(this,arguments).end(b)}).tween("brush",function(){var b=this,_=b.__brush,v=u(b,arguments),w=_.selection,T=e.input(typeof g=="function"?g.apply(this,arguments):g,_.extent),A=hi(w,T);function E(N){_.selection=N===1&&T===null?null:A(N),l.call(b),v.brush()}return w!==null&&T!==null?E:E(1)}):y.each(function(){var b=this,_=arguments,v=b.__brush,w=e.input(typeof g=="function"?g.apply(b,_):g,v.extent),T=u(b,_).beforestart();as(b),v.selection=w===null?null:w,l.call(b),T.start(x).brush(x).end(x)})},c.clear=function(y,g){c.move(y,null,g)};function l(){var y=Qt(this),g=$M(this).selection;g?(y.selectAll(".selection").style("display",null).attr("x",g[0][0]).attr("y",g[0][1]).attr("width",g[1][0]-g[0][0]).attr("height",g[1][1]-g[0][1]),y.selectAll(".handle").style("display",null).attr("x",function(x){return x.type[x.type.length-1]==="e"?g[1][0]-s/2:g[0][0]-s/2}).attr("y",function(x){return x.type[0]==="s"?g[1][1]-s/2:g[0][1]-s/2}).attr("width",function(x){return x.type==="n"||x.type==="s"?g[1][0]-g[0][0]+s:s}).attr("height",function(x){return x.type==="e"||x.type==="w"?g[1][1]-g[0][1]+s:s})):y.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function u(y,g,x){var b=y.__brush.emitter;return b&&(!x||!b.clean)?b:new f(y,g,x)}function f(y,g,x){this.that=y,this.args=g,this.state=y.__brush,this.active=0,this.clean=x}f.prototype={beforestart:function(){return++this.active===1&&(this.state.emitter=this,this.starting=!0),this},start:function(y,g){return this.starting?(this.starting=!1,this.emit("start",y,g)):this.emit("brush",y),this},brush:function(y,g){return this.emit("brush",y,g),this},end:function(y,g){return--this.active===0&&(delete this.state.emitter,this.emit("end",y,g)),this},emit:function(y,g,x){var b=Qt(this.that).datum();o.call(y,this.that,new PM(y,{sourceEvent:g,target:c,selection:e.output(this.state.selection),mode:x,dispatch:o}),b)}};function d(y){if(a&&!y.touches||!r.apply(this,arguments))return;var g=this,x=y.target.__data__.type,b=(i&&y.metaKey?x="overlay":x)==="selection"?kP:i&&y.altKey?kd:Cd,_=e===Ow?null:stt[x],v=e===Nw?null:att[x],w=$M(g),T=w.extent,A=w.selection,E=T[0][0],N,I,R=T[0][1],C,S,M=T[1][0],O,L,B=T[1][1],k,P,U=0,$=0,X,rt=_&&v&&i&&y.shiftKey,ot,at,Y=Array.from(y.touches||[y],tt=>{let ge=tt.identifier;return tt=an(tt,g),tt.point0=tt.slice(),tt.identifier=ge,tt});as(g);var st=u(g,arguments,!0).beforestart();if(x==="overlay"){A&&(X=!0);let tt=[Y[0],Y[1]||Y[0]];w.selection=A=[[N=e===Ow?E:un(tt[0][0],tt[1][0]),C=e===Nw?R:un(tt[0][1],tt[1][1])],[O=e===Ow?M:ln(tt[0][0],tt[1][0]),k=e===Nw?B:ln(tt[0][1],tt[1][1])]],Y.length>1&&Pt(y)}else N=A[0][0],C=A[0][1],O=A[1][0],k=A[1][1];I=N,S=C,L=O,P=k;var q=Qt(g).attr("pointer-events","none"),H=q.selectAll(".overlay").attr("cursor",Fa[x]);if(y.touches)st.moved=z,st.ended=ht;else{var nt=Qt(y.view).on("mousemove.brush",z,!0).on("mouseup.brush",ht,!0);i&&nt.on("keydown.brush",Zt,!0).on("keyup.brush",Jt,!0),yy(y.view)}l.call(g),st.start(y,b.name);function z(tt){for(let ge of tt.changedTouches||[tt])for(let Kn of Y)Kn.identifier===ge.identifier&&(Kn.cur=an(ge,g));if(rt&&!ot&&!at&&Y.length===1){let ge=Y[0];BP(ge.cur[0]-ge[0])>BP(ge.cur[1]-ge[1])?at=!0:ot=!0}for(let ge of Y)ge.cur&&(ge[0]=ge.cur[0],ge[1]=ge.cur[1]);X=!0,Mw(tt),Pt(tt)}function Pt(tt){let ge=Y[0],Kn=ge.point0;var Bo;switch(U=ge[0]-Kn[0],$=ge[1]-Kn[1],b){case UM:case kP:{_&&(U=ln(E-N,un(M-O,U)),I=N+U,L=O+U),v&&($=ln(R-C,un(B-k,$)),S=C+$,P=k+$);break}case Cd:{Y[1]?(_&&(I=ln(E,un(M,Y[0][0])),L=ln(E,un(M,Y[1][0])),_=1),v&&(S=ln(R,un(B,Y[0][1])),P=ln(R,un(B,Y[1][1])),v=1)):(_<0?(U=ln(E-N,un(M-N,U)),I=N+U,L=O):_>0&&(U=ln(E-O,un(M-O,U)),I=N,L=O+U),v<0?($=ln(R-C,un(B-C,$)),S=C+$,P=k):v>0&&($=ln(R-k,un(B-k,$)),S=C,P=k+$));break}case kd:{_&&(I=ln(E,un(M,N-U*_)),L=ln(E,un(M,O+U*_))),v&&(S=ln(R,un(B,C-$*v)),P=ln(R,un(B,k+$*v)));break}}L<I&&(_*=-1,Bo=N,N=O,O=Bo,Bo=I,I=L,L=Bo,x in UP&&H.attr("cursor",Fa[x=UP[x]])),P<S&&(v*=-1,Bo=C,C=k,k=Bo,Bo=S,S=P,P=Bo,x in $P&&H.attr("cursor",Fa[x=$P[x]])),w.selection&&(A=w.selection),ot&&(I=A[0][0],L=A[1][0]),at&&(S=A[0][1],P=A[1][1]),(A[0][0]!==I||A[0][1]!==S||A[1][0]!==L||A[1][1]!==P)&&(w.selection=[[I,S],[L,P]],l.call(g),st.brush(tt,b.name))}function ht(tt){if(CP(tt),tt.touches){if(tt.touches.length)return;a&&clearTimeout(a),a=setTimeout(function(){a=null},500)}else gy(tt.view,X),nt.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);q.attr("pointer-events","all"),H.attr("cursor",Fa.overlay),w.selection&&(A=w.selection),ftt(A)&&(w.selection=null,l.call(g)),st.end(tt,b.name)}function Zt(tt){switch(tt.keyCode){case 16:{rt=_&&v;break}case 18:{b===Cd&&(_&&(O=L-U*_,N=I+U*_),v&&(k=P-$*v,C=S+$*v),b=kd,Pt(tt));break}case 32:{(b===Cd||b===kd)&&(_<0?O=L-U:_>0&&(N=I-U),v<0?k=P-$:v>0&&(C=S-$),b=UM,H.attr("cursor",Fa.selection),Pt(tt));break}default:return}Mw(tt)}function Jt(tt){switch(tt.keyCode){case 16:{rt&&(ot=at=rt=!1,Pt(tt));break}case 18:{b===kd&&(_<0?O=L:_>0&&(N=I),v<0?k=P:v>0&&(C=S),b=Cd,Pt(tt));break}case 32:{b===UM&&(tt.altKey?(_&&(O=L-U*_,N=I+U*_),v&&(k=P-$*v,C=S+$*v),b=kd):(_<0?O=L:_>0&&(N=I),v<0?k=P:v>0&&(C=S),b=Cd),H.attr("cursor",Fa[x]),Pt(tt));break}default:return}Mw(tt)}}function h(y){u(this,arguments).moved(y)}function p(y){u(this,arguments).ended(y)}function m(){var y=this.__brush||{selection:null};return y.extent=zM(t.apply(this,arguments)),y.dim=e,y}return c.extent=function(y){return arguments.length?(t=typeof y=="function"?y:Ew(zM(y)),c):t},c.filter=function(y){return arguments.length?(r=typeof y=="function"?y:Ew(!!y),c):r},c.touchable=function(y){return arguments.length?(n=typeof y=="function"?y:Ew(!!y),c):n},c.handleSize=function(y){return arguments.length?(s=+y,c):s},c.keyModifiers=function(y){return arguments.length?(i=!!y,c):i},c.on=function(){var y=o.on.apply(o,arguments);return y===o?c:y},c}var WM=Math.PI,GM=2*WM,Ru=1e-6,dtt=GM-Ru;function zP(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=arguments[t]+e[t]}function htt(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return zP;let r=10**t;return function(n){this._+=n[0];for(let i=1,o=n.length;i<o;++i)this._+=Math.round(arguments[i]*r)/r+n[i]}}var Wc=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?zP:htt(t)}moveTo(t,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,r){this._append`L${this._x1=+t},${this._y1=+r}`}quadraticCurveTo(t,r,n,i){this._append`Q${+t},${+r},${this._x1=+n},${this._y1=+i}`}bezierCurveTo(t,r,n,i,o,s){this._append`C${+t},${+r},${+n},${+i},${this._x1=+o},${this._y1=+s}`}arcTo(t,r,n,i,o){if(t=+t,r=+r,n=+n,i=+i,o=+o,o<0)throw new Error(`negative radius: ${o}`);let s=this._x1,a=this._y1,c=n-t,l=i-r,u=s-t,f=a-r,d=u*u+f*f;if(this._x1===null)this._append`M${this._x1=t},${this._y1=r}`;else if(d>Ru)if(!(Math.abs(f*c-l*u)>Ru)||!o)this._append`L${this._x1=t},${this._y1=r}`;else{let h=n-s,p=i-a,m=c*c+l*l,y=h*h+p*p,g=Math.sqrt(m),x=Math.sqrt(d),b=o*Math.tan((WM-Math.acos((m+d-y)/(2*g*x)))/2),_=b/x,v=b/g;Math.abs(_-1)>Ru&&this._append`L${t+_*u},${r+_*f}`,this._append`A${o},${o},0,0,${+(f*h>u*p)},${this._x1=t+v*c},${this._y1=r+v*l}`}}arc(t,r,n,i,o,s){if(t=+t,r=+r,n=+n,s=!!s,n<0)throw new Error(`negative radius: ${n}`);let a=n*Math.cos(i),c=n*Math.sin(i),l=t+a,u=r+c,f=1^s,d=s?i-o:o-i;this._x1===null?this._append`M${l},${u}`:(Math.abs(this._x1-l)>Ru||Math.abs(this._y1-u)>Ru)&&this._append`L${l},${u}`,n&&(d<0&&(d=d%GM+GM),d>dtt?this._append`A${n},${n},0,1,${f},${t-a},${r-c}A${n},${n},0,1,${f},${this._x1=l},${this._y1=u}`:d>Ru&&this._append`A${n},${n},0,${+(d>=WM)},${f},${this._x1=t+n*Math.cos(o)},${this._y1=r+n*Math.sin(o)}`)}rect(t,r,n,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}};function jP(){return new Wc}jP.prototype=Wc.prototype;function Nn(e=3){return new Wc(+e)}var ptt=Array.prototype,Rw=ptt.slice;function qP(e,t){return e-t}function VP(e){for(var t=0,r=e.length,n=e[r-1][1]*e[0][0]-e[r-1][0]*e[0][1];++t<r;)n+=e[t-1][1]*e[t][0]-e[t-1][0]*e[t][1];return n}var cs=e=>()=>e;function YP(e,t){for(var r=-1,n=t.length,i;++r<n;)if(i=mtt(e,t[r]))return i;return 0}function mtt(e,t){for(var r=t[0],n=t[1],i=-1,o=0,s=e.length,a=s-1;o<s;a=o++){var c=e[o],l=c[0],u=c[1],f=e[a],d=f[0],h=f[1];if(ytt(c,f,t))return 0;u>n!=h>n&&r<(d-l)*(n-u)/(h-u)+l&&(i=-i)}return i}function ytt(e,t,r){var n;return gtt(e,t,r)&&xtt(e[n=+(e[0]===t[0])],r[n],t[n])}function gtt(e,t,r){return(t[0]-e[0])*(r[1]-e[1])===(r[0]-e[0])*(t[1]-e[1])}function xtt(e,t,r){return e<=t&&t<=r||r<=t&&t<=e}function WP(){}var Ca=[[],[[[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 Gc(){var e=1,t=1,r=$c,n=c;function i(l){var u=r(l);if(Array.isArray(u))u=u.slice().sort(qP);else{let f=ce(l,btt);for(u=Qr(...Id(f[0],f[1],u),u);u[u.length-1]>=f[1];)u.pop();for(;u[1]<f[0];)u.shift()}return u.map(f=>o(l,f))}function o(l,u){let f=u==null?NaN:+u;if(isNaN(f))throw new Error(`invalid value: ${u}`);var d=[],h=[];return s(l,f,function(p){n(p,l,f),VP(p)>0?d.push([p]):h.push(p)}),h.forEach(function(p){for(var m=0,y=d.length,g;m<y;++m)if(YP((g=d[m])[0],p)!==-1){g.push(p);return}}),{type:"MultiPolygon",value:u,coordinates:d}}function s(l,u,f){var d=new Array,h=new Array,p,m,y,g,x,b;for(p=m=-1,g=Du(l[0],u),Ca[g<<1].forEach(_);++p<e-1;)y=g,g=Du(l[p+1],u),Ca[y|g<<1].forEach(_);for(Ca[g<<0].forEach(_);++m<t-1;){for(p=-1,g=Du(l[m*e+e],u),x=Du(l[m*e],u),Ca[g<<1|x<<2].forEach(_);++p<e-1;)y=g,g=Du(l[m*e+e+p+1],u),b=x,x=Du(l[m*e+p+1],u),Ca[y|g<<1|x<<2|b<<3].forEach(_);Ca[g|x<<3].forEach(_)}for(p=-1,x=l[m*e]>=u,Ca[x<<2].forEach(_);++p<e-1;)b=x,x=Du(l[m*e+p+1],u),Ca[x<<2|b<<3].forEach(_);Ca[x<<3].forEach(_);function _(v){var w=[v[0][0]+p,v[0][1]+m],T=[v[1][0]+p,v[1][1]+m],A=a(w),E=a(T),N,I;(N=h[A])?(I=d[E])?(delete h[N.end],delete d[I.start],N===I?(N.ring.push(T),f(N.ring)):d[N.start]=h[I.end]={start:N.start,end:I.end,ring:N.ring.concat(I.ring)}):(delete h[N.end],N.ring.push(T),h[N.end=E]=N):(N=d[E])?(I=h[A])?(delete d[N.start],delete h[I.end],N===I?(N.ring.push(T),f(N.ring)):d[I.start]=h[N.end]={start:I.start,end:N.end,ring:I.ring.concat(N.ring)}):(delete d[N.start],N.ring.unshift(w),d[N.start=A]=N):d[A]=h[E]={start:A,end:E,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,y=p|0,g=XM(u[y*e+m]);h>0&&h<e&&m===h&&(d[0]=GP(h,XM(u[y*e+m-1]),g,f)),p>0&&p<t&&y===p&&(d[1]=GP(p,XM(u[(y-1)*e+m]),g,f))})}return i.contour=o,i.size=function(l){if(!arguments.length)return[e,t];var u=Math.floor(l[0]),f=Math.floor(l[1]);if(!(u>=0&&f>=0))throw new Error("invalid size");return e=u,t=f,i},i.thresholds=function(l){return arguments.length?(r=typeof l=="function"?l:Array.isArray(l)?cs(Rw.call(l)):cs(l),i):r},i.smooth=function(l){return arguments.length?(n=l?c:WP,i):n===c},i}function btt(e){return isFinite(e)?e:NaN}function Du(e,t){return e==null?!1:+e>=t}function XM(e){return e==null||isNaN(e=+e)?-1/0:e}function GP(e,t,r,n){let i=n-t,o=r-t,s=isFinite(i)||isFinite(o)?i/o:Math.sign(i)/Math.sign(o);return isNaN(s)?e:e+s-.5}function _tt(e){return e[0]}function wtt(e){return e[1]}function vtt(){return 1}function HM(){var e=_tt,t=wtt,r=vtt,n=960,i=500,o=20,s=2,a=o*3,c=n+a*2>>s,l=i+a*2>>s,u=cs(20);function f(x){var b=new Float32Array(c*l),_=Math.pow(2,-s),v=-1;for(let C of x){var w=(e(C,++v,x)+a)*_,T=(t(C,v,x)+a)*_,A=+r(C,v,x);if(A&&w>=0&&w<c&&T>=0&&T<l){var E=Math.floor(w),N=Math.floor(T),I=w-E-.5,R=T-N-.5;b[E+N*c]+=(1-I)*(1-R)*A,b[E+1+N*c]+=I*(1-R)*A,b[E+1+(N+1)*c]+=I*R*A,b[E+(N+1)*c]+=(1-I)*R*A}}return ay({data:b,width:c,height:l},o*_),b}function d(x){var b=f(x),_=u(b),v=Math.pow(2,2*s);return Array.isArray(_)||(_=Qr(Number.MIN_VALUE,Kt(b)/v,_)),Gc().size([c,l]).thresholds(_.map(w=>w*v))(b).map((w,T)=>(w.value=+_[T],h(w)))}d.contours=function(x){var b=f(x),_=Gc().size([c,l]),v=Math.pow(2,2*s),w=T=>{T=+T;var A=h(_.contour(b,T*v));return A.value=T,A};return Object.defineProperty(w,"max",{get:()=>Kt(b)/v}),w};function h(x){return x.coordinates.forEach(p),x}function p(x){x.forEach(m)}function m(x){x.forEach(y)}function y(x){x[0]=x[0]*Math.pow(2,s)-a,x[1]=x[1]*Math.pow(2,s)-a}function g(){return a=o*3,c=n+a*2>>s,l=i+a*2>>s,d}return d.x=function(x){return arguments.length?(e=typeof x=="function"?x:cs(+x),d):e},d.y=function(x){return arguments.length?(t=typeof x=="function"?x:cs(+x),d):t},d.weight=function(x){return arguments.length?(r=typeof x=="function"?x:cs(+x),d):r},d.size=function(x){if(!arguments.length)return[n,i];var b=+x[0],_=+x[1];if(!(b>=0&&_>=0))throw new Error("invalid size");return n=b,i=_,g()},d.cellSize=function(x){if(!arguments.length)return 1<<s;if(!((x=+x)>=1))throw new Error("invalid cell size");return s=Math.floor(Math.log(x)/Math.LN2),g()},d.thresholds=function(x){return arguments.length?(u=typeof x=="function"?x:Array.isArray(x)?cs(Rw.call(x)):cs(x),d):u},d.bandwidth=function(x){if(!arguments.length)return Math.sqrt(o*(o+1));if(!((x=+x)>=0))throw new Error("invalid bandwidth");return o=(Math.sqrt(4*x*x+1)-1)/2,g()},d}var ne=11102230246251565e-32,lr=134217729,Ly=(3+8*ne)*ne;function Lu(e,t,r,n,i){let o,s,a,c,l=t[0],u=n[0],f=0,d=0;u>l==u>-l?(o=l,l=t[++f]):(o=u,u=n[++d]);let h=0;if(f<e&&d<r)for(u>l==u>-l?(s=l+o,a=o-(s-l),l=t[++f]):(s=u+o,a=o-(s-u),u=n[++d]),o=s,a!==0&&(i[h++]=a);f<e&&d<r;)u>l==u>-l?(s=o+l,c=s-o,a=o-(s-c)+(l-c),l=t[++f]):(s=o+u,c=s-o,a=o-(s-c)+(u-c),u=n[++d]),o=s,a!==0&&(i[h++]=a);for(;f<e;)s=o+l,c=s-o,a=o-(s-c)+(l-c),l=t[++f],o=s,a!==0&&(i[h++]=a);for(;d<r;)s=o+u,c=s-o,a=o-(s-c)+(u-c),u=n[++d],o=s,a!==0&&(i[h++]=a);return(o!==0||h===0)&&(i[h++]=o),h}function Fy(e,t){let r=t[0];for(let n=1;n<e;n++)r+=t[n];return r}function V(e){return new Float64Array(e)}var Stt=(3+16*ne)*ne,Itt=(2+12*ne)*ne,Ttt=(9+64*ne)*ne*ne,Bd=V(4),XP=V(8),HP=V(12),QP=V(16),On=V(4);function Att(e,t,r,n,i,o,s){let a,c,l,u,f,d,h,p,m,y,g,x,b,_,v,w,T,A,E=e-i,N=r-i,I=t-o,R=n-o;_=E*R,d=lr*E,h=d-(d-E),p=E-h,d=lr*R,m=d-(d-R),y=R-m,v=p*y-(_-h*m-p*m-h*y),w=I*N,d=lr*I,h=d-(d-I),p=I-h,d=lr*N,m=d-(d-N),y=N-m,T=p*y-(w-h*m-p*m-h*y),g=v-T,f=v-g,Bd[0]=v-(g+f)+(f-T),x=_+g,f=x-_,b=_-(x-f)+(g-f),g=b-w,f=b-g,Bd[1]=b-(g+f)+(f-w),A=x+g,f=A-x,Bd[2]=x-(A-f)+(g-f),Bd[3]=A;let C=Fy(4,Bd),S=Itt*s;if(C>=S||-C>=S||(f=e-E,a=e-(E+f)+(f-i),f=r-N,l=r-(N+f)+(f-i),f=t-I,c=t-(I+f)+(f-o),f=n-R,u=n-(R+f)+(f-o),a===0&&c===0&&l===0&&u===0)||(S=Ttt*s+Ly*Math.abs(C),C+=E*u+R*a-(I*l+N*c),C>=S||-C>=S))return C;_=a*R,d=lr*a,h=d-(d-a),p=a-h,d=lr*R,m=d-(d-R),y=R-m,v=p*y-(_-h*m-p*m-h*y),w=c*N,d=lr*c,h=d-(d-c),p=c-h,d=lr*N,m=d-(d-N),y=N-m,T=p*y-(w-h*m-p*m-h*y),g=v-T,f=v-g,On[0]=v-(g+f)+(f-T),x=_+g,f=x-_,b=_-(x-f)+(g-f),g=b-w,f=b-g,On[1]=b-(g+f)+(f-w),A=x+g,f=A-x,On[2]=x-(A-f)+(g-f),On[3]=A;let M=Lu(4,Bd,4,On,XP);_=E*u,d=lr*E,h=d-(d-E),p=E-h,d=lr*u,m=d-(d-u),y=u-m,v=p*y-(_-h*m-p*m-h*y),w=I*l,d=lr*I,h=d-(d-I),p=I-h,d=lr*l,m=d-(d-l),y=l-m,T=p*y-(w-h*m-p*m-h*y),g=v-T,f=v-g,On[0]=v-(g+f)+(f-T),x=_+g,f=x-_,b=_-(x-f)+(g-f),g=b-w,f=b-g,On[1]=b-(g+f)+(f-w),A=x+g,f=A-x,On[2]=x-(A-f)+(g-f),On[3]=A;let O=Lu(M,XP,4,On,HP);_=a*u,d=lr*a,h=d-(d-a),p=a-h,d=lr*u,m=d-(d-u),y=u-m,v=p*y-(_-h*m-p*m-h*y),w=c*l,d=lr*c,h=d-(d-c),p=c-h,d=lr*l,m=d-(d-l),y=l-m,T=p*y-(w-h*m-p*m-h*y),g=v-T,f=v-g,On[0]=v-(g+f)+(f-T),x=_+g,f=x-_,b=_-(x-f)+(g-f),g=b-w,f=b-g,On[1]=b-(g+f)+(f-w),A=x+g,f=A-x,On[2]=x-(A-f)+(g-f),On[3]=A;let L=Lu(O,HP,4,On,QP);return QP[L-1]}function Pd(e,t,r,n,i,o){let s=(t-o)*(r-i),a=(e-i)*(n-o),c=s-a,l=Math.abs(s+a);return Math.abs(c)>=Stt*l?c:-Att(e,t,r,n,i,o,l)}var $Ft=(7+56*ne)*ne,zFt=(3+28*ne)*ne,jFt=(26+288*ne)*ne*ne,qFt=V(4),VFt=V(4),YFt=V(4),WFt=V(4),GFt=V(4),XFt=V(4),HFt=V(4),QFt=V(4),ZFt=V(4),KFt=V(8),JFt=V(8),tCt=V(8),eCt=V(4),rCt=V(8),nCt=V(8),iCt=V(8),oCt=V(12),sCt=V(192),aCt=V(192);var uCt=(10+96*ne)*ne,fCt=(4+48*ne)*ne,dCt=(44+576*ne)*ne*ne,hCt=V(4),pCt=V(4),mCt=V(4),yCt=V(4),gCt=V(4),xCt=V(4),bCt=V(4),_Ct=V(4),wCt=V(8),vCt=V(8),SCt=V(8),ICt=V(8),TCt=V(8),ACt=V(8),ECt=V(8),MCt=V(8),NCt=V(8),OCt=V(4),RCt=V(4),DCt=V(4),LCt=V(8),FCt=V(16),CCt=V(16),kCt=V(16),BCt=V(32),PCt=V(32),UCt=V(48),$Ct=V(64),zCt=V(1152),jCt=V(1152);var WCt=(16+224*ne)*ne,GCt=(5+72*ne)*ne,XCt=(71+1408*ne)*ne*ne,HCt=V(4),QCt=V(4),ZCt=V(4),KCt=V(4),JCt=V(4),tkt=V(4),ekt=V(4),rkt=V(4),nkt=V(4),ikt=V(4),okt=V(24),skt=V(24),akt=V(24),ckt=V(24),lkt=V(24),ukt=V(24),fkt=V(24),dkt=V(24),hkt=V(24),pkt=V(24),mkt=V(1152),ykt=V(1152),gkt=V(1152),xkt=V(1152),bkt=V(1152),_kt=V(2304),wkt=V(2304),vkt=V(3456),Skt=V(5760),Ikt=V(8),Tkt=V(8),Akt=V(8),Ekt=V(16),Mkt=V(24),Nkt=V(48),Okt=V(48),Rkt=V(96),Dkt=V(192),Lkt=V(384),Fkt=V(384),Ckt=V(384),kkt=V(768);var Bkt=V(96),Pkt=V(96),Ukt=V(96),$kt=V(1152);var KP=Math.pow(2,-52),Dw=new Uint32Array(512),$d=class e{static from(t,r=Dtt,n=Ltt){let i=t.length,o=new Float64Array(i*2);for(let s=0;s<i;s++){let a=t[s];o[2*s]=r(a),o[2*s+1]=n(a)}return new e(o)}constructor(t){let r=t.length>>1;if(r>0&&typeof t[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=t;let n=Math.max(2*r-5,0);this._triangles=new Uint32Array(n*3),this._halfedges=new Int32Array(n*3),this._hashSize=Math.ceil(Math.sqrt(r)),this._hullPrev=new Uint32Array(r),this._hullNext=new Uint32Array(r),this._hullTri=new Uint32Array(r),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(r),this._dists=new Float64Array(r),this.update()}update(){let{coords:t,_hullPrev:r,_hullNext:n,_hullTri:i,_hullHash:o}=this,s=t.length>>1,a=1/0,c=1/0,l=-1/0,u=-1/0;for(let E=0;E<s;E++){let N=t[2*E],I=t[2*E+1];N<a&&(a=N),I<c&&(c=I),N>l&&(l=N),I>u&&(u=I),this._ids[E]=E}let f=(a+l)/2,d=(c+u)/2,h,p,m;for(let E=0,N=1/0;E<s;E++){let I=QM(f,d,t[2*E],t[2*E+1]);I<N&&(h=E,N=I)}let y=t[2*h],g=t[2*h+1];for(let E=0,N=1/0;E<s;E++){if(E===h)continue;let I=QM(y,g,t[2*E],t[2*E+1]);I<N&&I>0&&(p=E,N=I)}let x=t[2*p],b=t[2*p+1],_=1/0;for(let E=0;E<s;E++){if(E===h||E===p)continue;let N=Ott(y,g,x,b,t[2*E],t[2*E+1]);N<_&&(m=E,_=N)}let v=t[2*m],w=t[2*m+1];if(_===1/0){for(let I=0;I<s;I++)this._dists[I]=t[2*I]-t[0]||t[2*I+1]-t[1];Ud(this._ids,this._dists,0,s-1);let E=new Uint32Array(s),N=0;for(let I=0,R=-1/0;I<s;I++){let C=this._ids[I],S=this._dists[C];S>R&&(E[N++]=C,R=S)}this.hull=E.subarray(0,N),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(Pd(y,g,x,b,v,w)<0){let E=p,N=x,I=b;p=m,x=v,b=w,m=E,v=N,w=I}let T=Rtt(y,g,x,b,v,w);this._cx=T.x,this._cy=T.y;for(let E=0;E<s;E++)this._dists[E]=QM(t[2*E],t[2*E+1],T.x,T.y);Ud(this._ids,this._dists,0,s-1),this._hullStart=h;let A=3;n[h]=r[m]=p,n[p]=r[h]=m,n[m]=r[p]=h,i[h]=0,i[p]=1,i[m]=2,o.fill(-1),o[this._hashKey(y,g)]=h,o[this._hashKey(x,b)]=p,o[this._hashKey(v,w)]=m,this.trianglesLen=0,this._addTriangle(h,p,m,-1,-1,-1);for(let E=0,N,I;E<this._ids.length;E++){let R=this._ids[E],C=t[2*R],S=t[2*R+1];if(E>0&&Math.abs(C-N)<=KP&&Math.abs(S-I)<=KP||(N=C,I=S,R===h||R===p||R===m))continue;let M=0;for(let P=0,U=this._hashKey(C,S);P<this._hashSize&&(M=o[(U+P)%this._hashSize],!(M!==-1&&M!==n[M]));P++);M=r[M];let O=M,L;for(;L=n[O],Pd(C,S,t[2*O],t[2*O+1],t[2*L],t[2*L+1])>=0;)if(O=L,O===M){O=-1;break}if(O===-1)continue;let B=this._addTriangle(O,R,n[O],-1,-1,i[O]);i[R]=this._legalize(B+2),i[O]=B,A++;let k=n[O];for(;L=n[k],Pd(C,S,t[2*k],t[2*k+1],t[2*L],t[2*L+1])<0;)B=this._addTriangle(k,R,L,i[R],-1,i[k]),i[R]=this._legalize(B+2),n[k]=k,A--,k=L;if(O===M)for(;L=r[O],Pd(C,S,t[2*L],t[2*L+1],t[2*O],t[2*O+1])<0;)B=this._addTriangle(L,R,O,-1,i[O],i[L]),this._legalize(B+2),i[L]=B,n[O]=O,A--,O=L;this._hullStart=r[R]=O,n[O]=r[k]=R,n[R]=k,o[this._hashKey(C,S)]=R,o[this._hashKey(t[2*O],t[2*O+1])]=O}this.hull=new Uint32Array(A);for(let E=0,N=this._hullStart;E<A;E++)this.hull[E]=N,N=n[N];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,r){return Math.floor(Mtt(t-this._cx,r-this._cy)*this._hashSize)%this._hashSize}_legalize(t){let{_triangles:r,_halfedges:n,coords:i}=this,o=0,s=0;for(;;){let a=n[t],c=t-t%3;if(s=c+(t+2)%3,a===-1){if(o===0)break;t=Dw[--o];continue}let l=a-a%3,u=c+(t+1)%3,f=l+(a+2)%3,d=r[s],h=r[t],p=r[u],m=r[f];if(Ntt(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])){r[t]=m,r[a]=d;let g=n[f];if(g===-1){let b=this._hullStart;do{if(this._hullTri[b]===f){this._hullTri[b]=t;break}b=this._hullPrev[b]}while(b!==this._hullStart)}this._link(t,g),this._link(a,n[s]),this._link(s,f);let x=l+(a+1)%3;o<Dw.length&&(Dw[o++]=x)}else{if(o===0)break;t=Dw[--o]}}return s}_link(t,r){this._halfedges[t]=r,r!==-1&&(this._halfedges[r]=t)}_addTriangle(t,r,n,i,o,s){let a=this.trianglesLen;return this._triangles[a]=t,this._triangles[a+1]=r,this._triangles[a+2]=n,this._link(a,i),this._link(a+1,o),this._link(a+2,s),this.trianglesLen+=3,a}};function Mtt(e,t){let r=e/(Math.abs(e)+Math.abs(t));return(t>0?3-r:1+r)/4}function QM(e,t,r,n){let i=e-r,o=t-n;return i*i+o*o}function Ntt(e,t,r,n,i,o,s,a){let c=e-s,l=t-a,u=r-s,f=n-a,d=i-s,h=o-a,p=c*c+l*l,m=u*u+f*f,y=d*d+h*h;return c*(f*y-m*h)-l*(u*y-m*d)+p*(u*h-f*d)<0}function Ott(e,t,r,n,i,o){let s=r-e,a=n-t,c=i-e,l=o-t,u=s*s+a*a,f=c*c+l*l,d=.5/(s*l-a*c),h=(l*u-a*f)*d,p=(s*f-c*u)*d;return h*h+p*p}function Rtt(e,t,r,n,i,o){let s=r-e,a=n-t,c=i-e,l=o-t,u=s*s+a*a,f=c*c+l*l,d=.5/(s*l-a*c),h=e+(l*u-a*f)*d,p=t+(s*f-c*u)*d;return{x:h,y:p}}function Ud(e,t,r,n){if(n-r<=20)for(let i=r+1;i<=n;i++){let o=e[i],s=t[o],a=i-1;for(;a>=r&&t[e[a]]>s;)e[a+1]=e[a--];e[a+1]=o}else{let i=r+n>>1,o=r+1,s=n;Cy(e,i,o),t[e[r]]>t[e[n]]&&Cy(e,r,n),t[e[o]]>t[e[n]]&&Cy(e,o,n),t[e[r]]>t[e[o]]&&Cy(e,r,o);let a=e[o],c=t[a];for(;;){do o++;while(t[e[o]]<c);do s--;while(t[e[s]]>c);if(s<o)break;Cy(e,o,s)}e[r+1]=e[s],e[s]=a,n-o+1>=s-r?(Ud(e,t,o,n),Ud(e,t,r,s-1)):(Ud(e,t,r,s-1),Ud(e,t,o,n))}}function Cy(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}function Dtt(e){return e[0]}function Ltt(e){return e[1]}var qi=class{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,r){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,r){this._+=`L${this._x1=+t},${this._y1=+r}`}arc(t,r,n){t=+t,r=+r,n=+n;let i=t+n,o=r;if(n<0)throw new Error("negative radius");this._x1===null?this._+=`M${i},${o}`:(Math.abs(this._x1-i)>1e-6||Math.abs(this._y1-o)>1e-6)&&(this._+="L"+i+","+o),n&&(this._+=`A${n},${n},0,1,1,${t-n},${r}A${n},${n},0,1,1,${this._x1=i},${this._y1=o}`)}rect(t,r,n,i){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${+n}v${+i}h${-n}Z`}value(){return this._||null}};var Xc=class{constructor(){this._=[]}moveTo(t,r){this._.push([t,r])}closePath(){this._.push(this._[0].slice())}lineTo(t,r){this._.push([t,r])}value(){return this._.length?this._:null}};var ky=class{constructor(t,[r,n,i,o]=[0,0,960,500]){if(!((i=+i)>=(r=+r))||!((o=+o)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(t.points.length*2),this.vectors=new Float64Array(t.points.length*2),this.xmax=i,this.xmin=r,this.ymax=o,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){let{delaunay:{points:t,hull:r,triangles:n},vectors:i}=this,o,s,a=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let m=0,y=0,g=n.length,x,b;m<g;m+=3,y+=2){let _=n[m]*2,v=n[m+1]*2,w=n[m+2]*2,T=t[_],A=t[_+1],E=t[v],N=t[v+1],I=t[w],R=t[w+1],C=E-T,S=N-A,M=I-T,O=R-A,L=(C*O-S*M)*2;if(Math.abs(L)<1e-9){if(o===void 0){o=s=0;for(let k of r)o+=t[k*2],s+=t[k*2+1];o/=r.length,s/=r.length}let B=1e9*Math.sign((o-T)*O-(s-A)*M);x=(T+I)/2-B*O,b=(A+R)/2+B*M}else{let B=1/L,k=C*C+S*S,P=M*M+O*O;x=T+(O*k-S*P)*B,b=A+(C*P-M*k)*B}a[y]=x,a[y+1]=b}let c=r[r.length-1],l,u=c*4,f,d=t[2*c],h,p=t[2*c+1];i.fill(0);for(let m=0;m<r.length;++m)c=r[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 r=t==null?t=new qi:void 0,{delaunay:{halfedges:n,inedges:i,hull:o},circumcenters:s,vectors:a}=this;if(o.length<=1)return null;for(let u=0,f=n.length;u<f;++u){let d=n[u];if(d<u)continue;let h=Math.floor(u/3)*2,p=Math.floor(d/3)*2,m=s[h],y=s[h+1],g=s[p],x=s[p+1];this._renderSegment(m,y,g,x,t)}let c,l=o[o.length-1];for(let u=0;u<o.length;++u){c=l,l=o[u];let f=Math.floor(i[l]/3)*2,d=s[f],h=s[f+1],p=c*4,m=this._project(d,h,a[p+2],a[p+3]);m&&this._renderSegment(d,h,m[0],m[1],t)}return r&&r.value()}renderBounds(t){let r=t==null?t=new qi:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),r&&r.value()}renderCell(t,r){let n=r==null?r=new qi:void 0,i=this._clip(t);if(i===null||!i.length)return;r.moveTo(i[0],i[1]);let o=i.length;for(;i[0]===i[o-2]&&i[1]===i[o-1]&&o>1;)o-=2;for(let s=2;s<o;s+=2)(i[s]!==i[s-2]||i[s+1]!==i[s-1])&&r.lineTo(i[s],i[s+1]);return r.closePath(),n&&n.value()}*cellPolygons(){let{delaunay:{points:t}}=this;for(let r=0,n=t.length/2;r<n;++r){let i=this.cellPolygon(r);i&&(i.index=r,yield i)}}cellPolygon(t){let r=new Xc;return this.renderCell(t,r),r.value()}_renderSegment(t,r,n,i,o){let s,a=this._regioncode(t,r),c=this._regioncode(n,i);a===0&&c===0?(o.moveTo(t,r),o.lineTo(n,i)):(s=this._clipSegment(t,r,n,i,a,c))&&(o.moveTo(s[0],s[1]),o.lineTo(s[2],s[3]))}contains(t,r,n){return r=+r,r!==r||(n=+n,n!==n)?!1:this.delaunay._step(t,r,n)===t}*neighbors(t){let r=this._clip(t);if(r)for(let n of this.delaunay.neighbors(t)){let i=this._clip(n);if(i){t:for(let o=0,s=r.length;o<s;o+=2)for(let a=0,c=i.length;a<c;a+=2)if(r[o]===i[a]&&r[o+1]===i[a+1]&&r[(o+2)%s]===i[(a+c-2)%c]&&r[(o+3)%s]===i[(a+c-1)%c]){yield n;break t}}}}_cell(t){let{circumcenters:r,delaunay:{inedges:n,halfedges:i,triangles:o}}=this,s=n[t];if(s===-1)return null;let a=[],c=s;do{let l=Math.floor(c/3);if(a.push(r[l*2],r[l*2+1]),c=c%3===2?c-2:c+1,o[c]!==t)break;c=i[c]}while(c!==s&&c!==-1);return a}_clip(t){if(t===0&&this.delaunay.hull.length===1)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];let r=this._cell(t);if(r===null)return null;let{vectors:n}=this,i=t*4;return this._simplify(n[i]||n[i+1]?this._clipInfinite(t,r,n[i],n[i+1],n[i+2],n[i+3]):this._clipFinite(t,r))}_clipFinite(t,r){let n=r.length,i=null,o,s,a=r[n-2],c=r[n-1],l,u=this._regioncode(a,c),f,d=0;for(let h=0;h<n;h+=2)if(o=a,s=c,a=r[h],c=r[h+1],l=u,u=this._regioncode(a,c),l===0&&u===0)f=d,d=0,i?i.push(a,c):i=[a,c];else{let p,m,y,g,x;if(l===0){if((p=this._clipSegment(o,s,a,c,l,u))===null)continue;[m,y,g,x]=p}else{if((p=this._clipSegment(a,c,o,s,u,l))===null)continue;[g,x,m,y]=p,f=d,d=this._edgecode(m,y),f&&d&&this._edge(t,f,d,i,i.length),i?i.push(m,y):i=[m,y]}f=d,d=this._edgecode(g,x),f&&d&&this._edge(t,f,d,i,i.length),i?i.push(g,x):i=[g,x]}if(i)f=d,d=this._edgecode(i[0],i[1]),f&&d&&this._edge(t,f,d,i,i.length);else if(this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return i}_clipSegment(t,r,n,i,o,s){let a=o<s;for(a&&([t,r,n,i,o,s]=[n,i,t,r,s,o]);;){if(o===0&&s===0)return a?[n,i,t,r]:[t,r,n,i];if(o&s)return null;let c,l,u=o||s;u&8?(c=t+(n-t)*(this.ymax-r)/(i-r),l=this.ymax):u&4?(c=t+(n-t)*(this.ymin-r)/(i-r),l=this.ymin):u&2?(l=r+(i-r)*(this.xmax-t)/(n-t),c=this.xmax):(l=r+(i-r)*(this.xmin-t)/(n-t),c=this.xmin),o?(t=c,r=l,o=this._regioncode(t,r)):(n=c,i=l,s=this._regioncode(n,i))}}_clipInfinite(t,r,n,i,o,s){let a=Array.from(r),c;if((c=this._project(a[0],a[1],n,i))&&a.unshift(c[0],c[1]),(c=this._project(a[a.length-2],a[a.length-1],o,s))&&a.push(c[0],c[1]),a=this._clipFinite(t,a))for(let l=0,u=a.length,f,d=this._edgecode(a[u-2],a[u-1]);l<u;l+=2)f=d,d=this._edgecode(a[l],a[l+1]),f&&d&&(l=this._edge(t,f,d,a,l),u=a.length);else this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(a=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return a}_edge(t,r,n,i,o){for(;r!==n;){let s,a;switch(r){case 5:r=4;continue;case 4:r=6,s=this.xmax,a=this.ymin;break;case 6:r=2;continue;case 2:r=10,s=this.xmax,a=this.ymax;break;case 10:r=8;continue;case 8:r=9,s=this.xmin,a=this.ymax;break;case 9:r=1;continue;case 1:r=5,s=this.xmin,a=this.ymin;break}(i[o]!==s||i[o+1]!==a)&&this.contains(t,s,a)&&(i.splice(o,0,s,a),o+=2)}return o}_project(t,r,n,i){let o=1/0,s,a,c;if(i<0){if(r<=this.ymin)return null;(s=(this.ymin-r)/i)<o&&(c=this.ymin,a=t+(o=s)*n)}else if(i>0){if(r>=this.ymax)return null;(s=(this.ymax-r)/i)<o&&(c=this.ymax,a=t+(o=s)*n)}if(n>0){if(t>=this.xmax)return null;(s=(this.xmax-t)/n)<o&&(a=this.xmax,c=r+(o=s)*i)}else if(n<0){if(t<=this.xmin)return null;(s=(this.xmin-t)/n)<o&&(a=this.xmin,c=r+(o=s)*i)}return[a,c]}_edgecode(t,r){return(t===this.xmin?1:t===this.xmax?2:0)|(r===this.ymin?4:r===this.ymax?8:0)}_regioncode(t,r){return(t<this.xmin?1:t>this.xmax?2:0)|(r<this.ymin?4:r>this.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let r=0;r<t.length;r+=2){let n=(r+2)%t.length,i=(r+4)%t.length;(t[r]===t[n]&&t[n]===t[i]||t[r+1]===t[n+1]&&t[n+1]===t[i+1])&&(t.splice(n,2),r-=2)}t.length||(t=null)}return t}};var Ftt=2*Math.PI,zd=Math.pow;function Ctt(e){return e[0]}function ktt(e){return e[1]}function Btt(e){let{triangles:t,coords:r}=e;for(let n=0;n<t.length;n+=3){let i=2*t[n],o=2*t[n+1],s=2*t[n+2];if((r[s]-r[i])*(r[o+1]-r[i+1])-(r[o]-r[i])*(r[s+1]-r[i+1])>1e-10)return!1}return!0}function Ptt(e,t,r){return[e+Math.sin(e+t)*r,t+Math.cos(e-t)*r]}var Vi=class e{static from(t,r=Ctt,n=ktt,i){return new e("length"in t?Utt(t,r,n,i):Float64Array.from($tt(t,r,n,i)))}constructor(t){this._delaunator=new $d(t),this.inedges=new Int32Array(t.length/2),this._hullIndex=new Int32Array(t.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){let t=this._delaunator,r=this.points;if(t.hull&&t.hull.length>2&&Btt(t)){this.collinear=Int32Array.from({length:r.length/2},(d,h)=>h).sort((d,h)=>r[2*d]-r[2*h]||r[2*d+1]-r[2*h+1]);let c=this.collinear[0],l=this.collinear[this.collinear.length-1],u=[r[2*c],r[2*c+1],r[2*l],r[2*l+1]],f=1e-8*Math.hypot(u[3]-u[1],u[2]-u[0]);for(let d=0,h=r.length/2;d<h;++d){let p=Ptt(r[2*d],r[2*d+1],f);r[2*d]=p[0],r[2*d+1]=p[1]}this._delaunator=new $d(r)}else delete this.collinear;let n=this.halfedges=this._delaunator.halfedges,i=this.hull=this._delaunator.hull,o=this.triangles=this._delaunator.triangles,s=this.inedges.fill(-1),a=this._hullIndex.fill(-1);for(let c=0,l=n.length;c<l;++c){let u=o[c%3===2?c-2:c+1];(n[c]===-1||s[u]===-1)&&(s[u]=c)}for(let c=0,l=i.length;c<l;++c)a[i[c]]=c;i.length<=2&&i.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=i[0],s[i[0]]=1,i.length===2&&(s[i[1]]=0,this.triangles[1]=i[1],this.triangles[2]=i[1]))}voronoi(t){return new ky(this,t)}*neighbors(t){let{inedges:r,hull:n,_hullIndex:i,halfedges:o,triangles:s,collinear:a}=this;if(a){let f=a.indexOf(t);f>0&&(yield a[f-1]),f<a.length-1&&(yield a[f+1]);return}let c=r[t];if(c===-1)return;let l=c,u=-1;do{if(yield u=s[l],l=l%3===2?l-2:l+1,s[l]!==t)return;if(l=o[l],l===-1){let f=n[(i[t]+1)%n.length];f!==u&&(yield f);return}}while(l!==c)}find(t,r,n=0){if(t=+t,t!==t||(r=+r,r!==r))return-1;let i=n,o;for(;(o=this._step(n,t,r))>=0&&o!==n&&o!==i;)n=o;return o}_step(t,r,n){let{inedges:i,hull:o,_hullIndex:s,halfedges:a,triangles:c,points:l}=this;if(i[t]===-1||!l.length)return(t+1)%(l.length>>1);let u=t,f=zd(r-l[t*2],2)+zd(n-l[t*2+1],2),d=i[t],h=d;do{let p=c[h],m=zd(r-l[p*2],2)+zd(n-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&&zd(r-l[h*2],2)+zd(n-l[h*2+1],2)<f)return h;break}}while(h!==d);return u}render(t){let r=t==null?t=new qi:void 0,{points:n,halfedges:i,triangles:o}=this;for(let s=0,a=i.length;s<a;++s){let c=i[s];if(c<s)continue;let l=o[s]*2,u=o[c]*2;t.moveTo(n[l],n[l+1]),t.lineTo(n[u],n[u+1])}return this.renderHull(t),r&&r.value()}renderPoints(t,r){r===void 0&&(!t||typeof t.moveTo!="function")&&(r=t,t=null),r=r==null?2:+r;let n=t==null?t=new qi:void 0,{points:i}=this;for(let o=0,s=i.length;o<s;o+=2){let a=i[o],c=i[o+1];t.moveTo(a+r,c),t.arc(a,c,r,0,Ftt)}return n&&n.value()}renderHull(t){let r=t==null?t=new qi:void 0,{hull:n,points:i}=this,o=n[0]*2,s=n.length;t.moveTo(i[o],i[o+1]);for(let a=1;a<s;++a){let c=2*n[a];t.lineTo(i[c],i[c+1])}return t.closePath(),r&&r.value()}hullPolygon(){let t=new Xc;return this.renderHull(t),t.value()}renderTriangle(t,r){let n=r==null?r=new qi:void 0,{points:i,triangles:o}=this,s=o[t*=3]*2,a=o[t+1]*2,c=o[t+2]*2;return r.moveTo(i[s],i[s+1]),r.lineTo(i[a],i[a+1]),r.lineTo(i[c],i[c+1]),r.closePath(),n&&n.value()}*trianglePolygons(){let{triangles:t}=this;for(let r=0,n=t.length/3;r<n;++r)yield this.trianglePolygon(r)}trianglePolygon(t){let r=new Xc;return this.renderTriangle(t,r),r.value()}};function Utt(e,t,r,n){let i=e.length,o=new Float64Array(i*2);for(let s=0;s<i;++s){let a=e[s];o[s*2]=t.call(n,a,s,e),o[s*2+1]=r.call(n,a,s,e)}return o}function*$tt(e,t,r,n){let i=0;for(let o of e)yield t.call(n,o,i,e),yield r.call(n,o,i,e),++i}function JP(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Fu(e,t){if((r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var r,n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function ls(e){return e=Fu(Math.abs(e)),e?e[1]:NaN}function t9(e,t){return function(r,n){for(var i=r.length,o=[],s=0,a=e[0],c=0;i>0&&a>0&&(c+a+1>n&&(a=Math.max(1,n-c)),o.push(r.substring(i-=a,i+a)),!((c+=a+1)>n));)a=e[s=(s+1)%e.length];return o.reverse().join(t)}}function e9(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var ztt=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function us(e){if(!(t=ztt.exec(e)))throw new Error("invalid format: "+e);var t;return new Lw({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]})}us.prototype=Lw.prototype;function Lw(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+""}Lw.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 r9(e){t:for(var t=e.length,r=1,n=-1,i;r<t;++r)switch(e[r]){case".":n=i=r;break;case"0":n===0&&(n=r),i=r;break;default:if(!+e[r])break t;n>0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(i+1):e}var ZM;function n9(e,t){var r=Fu(e,t);if(!r)return e+"";var n=r[0],i=r[1],o=i-(ZM=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,s=n.length;return o===s?n:o>s?n+new Array(o-s+1).join("0"):o>0?n.slice(0,o)+"."+n.slice(o):"0."+new Array(1-o).join("0")+Fu(e,Math.max(0,t+o-1))[0]}function KM(e,t){var r=Fu(e,t);if(!r)return e+"";var n=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+new Array(i-n.length+2).join("0")}var JM={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:JP,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)=>KM(e*100,t),r:KM,s:n9,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function t3(e){return e}var i9=Array.prototype.map,o9=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function s9(e){var t=e.grouping===void 0||e.thousands===void 0?t3:t9(i9.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",o=e.numerals===void 0?t3:e9(i9.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=us(f);var d=f.fill,h=f.align,p=f.sign,m=f.symbol,y=f.zero,g=f.width,x=f.comma,b=f.precision,_=f.trim,v=f.type;v==="n"?(x=!0,v="g"):JM[v]||(b===void 0&&(b=12),_=!0,v="g"),(y||d==="0"&&h==="=")&&(y=!0,d="0",h="=");var w=m==="$"?r:m==="#"&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",T=m==="$"?n:/[%p]/.test(v)?s:"",A=JM[v],E=/[defgprs%]/.test(v);b=b===void 0?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b));function N(I){var R=w,C=T,S,M,O;if(v==="c")C=A(I)+C,I="";else{I=+I;var L=I<0||1/I<0;if(I=isNaN(I)?c:A(Math.abs(I),b),_&&(I=r9(I)),L&&+I==0&&p!=="+"&&(L=!1),R=(L?p==="("?p:a:p==="-"||p==="("?"":p)+R,C=(v==="s"?o9[8+ZM/3]:"")+C+(L&&p==="("?")":""),E){for(S=-1,M=I.length;++S<M;)if(O=I.charCodeAt(S),48>O||O>57){C=(O===46?i+I.slice(S+1):I.slice(S))+C,I=I.slice(0,S);break}}}x&&!y&&(I=t(I,1/0));var B=R.length+I.length+C.length,k=B<g?new Array(g-B+1).join(d):"";switch(x&&y&&(I=t(k+I,k.length?g-C.length:1/0),k=""),h){case"<":I=R+I+C+k;break;case"=":I=R+k+I+C;break;case"^":I=k.slice(0,B=k.length>>1)+R+I+C+k.slice(B);break;default:I=k+R+I+C;break}return o(I)}return N.toString=function(){return f+""},N}function u(f,d){var h=l((f=us(f),f.type="f",f)),p=Math.max(-8,Math.min(8,Math.floor(ls(d)/3)))*3,m=Math.pow(10,-p),y=o9[8+p/3];return function(g){return h(m*g)+y}}return{format:l,formatPrefix:u}}var Fw,Yi,Cw;e3({thousands:",",grouping:[3],currency:["$",""]});function e3(e){return Fw=s9(e),Yi=Fw.format,Cw=Fw.formatPrefix,Fw}function r3(e){return Math.max(0,-ls(Math.abs(e)))}function n3(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(ls(t)/3)))*3-ls(Math.abs(e)))}function i3(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,ls(t)-ls(e))+1}var et=1e-6,Cu=1e-12,Ct=Math.PI,Te=Ct/2,o3=Ct/4,Rr=Ct*2,Ze=180/Ct,Yt=Ct/180,$t=Math.abs,Wi=Math.atan,ur=Math.atan2,J=Math.cos,By=Math.ceil,kw=Math.exp;var Bw=Math.hypot,ku=Math.log,Pw=Math.pow,Z=Math.sin,fn=Math.sign||function(e){return e>0?1:e<0?-1:0},Ae=Math.sqrt,jd=Math.tan;function Uw(e){return e>1?0:e<-1?Ct:Math.acos(e)}function Ce(e){return e>1?Te:e<-1?-Te:Math.asin(e)}function fr(){}function $w(e,t){e&&c9.hasOwnProperty(e.type)&&c9[e.type](e,t)}var a9={Feature:function(e,t){$w(e.geometry,t)},FeatureCollection:function(e,t){for(var r=e.features,n=-1,i=r.length;++n<i;)$w(r[n].geometry,t)}},c9={Sphere:function(e,t){t.sphere()},Point:function(e,t){e=e.coordinates,t.point(e[0],e[1],e[2])},MultiPoint:function(e,t){for(var r=e.coordinates,n=-1,i=r.length;++n<i;)e=r[n],t.point(e[0],e[1],e[2])},LineString:function(e,t){s3(e.coordinates,t,0)},MultiLineString:function(e,t){for(var r=e.coordinates,n=-1,i=r.length;++n<i;)s3(r[n],t,0)},Polygon:function(e,t){l9(e.coordinates,t)},MultiPolygon:function(e,t){for(var r=e.coordinates,n=-1,i=r.length;++n<i;)l9(r[n],t)},GeometryCollection:function(e,t){for(var r=e.geometries,n=-1,i=r.length;++n<i;)$w(r[n],t)}};function s3(e,t,r){var n=-1,i=e.length-r,o;for(t.lineStart();++n<i;)o=e[n],t.point(o[0],o[1],o[2]);t.lineEnd()}function l9(e,t){var r=-1,n=e.length;for(t.polygonStart();++r<n;)s3(e[r],t,1);t.polygonEnd()}function pi(e,t){e&&a9.hasOwnProperty(e.type)?a9[e.type](e,t):$w(e,t)}function Py(e){return[ur(e[1],e[0]),Ce(e[2])]}function fs(e){var t=e[0],r=e[1],n=J(r);return[n*J(t),n*Z(t),Z(r)]}function Uy(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function qd(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 zw(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function $y(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function zy(e){var t=Ae(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var jy,jw,qw,Vw,Yw,Ww,Gw,Xw,a3,c3,l3,d9,h9,Rn,Dn,Ln,No={sphere:fr,point:u3,lineStart:u9,lineEnd:f9,polygonStart:function(){No.lineStart=Vtt,No.lineEnd=Ytt},polygonEnd:function(){No.lineStart=u9,No.lineEnd=f9}};function u3(e,t){e*=Yt,t*=Yt;var r=J(t);qy(r*J(e),r*Z(e),Z(t))}function qy(e,t,r){++jy,qw+=(e-qw)/jy,Vw+=(t-Vw)/jy,Yw+=(r-Yw)/jy}function u9(){No.point=jtt}function jtt(e,t){e*=Yt,t*=Yt;var r=J(t);Rn=r*J(e),Dn=r*Z(e),Ln=Z(t),No.point=qtt,qy(Rn,Dn,Ln)}function qtt(e,t){e*=Yt,t*=Yt;var r=J(t),n=r*J(e),i=r*Z(e),o=Z(t),s=ur(Ae((s=Dn*o-Ln*i)*s+(s=Ln*n-Rn*o)*s+(s=Rn*i-Dn*n)*s),Rn*n+Dn*i+Ln*o);jw+=s,Ww+=s*(Rn+(Rn=n)),Gw+=s*(Dn+(Dn=i)),Xw+=s*(Ln+(Ln=o)),qy(Rn,Dn,Ln)}function f9(){No.point=u3}function Vtt(){No.point=Wtt}function Ytt(){p9(d9,h9),No.point=u3}function Wtt(e,t){d9=e,h9=t,e*=Yt,t*=Yt,No.point=p9;var r=J(t);Rn=r*J(e),Dn=r*Z(e),Ln=Z(t),qy(Rn,Dn,Ln)}function p9(e,t){e*=Yt,t*=Yt;var r=J(t),n=r*J(e),i=r*Z(e),o=Z(t),s=Dn*o-Ln*i,a=Ln*n-Rn*o,c=Rn*i-Dn*n,l=Bw(s,a,c),u=Ce(l),f=l&&-u/l;a3.add(f*s),c3.add(f*a),l3.add(f*c),jw+=u,Ww+=u*(Rn+(Rn=n)),Gw+=u*(Dn+(Dn=i)),Xw+=u*(Ln+(Ln=o)),qy(Rn,Dn,Ln)}function f3(e){jy=jw=qw=Vw=Yw=Ww=Gw=Xw=0,a3=new Xr,c3=new Xr,l3=new Xr,pi(e,No);var t=+a3,r=+c3,n=+l3,i=Bw(t,r,n);return i<Cu&&(t=Ww,r=Gw,n=Xw,jw<et&&(t=qw,r=Vw,n=Yw),i=Bw(t,r,n),i<Cu)?[NaN,NaN]:[ur(r,t)*Ze,Ce(n/i)*Ze]}function Vy(e,t){function r(n,i){return n=e(n,i),t(n[0],n[1])}return e.invert&&t.invert&&(r.invert=function(n,i){return n=t.invert(n,i),n&&e.invert(n[0],n[1])}),r}function d3(e,t){return $t(e)>Ct&&(e-=Math.round(e/Rr)*Rr),[e,t]}d3.invert=d3;function h3(e,t,r){return(e%=Rr)?t||r?Vy(y9(e),g9(t,r)):y9(e):t||r?g9(t,r):d3}function m9(e){return function(t,r){return t+=e,$t(t)>Ct&&(t-=Math.round(t/Rr)*Rr),[t,r]}}function y9(e){var t=m9(e);return t.invert=m9(-e),t}function g9(e,t){var r=J(e),n=Z(e),i=J(t),o=Z(t);function s(a,c){var l=J(c),u=J(a)*l,f=Z(a)*l,d=Z(c),h=d*r+u*n;return[ur(f*i-h*o,u*r-d*n),Ce(h*i+f*o)]}return s.invert=function(a,c){var l=J(c),u=J(a)*l,f=Z(a)*l,d=Z(c),h=d*i-f*o;return[ur(f*i+d*o,u*r+h*n),Ce(h*r-u*n)]},s}function x9(e){e=h3(e[0]*Yt,e[1]*Yt,e.length>2?e[2]*Yt:0);function t(r){return r=e(r[0]*Yt,r[1]*Yt),r[0]*=Ze,r[1]*=Ze,r}return t.invert=function(r){return r=e.invert(r[0]*Yt,r[1]*Yt),r[0]*=Ze,r[1]*=Ze,r},t}function _9(e,t,r,n,i,o){if(r){var s=J(t),a=Z(t),c=n*r;i==null?(i=t+n*Rr,o=t-c/2):(i=b9(s,i),o=b9(s,o),(n>0?i<o:i>o)&&(i+=n*Rr));for(var l,u=i;n>0?u>o:u<o;u-=c)l=Py([s,-a*J(u),-a*Z(u)]),e.point(l[0],l[1])}}function b9(e,t){t=fs(t),t[0]-=e,zy(t);var r=Uw(-t[1]);return((-t[2]<0?-r:r)+Rr-et)%Rr}function Hw(){var e=[],t;return{point:function(r,n,i){t.push([r,n,i])},lineStart:function(){e.push(t=[])},lineEnd:fr,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var r=e;return e=[],t=null,r}}}function Vd(e,t){return $t(e[0]-t[0])<et&&$t(e[1]-t[1])<et}function Qw(e,t,r,n){this.x=e,this.z=t,this.o=r,this.e=n,this.v=!1,this.n=this.p=null}function Zw(e,t,r,n,i){var o=[],s=[],a,c;if(e.forEach(function(p){if(!((m=p.length-1)<=0)){var m,y=p[0],g=p[m],x;if(Vd(y,g)){if(!y[2]&&!g[2]){for(i.lineStart(),a=0;a<m;++a)i.point((y=p[a])[0],y[1]);i.lineEnd();return}g[0]+=2*et}o.push(x=new Qw(y,p,null,!0)),s.push(x.o=new Qw(y,null,x,!1)),o.push(x=new Qw(g,p,null,!1)),s.push(x.o=new Qw(g,null,x,!0))}}),!!o.length){for(s.sort(t),w9(o),w9(s),a=0,c=s.length;a<c;++a)s[a].e=r=!r;for(var l=o[0],u,f;;){for(var d=l,h=!0;d.v;)if((d=d.n)===l)return;u=d.z,i.lineStart();do{if(d.v=d.o.v=!0,d.e){if(h)for(a=0,c=u.length;a<c;++a)i.point((f=u[a])[0],f[1]);else n(d.x,d.n.x,1,i);d=d.n}else{if(h)for(u=d.p.z,a=u.length-1;a>=0;--a)i.point((f=u[a])[0],f[1]);else n(d.x,d.p.x,-1,i);d=d.p}d=d.o,u=d.z,h=!h}while(!d.v);i.lineEnd()}}}function w9(e){if(t=e.length){for(var t,r=0,n=e[0],i;++r<t;)n.n=i=e[r],i.p=n,n=i;n.n=i=e[0],i.p=n}}function p3(e){return $t(e[0])<=Ct?e[0]:fn(e[0])*(($t(e[0])+Ct)%Rr-Ct)}function v9(e,t){var r=p3(t),n=t[1],i=Z(n),o=[Z(r),-J(r),0],s=0,a=0,c=new Xr;i===1?n=Te+et:i===-1&&(n=-Te-et);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=p3(h),m=h[1]/2+o3,y=Z(m),g=J(m),x=0;x<d;++x,p=_,y=w,g=T,h=b){var b=f[x],_=p3(b),v=b[1]/2+o3,w=Z(v),T=J(v),A=_-p,E=A>=0?1:-1,N=E*A,I=N>Ct,R=y*w;if(c.add(ur(R*E*Z(N),g*T+R*J(N))),s+=I?A+E*Rr:A,I^p>=r^_>=r){var C=qd(fs(h),fs(b));zy(C);var S=qd(o,C);zy(S);var M=(I^A>=0?-1:1)*Ce(S[2]);(n>M||n===M&&(C[0]||C[1]))&&(a+=I^A>=0?1:-1)}}return(s<-et||s<et&&c<-Cu)^a&1}function Kw(e,t,r,n){return function(i){var o=t(i),s=Hw(),a=t(s),c=!1,l,u,f,d={point:h,lineStart:m,lineEnd:y,polygonStart:function(){d.point=g,d.lineStart=x,d.lineEnd=b,u=[],l=[]},polygonEnd:function(){d.point=h,d.lineStart=m,d.lineEnd=y,u=Td(u);var _=v9(l,n);u.length?(c||(i.polygonStart(),c=!0),Zw(u,Xtt,_,r,i)):_&&(c||(i.polygonStart(),c=!0),i.lineStart(),r(null,null,1,i),i.lineEnd()),c&&(i.polygonEnd(),c=!1),u=l=null},sphere:function(){i.polygonStart(),i.lineStart(),r(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function h(_,v){e(_,v)&&i.point(_,v)}function p(_,v){o.point(_,v)}function m(){d.point=p,o.lineStart()}function y(){d.point=h,o.lineEnd()}function g(_,v){f.push([_,v]),a.point(_,v)}function x(){a.lineStart(),f=[]}function b(){g(f[0][0],f[0][1]),a.lineEnd();var _=a.clean(),v=s.result(),w,T=v.length,A,E,N;if(f.pop(),l.push(f),f=null,!!T){if(_&1){if(E=v[0],(A=E.length-1)>0){for(c||(i.polygonStart(),c=!0),i.lineStart(),w=0;w<A;++w)i.point((N=E[w])[0],N[1]);i.lineEnd()}return}T>1&&_&2&&v.push(v.pop().concat(v.shift())),u.push(v.filter(Gtt))}}return d}}function Gtt(e){return e.length>1}function Xtt(e,t){return((e=e.x)[0]<0?e[1]-Te-et:Te-e[1])-((t=t.x)[0]<0?t[1]-Te-et:Te-t[1])}var m3=Kw(function(){return!0},Htt,Ztt,[-Ct,-Te]);function Htt(e){var t=NaN,r=NaN,n=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(o,s){var a=o>0?Ct:-Ct,c=$t(o-t);$t(c-Ct)<et?(e.point(t,r=(r+s)/2>0?Te:-Te),e.point(n,r),e.lineEnd(),e.lineStart(),e.point(a,r),e.point(o,r),i=0):n!==a&&c>=Ct&&($t(t-n)<et&&(t-=n*et),$t(o-a)<et&&(o-=a*et),r=Qtt(t,r,o,s),e.point(n,r),e.lineEnd(),e.lineStart(),e.point(a,r),i=0),e.point(t=o,r=s),n=a},lineEnd:function(){e.lineEnd(),t=r=NaN},clean:function(){return 2-i}}}function Qtt(e,t,r,n){var i,o,s=Z(e-r);return $t(s)>et?Wi((Z(t)*(o=J(n))*Z(r)-Z(n)*(i=J(t))*Z(e))/(i*o*s)):(t+n)/2}function Ztt(e,t,r,n){var i;if(e==null)i=r*Te,n.point(-Ct,i),n.point(0,i),n.point(Ct,i),n.point(Ct,0),n.point(Ct,-i),n.point(0,-i),n.point(-Ct,-i),n.point(-Ct,0),n.point(-Ct,i);else if($t(e[0]-t[0])>et){var o=e[0]<t[0]?Ct:-Ct;i=r*o/2,n.point(-o,i),n.point(0,i),n.point(o,i)}else n.point(t[0],t[1])}function S9(e){var t=J(e),r=2*Yt,n=t>0,i=$t(t)>et;function o(u,f,d,h){_9(h,e,r,d,u,f)}function s(u,f){return J(u)*J(f)>t}function a(u){var f,d,h,p,m;return{lineStart:function(){p=h=!1,m=1},point:function(y,g){var x=[y,g],b,_=s(y,g),v=n?_?0:l(y,g):_?l(y+(y<0?Ct:-Ct),g):0;if(!f&&(p=h=_)&&u.lineStart(),_!==h&&(b=c(f,x),(!b||Vd(f,b)||Vd(x,b))&&(x[2]=1)),_!==h)m=0,_?(u.lineStart(),b=c(x,f),u.point(b[0],b[1])):(b=c(f,x),u.point(b[0],b[1],2),u.lineEnd()),f=b;else if(i&&f&&n^_){var w;!(v&d)&&(w=c(x,f,!0))&&(m=0,n?(u.lineStart(),u.point(w[0][0],w[0][1]),u.point(w[1][0],w[1][1]),u.lineEnd()):(u.point(w[1][0],w[1][1]),u.lineEnd(),u.lineStart(),u.point(w[0][0],w[0][1],3)))}_&&(!f||!Vd(f,x))&&u.point(x[0],x[1]),f=x,h=_,d=v},lineEnd:function(){h&&u.lineEnd(),f=null},clean:function(){return m|(p&&h)<<1}}}function c(u,f,d){var h=fs(u),p=fs(f),m=[1,0,0],y=qd(h,p),g=Uy(y,y),x=y[0],b=g-x*x;if(!b)return!d&&u;var _=t*g/b,v=-t*x/b,w=qd(m,y),T=$y(m,_),A=$y(y,v);zw(T,A);var E=w,N=Uy(T,E),I=Uy(E,E),R=N*N-I*(Uy(T,T)-1);if(!(R<0)){var C=Ae(R),S=$y(E,(-N-C)/I);if(zw(S,T),S=Py(S),!d)return S;var M=u[0],O=f[0],L=u[1],B=f[1],k;O<M&&(k=M,M=O,O=k);var P=O-M,U=$t(P-Ct)<et,$=U||P<et;if(!U&&B<L&&(k=L,L=B,B=k),$?U?L+B>0^S[1]<($t(S[0]-M)<et?L:B):L<=S[1]&&S[1]<=B:P>Ct^(M<=S[0]&&S[0]<=O)){var X=$y(E,(-N+C)/I);return zw(X,T),[S,Py(X)]}}}function l(u,f){var d=n?e:Ct-e,h=0;return u<-d?h|=1:u>d&&(h|=2),f<-d?h|=4:f>d&&(h|=8),h}return Kw(s,a,o,n?[0,-e]:[-Ct,e-Ct])}function I9(e,t,r,n,i,o){var s=e[0],a=e[1],c=t[0],l=t[1],u=0,f=1,d=c-s,h=l-a,p;if(p=r-s,!(!d&&p>0)){if(p/=d,d<0){if(p<u)return;p<f&&(f=p)}else if(d>0){if(p>f)return;p>u&&(u=p)}if(p=i-s,!(!d&&p<0)){if(p/=d,d<0){if(p>f)return;p>u&&(u=p)}else if(d>0){if(p<u)return;p<f&&(f=p)}if(p=n-a,!(!h&&p>0)){if(p/=h,h<0){if(p<u)return;p<f&&(f=p)}else if(h>0){if(p>f)return;p>u&&(u=p)}if(p=o-a,!(!h&&p<0)){if(p/=h,h<0){if(p>f)return;p>u&&(u=p)}else if(h>0){if(p<u)return;p<f&&(f=p)}return u>0&&(e[0]=s+u*d,e[1]=a+u*h),f<1&&(t[0]=s+f*d,t[1]=a+f*h),!0}}}}}var Yy=1e9,Jw=-Yy;function Yd(e,t,r,n){function i(l,u){return e<=l&&l<=r&&t<=u&&u<=n}function o(l,u,f,d){var h=0,p=0;if(l==null||(h=s(l,f))!==(p=s(u,f))||c(l,u)<0^f>0)do d.point(h===0||h===3?e:r,h>1?n:t);while((h=(h+f+4)%4)!==p);else d.point(u[0],u[1])}function s(l,u){return $t(l[0]-e)<et?u>0?0:3:$t(l[0]-r)<et?u>0?2:1:$t(l[1]-t)<et?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=Hw(),d,h,p,m,y,g,x,b,_,v,w,T={point:A,lineStart:R,lineEnd:C,polygonStart:N,polygonEnd:I};function A(M,O){i(M,O)&&u.point(M,O)}function E(){for(var M=0,O=0,L=h.length;O<L;++O)for(var B=h[O],k=1,P=B.length,U=B[0],$,X,rt=U[0],ot=U[1];k<P;++k)$=rt,X=ot,U=B[k],rt=U[0],ot=U[1],X<=n?ot>n&&(rt-$)*(n-X)>(ot-X)*(e-$)&&++M:ot<=n&&(rt-$)*(n-X)<(ot-X)*(e-$)&&--M;return M}function N(){u=f,d=[],h=[],w=!0}function I(){var M=E(),O=w&&M,L=(d=Td(d)).length;(O||L)&&(l.polygonStart(),O&&(l.lineStart(),o(null,null,1,l),l.lineEnd()),L&&Zw(d,a,M,o,l),l.polygonEnd()),u=l,d=h=p=null}function R(){T.point=S,h&&h.push(p=[]),v=!0,_=!1,x=b=NaN}function C(){d&&(S(m,y),g&&_&&f.rejoin(),d.push(f.result())),T.point=A,_&&u.lineEnd()}function S(M,O){var L=i(M,O);if(h&&p.push([M,O]),v)m=M,y=O,g=L,v=!1,L&&(u.lineStart(),u.point(M,O));else if(L&&_)u.point(M,O);else{var B=[x=Math.max(Jw,Math.min(Yy,x)),b=Math.max(Jw,Math.min(Yy,b))],k=[M=Math.max(Jw,Math.min(Yy,M)),O=Math.max(Jw,Math.min(Yy,O))];I9(B,k,e,t,r,n)?(_||(u.lineStart(),u.point(B[0],B[1])),u.point(k[0],k[1]),L||u.lineEnd(),w=!1):L&&(u.lineStart(),u.point(M,O),w=!1)}x=M,b=O,_=L}return T}}function T9(e,t,r){var n=er(e,t-et,r).concat(t);return function(i){return n.map(function(o){return[i,o]})}}function A9(e,t,r){var n=er(e,t-et,r).concat(t);return function(i){return n.map(function(o){return[o,i]})}}function y3(){var e,t,r,n,i,o,s,a,c=10,l=c,u=90,f=360,d,h,p,m,y=2.5;function g(){return{type:"MultiLineString",coordinates:x()}}function x(){return er(By(n/u)*u,r,u).map(p).concat(er(By(a/f)*f,s,f).map(m)).concat(er(By(t/c)*c,e,c).filter(function(b){return $t(b%u)>et}).map(d)).concat(er(By(o/l)*l,i,l).filter(function(b){return $t(b%f)>et}).map(h))}return g.lines=function(){return x().map(function(b){return{type:"LineString",coordinates:b}})},g.outline=function(){return{type:"Polygon",coordinates:[p(n).concat(m(s).slice(1),p(r).reverse().slice(1),m(a).reverse().slice(1))]}},g.extent=function(b){return arguments.length?g.extentMajor(b).extentMinor(b):g.extentMinor()},g.extentMajor=function(b){return arguments.length?(n=+b[0][0],r=+b[1][0],a=+b[0][1],s=+b[1][1],n>r&&(b=n,n=r,r=b),a>s&&(b=a,a=s,s=b),g.precision(y)):[[n,a],[r,s]]},g.extentMinor=function(b){return arguments.length?(t=+b[0][0],e=+b[1][0],o=+b[0][1],i=+b[1][1],t>e&&(b=t,t=e,e=b),o>i&&(b=o,o=i,i=b),g.precision(y)):[[t,o],[e,i]]},g.step=function(b){return arguments.length?g.stepMajor(b).stepMinor(b):g.stepMinor()},g.stepMajor=function(b){return arguments.length?(u=+b[0],f=+b[1],g):[u,f]},g.stepMinor=function(b){return arguments.length?(c=+b[0],l=+b[1],g):[c,l]},g.precision=function(b){return arguments.length?(y=+b,d=T9(o,i,90),h=A9(t,e,y),p=T9(a,s,90),m=A9(n,r,y),g):y},g.extentMajor([[-180,-90+et],[180,90-et]]).extentMinor([[-180,-80-et],[180,80+et]])}function g3(){return y3()()}var Wy=e=>e;var x3=new Xr,b3=new Xr,E9,M9,_3,w3,Hc={point:fr,lineStart:fr,lineEnd:fr,polygonStart:function(){Hc.lineStart=Ktt,Hc.lineEnd=tet},polygonEnd:function(){Hc.lineStart=Hc.lineEnd=Hc.point=fr,x3.add($t(b3)),b3=new Xr},result:function(){var e=x3/2;return x3=new Xr,e}};function Ktt(){Hc.point=Jtt}function Jtt(e,t){Hc.point=N9,E9=_3=e,M9=w3=t}function N9(e,t){b3.add(w3*e-_3*t),_3=e,w3=t}function tet(){N9(E9,M9)}var v3=Hc;var Wd=1/0,tv=Wd,Gy=-Wd,ev=Gy,eet={point:ret,lineStart:fr,lineEnd:fr,polygonStart:fr,polygonEnd:fr,result:function(){var e=[[Wd,tv],[Gy,ev]];return Gy=ev=-(tv=Wd=1/0),e}};function ret(e,t){e<Wd&&(Wd=e),e>Gy&&(Gy=e),t<tv&&(tv=t),t>ev&&(ev=t)}var Gd=eet;var S3=0,I3=0,Xy=0,rv=0,nv=0,Xd=0,T3=0,A3=0,Hy=0,D9,L9,ds,hs,Oo={point:Bu,lineStart:O9,lineEnd:R9,polygonStart:function(){Oo.lineStart=oet,Oo.lineEnd=set},polygonEnd:function(){Oo.point=Bu,Oo.lineStart=O9,Oo.lineEnd=R9},result:function(){var e=Hy?[T3/Hy,A3/Hy]:Xd?[rv/Xd,nv/Xd]:Xy?[S3/Xy,I3/Xy]:[NaN,NaN];return S3=I3=Xy=rv=nv=Xd=T3=A3=Hy=0,e}};function Bu(e,t){S3+=e,I3+=t,++Xy}function O9(){Oo.point=net}function net(e,t){Oo.point=iet,Bu(ds=e,hs=t)}function iet(e,t){var r=e-ds,n=t-hs,i=Ae(r*r+n*n);rv+=i*(ds+e)/2,nv+=i*(hs+t)/2,Xd+=i,Bu(ds=e,hs=t)}function R9(){Oo.point=Bu}function oet(){Oo.point=aet}function set(){F9(D9,L9)}function aet(e,t){Oo.point=F9,Bu(D9=ds=e,L9=hs=t)}function F9(e,t){var r=e-ds,n=t-hs,i=Ae(r*r+n*n);rv+=i*(ds+e)/2,nv+=i*(hs+t)/2,Xd+=i,i=hs*e-ds*t,T3+=i*(ds+e),A3+=i*(hs+t),Hy+=i*3,Bu(ds=e,hs=t)}var E3=Oo;function iv(e){this._context=e}iv.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,Rr);break}}},result:fr};var N3=new Xr,M3,C9,k9,Qy,Zy,ov={point:fr,lineStart:function(){ov.point=cet},lineEnd:function(){M3&&B9(C9,k9),ov.point=fr},polygonStart:function(){M3=!0},polygonEnd:function(){M3=null},result:function(){var e=+N3;return N3=new Xr,e}};function cet(e,t){ov.point=B9,C9=Qy=e,k9=Zy=t}function B9(e,t){Qy-=e,Zy-=t,N3.add(Ae(Qy*Qy+Zy*Zy)),Qy=e,Zy=t}var O3=ov;var P9,sv,U9,$9,Hd=class{constructor(t){this._append=t==null?z9:uet(t),this._radius=4.5,this._=""}pointRadius(t){return this._radius=+t,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){this._line===0&&(this._+="Z"),this._point=NaN}point(t,r){switch(this._point){case 0:{this._append`M${t},${r}`,this._point=1;break}case 1:{this._append`L${t},${r}`;break}default:{if(this._append`M${t},${r}`,this._radius!==U9||this._append!==sv){let n=this._radius,i=this._;this._="",this._append`m0,${n}a${n},${n} 0 1,1 0,${-2*n}a${n},${n} 0 1,1 0,${2*n}z`,U9=n,sv=this._append,$9=this._,this._=i}this._+=$9;break}}}result(){let t=this._;return this._="",t.length?t:null}};function z9(e){let t=1;this._+=e[0];for(let r=e.length;t<r;++t)this._+=arguments[t]+e[t]}function uet(e){let t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return z9;if(t!==P9){let r=10**t;P9=t,sv=function(i){let o=1;this._+=i[0];for(let s=i.length;o<s;++o)this._+=Math.round(arguments[o]*r)/r+i[o]}}return sv}function Dr(e,t){let r=3,n=4.5,i,o;function s(a){return a&&(typeof n=="function"&&o.pointRadius(+n.apply(this,arguments)),pi(a,i(o))),o.result()}return s.area=function(a){return pi(a,i(v3)),v3.result()},s.measure=function(a){return pi(a,i(O3)),O3.result()},s.bounds=function(a){return pi(a,i(Gd)),Gd.result()},s.centroid=function(a){return pi(a,i(E3)),E3.result()},s.projection=function(a){return arguments.length?(i=a==null?(e=null,Wy):(e=a).stream,s):e},s.context=function(a){return arguments.length?(o=a==null?(t=null,new Hd(r)):new iv(t=a),typeof n!="function"&&o.pointRadius(n),s):t},s.pointRadius=function(a){return arguments.length?(n=typeof a=="function"?a:(o.pointRadius(+a),+a),s):n},s.digits=function(a){if(!arguments.length)return r;if(a==null)r=null;else{let c=Math.floor(a);if(!(c>=0))throw new RangeError(`invalid digits: ${a}`);r=c}return t===null&&(o=new Hd(r)),s},s.projection(e).digits(r).context(t)}function Pu(e){return{stream:Qd(e)}}function Qd(e){return function(t){var r=new R3;for(var n in e)r[n]=e[n];return r.stream=t,r}}function R3(){}R3.prototype={constructor:R3,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 D3(e,t,r){var n=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),n!=null&&e.clipExtent(null),pi(r,e.stream(Gd)),t(Gd.result()),n!=null&&e.clipExtent(n),e}function Ky(e,t,r){return D3(e,function(n){var i=t[1][0]-t[0][0],o=t[1][1]-t[0][1],s=Math.min(i/(n[1][0]-n[0][0]),o/(n[1][1]-n[0][1])),a=+t[0][0]+(i-s*(n[1][0]+n[0][0]))/2,c=+t[0][1]+(o-s*(n[1][1]+n[0][1]))/2;e.scale(150*s).translate([a,c])},r)}function av(e,t,r){return Ky(e,[[0,0],t],r)}function cv(e,t,r){return D3(e,function(n){var i=+t,o=i/(n[1][0]-n[0][0]),s=(i-o*(n[1][0]+n[0][0]))/2,a=-o*n[0][1];e.scale(150*o).translate([s,a])},r)}function lv(e,t,r){return D3(e,function(n){var i=+t,o=i/(n[1][1]-n[0][1]),s=-o*n[0][0],a=(i-o*(n[1][1]+n[0][1]))/2;e.scale(150*o).translate([s,a])},r)}var j9=16,fet=J(30*Yt);function L3(e,t){return+t?het(e,t):det(e)}function det(e){return Qd({point:function(t,r){t=e(t,r),this.stream.point(t[0],t[1])}})}function het(e,t){function r(n,i,o,s,a,c,l,u,f,d,h,p,m,y){var g=l-n,x=u-i,b=g*g+x*x;if(b>4*t&&m--){var _=s+d,v=a+h,w=c+p,T=Ae(_*_+v*v+w*w),A=Ce(w/=T),E=$t($t(w)-1)<et||$t(o-f)<et?(o+f)/2:ur(v,_),N=e(E,A),I=N[0],R=N[1],C=I-n,S=R-i,M=x*C-g*S;(M*M/b>t||$t((g*C+x*S)/b-.5)>.3||s*d+a*h+c*p<fet)&&(r(n,i,o,s,a,c,I,R,E,_/=T,v/=T,w,m,y),y.point(I,R),r(I,R,E,_,v,w,l,u,f,d,h,p,m,y))}}return function(n){var i,o,s,a,c,l,u,f,d,h,p,m,y={point:g,lineStart:x,lineEnd:_,polygonStart:function(){n.polygonStart(),y.lineStart=v},polygonEnd:function(){n.polygonEnd(),y.lineStart=x}};function g(A,E){A=e(A,E),n.point(A[0],A[1])}function x(){f=NaN,y.point=b,n.lineStart()}function b(A,E){var N=fs([A,E]),I=e(A,E);r(f,d,u,h,p,m,f=I[0],d=I[1],u=A,h=N[0],p=N[1],m=N[2],j9,n),n.point(f,d)}function _(){y.point=g,n.lineEnd()}function v(){x(),y.point=w,y.lineEnd=T}function w(A,E){b(i=A,E),o=f,s=d,a=h,c=p,l=m,y.point=b}function T(){r(f,d,u,h,p,m,o,s,i,a,c,l,j9,n),y.lineEnd=_,_()}return y}}var pet=Qd({point:function(e,t){this.stream.point(e*Yt,t*Yt)}});function met(e){return Qd({point:function(t,r){var n=e(t,r);return this.stream.point(n[0],n[1])}})}function yet(e,t,r,n,i){function o(s,a){return s*=n,a*=i,[t+e*s,r-e*a]}return o.invert=function(s,a){return[(s-t)/e*n,(r-a)/e*i]},o}function q9(e,t,r,n,i,o){if(!o)return yet(e,t,r,n,i);var s=J(o),a=Z(o),c=s*e,l=a*e,u=s/e,f=a/e,d=(a*r-s*t)/e,h=(a*t+s*r)/e;function p(m,y){return m*=n,y*=i,[c*m-l*y+t,r-l*m-c*y]}return p.invert=function(m,y){return[n*(u*m-f*y+d),i*(h-f*m-u*y)]},p}function Jr(e){return F3(function(){return e})()}function F3(e){var t,r=150,n=480,i=250,o=0,s=0,a=0,c=0,l=0,u,f=0,d=1,h=1,p=null,m=m3,y=null,g,x,b,_=Wy,v=.5,w,T,A,E,N;function I(M){return A(M[0]*Yt,M[1]*Yt)}function R(M){return M=A.invert(M[0],M[1]),M&&[M[0]*Ze,M[1]*Ze]}I.stream=function(M){return E&&N===M?E:E=pet(met(u)(m(w(_(N=M)))))},I.preclip=function(M){return arguments.length?(m=M,p=void 0,S()):m},I.postclip=function(M){return arguments.length?(_=M,y=g=x=b=null,S()):_},I.clipAngle=function(M){return arguments.length?(m=+M?S9(p=M*Yt):(p=null,m3),S()):p*Ze},I.clipExtent=function(M){return arguments.length?(_=M==null?(y=g=x=b=null,Wy):Yd(y=+M[0][0],g=+M[0][1],x=+M[1][0],b=+M[1][1]),S()):y==null?null:[[y,g],[x,b]]},I.scale=function(M){return arguments.length?(r=+M,C()):r},I.translate=function(M){return arguments.length?(n=+M[0],i=+M[1],C()):[n,i]},I.center=function(M){return arguments.length?(o=M[0]%360*Yt,s=M[1]%360*Yt,C()):[o*Ze,s*Ze]},I.rotate=function(M){return arguments.length?(a=M[0]%360*Yt,c=M[1]%360*Yt,l=M.length>2?M[2]%360*Yt:0,C()):[a*Ze,c*Ze,l*Ze]},I.angle=function(M){return arguments.length?(f=M%360*Yt,C()):f*Ze},I.reflectX=function(M){return arguments.length?(d=M?-1:1,C()):d<0},I.reflectY=function(M){return arguments.length?(h=M?-1:1,C()):h<0},I.precision=function(M){return arguments.length?(w=L3(T,v=M*M),S()):Ae(v)},I.fitExtent=function(M,O){return Ky(I,M,O)},I.fitSize=function(M,O){return av(I,M,O)},I.fitWidth=function(M,O){return cv(I,M,O)},I.fitHeight=function(M,O){return lv(I,M,O)};function C(){var M=q9(r,0,0,d,h,f).apply(null,t(o,s)),O=q9(r,n-M[0],i-M[1],d,h,f);return u=h3(a,c,l),T=Vy(t,O),A=Vy(u,T),w=L3(T,v),S()}function S(){return E=N=null,I}return function(){return t=e.apply(this,arguments),I.invert=t.invert&&R,C()}}function Zd(e){var t=0,r=Ct/3,n=F3(e),i=n(t,r);return i.parallels=function(o){return arguments.length?n(t=o[0]*Yt,r=o[1]*Yt):[t*Ze,r*Ze]},i}function V9(e){var t=J(e);function r(n,i){return[n*t,Z(i)/t]}return r.invert=function(n,i){return[n/t,Ce(i*t)]},r}function Y9(e,t){var r=Z(e),n=(r+Z(t))/2;if($t(n)<et)return V9(e);var i=1+r*(2*n-r),o=Ae(i)/n;function s(a,c){var l=Ae(i-2*n*Z(c))/n;return[l*Z(a*=n),o-l*J(a)]}return s.invert=function(a,c){var l=o-c,u=ur(a,$t(l))*fn(l);return l*n<0&&(u-=Ct*fn(a)*fn(l)),[u/n,Ce((i-(a*a+l*l)*n*n)/(2*n))]},s}function Qc(){return Zd(Y9).scale(155.424).center([0,33.6442])}function Jy(){return Qc().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function get(e){var t=e.length;return{point:function(r,n){for(var i=-1;++i<t;)e[i].point(r,n)},sphere:function(){for(var r=-1;++r<t;)e[r].sphere()},lineStart:function(){for(var r=-1;++r<t;)e[r].lineStart()},lineEnd:function(){for(var r=-1;++r<t;)e[r].lineEnd()},polygonStart:function(){for(var r=-1;++r<t;)e[r].polygonStart()},polygonEnd:function(){for(var r=-1;++r<t;)e[r].polygonEnd()}}}function C3(){var e,t,r=Jy(),n,i=Qc().rotate([154,0]).center([-2,58.5]).parallels([55,65]),o,s=Qc().rotate([157,0]).center([-3,19.9]).parallels([8,18]),a,c,l={point:function(d,h){c=[d,h]}};function u(d){var h=d[0],p=d[1];return c=null,n.point(h,p),c||(o.point(h,p),c)||(a.point(h,p),c)}u.invert=function(d){var h=r.scale(),p=r.translate(),m=(d[0]-p[0])/h,y=(d[1]-p[1])/h;return(y>=.12&&y<.234&&m>=-.425&&m<-.214?i:y>=.166&&y<.234&&m>=-.214&&m<-.115?s:r).invert(d)},u.stream=function(d){return e&&t===d?e:e=get([r.stream(t=d),i.stream(d),s.stream(d)])},u.precision=function(d){return arguments.length?(r.precision(d),i.precision(d),s.precision(d),f()):r.precision()},u.scale=function(d){return arguments.length?(r.scale(d),i.scale(d*.35),s.scale(d),u.translate(r.translate())):r.scale()},u.translate=function(d){if(!arguments.length)return r.translate();var h=r.scale(),p=+d[0],m=+d[1];return n=r.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+et,m+.12*h+et],[p-.214*h-et,m+.234*h-et]]).stream(l),a=s.translate([p-.205*h,m+.212*h]).clipExtent([[p-.214*h+et,m+.166*h+et],[p-.115*h-et,m+.234*h-et]]).stream(l),f()},u.fitExtent=function(d,h){return Ky(u,d,h)},u.fitSize=function(d,h){return av(u,d,h)},u.fitWidth=function(d,h){return cv(u,d,h)},u.fitHeight=function(d,h){return lv(u,d,h)};function f(){return e=t=null,u}return u.scale(1070)}function uv(e){return function(t,r){var n=J(t),i=J(r),o=e(n*i);return o===1/0?[2,0]:[o*i*Z(t),o*Z(r)]}}function ps(e){return function(t,r){var n=Ae(t*t+r*r),i=e(n),o=Z(i),s=J(i);return[ur(t*o,n*s),Ce(n&&r*o/n)]}}var k3=uv(function(e){return Ae(2/(1+e))});k3.invert=ps(function(e){return 2*Ce(e/2)});function B3(){return Jr(k3).scale(124.75).clipAngle(180-.001)}var P3=uv(function(e){return(e=Uw(e))&&e/Z(e)});P3.invert=ps(function(e){return e});function U3(){return Jr(P3).scale(79.4188).clipAngle(180-.001)}function Kd(e,t){return[e,ku(jd((Te+t)/2))]}Kd.invert=function(e,t){return[e,2*Wi(kw(t))-Te]};function $3(){return z3(Kd).scale(961/Rr)}function z3(e){var t=Jr(e),r=t.center,n=t.scale,i=t.translate,o=t.clipExtent,s=null,a,c,l;t.scale=function(f){return arguments.length?(n(f),u()):n()},t.translate=function(f){return arguments.length?(i(f),u()):i()},t.center=function(f){return arguments.length?(r(f),u()):r()},t.clipExtent=function(f){return arguments.length?(f==null?s=a=c=l=null:(s=+f[0][0],a=+f[0][1],c=+f[1][0],l=+f[1][1]),u()):s==null?null:[[s,a],[c,l]]};function u(){var f=Ct*n(),d=t(x9(t.rotate()).invert([0,0]));return o(s==null?[[d[0]-f,d[1]-f],[d[0]+f,d[1]+f]]:e===Kd?[[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 fv(e){return jd((Te+e)/2)}function W9(e,t){var r=J(e),n=e===t?Z(e):ku(r/J(t))/ku(fv(t)/fv(e)),i=r*Pw(fv(e),n)/n;if(!n)return Kd;function o(s,a){i>0?a<-Te+et&&(a=-Te+et):a>Te-et&&(a=Te-et);var c=i/Pw(fv(a),n);return[c*Z(n*s),i-c*J(n*s)]}return o.invert=function(s,a){var c=i-a,l=fn(n)*Ae(s*s+c*c),u=ur(s,$t(c))*fn(c);return c*n<0&&(u-=Ct*fn(s)*fn(c)),[u/n,2*Wi(Pw(i/l,1/n))-Te]},o}function j3(){return Zd(W9).scale(109.5).parallels([30,30])}function Jd(e,t){return[e,t]}Jd.invert=Jd;function q3(){return Jr(Jd).scale(152.63)}function G9(e,t){var r=J(e),n=e===t?Z(e):(r-J(t))/(t-e),i=r/n+e;if($t(n)<et)return Jd;function o(s,a){var c=i-a,l=n*s;return[c*Z(l),i-c*J(l)]}return o.invert=function(s,a){var c=i-a,l=ur(s,$t(c))*fn(c);return c*n<0&&(l-=Ct*fn(s)*fn(c)),[l/n,i-fn(n)*Ae(s*s+c*c)]},o}function V3(){return Zd(G9).scale(131.154).center([0,13.9389])}var tg=1.340264,eg=-.081106,rg=893e-6,ng=.003796,dv=Ae(3)/2,xet=12;function Y3(e,t){var r=Ce(dv*Z(t)),n=r*r,i=n*n*n;return[e*J(r)/(dv*(tg+3*eg*n+i*(7*rg+9*ng*n))),r*(tg+eg*n+i*(rg+ng*n))]}Y3.invert=function(e,t){for(var r=t,n=r*r,i=n*n*n,o=0,s,a,c;o<xet&&(a=r*(tg+eg*n+i*(rg+ng*n))-t,c=tg+3*eg*n+i*(7*rg+9*ng*n),r-=s=a/c,n=r*r,i=n*n*n,!($t(s)<Cu));++o);return[dv*e*(tg+3*eg*n+i*(7*rg+9*ng*n))/J(r),Ce(Z(r)/dv)]};function W3(){return Jr(Y3).scale(177.158)}function G3(e,t){var r=J(t),n=J(e)*r;return[r*Z(e)/n,Z(t)/n]}G3.invert=ps(Wi);function X3(){return Jr(G3).scale(144.049).clipAngle(60)}function H3(e,t){return[J(t)*Z(e),Z(t)]}H3.invert=ps(Ce);function Q3(){return Jr(H3).scale(249.5).clipAngle(90+et)}function Z3(e,t){var r=J(t),n=1+J(e)*r;return[r*Z(e)/n,Z(t)/n]}Z3.invert=ps(function(e){return 2*Wi(e)});function K3(){return Jr(Z3).scale(250).clipAngle(142)}function J3(e,t){return[ku(jd((Te+t)/2)),-e]}J3.invert=function(e,t){return[-t,2*Wi(kw(e))-Te]};function t6(){var e=z3(J3),t=e.center,r=e.rotate;return e.center=function(n){return arguments.length?t([-n[1],n[0]]):(n=t(),[n[1],-n[0]])},e.rotate=function(n){return arguments.length?r([n[0],n[1],n.length>2?n[2]+90:90]):(n=r(),[n[0],n[1],n[2]-90])},r([0,0,90]).scale(159.155)}function bet(e,t){return e.parent===t.parent?1:2}function _et(e){return e.reduce(wet,0)/e.length}function wet(e,t){return e+t.x}function vet(e){return 1+e.reduce(Iet,0)}function Iet(e,t){return Math.max(e,t.y)}function Tet(e){for(var t;t=e.children;)e=t[0];return e}function Aet(e){for(var t;t=e.children;)e=t[t.length-1];return e}function hv(){var e=bet,t=1,r=1,n=!1;function i(o){var s,a=0;o.eachAfter(function(d){var h=d.children;h?(d.x=_et(h),d.y=vet(h)):(d.x=s?a+=e(d,s):0,d.y=0,s=d)});var c=Tet(o),l=Aet(o),u=c.x-e(c,l)/2,f=l.x+e(l,c)/2;return o.eachAfter(n?function(d){d.x=(d.x-o.x)*t,d.y=(o.y-d.y)*r}:function(d){d.x=(d.x-u)/(f-u)*t,d.y=(1-(o.y?d.y/o.y:1))*r})}return i.separation=function(o){return arguments.length?(e=o,i):e},i.size=function(o){return arguments.length?(n=!1,t=+o[0],r=+o[1],i):n?null:[t,r]},i.nodeSize=function(o){return arguments.length?(n=!0,t=+o[0],r=+o[1],i):n?[t,r]:null},i}function Eet(e){var t=0,r=e.children,n=r&&r.length;if(!n)t=1;else for(;--n>=0;)t+=r[n].value;e.value=t}function X9(){return this.eachAfter(Eet)}function H9(e,t){let r=-1;for(let n of this)e.call(t,n,++r,this);return this}function Q9(e,t){for(var r=this,n=[r],i,o,s=-1;r=n.pop();)if(e.call(t,r,++s,this),i=r.children)for(o=i.length-1;o>=0;--o)n.push(i[o]);return this}function Z9(e,t){for(var r=this,n=[r],i=[],o,s,a,c=-1;r=n.pop();)if(i.push(r),o=r.children)for(s=0,a=o.length;s<a;++s)n.push(o[s]);for(;r=i.pop();)e.call(t,r,++c,this);return this}function K9(e,t){let r=-1;for(let n of this)if(e.call(t,n,++r,this))return n}function J9(e){return this.eachAfter(function(t){for(var r=+e(t.data)||0,n=t.children,i=n&&n.length;--i>=0;)r+=n[i].value;t.value=r})}function tU(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function eU(e){for(var t=this,r=Met(t,e),n=[t];t!==r;)t=t.parent,n.push(t);for(var i=n.length;e!==r;)n.splice(i,0,e),e=e.parent;return n}function Met(e,t){if(e===t)return e;var r=e.ancestors(),n=t.ancestors(),i=null;for(e=r.pop(),t=n.pop();e===t;)i=e,e=r.pop(),t=n.pop();return i}function rU(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function nU(){return Array.from(this)}function iU(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function oU(){var e=this,t=[];return e.each(function(r){r!==e&&t.push({source:r.parent,target:r})}),t}function*sU(){var e=this,t,r=[e],n,i,o;do for(t=r.reverse(),r=[];e=t.pop();)if(yield e,n=e.children)for(i=0,o=n.length;i<o;++i)r.push(n[i]);while(r.length)}function e6(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=Ret)):t===void 0&&(t=Oet);for(var r=new Zc(e),n,i=[r],o,s,a,c;n=i.pop();)if((s=t(n.data))&&(c=(s=Array.from(s)).length))for(n.children=s,a=c-1;a>=0;--a)i.push(o=s[a]=new Zc(s[a])),o.parent=n,o.depth=n.depth+1;return r.eachBefore(r6)}function Net(){return e6(this).eachBefore(Det)}function Oet(e){return e.children}function Ret(e){return Array.isArray(e)?e[1]:null}function Det(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function r6(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function Zc(e){this.data=e,this.depth=this.height=0,this.parent=null}Zc.prototype=e6.prototype={constructor:Zc,count:X9,each:H9,eachAfter:Z9,eachBefore:Q9,find:K9,sum:J9,sort:tU,path:eU,ancestors:rU,descendants:nU,leaves:iU,links:oU,copy:Net,[Symbol.iterator]:sU};function pv(e){return e==null?null:Let(e)}function Let(e){if(typeof e!="function")throw new Error;return e}var Fet={depth:-1},aU={},n6={};function Cet(e){return e.id}function ket(e){return e.parentId}function mv(){var e=Cet,t=ket,r;function n(i){var o=Array.from(i),s=e,a=t,c,l,u,f,d,h,p,m,y=new Map;if(r!=null){let g=o.map((_,v)=>Bet(r(_,v,i))),x=g.map(cU),b=new Set(g).add("");for(let _ of x)b.has(_)||(b.add(_),g.push(_),x.push(cU(_)),o.push(n6));s=(_,v)=>g[v],a=(_,v)=>x[v]}for(u=0,c=o.length;u<c;++u)l=o[u],h=o[u]=new Zc(l),(p=s(l,u,i))!=null&&(p+="")&&(m=h.id=p,y.set(m,y.has(m)?aU: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=y.get(p),!d)throw new Error("missing: "+p);if(d===aU)throw new Error("ambiguous: "+p);d.children?d.children.push(h):d.children=[h],h.parent=d}else{if(f)throw new Error("multiple roots");f=h}if(!f)throw new Error("no root");if(r!=null){for(;f.data===n6&&f.children.length===1;)f=f.children[0],--c;for(let g=o.length-1;g>=0&&(h=o[g],h.data===n6);--g)h.data=null}if(f.parent=Fet,f.eachBefore(function(g){g.depth=g.parent.depth+1,--c}).eachBefore(r6),f.parent=null,c>0)throw new Error("cycle");return f}return n.id=function(i){return arguments.length?(e=pv(i),n):e},n.parentId=function(i){return arguments.length?(t=pv(i),n):t},n.path=function(i){return arguments.length?(r=pv(i),n):r},n}function Bet(e){e=`${e}`;let t=e.length;return i6(e,t-1)&&!i6(e,t-2)&&(e=e.slice(0,-1)),e[0]==="/"?e:`/${e}`}function cU(e){let t=e.length;if(t<2)return"";for(;--t>1&&!i6(e,t););return e.slice(0,t)}function i6(e,t){if(e[t]==="/"){let r=0;for(;t>0&&e[--t]==="\\";)++r;if(!(r&1))return!0}return!1}function Pet(e,t){return e.parent===t.parent?1:2}function o6(e){var t=e.children;return t?t[0]:e.t}function s6(e){var t=e.children;return t?t[t.length-1]:e.t}function Uet(e,t,r){var n=r/(t.i-e.i);t.c-=n,t.s+=r,e.c+=n,t.z+=r,t.m+=r}function $et(e){for(var t=0,r=0,n=e.children,i=n.length,o;--i>=0;)o=n[i],o.z+=t,o.m+=t,t+=o.s+(r+=o.c)}function zet(e,t,r){return e.a.parent===t.parent?e.a:r}function yv(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}yv.prototype=Object.create(Zc.prototype);function jet(e){for(var t=new yv(e,0),r,n=[t],i,o,s,a;r=n.pop();)if(o=r._.children)for(r.children=new Array(a=o.length),s=a-1;s>=0;--s)n.push(i=r.children[s]=new yv(o[s],s)),i.parent=r;return(t.parent=new yv(null,0)).children=[t],t}function Uu(){var e=Pet,t=1,r=1,n=null;function i(l){var u=jet(l);if(u.eachAfter(o),u.parent.m=-u.z,u.eachBefore(s),n)l.eachBefore(c);else{var f=l,d=l,h=l;l.eachBefore(function(x){x.x<f.x&&(f=x),x.x>d.x&&(d=x),x.depth>h.depth&&(h=x)});var p=f===d?1:e(f,d)/2,m=p-f.x,y=t/(d.x+p+m),g=r/(h.depth||1);l.eachBefore(function(x){x.x=(x.x+m)*y,x.y=x.depth*g})}return l}function o(l){var u=l.children,f=l.parent.children,d=l.i?f[l.i-1]:null;if(u){$et(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],y=d.m,g=h.m,x=p.m,b=m.m,_;p=s6(p),d=o6(d),p&&d;)m=o6(m),h=s6(h),h.a=l,_=p.z+x-d.z-y+e(p._,d._),_>0&&(Uet(zet(p,l,f),l,_),y+=_,g+=_),x+=p.m,y+=d.m,b+=m.m,g+=h.m;p&&!s6(h)&&(h.t=p,h.m+=x-g),d&&!o6(m)&&(m.t=d,m.m+=y-b,f=l)}return f}function c(l){l.x*=t,l.y=l.depth*r}return i.separation=function(l){return arguments.length?(e=l,i):e},i.size=function(l){return arguments.length?(n=!1,t=+l[0],r=+l[1],i):n?null:[t,r]},i.nodeSize=function(l){return arguments.length?(n=!0,t=+l[0],r=+l[1],i):n?[t,r]:null},i}var lU=23283064365386963e-26;function $u(e=Math.random()){let t=(0<=e&&e<1?e/lU:Math.abs(e))|0;return()=>(t=1664525*t+1013904223|0,lU*(t>>>0))}function dr(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function ig(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 og=Symbol("implicit");function zu(){var e=new Sn,t=[],r=[],n=og;function i(o){let s=e.get(o);if(s===void 0){if(n!==og)return n;e.set(o,s=t.push(o)-1)}return r[s%r.length]}return i.domain=function(o){if(!arguments.length)return t.slice();t=[],e=new Sn;for(let s of o)e.has(s)||e.set(s,t.push(s)-1);return i},i.range=function(o){return arguments.length?(r=Array.from(o),i):r.slice()},i.unknown=function(o){return arguments.length?(n=o,i):n},i.copy=function(){return zu(t,r).unknown(n)},dr.apply(i,arguments),i}function Kc(){var e=zu().unknown(void 0),t=e.domain,r=e.range,n=0,i=1,o,s,a=!1,c=0,l=0,u=.5;delete e.unknown;function f(){var d=t().length,h=i<n,p=h?i:n,m=h?n: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 y=er(d).map(function(g){return p+o*g});return r(h?y.reverse():y)}return e.domain=function(d){return arguments.length?(t(d),f()):t()},e.range=function(d){return arguments.length?([n,i]=d,n=+n,i=+i,f()):[n,i]},e.rangeRound=function(d){return[n,i]=d,n=+n,i=+i,a=!0,f()},e.bandwidth=function(){return s},e.step=function(){return o},e.round=function(d){return arguments.length?(a=!!d,f()):a},e.padding=function(d){return arguments.length?(c=Math.min(1,l=+d),f()):c},e.paddingInner=function(d){return arguments.length?(c=Math.min(1,d),f()):c},e.paddingOuter=function(d){return arguments.length?(l=+d,f()):l},e.align=function(d){return arguments.length?(u=Math.max(0,Math.min(1,d)),f()):u},e.copy=function(){return Kc(t(),[n,i]).round(a).paddingInner(c).paddingOuter(l).align(u)},dr.apply(f(),arguments)}function uU(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return uU(t())},e}function a6(){return uU(Kc.apply(null,arguments).paddingInner(1))}function c6(e){return function(){return e}}function th(e){return+e}var fU=[0,1];function Hn(e){return e}function l6(e,t){return(t-=e=+e)?function(r){return(r-e)/t}:c6(isNaN(t)?NaN:.5)}function qet(e,t){var r;return e>t&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function Vet(e,t,r){var n=e[0],i=e[1],o=t[0],s=t[1];return i<n?(n=l6(i,n),o=r(s,o)):(n=l6(n,i),o=r(o,s)),function(a){return o(n(a))}}function Yet(e,t,r){var n=Math.min(e.length,t.length)-1,i=new Array(n),o=new Array(n),s=-1;for(e[n]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++s<n;)i[s]=l6(e[s],e[s+1]),o[s]=r(t[s],t[s+1]);return function(a){var c=Ia(e,a,1,n)-1;return o[c](i[c](a))}}function ms(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function ju(){var e=fU,t=fU,r=hi,n,i,o,s=Hn,a,c,l;function u(){var d=Math.min(e.length,t.length);return s!==Hn&&(s=qet(e[0],e[d-1])),a=d>2?Yet:Vet,c=l=null,f}function f(d){return d==null||isNaN(d=+d)?o:(c||(c=a(e.map(n),t,r)))(n(s(d)))}return f.invert=function(d){return s(i((l||(l=a(t,e.map(n),Fe)))(d)))},f.domain=function(d){return arguments.length?(e=Array.from(d,th),u()):e.slice()},f.range=function(d){return arguments.length?(t=Array.from(d),u()):t.slice()},f.rangeRound=function(d){return t=Array.from(d),r=Nu,u()},f.clamp=function(d){return arguments.length?(s=d?!0:Hn,u()):s!==Hn},f.interpolate=function(d){return arguments.length?(r=d,u()):r},f.unknown=function(d){return arguments.length?(o=d,f):o},function(d,h){return n=d,i=h,u()}}function sg(){return ju()(Hn,Hn)}function u6(e,t,r,n){var i=Sd(e,t,r),o;switch(n=us(n??",f"),n.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(o=n3(i,s))&&(n.precision=o),Cw(n,s)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(o=i3(i,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=o-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(o=r3(i))&&(n.precision=o-(n.type==="%")*2);break}}return Yi(n)}function ka(e){var t=e.domain;return e.ticks=function(r){var n=t();return Qr(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var i=t();return u6(i[0],i[i.length-1],r??10,n)},e.nice=function(r){r==null&&(r=10);var n=t(),i=0,o=n.length-1,s=n[i],a=n[o],c,l,u=10;for(a<s&&(l=s,s=a,a=l,l=i,i=o,o=l);u-- >0;){if(l=Aa(s,a,r),l===c)return n[i]=s,n[o]=a,t(n);if(l>0)s=Math.floor(s/l)*l,a=Math.ceil(a/l)*l;else if(l<0)s=Math.ceil(s*l)/l,a=Math.floor(a*l)/l;else break;c=l}return e},e}function Ba(){var e=sg();return e.copy=function(){return ms(e,Ba())},dr.apply(e,arguments),ka(e)}function ag(e){var t;function r(n){return n==null||isNaN(n=+n)?t:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(e=Array.from(n,th),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return ag(e).unknown(t)},e=arguments.length?Array.from(e,th):[0,1],ka(r)}function cg(e,t){e=e.slice();var r=0,n=e.length-1,i=e[r],o=e[n],s;return o<i&&(s=r,r=n,n=s,s=i,i=o,o=s),e[r]=t.floor(i),e[n]=t.ceil(o),e}function dU(e){return Math.log(e)}function hU(e){return Math.exp(e)}function Wet(e){return-Math.log(-e)}function Get(e){return-Math.exp(-e)}function Xet(e){return isFinite(e)?+("1e"+e):e<0?0:e}function Het(e){return e===10?Xet:e===Math.E?Math.exp:t=>Math.pow(e,t)}function Qet(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 pU(e){return(t,r)=>-e(-t,r)}function f6(e){let t=e(dU,hU),r=t.domain,n=10,i,o;function s(){return i=Qet(n),o=Het(n),r()[0]<0?(i=pU(i),o=pU(o),e(Wet,Get)):e(dU,hU),t}return t.base=function(a){return arguments.length?(n=+a,s()):n},t.domain=function(a){return arguments.length?(r(a),s()):r()},t.ticks=a=>{let c=r(),l=c[0],u=c[c.length-1],f=u<l;f&&([l,u]=[u,l]);let d=i(l),h=i(u),p,m,y=a==null?10:+a,g=[];if(!(n%1)&&h-d<y){if(d=Math.floor(d),h=Math.ceil(h),l>0){for(;d<=h;++d)for(p=1;p<n;++p)if(m=d<0?p/o(-d):p*o(d),!(m<l)){if(m>u)break;g.push(m)}}else for(;d<=h;++d)for(p=n-1;p>=1;--p)if(m=d>0?p/o(-d):p*o(d),!(m<l)){if(m>u)break;g.push(m)}g.length*2<y&&(g=Qr(l,u,y))}else g=Qr(d,h,Math.min(h-d,y)).map(o);return f?g.reverse():g},t.tickFormat=(a,c)=>{if(a==null&&(a=10),c==null&&(c=n===10?"s":","),typeof c!="function"&&(!(n%1)&&(c=us(c)).precision==null&&(c.trim=!0),c=Yi(c)),a===1/0)return c;let l=Math.max(1,n*a/t.ticks().length);return u=>{let f=u/o(Math.round(i(u)));return f*n<n-.5&&(f*=n),f<=l?c(u):""}},t.nice=()=>r(cg(r(),{floor:a=>o(Math.floor(i(a))),ceil:a=>o(Math.ceil(i(a)))})),t}function lg(){let e=f6(ju()).domain([1,10]);return e.copy=()=>ms(e,lg()).base(e.base()),dr.apply(e,arguments),e}function mU(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function yU(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function d6(e){var t=1,r=e(mU(t),yU(t));return r.constant=function(n){return arguments.length?e(mU(t=+n),yU(t)):t},ka(r)}function ug(){var e=d6(ju());return e.copy=function(){return ms(e,ug()).constant(e.constant())},dr.apply(e,arguments)}function gU(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Zet(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function Ket(e){return e<0?-e*e:e*e}function h6(e){var t=e(Hn,Hn),r=1;function n(){return r===1?e(Hn,Hn):r===.5?e(Zet,Ket):e(gU(r),gU(1/r))}return t.exponent=function(i){return arguments.length?(r=+i,n()):r},ka(t)}function fg(){var e=h6(ju());return e.copy=function(){return ms(e,fg()).exponent(e.exponent())},dr.apply(e,arguments),e}function dg(){var e=[],t=[],r=[],n;function i(){var s=0,a=Math.max(1,t.length);for(r=new Array(a-1);++s<a;)r[s-1]=dM(e,s/a);return o}function o(s){return s==null||isNaN(s=+s)?n:t[Ia(r,s)]}return o.invertExtent=function(s){var a=t.indexOf(s);return a<0?[NaN,NaN]:[a>0?r[a-1]:e[0],a<r.length?r[a]:e[e.length-1]]},o.domain=function(s){if(!arguments.length)return e.slice();e=[];for(let a of s)a!=null&&!isNaN(a=+a)&&e.push(a);return e.sort(Ft),i()},o.range=function(s){return arguments.length?(t=Array.from(s),i()):t.slice()},o.unknown=function(s){return arguments.length?(n=s,o):n},o.quantiles=function(){return r.slice()},o.copy=function(){return dg().domain(e).range(t).unknown(n)},dr.apply(o,arguments)}function hg(){var e=[.5],t=[0,1],r,n=1;function i(o){return o!=null&&o<=o?t[Ia(e,o,0,n)]:r}return i.domain=function(o){return arguments.length?(e=Array.from(o),n=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(o){return arguments.length?(t=Array.from(o),n=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(o){var s=t.indexOf(o);return[e[s-1],e[s]]},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return hg().domain(e).range(t).unknown(r)},dr.apply(i,arguments)}var p6=new Date,m6=new Date;function Me(e,t,r,n){function i(o){return e(o=arguments.length===0?new Date:new Date(+o)),o}return i.floor=o=>(e(o=new Date(+o)),o),i.ceil=o=>(e(o=new Date(o-1)),t(o,1),e(o),o),i.round=o=>{let s=i(o),a=i.ceil(o);return o-s<a-o?s:a},i.offset=(o,s)=>(t(o=new Date(+o),s==null?1:Math.floor(s)),o),i.range=(o,s,a)=>{let c=[];if(o=i.ceil(o),a=a==null?1:Math.floor(a),!(o<s)||!(a>0))return c;let l;do c.push(l=new Date(+o)),t(o,a),e(o);while(l<o&&o<s);return c},i.filter=o=>Me(s=>{if(s>=s)for(;e(s),!o(s);)s.setTime(s-1)},(s,a)=>{if(s>=s)if(a<0)for(;++a<=0;)for(;t(s,-1),!o(s););else for(;--a>=0;)for(;t(s,1),!o(s););}),r&&(i.count=(o,s)=>(p6.setTime(+o),m6.setTime(+s),e(p6),e(m6),Math.floor(r(p6,m6))),i.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?i.filter(n?s=>n(s)%o===0:s=>i.count(0,s)%o===0):i)),i}var pg=Me(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);pg.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Me(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):pg);var QUt=pg.range;var Lr=Me(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*1e3)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds()),xU=Lr.range;var Pa=Me(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getMinutes()),Jet=Pa.range,Ua=Me(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes()),trt=Ua.range;var $a=Me(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()),ert=$a.range,za=Me(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours()),rrt=za.range;var Gi=Me(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),nrt=Gi.range,Yu=Me(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1),irt=Yu.range,Wu=Me(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>Math.floor(e/864e5)),ort=Wu.range;function Gu(e){return Me(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,r)=>{t.setDate(t.getDate()+r*7)},(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/6048e5)}var mi=Gu(0),Jc=Gu(1),gv=Gu(2),xv=Gu(3),gs=Gu(4),bv=Gu(5),_v=Gu(6),_U=mi.range,srt=Jc.range,art=gv.range,crt=xv.range,lrt=gs.range,urt=bv.range,frt=_v.range;function Xu(e){return Me(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r*7)},(t,r)=>(r-t)/6048e5)}var yi=Xu(0),tl=Xu(1),wv=Xu(2),vv=Xu(3),xs=Xu(4),Sv=Xu(5),Iv=Xu(6),wU=yi.range,drt=tl.range,hrt=wv.range,prt=vv.range,mrt=xs.range,yrt=Sv.range,grt=Iv.range;var ja=Me(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()),xrt=ja.range,qa=Me(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()),brt=qa.range;var dn=Me(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());dn.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Me(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r*e)});var _rt=dn.range,hn=Me(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());hn.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Me(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r*e)});var wrt=hn.range;function SU(e,t,r,n,i,o){let s=[[Lr,1,1e3],[Lr,5,5*1e3],[Lr,15,15*1e3],[Lr,30,30*1e3],[o,1,6e4],[o,5,5*6e4],[o,15,15*6e4],[o,30,30*6e4],[i,1,36e5],[i,3,3*36e5],[i,6,6*36e5],[i,12,12*36e5],[n,1,864e5],[n,2,2*864e5],[r,1,6048e5],[t,1,2592e6],[t,3,3*2592e6],[e,1,31536e6]];function a(l,u,f){let d=u<l;d&&([l,u]=[u,l]);let h=f&&typeof f.range=="function"?f:c(l,u,f),p=h?h.range(l,+u+1):[];return d?p.reverse():p}function c(l,u,f){let d=Math.abs(u-l)/f,h=To(([,,y])=>y).right(s,d);if(h===s.length)return e.every(Sd(l/31536e6,u/31536e6,f));if(h===0)return pg.every(Math.max(Sd(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[y6,yg]=SU(hn,qa,yi,Wu,za,Ua),[g6,x6]=SU(dn,ja,mi,Gi,$a,Pa);function b6(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 _6(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 gg(e,t,r){return{y:e,m:t,d:r,H:0,M:0,S:0,L:0}}function w6(e){var t=e.dateTime,r=e.date,n=e.time,i=e.periods,o=e.days,s=e.shortDays,a=e.months,c=e.shortMonths,l=xg(i),u=bg(i),f=xg(o),d=bg(o),h=xg(s),p=bg(s),m=xg(a),y=bg(a),g=xg(c),x=bg(c),b={a:L,A:B,b:k,B:P,c:null,d:NU,e:NU,f:Yrt,g:ent,G:nnt,H:jrt,I:qrt,j:Vrt,L:FU,m:Wrt,M:Grt,p:U,q:$,Q:DU,s:LU,S:Xrt,u:Hrt,U:Qrt,V:Zrt,w:Krt,W:Jrt,x:null,X:null,y:tnt,Y:rnt,Z:int,"%":RU},_={a:X,A:rt,b:ot,B:at,c:null,d:OU,e:OU,f:cnt,g:xnt,G:_nt,H:ont,I:snt,j:ant,L:kU,m:lnt,M:unt,p:Y,q:st,Q:DU,s:LU,S:fnt,u:dnt,U:hnt,V:pnt,w:mnt,W:ynt,x:null,X:null,y:gnt,Y:bnt,Z:wnt,"%":RU},v={a:N,A:I,b:R,B:C,c:S,d:EU,e:EU,f:Prt,g:AU,G:TU,H:MU,I:MU,j:Frt,L:Brt,m:Lrt,M:Crt,p:E,q:Drt,Q:$rt,s:zrt,S:krt,u:Ert,U:Mrt,V:Nrt,w:Art,W:Ort,x:M,X:O,y:AU,Y:TU,Z:Rrt,"%":Urt};b.x=w(r,b),b.X=w(n,b),b.c=w(t,b),_.x=w(r,_),_.X=w(n,_),_.c=w(t,_);function w(q,H){return function(nt){var z=[],Pt=-1,ht=0,Zt=q.length,Jt,tt,ge;for(nt instanceof Date||(nt=new Date(+nt));++Pt<Zt;)q.charCodeAt(Pt)===37&&(z.push(q.slice(ht,Pt)),(tt=IU[Jt=q.charAt(++Pt)])!=null?Jt=q.charAt(++Pt):tt=Jt==="e"?" ":"0",(ge=H[Jt])&&(Jt=ge(nt,tt)),z.push(Jt),ht=Pt+1);return z.push(q.slice(ht,Pt)),z.join("")}}function T(q,H){return function(nt){var z=gg(1900,void 0,1),Pt=A(z,q,nt+="",0),ht,Zt;if(Pt!=nt.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?(ht=_6(gg(z.y,0,1)),Zt=ht.getUTCDay(),ht=Zt>4||Zt===0?tl.ceil(ht):tl(ht),ht=Yu.offset(ht,(z.V-1)*7),z.y=ht.getUTCFullYear(),z.m=ht.getUTCMonth(),z.d=ht.getUTCDate()+(z.w+6)%7):(ht=b6(gg(z.y,0,1)),Zt=ht.getDay(),ht=Zt>4||Zt===0?Jc.ceil(ht):Jc(ht),ht=Gi.offset(ht,(z.V-1)*7),z.y=ht.getFullYear(),z.m=ht.getMonth(),z.d=ht.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),Zt="Z"in z?_6(gg(z.y,0,1)).getUTCDay():b6(gg(z.y,0,1)).getDay(),z.m=0,z.d="W"in z?(z.w+6)%7+z.W*7-(Zt+5)%7:z.w+z.U*7-(Zt+6)%7);return"Z"in z?(z.H+=z.Z/100|0,z.M+=z.Z%100,_6(z)):b6(z)}}function A(q,H,nt,z){for(var Pt=0,ht=H.length,Zt=nt.length,Jt,tt;Pt<ht;){if(z>=Zt)return-1;if(Jt=H.charCodeAt(Pt++),Jt===37){if(Jt=H.charAt(Pt++),tt=v[Jt in IU?H.charAt(Pt++):Jt],!tt||(z=tt(q,nt,z))<0)return-1}else if(Jt!=nt.charCodeAt(z++))return-1}return z}function E(q,H,nt){var z=l.exec(H.slice(nt));return z?(q.p=u.get(z[0].toLowerCase()),nt+z[0].length):-1}function N(q,H,nt){var z=h.exec(H.slice(nt));return z?(q.w=p.get(z[0].toLowerCase()),nt+z[0].length):-1}function I(q,H,nt){var z=f.exec(H.slice(nt));return z?(q.w=d.get(z[0].toLowerCase()),nt+z[0].length):-1}function R(q,H,nt){var z=g.exec(H.slice(nt));return z?(q.m=x.get(z[0].toLowerCase()),nt+z[0].length):-1}function C(q,H,nt){var z=m.exec(H.slice(nt));return z?(q.m=y.get(z[0].toLowerCase()),nt+z[0].length):-1}function S(q,H,nt){return A(q,t,H,nt)}function M(q,H,nt){return A(q,r,H,nt)}function O(q,H,nt){return A(q,n,H,nt)}function L(q){return s[q.getDay()]}function B(q){return o[q.getDay()]}function k(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 rt(q){return o[q.getUTCDay()]}function ot(q){return c[q.getUTCMonth()]}function at(q){return a[q.getUTCMonth()]}function Y(q){return i[+(q.getUTCHours()>=12)]}function st(q){return 1+~~(q.getUTCMonth()/3)}return{format:function(q){var H=w(q+="",b);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 IU={"-":"",_:" ",0:"0"},Fr=/^\s*\d+/,Srt=/^%/,Irt=/[\\^$*+?|[\]().{}]/g;function le(e,t,r){var n=e<0?"-":"",i=(n?-e:e)+"",o=i.length;return n+(o<r?new Array(r-o+1).join(t)+i:i)}function Trt(e){return e.replace(Irt,"\\$&")}function xg(e){return new RegExp("^(?:"+e.map(Trt).join("|")+")","i")}function bg(e){return new Map(e.map((t,r)=>[t.toLowerCase(),r]))}function Art(e,t,r){var n=Fr.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function Ert(e,t,r){var n=Fr.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function Mrt(e,t,r){var n=Fr.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function Nrt(e,t,r){var n=Fr.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function Ort(e,t,r){var n=Fr.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function TU(e,t,r){var n=Fr.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function AU(e,t,r){var n=Fr.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function Rrt(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function Drt(e,t,r){var n=Fr.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function Lrt(e,t,r){var n=Fr.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function EU(e,t,r){var n=Fr.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function Frt(e,t,r){var n=Fr.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function MU(e,t,r){var n=Fr.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function Crt(e,t,r){var n=Fr.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function krt(e,t,r){var n=Fr.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function Brt(e,t,r){var n=Fr.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function Prt(e,t,r){var n=Fr.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function Urt(e,t,r){var n=Srt.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function $rt(e,t,r){var n=Fr.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function zrt(e,t,r){var n=Fr.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function NU(e,t){return le(e.getDate(),t,2)}function jrt(e,t){return le(e.getHours(),t,2)}function qrt(e,t){return le(e.getHours()%12||12,t,2)}function Vrt(e,t){return le(1+Gi.count(dn(e),e),t,3)}function FU(e,t){return le(e.getMilliseconds(),t,3)}function Yrt(e,t){return FU(e,t)+"000"}function Wrt(e,t){return le(e.getMonth()+1,t,2)}function Grt(e,t){return le(e.getMinutes(),t,2)}function Xrt(e,t){return le(e.getSeconds(),t,2)}function Hrt(e){var t=e.getDay();return t===0?7:t}function Qrt(e,t){return le(mi.count(dn(e)-1,e),t,2)}function CU(e){var t=e.getDay();return t>=4||t===0?gs(e):gs.ceil(e)}function Zrt(e,t){return e=CU(e),le(gs.count(dn(e),e)+(dn(e).getDay()===4),t,2)}function Krt(e){return e.getDay()}function Jrt(e,t){return le(Jc.count(dn(e)-1,e),t,2)}function tnt(e,t){return le(e.getFullYear()%100,t,2)}function ent(e,t){return e=CU(e),le(e.getFullYear()%100,t,2)}function rnt(e,t){return le(e.getFullYear()%1e4,t,4)}function nnt(e,t){var r=e.getDay();return e=r>=4||r===0?gs(e):gs.ceil(e),le(e.getFullYear()%1e4,t,4)}function int(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+le(t/60|0,"0",2)+le(t%60,"0",2)}function OU(e,t){return le(e.getUTCDate(),t,2)}function ont(e,t){return le(e.getUTCHours(),t,2)}function snt(e,t){return le(e.getUTCHours()%12||12,t,2)}function ant(e,t){return le(1+Yu.count(hn(e),e),t,3)}function kU(e,t){return le(e.getUTCMilliseconds(),t,3)}function cnt(e,t){return kU(e,t)+"000"}function lnt(e,t){return le(e.getUTCMonth()+1,t,2)}function unt(e,t){return le(e.getUTCMinutes(),t,2)}function fnt(e,t){return le(e.getUTCSeconds(),t,2)}function dnt(e){var t=e.getUTCDay();return t===0?7:t}function hnt(e,t){return le(yi.count(hn(e)-1,e),t,2)}function BU(e){var t=e.getUTCDay();return t>=4||t===0?xs(e):xs.ceil(e)}function pnt(e,t){return e=BU(e),le(xs.count(hn(e),e)+(hn(e).getUTCDay()===4),t,2)}function mnt(e){return e.getUTCDay()}function ynt(e,t){return le(tl.count(hn(e)-1,e),t,2)}function gnt(e,t){return le(e.getUTCFullYear()%100,t,2)}function xnt(e,t){return e=BU(e),le(e.getUTCFullYear()%100,t,2)}function bnt(e,t){return le(e.getUTCFullYear()%1e4,t,4)}function _nt(e,t){var r=e.getUTCDay();return e=r>=4||r===0?xs(e):xs.ceil(e),le(e.getUTCFullYear()%1e4,t,4)}function wnt(){return"+0000"}function RU(){return"%"}function DU(e){return+e}function LU(e){return Math.floor(+e/1e3)}var eh,rh,PU,bs,UU;v6({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 v6(e){return eh=w6(e),rh=eh.format,PU=eh.parse,bs=eh.utcFormat,UU=eh.utcParse,eh}function vnt(e){return new Date(e)}function Snt(e){return e instanceof Date?+e:+new Date(+e)}function Tv(e,t,r,n,i,o,s,a,c,l){var u=sg(),f=u.invert,d=u.domain,h=l(".%L"),p=l(":%S"),m=l("%I:%M"),y=l("%I %p"),g=l("%a %d"),x=l("%b %d"),b=l("%B"),_=l("%Y");function v(w){return(c(w)<w?h:a(w)<w?p:s(w)<w?m:o(w)<w?y:n(w)<w?i(w)<w?g:x:r(w)<w?b:_)(w)}return u.invert=function(w){return new Date(f(w))},u.domain=function(w){return arguments.length?d(Array.from(w,Snt)):d().map(vnt)},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(cg(T,w)):u},u.copy=function(){return ms(u,Tv(e,t,r,n,i,o,s,a,c,l))},u}function Av(){return dr.apply(Tv(g6,x6,dn,ja,mi,Gi,$a,Pa,Lr,rh).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function Ev(){return dr.apply(Tv(y6,yg,hn,qa,yi,Yu,za,Ua,Lr,bs).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function _g(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function Mv(){var e=0,t=.5,r=1,n=1,i,o,s,a,c,l=Hn,u,f=!1,d;function h(m){return isNaN(m=+m)?d:(m=.5+((m=+u(m))-o)*(n*m<n*o?a:c),l(f?Math.max(0,Math.min(1,m)):m))}h.domain=function(m){return arguments.length?([e,t,r]=m,i=u(e=+e),o=u(t=+t),s=u(r=+r),a=i===o?0:.5/(o-i),c=o===s?0:.5/(s-o),n=o<i?-1:1,h):[e,t,r]},h.clamp=function(m){return arguments.length?(f=!!m,h):f},h.interpolator=function(m){return arguments.length?(l=m,h):l};function p(m){return function(y){var g,x,b;return arguments.length?([g,x,b]=y,l=ss(m,[g,x,b]),h):[l(0),l(.5),l(1)]}}return h.range=p(hi),h.rangeRound=p(Nu),h.unknown=function(m){return arguments.length?(d=m,h):d},function(m){return u=m,i=m(e),o=m(t),s=m(r),a=i===o?0:.5/(o-i),c=o===s?0:.5/(s-o),n=o<i?-1:1,h}}function wg(){var e=ka(Mv()(Hn));return e.copy=function(){return _g(e,wg())},ig.apply(e,arguments)}function Nv(){var e=f6(Mv()).domain([.1,1,10]);return e.copy=function(){return _g(e,Nv()).base(e.base())},ig.apply(e,arguments)}function Ov(){var e=d6(Mv());return e.copy=function(){return _g(e,Ov()).constant(e.constant())},ig.apply(e,arguments)}function Rv(){var e=h6(Mv());return e.copy=function(){return _g(e,Rv()).exponent(e.exponent())},ig.apply(e,arguments)}function W(e){for(var t=e.length/6|0,r=new Array(t),n=0;n<t;)r[n]="#"+e.slice(n*6,++n*6);return r}var S6=W("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");var I6=W("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666");var T6=W("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666");var A6=W("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0");var E6=W("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");var M6=W("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2");var N6=W("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc");var O6=W("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999");var R6=W("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3");var D6=W("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");var L6=W("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");var pt=e=>MM(e[e.length-1]);var Dv=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(W),Lv=pt(Dv);var Fv=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(W),Cv=pt(Fv);var kv=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(W),Bv=pt(kv);var Pv=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(W),Uv=pt(Pv);var vg=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(W),nh=pt(vg);var $v=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(W),zv=pt($v);var Sg=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(W),ih=pt(Sg);var jv=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(W),qv=pt(jv);var Vv=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(W),Yv=pt(Vv);var Wv=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(W),Gv=pt(Wv);var Xv=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(W),Hv=pt(Xv);var Qv=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(W),Zv=pt(Qv);var Kv=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(W),Jv=pt(Kv);var t2=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(W),e2=pt(t2);var r2=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(W),n2=pt(r2);var i2=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(W),o2=pt(i2);var s2=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(W),a2=pt(s2);var c2=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(W),l2=pt(c2);var u2=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(W),f2=pt(u2);var d2=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(W),h2=pt(d2);var p2=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(W),m2=pt(p2);var y2=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(W),g2=pt(y2);var x2=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(W),b2=pt(x2);var _2=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(W),w2=pt(_2);var v2=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(W),S2=pt(v2);var I2=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(W),T2=pt(I2);var A2=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(W),E2=pt(A2);function M2(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 N2=Dd(En(300,.5,0),En(-240,.5,1));var R2=Dd(En(-100,.75,.35),En(80,1.5,.8)),D2=Dd(En(260,.75,.35),En(80,1.5,.8)),O2=En();function L2(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return O2.h=360*e-100,O2.s=1.5-1.5*t,O2.l=.8-.9*t,O2+""}var F2=wr(),Int=Math.PI/3,Tnt=Math.PI*2/3;function C2(e){var t;return e=(.5-e)*Math.PI,F2.r=255*(t=Math.sin(e))*t,F2.g=255*(t=Math.sin(e+Int))*t,F2.b=255*(t=Math.sin(e+Tnt))*t,F2+""}function k2(e){return e=Math.max(0,Math.min(1,e)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+e*(1172.33-e*(10793.56-e*(33300.12-e*(38394.49-e*14825.05)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+e*(557.33+e*(1225.33-e*(3574.96-e*(1073.77+e*707.56)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+e*(3211.1-e*(15327.97-e*(27814-e*(22569.18-e*6838.66)))))))+")"}function B2(e){var t=e.length;return function(r){return e[Math.max(0,Math.min(t-1,Math.floor(r*t)))]}}var P2=B2(W("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),U2=B2(W("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),$2=B2(W("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),z2=B2(W("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function hr(e){return function(){return e}}var F6=Math.cos;var oh=Math.min,Ig=Math.sin,ue=Math.sqrt,C6=1e-12,Hu=Math.PI,wVt=Hu/2,sh=2*Hu;function j2(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{let n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new Wc(t)}var TVt=Array.prototype.slice;function q2(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function $U(e){this._context=e}$U.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 Va(e){return new $U(e)}function V2(e){return e[0]}function Y2(e){return e[1]}function Tg(e,t){var r=hr(!0),n=null,i=Va,o=null,s=j2(a);e=typeof e=="function"?e:e===void 0?V2:hr(e),t=typeof t=="function"?t:t===void 0?Y2:hr(t);function a(c){var l,u=(c=q2(c)).length,f,d=!1,h;for(n==null&&(o=i(h=s())),l=0;l<=u;++l)!(l<u&&r(f=c[l],l,c))===d&&((d=!d)?o.lineStart():o.lineEnd()),d&&o.point(+e(f,l,c),+t(f,l,c));if(h)return o=null,h+""||null}return a.x=function(c){return arguments.length?(e=typeof c=="function"?c:hr(+c),a):e},a.y=function(c){return arguments.length?(t=typeof c=="function"?c:hr(+c),a):t},a.defined=function(c){return arguments.length?(r=typeof c=="function"?c:hr(!!c),a):r},a.curve=function(c){return arguments.length?(i=c,n!=null&&(o=i(n)),a):i},a.context=function(c){return arguments.length?(c==null?n=o=null:o=i(n=c),a):n},a}function ah(e,t,r){var n=null,i=hr(!0),o=null,s=Va,a=null,c=j2(l);e=typeof e=="function"?e:e===void 0?V2:hr(+e),t=typeof t=="function"?t:t===void 0?hr(0):hr(+t),r=typeof r=="function"?r:r===void 0?Y2:hr(+r);function l(f){var d,h,p,m=(f=q2(f)).length,y,g=!1,x,b=new Array(m),_=new Array(m);for(o==null&&(a=s(x=c())),d=0;d<=m;++d){if(!(d<m&&i(y=f[d],d,f))===g)if(g=!g)h=d,a.areaStart(),a.lineStart();else{for(a.lineEnd(),a.lineStart(),p=d-1;p>=h;--p)a.point(b[p],_[p]);a.lineEnd(),a.areaEnd()}g&&(b[d]=+e(y,d,f),_[d]=+t(y,d,f),a.point(n?+n(y,d,f):b[d],r?+r(y,d,f):_[d]))}if(x)return a=null,x+""||null}function u(){return Tg().defined(i).curve(s).context(o)}return l.x=function(f){return arguments.length?(e=typeof f=="function"?f:hr(+f),n=null,l):e},l.x0=function(f){return arguments.length?(e=typeof f=="function"?f:hr(+f),l):e},l.x1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:hr(+f),l):n},l.y=function(f){return arguments.length?(t=typeof f=="function"?f:hr(+f),r=null,l):t},l.y0=function(f){return arguments.length?(t=typeof f=="function"?f:hr(+f),l):t},l.y1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:hr(+f),l):r},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(r)},l.lineX1=function(){return u().x(n).y(t)},l.defined=function(f){return arguments.length?(i=typeof f=="function"?f:hr(!!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 W2=class{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}};function k6(e){return new W2(e,!0)}function B6(e){return new W2(e,!1)}var Ant=ue(3),Ag={draw(e,t){let r=ue(t+oh(t/28,.75))*.59436,n=r/2,i=n*Ant;e.moveTo(0,r),e.lineTo(0,-r),e.moveTo(-i,-n),e.lineTo(i,n),e.moveTo(-i,n),e.lineTo(i,-n)}};var Ya={draw(e,t){let r=ue(t/Hu);e.moveTo(r,0),e.arc(0,0,r,0,sh)}};var Eg={draw(e,t){let r=ue(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}};var zU=ue(1/3),Ent=zU*2,Mg={draw(e,t){let r=ue(t/Ent),n=r*zU;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}};var Ng={draw(e,t){let r=ue(t)*.62625;e.moveTo(0,-r),e.lineTo(r,0),e.lineTo(0,r),e.lineTo(-r,0),e.closePath()}};var Og={draw(e,t){let r=ue(t-oh(t/7,2))*.87559;e.moveTo(-r,0),e.lineTo(r,0),e.moveTo(0,r),e.lineTo(0,-r)}};var Rg={draw(e,t){let r=ue(t),n=-r/2;e.rect(n,n,r,r)}};var Dg={draw(e,t){let r=ue(t)*.4431;e.moveTo(r,r),e.lineTo(r,-r),e.lineTo(-r,-r),e.lineTo(-r,r),e.closePath()}};var Mnt=.8908130915292852,jU=Ig(Hu/10)/Ig(7*Hu/10),Nnt=Ig(sh/10)*jU,Ont=-F6(sh/10)*jU,Lg={draw(e,t){let r=ue(t*Mnt),n=Nnt*r,i=Ont*r;e.moveTo(0,-r),e.lineTo(n,i);for(let o=1;o<5;++o){let s=sh*o/5,a=F6(s),c=Ig(s);e.lineTo(c*r,-a*r),e.lineTo(a*n-c*i,c*n+a*i)}e.closePath()}};var P6=ue(3),Fg={draw(e,t){let r=-ue(t/(P6*3));e.moveTo(0,r*2),e.lineTo(-P6*r,-r),e.lineTo(P6*r,-r),e.closePath()}};var Rnt=ue(3),Cg={draw(e,t){let r=ue(t)*.6824,n=r/2,i=r*Rnt/2;e.moveTo(0,-r),e.lineTo(i,n),e.lineTo(-i,n),e.closePath()}};var Xi=-.5,Hi=ue(3)/2,U6=1/ue(12),Dnt=(U6/2+1)*3,kg={draw(e,t){let r=ue(t/Dnt),n=r/2,i=r*U6,o=n,s=r*U6+r,a=-o,c=s;e.moveTo(n,i),e.lineTo(o,s),e.lineTo(a,c),e.lineTo(Xi*n-Hi*i,Hi*n+Xi*i),e.lineTo(Xi*o-Hi*s,Hi*o+Xi*s),e.lineTo(Xi*a-Hi*c,Hi*a+Xi*c),e.lineTo(Xi*n+Hi*i,Xi*i-Hi*n),e.lineTo(Xi*o+Hi*s,Xi*s-Hi*o),e.lineTo(Xi*a+Hi*c,Xi*c-Hi*a),e.closePath()}};var ch={draw(e,t){let r=ue(t-oh(t/6,1.7))*.6189;e.moveTo(-r,-r),e.lineTo(r,r),e.moveTo(-r,r),e.lineTo(r,-r)}};var G2=[Ya,Eg,Mg,Rg,Lg,Fg,kg],$6=[Ya,Og,ch,Cg,Ag,Dg,Ng];function Qi(){}function lh(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function Bg(e){this._context=e}Bg.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:lh(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:lh(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function z6(e){return new Bg(e)}function qU(e){this._context=e}qU.prototype={areaStart:Qi,areaEnd:Qi,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:lh(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function j6(e){return new qU(e)}function VU(e){this._context=e}VU.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:lh(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function q6(e){return new VU(e)}function YU(e,t){this._basis=new Bg(e),this._beta=t}YU.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,r=e.length-1;if(r>0)for(var n=e[0],i=t[0],o=e[r]-n,s=t[r]-i,a=-1,c;++a<=r;)c=a/r,this._basis.point(this._beta*e[a]+(1-this._beta)*(n+c*o),this._beta*t[a]+(1-this._beta)*(i+c*s));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};var V6=function e(t){function r(n){return t===1?new Bg(n):new YU(n,t)}return r.beta=function(n){return e(+n)},r}(.85);function uh(e,t,r){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-r),e._x2,e._y2)}function X2(e,t){this._context=e,this._k=(1-t)/6}X2.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:uh(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:uh(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 Y6=function e(t){function r(n){return new X2(n,t)}return r.tension=function(n){return e(+n)},r}(0);function H2(e,t){this._context=e,this._k=(1-t)/6}H2.prototype={areaStart:Qi,areaEnd:Qi,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:uh(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 W6=function e(t){function r(n){return new H2(n,t)}return r.tension=function(n){return e(+n)},r}(0);function Q2(e,t){this._context=e,this._k=(1-t)/6}Q2.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:uh(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 G6=function e(t){function r(n){return new Q2(n,t)}return r.tension=function(n){return e(+n)},r}(0);function Pg(e,t,r){var n=e._x1,i=e._y1,o=e._x2,s=e._y2;if(e._l01_a>C6){var a=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,c=3*e._l01_a*(e._l01_a+e._l12_a);n=(n*a-e._x0*e._l12_2a+e._x2*e._l01_2a)/c,i=(i*a-e._y0*e._l12_2a+e._y2*e._l01_2a)/c}if(e._l23_a>C6){var l=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,u=3*e._l23_a*(e._l23_a+e._l12_a);o=(o*l+e._x1*e._l23_2a-t*e._l12_2a)/u,s=(s*l+e._y1*e._l23_2a-r*e._l12_2a)/u}e._context.bezierCurveTo(n,i,o,s,e._x2,e._y2)}function WU(e,t){this._context=e,this._alpha=t}WU.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var r=this._x2-e,n=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:Pg(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 X6=function e(t){function r(n){return t?new WU(n,t):new X2(n,0)}return r.alpha=function(n){return e(+n)},r}(.5);function GU(e,t){this._context=e,this._alpha=t}GU.prototype={areaStart:Qi,areaEnd:Qi,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){if(e=+e,t=+t,this._point){var r=this._x2-e,n=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:Pg(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 H6=function e(t){function r(n){return t?new GU(n,t):new H2(n,0)}return r.alpha=function(n){return e(+n)},r}(.5);function XU(e,t){this._context=e,this._alpha=t}XU.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var r=this._x2-e,n=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Pg(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 Q6=function e(t){function r(n){return t?new XU(n,t):new Q2(n,0)}return r.alpha=function(n){return e(+n)},r}(.5);function HU(e){this._context=e}HU.prototype={areaStart:Qi,areaEnd:Qi,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 Z6(e){return new HU(e)}function QU(e){return e<0?-1:1}function ZU(e,t,r){var n=e._x1-e._x0,i=t-e._x1,o=(e._y1-e._y0)/(n||i<0&&-0),s=(r-e._y1)/(i||n<0&&-0),a=(o*i+s*n)/(n+i);return(QU(o)+QU(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(a))||0}function KU(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function K6(e,t,r){var n=e._x0,i=e._y0,o=e._x1,s=e._y1,a=(o-n)/3;e._context.bezierCurveTo(n+a,i+a*t,o-a,s-a*r,o,s)}function Z2(e){this._context=e}Z2.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:K6(this,this._t0,KU(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,K6(this,KU(this,r=ZU(this,e,t)),r);break;default:K6(this,this._t0,r=ZU(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function JU(e){this._context=new t$(e)}(JU.prototype=Object.create(Z2.prototype)).point=function(e,t){Z2.prototype.point.call(this,t,e)};function t$(e){this._context=e}t$.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,i,o){this._context.bezierCurveTo(t,e,n,r,o,i)}};function J6(e){return new Z2(e)}function t4(e){return new JU(e)}function r$(e){this._context=e}r$.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=e$(e),i=e$(t),o=0,s=1;s<r;++o,++s)this._context.bezierCurveTo(n[0][o],i[0][o],n[1][o],i[1][o],e[s],t[s]);(this._line||this._line!==0&&r===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function e$(e){var t,r=e.length-1,n,i=new Array(r),o=new Array(r),s=new Array(r);for(i[0]=0,o[0]=2,s[0]=e[0]+2*e[1],t=1;t<r-1;++t)i[t]=1,o[t]=4,s[t]=4*e[t]+2*e[t+1];for(i[r-1]=2,o[r-1]=7,s[r-1]=8*e[r-1]+e[r],t=1;t<r;++t)n=i[t]/o[t-1],o[t]-=n,s[t]-=n*s[t-1];for(i[r-1]=s[r-1]/o[r-1],t=r-2;t>=0;--t)i[t]=(s[t]-i[t+1])/o[t];for(o[r-1]=(e[r]+i[r-1])/2,t=0;t<r-1;++t)o[t]=2*e[t+1]-i[t+1];return[i,o]}function e4(e){return new r$(e)}function K2(e,t){this._context=e,this._t=t}K2.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function r4(e){return new K2(e,.5)}function n4(e){return new K2(e,0)}function i4(e){return new K2(e,1)}var Ug=e=>()=>e;function o4(e,{sourceEvent:t,target:r,transform:n,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:n,enumerable:!0,configurable:!0},_:{value:i}})}function gi(e,t,r){this.k=e,this.x=t,this.y=r}gi.prototype={constructor:gi,scale:function(e){return e===1?this:new gi(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new gi(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var $g=new gi(1,0,0);s4.prototype=gi.prototype;function s4(e){for(;!e.__zoom;)if(!(e=e.parentNode))return $g;return e.__zoom}function J2(e){e.stopImmediatePropagation()}function fh(e){e.preventDefault(),e.stopImmediatePropagation()}function Lnt(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Fnt(){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 n$(){return this.__zoom||$g}function Cnt(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function knt(){return navigator.maxTouchPoints||"ontouchstart"in this}function Bnt(e,t,r){var n=e.invertX(t[0][0])-r[0][0],i=e.invertX(t[1][0])-r[1][0],o=e.invertY(t[0][1])-r[0][1],s=e.invertY(t[1][1])-r[1][1];return e.translate(i>n?(n+i)/2:Math.min(0,n)||Math.max(0,i),s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s))}function a4(){var e=Lnt,t=Fnt,r=Bnt,n=Cnt,i=knt,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=FM,l=Su("start","zoom","end"),u,f,d,h=500,p=150,m=0,y=10;function g(S){S.property("__zoom",n$).on("wheel.zoom",A,{passive:!1}).on("mousedown.zoom",E).on("dblclick.zoom",N).filter(i).on("touchstart.zoom",I).on("touchmove.zoom",R).on("touchend.zoom touchcancel.zoom",C).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(S,M,O,L){var B=S.selection?S.selection():S;B.property("__zoom",n$),S!==B?v(S,M,O,L):B.interrupt().each(function(){w(this,arguments).event(L).start().zoom(null,typeof M=="function"?M.apply(this,arguments):M).end()})},g.scaleBy=function(S,M,O,L){g.scaleTo(S,function(){var B=this.__zoom.k,k=typeof M=="function"?M.apply(this,arguments):M;return B*k},O,L)},g.scaleTo=function(S,M,O,L){g.transform(S,function(){var B=t.apply(this,arguments),k=this.__zoom,P=O==null?_(B):typeof O=="function"?O.apply(this,arguments):O,U=k.invert(P),$=typeof M=="function"?M.apply(this,arguments):M;return r(b(x(k,$),P,U),B,s)},O,L)},g.translateBy=function(S,M,O,L){g.transform(S,function(){return r(this.__zoom.translate(typeof M=="function"?M.apply(this,arguments):M,typeof O=="function"?O.apply(this,arguments):O),t.apply(this,arguments),s)},null,L)},g.translateTo=function(S,M,O,L,B){g.transform(S,function(){var k=t.apply(this,arguments),P=this.__zoom,U=L==null?_(k):typeof L=="function"?L.apply(this,arguments):L;return r($g.translate(U[0],U[1]).scale(P.k).translate(typeof M=="function"?-M.apply(this,arguments):-M,typeof O=="function"?-O.apply(this,arguments):-O),k,s)},L,B)};function x(S,M){return M=Math.max(o[0],Math.min(o[1],M)),M===S.k?S:new gi(M,S.x,S.y)}function b(S,M,O){var L=M[0]-O[0]*S.k,B=M[1]-O[1]*S.k;return L===S.x&&B===S.y?S:new gi(S.k,L,B)}function _(S){return[(+S[0][0]+ +S[1][0])/2,(+S[0][1]+ +S[1][1])/2]}function v(S,M,O,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,k=arguments,P=w(B,k).event(L),U=t.apply(B,k),$=O==null?_(U):typeof O=="function"?O.apply(B,k):O,X=Math.max(U[1][0]-U[0][0],U[1][1]-U[0][1]),rt=B.__zoom,ot=typeof M=="function"?M.apply(B,k):M,at=c(rt.invert($).concat(X/rt.k),ot.invert($).concat(X/ot.k));return function(Y){if(Y===1)Y=ot;else{var st=at(Y),q=X/st[2];Y=new gi(q,$[0]-st[0]*q,$[1]-st[1]*q)}P.zoom(null,Y)}})}function w(S,M,O){return!O&&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=Qt(this.that).datum();l.call(S,this.that,new o4(S,{sourceEvent:this.sourceEvent,target:g,type:S,transform:this.that.__zoom,dispatch:l}),M)}};function A(S,...M){if(!e.apply(this,arguments))return;var O=w(this,M).event(S),L=this.__zoom,B=Math.max(o[0],Math.min(o[1],L.k*Math.pow(2,n.apply(this,arguments)))),k=an(S);if(O.wheel)(O.mouse[0][0]!==k[0]||O.mouse[0][1]!==k[1])&&(O.mouse[1]=L.invert(O.mouse[0]=k)),clearTimeout(O.wheel);else{if(L.k===B)return;O.mouse=[k,L.invert(k)],as(this),O.start()}fh(S),O.wheel=setTimeout(P,p),O.zoom("mouse",r(b(x(L,B),O.mouse[0],O.mouse[1]),O.extent,s));function P(){O.wheel=null,O.end()}}function E(S,...M){if(d||!e.apply(this,arguments))return;var O=S.currentTarget,L=w(this,M,!0).event(S),B=Qt(S.view).on("mousemove.zoom",$,!0).on("mouseup.zoom",X,!0),k=an(S,O),P=S.clientX,U=S.clientY;yy(S.view),J2(S),L.mouse=[k,this.__zoom.invert(k)],as(this),L.start();function $(rt){if(fh(rt),!L.moved){var ot=rt.clientX-P,at=rt.clientY-U;L.moved=ot*ot+at*at>m}L.event(rt).zoom("mouse",r(b(L.that.__zoom,L.mouse[0]=an(rt,O),L.mouse[1]),L.extent,s))}function X(rt){B.on("mousemove.zoom mouseup.zoom",null),gy(rt.view,L.moved),fh(rt),L.event(rt).end()}}function N(S,...M){if(e.apply(this,arguments)){var O=this.__zoom,L=an(S.changedTouches?S.changedTouches[0]:S,this),B=O.invert(L),k=O.k*(S.shiftKey?.5:2),P=r(b(x(O,k),L,B),t.apply(this,M),s);fh(S),a>0?Qt(this).transition().duration(a).call(v,P,L,S):Qt(this).call(g.transform,P,L,S)}}function I(S,...M){if(e.apply(this,arguments)){var O=S.touches,L=O.length,B=w(this,M,S.changedTouches.length===L).event(S),k,P,U,$;for(J2(S),P=0;P<L;++P)U=O[P],$=an(U,this),$=[$,this.__zoom.invert($),U.identifier],B.touch0?!B.touch1&&B.touch0[2]!==$[2]&&(B.touch1=$,B.taps=0):(B.touch0=$,k=!0,B.taps=1+!!u);u&&(u=clearTimeout(u)),k&&(B.taps<2&&(f=$[0],u=setTimeout(function(){u=null},h)),as(this),B.start())}}function R(S,...M){if(this.__zooming){var O=w(this,M).event(S),L=S.changedTouches,B=L.length,k,P,U,$;for(fh(S),k=0;k<B;++k)P=L[k],U=an(P,this),O.touch0&&O.touch0[2]===P.identifier?O.touch0[0]=U:O.touch1&&O.touch1[2]===P.identifier&&(O.touch1[0]=U);if(P=O.that.__zoom,O.touch1){var X=O.touch0[0],rt=O.touch0[1],ot=O.touch1[0],at=O.touch1[1],Y=(Y=ot[0]-X[0])*Y+(Y=ot[1]-X[1])*Y,st=(st=at[0]-rt[0])*st+(st=at[1]-rt[1])*st;P=x(P,Math.sqrt(Y/st)),U=[(X[0]+ot[0])/2,(X[1]+ot[1])/2],$=[(rt[0]+at[0])/2,(rt[1]+at[1])/2]}else if(O.touch0)U=O.touch0[0],$=O.touch0[1];else return;O.zoom("touch",r(b(P,U,$),O.extent,s))}}function C(S,...M){if(this.__zooming){var O=w(this,M).event(S),L=S.changedTouches,B=L.length,k,P;for(J2(S),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),k=0;k<B;++k)P=L[k],O.touch0&&O.touch0[2]===P.identifier?delete O.touch0:O.touch1&&O.touch1[2]===P.identifier&&delete O.touch1;if(O.touch1&&!O.touch0&&(O.touch0=O.touch1,delete O.touch1),O.touch0)O.touch0[1]=this.__zoom.invert(O.touch0[0]);else if(O.end(),O.taps===2&&(P=an(P,this),Math.hypot(f[0]-P[0],f[1]-P[1])<y)){var U=Qt(this).on("dblclick.zoom");U&&U.apply(this,arguments)}}}return g.wheelDelta=function(S){return arguments.length?(n=typeof S=="function"?S:Ug(+S),g):n},g.filter=function(S){return arguments.length?(e=typeof S=="function"?S:Ug(!!S),g):e},g.touchable=function(S){return arguments.length?(i=typeof S=="function"?S:Ug(!!S),g):i},g.extent=function(S){return arguments.length?(t=typeof S=="function"?S:Ug([[+S[0][0],+S[0][1]],[+S[1][0],+S[1][1]]]),g):t},g.scaleExtent=function(S){return arguments.length?(o[0]=+S[0],o[1]=+S[1],g):[o[0],o[1]]},g.translateExtent=function(S){return arguments.length?(s[0][0]=+S[0][0],s[1][0]=+S[1][0],s[0][1]=+S[0][1],s[1][1]=+S[1][1],g):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},g.constrain=function(S){return arguments.length?(r=S,g):r},g.duration=function(S){return arguments.length?(a=+S,g):a},g.interpolate=function(S){return arguments.length?(c=S,g):c},g.on=function(){var S=l.on.apply(l,arguments);return S===l?g:S},g.clickDistance=function(S){return arguments.length?(m=(S=+S)*S,g):Math.sqrt(m)},g.tapDistance=function(S){return arguments.length?(y=+S,g):y},g}function Pe(e){return e!=null&&!Number.isNaN(e)}function Cr(e,t){return+Pe(t)-+Pe(e)||Ft(e,t)}function Qu(e,t){return+Pe(t)-+Pe(e)||vn(e,t)}function zg(e){return e!=null&&`${e}`!=""}function dh(e){return isFinite(e)?e:NaN}function Fn(e){return e>0&&isFinite(e)?e:NaN}function el(e){return e<0&&isFinite(e)?e:NaN}function hh(e,t){if(e instanceof Date||(e=new Date(+e)),isNaN(e))return typeof t=="function"?t(e):t;let r=e.getUTCHours(),n=e.getUTCMinutes(),i=e.getUTCSeconds(),o=e.getUTCMilliseconds();return`${Pnt(e.getUTCFullYear(),4)}-${Wa(e.getUTCMonth()+1,2)}-${Wa(e.getUTCDate(),2)}${r||n||i||o?`T${Wa(r,2)}:${Wa(n,2)}${i||o?`:${Wa(i,2)}${o?`.${Wa(o,3)}`:""}`:""}Z`:""}`}function Pnt(e){return e<0?`-${Wa(-e,6)}`:e>9999?`+${Wa(e,6)}`:Wa(e,4)}function Wa(e,t){return`${e}`.padStart(t,"0")}var Unt=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function jg(e,t){return Unt.test(e+="")?new Date(e):typeof t=="function"?t(e):t}function Ga(e){if(e==null)return;let t=e[0],r=e[e.length-1];return vn(t,r)}var mh=1e3,nl=mh*60,il=nl*60,ws=il*24,_s=ws*7,Zu=ws*30,rl=ws*365,c4=[["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",mh],["5 seconds",5*mh],["15 seconds",15*mh],["30 seconds",30*mh],["minute",nl],["5 minutes",5*nl],["15 minutes",15*nl],["30 minutes",30*nl],["hour",il],["3 hours",3*il],["6 hours",6*il],["12 hours",12*il],["day",ws],["2 days",2*ws],["week",_s],["2 weeks",2*_s],["month",Zu],["3 months",3*Zu],["6 months",6*Zu],["year",rl],["2 years",2*rl],["5 years",5*rl],["10 years",10*rl],["20 years",20*rl],["50 years",50*rl],["100 years",100*rl]],l4=new Map([["second",mh],["minute",nl],["hour",il],["day",ws],["monday",_s],["tuesday",_s],["wednesday",_s],["thursday",_s],["friday",_s],["saturday",_s],["sunday",_s],["week",_s],["month",Zu],["year",rl]]),o$=new Map([["second",Lr],["minute",Pa],["hour",$a],["day",Gi],["monday",Jc],["tuesday",gv],["wednesday",xv],["thursday",gs],["friday",bv],["saturday",_v],["sunday",mi],["week",mi],["month",ja],["year",dn]]),u4=new Map([["second",Lr],["minute",Ua],["hour",za],["day",Wu],["monday",tl],["tuesday",wv],["wednesday",vv],["thursday",xs],["friday",Sv],["saturday",Iv],["sunday",yi],["week",yi],["month",qa],["year",hn]]),yh=Symbol("intervalDuration"),eS=Symbol("intervalType");for(let[e,t]of o$)t[yh]=l4.get(e),t[eS]="time";for(let[e,t]of u4)t[yh]=l4.get(e),t[eS]="utc";var qg=[["year",hn,"utc"],["month",qa,"utc"],["day",Wu,"utc",6*Zu],["hour",za,"utc",3*ws],["minute",Ua,"utc",6*il],["second",Lr,"utc",30*nl]],tS=[["year",dn,"time"],["month",ja,"time"],["day",Gi,"time",6*Zu],["hour",$a,"time",3*ws],["minute",Pa,"time",6*il],["second",Lr,"time",30*nl]],$nt=[qg[0],tS[0],qg[1],tS[1],qg[2],tS[2],...qg.slice(3)];function rS(e){let t=`${e}`.toLowerCase();t.endsWith("s")&&(t=t.slice(0,-1));let r=1,n=/^(?:(\d+)\s+)/.exec(t);switch(n&&(t=t.slice(n[0].length),r=+n[1]),t){case"quarter":t="month",r*=3;break;case"half":t="month",r*=6;break}let i=u4.get(t);if(!i)throw new Error(`unknown interval: ${e}`);if(r>1&&!i.every)throw new Error(`non-periodic interval: ${t}`);return[t,r]}function Vg(e){return s$(rS(e),"time")}function Ku(e){return s$(rS(e),"utc")}function s$([e,t],r){let n=(r==="time"?o$:u4).get(e);return t>1&&(n=n.every(t),n[yh]=l4.get(e)*t,n[eS]=r),n}function f4(e,t){if(!(t>1))return;let r=e[yh];if(!c4.some(([,i])=>i===r)||r%ws===0&&ws<r&&r<Zu)return;let[n]=c4[To(([,i])=>Math.log(i)).center(c4,Math.log(r*t))];return(e[eS]==="time"?Vg:Ku)(n)}function i$(e,t,r){let n=t==="time"?rh:bs;if(r==null)return n(e==="year"?"%Y":e==="month"?"%Y-%m":e==="day"?"%Y-%m-%d":e==="hour"||e==="minute"?"%Y-%m-%dT%H:%M":e==="second"?"%Y-%m-%dT%H:%M:%S":"%Y-%m-%dT%H:%M:%S.%L");let i=znt(r);switch(e){case"millisecond":return ph(n(".%L"),n(":%M:%S"),i);case"second":return ph(n(":%S"),n("%-I:%M"),i);case"minute":return ph(n("%-I:%M"),n("%p"),i);case"hour":return ph(n("%-I %p"),n("%b %-d"),i);case"day":return ph(n("%-d"),n("%b"),i);case"month":return ph(n("%b"),n("%Y"),i);case"year":return n("%Y")}throw new Error("unable to format time ticks")}function znt(e){return e==="left"||e==="right"?(t,r)=>`
12
12
  ${t}
13
13
  ${r}`:e==="top"?(t,r)=>`${r}
14
14
  ${t}`:(t,r)=>`${t}
15
- ${r}`}function $nt(e){return e==="time"?J2:e==="utc"?qg:Pnt}function o$(e,t,r){let n=Kt(H_(t,(i,o)=>Math.abs(o-i)));if(n<1e3)return r$("millisecond","utc",r);for(let[i,o,s,a]of $nt(e)){if(n>a||i==="hour"&&!n)break;if(t.every(c=>o.floor(c)>=c))return r$(i,s,r)}}function mh(e,t,r){return(n,i,o)=>{let s=e(n,i),a=t(n,i),c=i-Ga(o);return i!==c&&o[c]!==void 0&&a===t(o[c],c)?s:r(s,a)}}var Yg=Object.getPrototypeOf(Uint8Array),znt=Object.prototype.toString;function Qn(e){return e instanceof Array||e instanceof Yg}function a$(e){return e instanceof Yg&&!jnt(e)}function c$(e){return e?.prototype instanceof Yg&&!qnt(e)}function jnt(e){return e instanceof BigInt64Array||e instanceof BigUint64Array}function qnt(e){return e===BigInt64Array||e===BigUint64Array}var h4=Symbol("reindex");function _t(e,t,r){let n=typeof t;return n==="string"?_$(e)?p4(e.getChild(t),r):s$(e,m4(t),r):n==="function"?s$(e,t,r):n==="number"||t instanceof Date||n==="boolean"?Xt(e,Ye(t),r):typeof t?.transform=="function"?d4(t.transform(e),r):Vnt(d4(t,r),e?.[h4])}function Vnt(e,t){return e!=null&&t?Gg(e,t):e}function s$(e,t,r){return Xt(e,c$(r)?(n,i)=>y4(t(n,i)):t,r)}function d4(e,t){return t===void 0?xi(e):w$(e)?p4(e,t):e instanceof t?e:t.from(e,c$(t)&&!a$(e)?y4:void 0)}function p4(e,t){return e==null?e:(t===void 0||t===Array)&&Gnt(e.type)?g4(e.toArray()):d4(e.toArray(),t)}var il=[null],m4=e=>t=>{let r=t[e];return r===void 0&&t.type==="Feature"?t.properties?.[e]:r},Ee={transform:Cn},G={transform:e=>e};var Wg=()=>1,l$=()=>!0,rr=e=>e==null?e:`${e}`,ie=e=>e==null?e:+e;var Ju=e=>e?e[0]:void 0,ol=e=>e?e[1]:void 0,u$=e=>e?e[2]:void 0,Ye=e=>()=>e;function xh(e){let t=+`${e}`.slice(1)/100;return(r,n)=>Tn(r,t,n)}function pr(e){return a$(e)?e:Xt(e,y4,Float64Array)}function y4(e){return e==null?NaN:Number(e)}function g4(e){return Xt(e,x4)}function x4(e){return e instanceof Date&&!isNaN(e)?e:typeof e=="string"?jg(e):e==null||isNaN(e=Number(e))?void 0:new Date(e)}function qe(e,t){return e===void 0&&(e=t),e===null?[void 0,"none"]:ll(e)?[void 0,e]:[e,void 0]}function ye(e,t){return e===void 0&&(e=t),e===null||typeof e=="number"?[void 0,e]:[e,void 0]}function b4(e,t,r){if(e!=null)return Sr(e,t,r)}function Sr(e,t,r){let n=`${e}`.toLowerCase();if(!r.includes(n))throw new Error(`invalid ${t}: ${e}`);return n}function Xa(e){return _$(e)?e:xi(e)}function xi(e){if(e==null||Qn(e))return e;if(w$(e))return p4(e);switch(e.type){case"FeatureCollection":return e.features;case"GeometryCollection":return e.geometries;case"Feature":case"LineString":case"MultiLineString":case"MultiPoint":case"MultiPolygon":case"Point":case"Polygon":case"Sphere":return[e]}return Array.from(e)}function Xt(e,t,r=Array){return e==null?e:e instanceof r?e.map(t):r.from(e,t)}function sl(e,t=Array){return e instanceof t?e.slice():t.from(e)}function _4({x:e,x1:t,x2:r}){return e!==void 0||t!==void 0||r!==void 0}function w4({y:e,y1:t,y2:r}){return e!==void 0||t!==void 0||r!==void 0}function Ha(e){return _4(e)||w4(e)||e.interval!==void 0}function kr(e){return e?.toString===znt}function vs(e){return kr(e)&&(e.type!==void 0||e.domain!==void 0)}function bi(e){return kr(e)&&typeof e.transform!="function"}function Ss(e){return bi(e)&&e.value===void 0&&e.channel===void 0}function v4(e,t,r,n=G){return t===void 0&&r===void 0?(t=0,r=e===void 0?n:e):t===void 0?t=e===void 0?0:e:r===void 0&&(r=e===void 0?0:e),[t,r]}function Ke(e,t){return e===void 0&&t===void 0?[Ju,ol]:[e,t]}function pn({z:e,fill:t,stroke:r}={}){return e===void 0&&([e]=qe(t)),e===void 0&&([e]=qe(r)),e}function al(e){return Qn(e)?e.length:e?.numRows}function Cn(e){let t=al(e),r=new Uint32Array(t);for(let n=0;n<t;++n)r[n]=n;return r}function Gg(e,t){return Qn(e)?Xt(t,r=>e[r],e.constructor):Xt(t,r=>e.at(r))}function bh(e){return e.length===1?(t,r)=>e(Gg(r,t)):e}function Qa(e,t,r){return e.subarray?e.subarray(t,r):e.slice(t,r)}function Zi(e){return e!==null&&typeof e=="object"?e.valueOf():e}function rS(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 Br(e){let t;return[{transform:()=>t,label:en(e)},r=>t=r]}function tn(e){return e==null?[e]:Br(e)}function en(e,t){return typeof e=="string"?e:e&&e.label!==void 0?e.label:t}function _h(e,t){return{transform(r){let n=e.transform(r),i=t.transform(r);return Ve(n)||Ve(i)?Xt(n,(o,s)=>new Date((+n[s]+ +i[s])/2)):Xt(n,(o,s)=>(+n[s]+ +i[s])/2,Float64Array)},label:e.label}}function tf(e,t){let r=S4(t?.interval,t?.type);return r?Xt(e,r):e}function S4(e,t){let r=wh(e,t);return r&&(n=>Pe(n)?r.floor(n):n)}function wh(e,t){if(e!=null){if(typeof e=="number")return I4(e);if(typeof e=="string")return(t==="time"?Vg:Ku)(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 I4(e){e=+e,0<e&&e<1&&Number.isInteger(1/e)&&(e=-1/e);let t=Math.abs(e);return e<0?{floor:r=>Math.floor(r*t)/t,offset:(r,n=1)=>(r*t+Math.floor(n))/t,range:(r,n)=>er(Math.ceil(r*t),n*t).map(i=>i/t)}:{floor:r=>Math.floor(r/t)*t,offset:(r,n=1)=>r+t*Math.floor(n),range:(r,n)=>er(Math.ceil(r/t),n/t).map(i=>i*t)}}function Is(e,t){if(e=wh(e,t),e&&typeof e.range!="function")throw new Error("invalid interval: missing range method");return e}function f$(e,t){if(e=Is(e,t),e&&typeof e.ceil!="function")throw new Error("invalid interval: missing ceil method");return e}function d$(e){return cl(e)&&typeof e?.floor=="function"&&e.floor()instanceof Date}function cl(e){return typeof e?.range=="function"}function Ki(e){return e===void 0||bi(e)?e:{value:e}}function h$(e){return e==null?null:{transform:t=>_t(t,e,Float64Array),label:en(e)}}function p$(e){if(!kn(e))return!1;for(let t of e)if(t!=null)return typeof t=="object"&&"0"in t&&"1"in t}function kn(e){return e&&typeof e[Symbol.iterator]=="function"}function nS(e){for(let t of e)if(t!=null)return typeof t!="object"||t instanceof Date}function Ue(e){for(let t of e){if(t==null)continue;let r=typeof t;return r==="string"||r==="boolean"}}function Ve(e){for(let t of e)if(t!=null)return t instanceof Date}function m$(e){for(let t of e)if(t!=null)return typeof t=="string"&&isNaN(t)&&jg(t)}function y$(e){for(let t of e)if(t!=null){if(typeof t!="string")return!1;if(t.trim())return!isNaN(t)}}function Za(e){for(let t of e)if(t!=null)return typeof t=="number"}function iS(e,t){let r;for(let n of e)if(n!=null){if(!t(n))return!1;r=!0}return r}var Ynt=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 ll(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)||Ynt.has(e))}function g$(e){return typeof e=="number"&&(0<=e&&e<=1||isNaN(e))}function fe(e){return e==null||Ka(e)}function Ka(e){return/^\s*none\s*$/i.test(e)}function x$(e){return/^\s*round\s*$/i.test(e)}function oS(e,t){return b4(e,t,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function Ts(e="middle"){return oS(e,"frameAnchor")}function b$(e={},...t){let r=e;for(let n of t)for(let i in n)if(r[i]===void 0){let o=n[i];r===e?r={...r,[i]:o}:r[i]=o}return r}function Wnt(e){console.warn("named iterables are deprecated; please use an object instead");let t=new Set;return Object.fromEntries(Array.from(e,r=>{let{name:n}=r;if(n==null)throw new Error("missing name");let i=`${n}`;if(i==="__proto__")throw new Error(`illegal name: ${i}`);if(t.has(i))throw new Error(`duplicate name: ${i}`);return t.add(i),[n,r]}))}function Xg(e){return kn(e)?Wnt(e):e}function sS(e){return e===!0?e="frame":e===!1?e=null:e!=null&&(e=Sr(e,"clip",["frame","sphere"])),e}function _$(e){return e&&typeof e.getChild=="function"&&typeof e.toArray=="function"&&e.schema&&Array.isArray(e.schema.fields)}function w$(e){return e&&typeof e.toArray=="function"&&e.type}function Gnt(e){return e&&(e.typeId===8||e.typeId===10)&&e.unit===1}var Ji=Symbol("position"),_i=Symbol("color"),ef=Symbol("radius"),rf=Symbol("length"),nf=Symbol("opacity"),vh=Symbol("symbol"),v$=Symbol("projection"),_e=new Map([["x",Ji],["y",Ji],["fx",Ji],["fy",Ji],["r",ef],["color",_i],["opacity",nf],["symbol",vh],["length",rf],["projection",v$]]);function S$(e){return e===Ji||e===v$}function I$(e){return e===Ji||e===ef||e===rf||e===nf}var T4=Math.sqrt(3),A4=2/T4,Xnt={draw(e,t){let r=Math.sqrt(t/Math.PI),n=r*A4,i=n/2;e.moveTo(0,n),e.lineTo(r,i),e.lineTo(r,-i),e.lineTo(0,-n),e.lineTo(-r,-i),e.lineTo(-r,i),e.closePath()}},E4=new Map([["asterisk",Ag],["circle",Ya],["cross",Eg],["diamond",Mg],["diamond2",Ng],["hexagon",Xnt],["plus",Og],["square",Rg],["square2",Dg],["star",Lg],["times",lh],["triangle",Fg],["triangle2",Cg],["wye",kg]]);function M4(e){return e&&typeof e.draw=="function"}function T$(e){return M4(e)?!0:typeof e!="string"?!1:E4.has(e.toLowerCase())}function Sh(e){if(e==null||M4(e))return e;let t=E4.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid symbol: ${e}`)}function A$(e){if(e==null||M4(e))return[void 0,e];if(typeof e=="string"){let t=E4.get(`${e}`.toLowerCase());if(t)return[void 0,t]}return[e,void 0]}function mr({filter:e,sort:t,reverse:r,transform:n,initializer:i,...o}={},s){if(n===void 0&&(e!=null&&(n=R4(e)),t!=null&&!Ss(t)&&(n=N4(n,L4(t))),r&&(n=N4(n,D4))),s!=null&&i!=null)throw new Error("transforms cannot be applied after initializers");return{...o,...(t===null||Ss(t))&&{sort:t},transform:N4(n,s)}}function Ne({filter:e,sort:t,reverse:r,initializer:n,...i}={},o){return n===void 0&&(e!=null&&(n=R4(e)),t!=null&&!Ss(t)&&(n=O4(n,L4(t))),r&&(n=O4(n,D4))),{...i,...(t===null||Ss(t))&&{sort:t},initializer:O4(n,o)}}function N4(e,t){return e==null?t===null?void 0:t:t==null?e===null?void 0:e:function(r,n,i){return{data:r,facets:n}=e.call(this,r,n,i),t.call(this,Xa(r),n,i)}}function O4(e,t){return e==null?t===null?void 0:t:t==null?e===null?void 0:e:function(r,n,i,...o){let s,a,c,l,u,f;return{data:a=r,facets:c=n,channels:s}=e.call(this,r,n,i,...o),{data:u=a,facets:f=c,channels:l}=t.call(this,a,c,{...i,...s},...o),{data:u,facets:f,channels:{...s,...l}}}}function aS(e,t){return(e.initializer!=null?Ne:mr)(e,t)}function E$(e,t){return aS(t,R4(e))}function R4(e){return(t,r)=>{let n=_t(t,e);return{data:t,facets:r.map(i=>i.filter(o=>n[o]))}}}function M$({sort:e,...t}={}){return{...aS(t,D4),sort:Ss(e)?e:null}}function D4(e,t){return{data:e,facets:t.map(r=>r.slice().reverse())}}function N$({seed:e,sort:t,...r}={}){return{...aS(r,O$(e==null?Math.random:$u(e))),sort:Ss(t)?t:null}}function cS(e,{sort:t,...r}={}){return{...(bi(e)&&e.channel!==void 0?Ne:aS)(r,L4(e)),sort:Ss(t)?t:null}}function L4(e){return(typeof e=="function"&&e.length!==1?Hnt:O$)(e)}function Hnt(e){return(t,r)=>{let n=Qn(t)?(i,o)=>e(t[i],t[o]):(i,o)=>e(t.get(i),t.get(o));return{data:t,facets:r.map(i=>i.slice().sort(n))}}}function O$(e){let t,r;({channel:t,value:e,order:r}={...Ki(e)});let n=t?.startsWith("-");if(n&&(t=t.slice(1)),r===void 0&&(r=n?Qu:Cr),typeof r!="function")switch(`${r}`.toLowerCase()){case"ascending":r=Cr;break;case"descending":r=Qu;break;default:throw new Error(`invalid order: ${r}`)}return(i,o,s)=>{let a;if(t===void 0)a=_t(i,e);else{if(s===void 0)throw new Error("channel sort requires an initializer");if(a=s[t],!a)return{};a=a.value}let c=(l,u)=>r(a[l],a[u]);return{data:i,facets:o.map(l=>l.slice().sort(c))}}}function Qg(e,t){return lS(null,null,e,t)}function ul(e={y:"count"},t={}){let{x:r=G}=t;if(r==null)throw new Error("missing channel: x");return lS(r,null,e,t)}function fl(e={x:"count"},t={}){let{y:r=G}=t;if(r==null)throw new Error("missing channel: y");return lS(null,r,e,t)}function Zg(e={fill:"count"},t={}){let{x:r,y:n}=t;if([r,n]=Ke(r,n),r==null)throw new Error("missing channel: x");if(n==null)throw new Error("missing channel: y");return lS(r,n,e,t)}function lS(e,t,{data:r=dS,filter:n,sort:i,reverse:o,...s}={},a={}){s=C4(s,a),r=C$(r,G),i=i==null?void 0:L$("sort",i,a),n=n==null?void 0:F$("filter",n,a);let[c,l]=tn(e),[u,f]=tn(t),{z:d,fill:h,stroke:p,x1:m,x2:y,y1:g,y2:x,...b}=a,[_,v]=tn(d),[w]=qe(h),[T]=qe(p),[A,E]=tn(w),[N,I]=tn(T);return{..."z"in a&&{z:_||d},..."fill"in a&&{fill:A||h},..."stroke"in a&&{stroke:N||p},...mr(b,(R,C,S)=>{let M=tf(_t(R,e),S?.x),O=tf(_t(R,t),S?.y),L=_t(R,d),B=_t(R,w),k=_t(R,T),P=Kg(s,{z:L,fill:B,stroke:k}),U=[],$=[],X=M&&l([]),rt=O&&f([]),ot=L&&v([]),at=B&&E([]),Y=k&&I([]),st=0;for(let q of s)q.initialize(R);i&&i.initialize(R),n&&n.initialize(R);for(let q of C){let H=[];for(let nt of s)nt.scope("facet",q);i&&i.scope("facet",q),n&&n.scope("facet",q);for(let[nt,z]of As(q,P))for(let[Pt,ht]of As(z,O))for(let[Zt,Jt]of As(ht,M)){let tt={data:R};if(M&&(tt.x=Zt),O&&(tt.y=Pt),P&&(tt.z=nt),!(n&&!n.reduce(Jt,tt))){H.push(st++),$.push(r.reduceIndex(Jt,R,tt)),M&&X.push(Zt),O&&rt.push(Pt),L&&ot.push(P===L?nt:L[Jt[0]]),B&&at.push(P===B?nt:B[Jt[0]]),k&&Y.push(P===k?nt:k[Jt[0]]);for(let ge of s)ge.reduce(Jt,tt);i&&i.reduce(Jt,tt)}}U.push(H)}return k4(U,i,o),{data:$,facets:U}}),...!Es(s,"x")&&(c?{x:c}:{x1:m,x2:y}),...!Es(s,"y")&&(u?{y:u}:{y1:g,y2:x}),...Object.fromEntries(s.map(({name:R,output:C})=>[R,C]))}}function Es(e,...t){for(let{name:r}of e)if(t.includes(r))return!0;return!1}function F4(e,t,r=uS){let n=Object.entries(e);return t.title!=null&&e.title===void 0&&n.push(["title",eit]),t.href!=null&&e.href===void 0&&n.push(["href",hS]),n.filter(([,i])=>i!==void 0).map(([i,o])=>o===null?Qnt(i):r(i,o,t))}function uS(e,t,r,n=fS){let i;kr(t)&&"reduce"in t&&(i=t.scale,t=t.reduce);let o=n(e,t,r),[s,a]=Br(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 Qnt(e){return{name:e,initialize(){},scope(){},reduce(){}}}function fS(e,t,r,n=Ih){let i=rS(e,r),o=n(t,i),s,a;return{label:en(o===Hg?null:i,o.label),initialize(c){s=i===void 0?c:_t(c,i),o.scope==="data"&&(a=o.reduceIndex(Cn(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 As(e,t){return t?Hr(e,r=>t[r]):[[,e]]}function Ih(e,t,r=Znt){if(e==null)return r(e);if(typeof e.reduceIndex=="function")return e;if(typeof e.reduce=="function"&&kr(e))return Jnt(e);if(typeof e=="function")return tit(e);if(/^p\d{2}$/i.test(e))return Ja(xh(e));switch(`${e}`.toLowerCase()){case"first":return hS;case"last":return rit;case"identity":return dS;case"count":return Hg;case"distinct":return nit;case"sum":return t==null?Hg:iit;case"proportion":return D$(t,"data");case"proportion-facet":return D$(t,"facet");case"deviation":return Ja(zi);case"min":return Ja(Ht);case"min-index":return Ja(W_);case"max":return Ja(Kt);case"max-index":return Ja(Y_);case"mean":return R$(Ea);case"median":return R$(Eo);case"variance":return Ja(Pc);case"mode":return Ja(Ed)}return r(e)}function Znt(e){throw new Error(`invalid reduce: ${e}`)}function C4(e,t){return F4(e,t,L$)}function L$(e,t,r){return uS(e,t,r,F$)}function F$(e,t,r){return fS(e,t,r,C$)}function C$(e,t){return Ih(e,t,Knt)}function Knt(e){switch(`${e}`.toLowerCase()){case"x":return oit;case"y":return sit;case"z":return B4}throw new Error(`invalid group reduce: ${e}`)}function Kg(e,t){for(let r in t){let n=t[r];if(n!==void 0&&!e.some(i=>i.name===r))return n}}function k4(e,t,r){if(t){let n=t.output.transform(),i=(o,s)=>Cr(n[o],n[s]);e.forEach(o=>o.sort(i))}r&&e.forEach(n=>n.reverse())}function Jnt(e){return console.warn("deprecated reduce interface; implement reduceIndex instead."),{...e,reduceIndex:e.reduce.bind(e)}}function tit(e){return{reduceIndex(t,r,n){return e(Gg(r,t),n)}}}function Ja(e){return{reduceIndex(t,r){return e(t,n=>r[n])}}}function R$(e){return{reduceIndex(t,r){let n=e(t,i=>r[i]);return Ve(r)?new Date(n):n}}}var dS={reduceIndex(e,t){return Gg(t,e)}},hS={reduceIndex(e,t){return t[e[0]]}},eit={reduceIndex(e,t){let n=Ta(Ao(e,o=>o.length,o=>t[o]),ol),i=n.slice(-5).reverse();if(i.length<n.length){let o=n.slice(0,-4);i[4]=[`\u2026 ${o.length.toLocaleString("en-US")} more`,Zr(o,ol)]}return i.map(([o,s])=>`${o} (${s.toLocaleString("en-US")})`).join(`
16
- `)}},rit={reduceIndex(e,t){return t[e[e.length-1]]}},Hg={label:"Frequency",reduceIndex(e){return e.length}},nit={label:"Distinct",reduceIndex(e,t){let r=new In;for(let n of e)r.add(t[n]);return r.size}},iit=Ja(Zr);function D$(e,t){return e==null?{scope:t,label:"Frequency",reduceIndex:(r,n,i=1)=>r.length/i}:{scope:t,reduceIndex:(r,n,i=1)=>Zr(r,o=>n[o])/i}}var oit={reduceIndex(e,t,{x:r}){return r}},sit={reduceIndex(e,t,{y:r}){return r}},B4={reduceIndex(e,t,{z:r}){return r}};function k$(e){if(typeof e!="function")throw new Error(`invalid test function: ${e}`);return{reduceIndex(t,r,{data:n}){return r[t.find(Qn(n)?i=>e(n[i],i,n):i=>e(n.get(i),i,n))]}}}function Th(e,{scale:t,type:r,value:n,filter:i,hint:o,label:s=en(n)},a){return o===void 0&&typeof n?.transform=="function"&&(o=n.hint),U4(a,{scale:t,type:r,value:_t(e,n),label:s,filter:i,hint:o})}function pS(e,t){return Object.fromEntries(Object.entries(e).map(([r,n])=>[r,Th(t,n,r)]))}function Ah(e,t){let r=Object.fromEntries(Object.entries(e).map(([n,{scale:i,value:o}])=>{let s=i==null?null:t[i];return[n,s==null?o:Xt(o,s)]}));return r.channels=e,r}function U4(e,t){let{scale:r,value:n}=t;if(r===!0||r==="auto")switch(e){case"fill":case"stroke":case"color":t.scale=r!==!0&&iS(n,ll)?null:"color",t.defaultScale="color";break;case"fillOpacity":case"strokeOpacity":case"opacity":t.scale=r!==!0&&iS(n,g$)?null:"opacity",t.defaultScale="opacity";break;case"symbol":r!==!0&&iS(n,T$)?(t.scale=null,t.value=Xt(n,Sh)):t.scale="symbol",t.defaultScale="symbol";break;default:t.scale=_e.has(e)?e:null;break}else if(r===!1)t.scale=null;else if(r!=null&&!_e.has(r))throw new Error(`unknown scale: ${r}`);return t}function P$(e,t,r,n,i){let{order:o,reverse:s,reduce:a=!0,limit:c}=i;for(let l in i){if(!_e.has(l))continue;let{value:u,order:f=o,reverse:d=s,reduce:h=a,limit:p=c}=Ki(i[l]),m=u?.startsWith("-");if(m&&(u=u.slice(1)),f=f===void 0?m!==(u==="width"||u==="height")?$$:U$:lit(f),h==null||h===!1)continue;let y=l==="fx"||l==="fy"?cit(t,n[l]):ait(r,l);if(!y)throw new Error(`missing channel for scale: ${l}`);let g=y.value,[x=0,b=1/0]=kn(p)?p:p<0?[p]:[0,p];if(u==null)y.domain=()=>{let _=Array.from(new In(g));return d&&(_=_.reverse()),(x!==0||b!==1/0)&&(_=_.slice(x,b)),_};else{let _=u==="data"?e:u==="height"?B$(r,"y1","y2"):u==="width"?B$(r,"x1","x2"):P4(r,u,u==="y"?"y2":u==="x"?"x2":void 0),v=Ih(h===!0?"max":h,_);y.domain=()=>{let w=lM(Cn(g),T=>v.reduceIndex(T,_),T=>g[T]);return f&&w.sort(f),d&&w.reverse(),(x!==0||b!==1/0)&&(w=w.slice(x,b)),w.map(Ju)}}}}function ait(e,t){for(let r in e){let n=e[r];if(n.scale===t)return n}}function cit(e,t){let r=e.original;if(r===e)return t;let n=t.value,i=t.value=[];for(let o=0;o<r.length;++o){let s=n[r[o][0]];for(let a of e[o])i[a]=s}return t}function B$(e,t,r){let n=P4(e,t),i=P4(e,r);return Xt(i,(o,s)=>Math.abs(o-n[s]),Float64Array)}function P4(e,t,r){let n=e[t];if(!n&&r!==void 0&&(n=e[r]),n)return n.value;throw new Error(`missing channel: ${t}`)}function lit(e){if(e==null||typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"ascending":return U$;case"descending":return $$}throw new Error(`invalid order: ${e}`)}function U$([e,t],[r,n]){return Cr(t,n)||Cr(e,r)}function $$([e,t],[r,n]){return Qu(t,n)||Cr(e,r)}function Jg(e,t){let r=e[t];if(r){for(;r.source;)r=r.source;return r.source===null?null:r}}var Y$=new Map([["accent",I6],["category10",S6],["dark2",T6],["observable10",A6],["paired",E6],["pastel1",M6],["pastel2",N6],["set1",O6],["set2",R6],["set3",D6],["tableau10",L6]]);function W$(e){return e!=null&&Y$.has(`${e}`.toLowerCase())}var z$=new Map([...Y$,["brbg",tc(Rv,Dv)],["prgn",tc(Lv,Fv)],["piyg",tc(Cv,kv)],["puor",tc(Bv,Pv)],["rdbu",tc(vg,ih)],["rdgy",tc(Uv,$v)],["rdylbu",tc(Sg,oh)],["rdylgn",tc(zv,jv)],["spectral",tc(qv,Vv)],["burd",j$(vg,ih)],["buylrd",j$(Sg,oh)],["blues",Pr(m2,y2)],["greens",Pr(g2,x2)],["greys",Pr(b2,_2)],["oranges",Pr(T2,A2)],["purples",Pr(w2,v2)],["reds",Pr(S2,I2)],["turbo",ec(C2)],["viridis",ec(B2)],["magma",ec(P2)],["inferno",ec(U2)],["plasma",ec($2)],["cividis",ec(E2)],["cubehelix",ec(M2)],["warm",ec(O2)],["cool",ec(R2)],["bugn",Pr(Yv,Wv)],["bupu",Pr(Gv,Xv)],["gnbu",Pr(Hv,Qv)],["orrd",Pr(Zv,Kv)],["pubu",Pr(e2,r2)],["pubugn",Pr(Jv,t2)],["purd",Pr(n2,i2)],["rdpu",Pr(o2,s2)],["ylgn",Pr(l2,u2)],["ylgnbu",Pr(a2,c2)],["ylorbr",Pr(f2,d2)],["ylorrd",Pr(h2,p2)],["rainbow",q$(D2)],["sinebow",q$(F2)]]);function Pr(e,t){return({length:r})=>r===1?[e[3][1]]:r===2?[e[3][1],e[3][2]]:(r=Math.max(3,Math.floor(r)),r>9?cn(t,r):e[r])}function tc(e,t){return({length:r})=>r===2?[e[3][0],e[3][2]]:(r=Math.max(3,Math.floor(r)),r>11?cn(t,r):e[r])}function j$(e,t){return({length:r})=>r===2?[e[3][2],e[3][0]]:(r=Math.max(3,Math.floor(r)),r>11?cn(n=>t(1-n),r):e[r].slice().reverse())}function ec(e){return({length:t})=>cn(e,Math.max(2,Math.floor(t)))}function q$(e){return({length:t})=>cn(e,Math.floor(t)+1).slice(0,-1)}function $4(e){let t=`${e}`.toLowerCase();if(!z$.has(t))throw new Error(`unknown ordinal scheme: ${t}`);return z$.get(t)}function t0(e,t){let r=$4(e),n=typeof r=="function"?r({length:t}):r;return n.length!==t?n.slice(0,t):n}function G$(e,t="greys"){let r=new Set,[n,i]=t0(t,2);for(let o of e)if(o!=null)if(o===!0)r.add(i);else if(o===!1)r.add(n);else return;return[...r]}var V$=new Map([["brbg",Dv],["prgn",Fv],["piyg",kv],["puor",Pv],["rdbu",ih],["rdgy",$v],["rdylbu",oh],["rdylgn",jv],["spectral",Vv],["burd",e=>ih(1-e)],["buylrd",e=>oh(1-e)],["blues",y2],["greens",x2],["greys",_2],["purples",v2],["reds",I2],["oranges",A2],["turbo",C2],["viridis",B2],["magma",P2],["inferno",U2],["plasma",$2],["cividis",E2],["cubehelix",M2],["warm",O2],["cool",R2],["bugn",Wv],["bupu",Xv],["gnbu",Qv],["orrd",Kv],["pubugn",t2],["pubu",r2],["purd",i2],["rdpu",s2],["ylgnbu",c2],["ylgn",u2],["ylorbr",d2],["ylorrd",p2],["rainbow",D2],["sinebow",F2]]);function Eh(e){let t=`${e}`.toLowerCase();if(!V$.has(t))throw new Error(`unknown quantitative scheme: ${t}`);return V$.get(t)}var uit=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function X$(e){return e!=null&&uit.has(`${e}`.toLowerCase())}var j4=e=>t=>e(1-t),z4=[0,1],H$=new Map([["number",Fe],["rgb",ji],["hsl",CM],["hcl",kM],["lab",pw]]);function q4(e){let t=`${e}`.toLowerCase();if(!H$.has(t))throw new Error(`unknown interpolator: ${t}`);return H$.get(t)}function Nh(e,t,r,{type:n,nice:i,clamp:o,zero:s,domain:a=nz(e,r),unknown:c,round:l,scheme:u,interval:f,range:d=_e.get(e)===ef?pit(r,a):_e.get(e)===rf?mit(r,a):_e.get(e)===nf?z4:void 0,interpolate:h=_e.get(e)===_i?u==null&&d!==void 0?ji:Eh(u!==void 0?u:n==="cyclical"?"rainbow":"turbo"):l?Nu:Fe,reverse:p}){if(f=Is(f,n),(n==="cyclical"||n==="sequential")&&(n="linear"),typeof h!="function"&&(h=q4(h)),p=!!p,d!==void 0){let m=(a=xi(a)).length,y=(d=xi(d)).length;if(m!==y){if(h.length===1)throw new Error("invalid piecewise interpolator");h=ss(h,d),d=void 0}}if(h.length===1?(p&&(h=j4(h),p=!1),d===void 0&&(d=Float64Array.from(a,(m,y)=>y/(a.length-1)),d.length===2&&(d=z4)),t.interpolate((d===z4?Ye:e0)(h))):t.interpolate(h),s){let[m,y]=ce(a);(m>0||y<0)&&(a=sl(a),(Ga(a)||1)===Math.sign(m)?a[0]=0:a[a.length-1]=0)}return p&&(a=$c(a)),t.domain(a).unknown(c),i&&(t.nice(fit(i,n)),a=t.domain()),d!==void 0&&t.range(d),o&&t.clamp(o),{type:n,domain:a,range:d,scale:t,interpolate:h,interval:f}}function fit(e,t){return e===!0?void 0:typeof e=="number"?e:f$(e,t)}function Q$(e,t,r){return Nh(e,Ba(),t,r)}function Z$(e,t,r){return V4(e,t,{...r,exponent:.5})}function V4(e,t,{exponent:r=1,...n}){return Nh(e,fg().exponent(r),t,{...n,type:"pow"})}function K$(e,t,{base:r=10,domain:n=yit(t),...i}){return Nh(e,lg().base(r),t,{...i,domain:n})}function J$(e,t,{constant:r=1,...n}){return Nh(e,ug().constant(r),t,n)}function tz(e,t,{range:r,quantiles:n=r===void 0?5:(r=[...r]).length,n:i=n,scheme:o="rdylbu",domain:s=git(t),unknown:a,interpolate:c,reverse:l}){return r===void 0&&(r=c!==void 0?cn(c,i):_e.get(e)===_i?t0(o,i):void 0),s.length>0&&(s=dg(s,r===void 0?{length:i}:r).quantiles()),mS(e,t,{domain:s,range:r,reverse:l,unknown:a})}function ez(e,t,{range:r,n=r===void 0?5:(r=[...r]).length,scheme:i="rdylbu",domain:o=nz(e,t),unknown:s,interpolate:a,reverse:c}){let[l,u]=ce(o),f;return r===void 0?(f=Qr(l,u,n),f[0]<=l&&f.splice(0,1),f[f.length-1]>=u&&f.pop(),n=f.length+1,r=a!==void 0?cn(a,n):_e.get(e)===_i?t0(i,n):void 0):(f=cn(Fe(l,u),n+1).slice(1,-1),l instanceof Date&&(f=f.map(d=>new Date(d)))),Ga(xi(o))<0&&f.reverse(),mS(e,t,{domain:f,range:r,reverse:c,unknown:s})}function mS(e,t,{domain:r=[0],unknown:n,scheme:i="rdylbu",interpolate:o,range:s=o!==void 0?cn(o,r.length+1):_e.get(e)===_i?t0(i,r.length+1):void 0,reverse:a}){r=xi(r);let c=Ga(r);if(!isNaN(c)&&!dit(r,c))throw new Error(`the ${e} scale has a non-monotonic domain`);return a&&(s=$c(s)),{type:"threshold",scale:hg(c<0?$c(r):r,s===void 0?[]:s).unknown(n),domain:r,range:s}}function dit(e,t){for(let r=1,n=e.length,i=e[0];r<n;++r){let o=vn(i,i=e[r]);if(o!==0&&o!==t)return!1}return!0}function rz(e){return{type:"identity",scale:I$(_e.get(e))?ag():t=>t}}function Mh(e,t=hh){return e.length?[Ht(e,({value:r})=>r===void 0?r:Ht(r,t)),Kt(e,({value:r})=>r===void 0?r:Kt(r,t))]:[0,1]}function nz(e,t){let r=_e.get(e);return(r===ef||r===nf||r===rf?hit:Mh)(t)}function hit(e){return[0,e.length?Kt(e,({value:t})=>t===void 0?t:Kt(t,hh)):1]}function pit(e,t){let r=e.find(({radius:s})=>s!==void 0);if(r!==void 0)return[0,r.radius];let n=Tn(e,.5,({value:s})=>s===void 0?NaN:Tn(s,.25,Fn)),i=t.map(s=>3*Math.sqrt(s/n)),o=30/Kt(i);return o<1?i.map(s=>s*o):i}function mit(e,t){let r=Eo(e,({value:o})=>o===void 0?NaN:Eo(o,Math.abs)),n=t.map(o=>12*o/r),i=60/Kt(n);return i<1?n.map(o=>o*i):n}function yit(e){for(let{value:t}of e)if(t!==void 0)for(let r of t){if(r>0)return Mh(e,Fn);if(r<0)return Mh(e,tl)}return[1,10]}function git(e){let t=[];for(let{value:r}of e)if(r!==void 0)for(let n of r)t.push(n);return t}function e0(e){return(t,r)=>n=>e(t+n*(r-t))}var Y4=0,W4;function iz(){let e=Y4;return Y4=0,W4=void 0,e}function mn(e){e!==W4&&(W4=e,console.warn(e),++Y4)}function yS(e,t,r,n,{type:i,nice:o,clamp:s,domain:a=Mh(n),unknown:c,pivot:l=0,scheme:u,range:f,symmetric:d=!0,interpolate:h=_e.get(e)===_i?u==null&&f!==void 0?ji:Eh(u!==void 0?u:"rdbu"):Fe,reverse:p}){l=+l,a=xi(a);let[m,y]=a;if(a.length>2&&mn(`Warning: the diverging ${e} scale domain contains extra elements.`),vn(m,y)<0&&([m,y]=[y,m],p=!p),m=Math.min(m,l),y=Math.max(y,l),typeof h!="function"&&(h=q4(h)),f!==void 0&&(h=h.length===1?e0(h)(...f):ss(h,f)),p&&(h=j4(h)),d){let g=r.apply(l),x=g-r.apply(m),b=r.apply(y)-g;x<b?m=r.invert(g-b):x>b&&(y=r.invert(g+x))}return t.domain([m,l,y]).unknown(c).interpolator(h),s&&t.clamp(s),o&&t.nice(o),{type:i,domain:[m,y],pivot:l,interpolate:h,scale:t}}function oz(e,t,r){return yS(e,wg(),xit,t,r)}function sz(e,t,r){return G4(e,t,{...r,exponent:.5})}function G4(e,t,{exponent:r=1,...n}){return yS(e,Ov().exponent(r=+r),wit(r),t,{...n,type:"diverging-pow"})}function az(e,t,{base:r=10,pivot:n=1,domain:i=Mh(t,n<0?tl:Fn),...o}){return yS(e,Mv().base(r=+r),bit,t,{domain:i,pivot:n,...o})}function cz(e,t,{constant:r=1,...n}){return yS(e,Nv().constant(r=+r),vit(r),t,n)}var xit={apply(e){return e},invert(e){return e}},bit={apply:Math.log,invert:Math.exp},_it={apply(e){return Math.sign(e)*Math.sqrt(Math.abs(e))},invert(e){return Math.sign(e)*(e*e)}};function wit(e){return e===.5?_it:{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 vit(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 lz(e,t,r,n){return Nh(e,t,r,n)}function uz(e,t,r){return lz(e,Tv(),t,r)}function fz(e,t,r){return lz(e,Av(),t,r)}var Oh=Symbol("ordinal");function hz(e,t,r,{type:n,interval:i,domain:o,range:s,reverse:a,hint:c}){return i=Is(i,n),o===void 0&&(o=xz(r,i,e)),(n==="categorical"||n===Oh)&&(n="ordinal"),a&&(o=$c(o)),o=t.domain(o).domain(),s!==void 0&&(typeof s=="function"&&(s=s(o)),t.range(s)),{type:n,domain:o,range:s,scale:t,hint:c,interval:i}}function pz(e,t,{type:r,interval:n,domain:i,range:o,scheme:s,unknown:a,...c}){n=Is(n,r),i===void 0&&(i=xz(t,n,e));let l;if(_e.get(e)===vh)l=Sit(t),o=o===void 0?Iit(l):Xt(o,Sh);else if(_e.get(e)===_i&&(o===void 0&&(r==="ordinal"||r===Oh)&&(o=G$(i,s),o!==void 0&&(s=void 0)),s===void 0&&o===void 0&&(s=r==="ordinal"?"turbo":"observable10"),s!==void 0))if(o!==void 0){let u=Eh(s),f=o[0],d=o[1]-o[0];o=({length:h})=>cn(p=>u(f+d*p),h)}else o=$4(s);if(a===og)throw new Error(`implicit unknown on ${e} scale is not supported`);return hz(e,zu().unknown(a),t,{...c,type:r,domain:i,range:o,hint:l})}function mz(e,t,{align:r=.5,padding:n=.5,...i}){return gz(a6().align(r).padding(n),t,i,e)}function yz(e,t,{align:r=.5,padding:n=.1,paddingInner:i=n,paddingOuter:o=e==="fx"||e==="fy"?0:n,...s}){return gz(Zc().align(r).paddingInner(i).paddingOuter(o),t,s,e)}function gz(e,t,r,n){let{round:i}=r;return i!==void 0&&e.round(i=!!i),e=hz(n,e,t,r),e.round=i,e}function xz(e,t,r){let n=new In;for(let{value:i,domain:o}of e){if(o!==void 0)return o();if(i!==void 0)for(let s of i)n.add(s)}if(t!==void 0){let[i,o]=ce(n).map(t.floor,t);return t.range(i,t.offset(o))}if(n.size>1e4&&_e.get(r)===Ji)throw new Error(`implicit ordinal domain of ${r} scale has more than 10,000 values`);return Ta(n,Cr)}function dz(e,t){let r;for(let{hint:n}of e){let i=n?.[t];if(i!==void 0){if(r===void 0)r=i;else if(r!==i)return}}return r}function Sit(e){return{fill:dz(e,"fill"),stroke:dz(e,"stroke")}}function Iit(e){return fe(e.fill)?$6:W2}function r0(e,{label:t,inset:r=0,insetTop:n=r,insetRight:i=r,insetBottom:o=r,insetLeft:s=r,round:a,nice:c,clamp:l,zero:u,align:f,padding:d,projection:h,facet:{label:p=t}={},...m}={}){let y={};for(let[g,x]of e){let b=m[g],_=Az(g,x,{round:_e.get(g)===Ji?a:void 0,nice:c,clamp:l,zero:u,align:f,padding:d,projection:h,...b});if(_){let{label:v=g==="fx"||g==="fy"?p:t,percent:w,transform:T,inset:A,insetTop:E=A!==void 0?A:g==="y"?n:0,insetRight:N=A!==void 0?A:g==="x"?i:0,insetBottom:I=A!==void 0?A:g==="y"?o:0,insetLeft:R=A!==void 0?A:g==="x"?s:0}=b||{};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?Tit(x,_):v,_.transform=T,g==="x"||g==="fx"?(_.insetLeft=+R,_.insetRight=+N):(g==="y"||g==="fy")&&(_.insetTop=+E,_.insetBottom=+I),y[g]=_}}return y}function H4(e){let t={},r={scales:t};for(let[n,i]of Object.entries(e)){let{scale:o,type:s,interval:a,label:c}=i;t[n]=Mz(i),r[n]=o,o.type=s,a!=null&&(o.interval=a),c!=null&&(o.label=c)}return r}function Sz(e,t){let{x:r,y:n,fx:i,fy:o}=e,s=i||o?bS(t):t;i&&bz(i,s),o&&_z(o,s);let a=i||o?Q4(e,t):t;r&&bz(r,a),n&&_z(n,a)}function Tit(e=[],t){let r;for(let{label:n}of e)if(n!==void 0){if(r===void 0)r=n;else if(r!==n)return}if(r!==void 0)return!Ms(t)&&t.percent&&(r=`${r} (%)`),{inferred:!0,toString:()=>r}}function xS(e){return Math.sign(Ga(e.domain()))*Math.sign(Ga(e.range()))}function bS(e){let{marginTop:t,marginRight:r,marginBottom:n,marginLeft:i,width:o,height:s,facet:{marginTop:a,marginRight:c,marginBottom:l,marginLeft:u}}=e;return{marginTop:Math.max(t,a),marginRight:Math.max(r,c),marginBottom:Math.max(n,l),marginLeft:Math.max(i,u),width:o,height:s}}function Q4({fx:e,fy:t},r){let{marginTop:n,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=bS(r);return{marginTop:n,marginRight:i,marginBottom:o,marginLeft:s,width:e?e.scale.bandwidth()+s+i:a,height:t?t.scale.bandwidth()+n+o:c,facet:{width:a,height:c}}}function bz(e,t){if(e.range===void 0){let{insetLeft:r,insetRight:n}=e,{width:i,marginLeft:o=0,marginRight:s=0}=t,a=o+r,c=i-s-n;e.range=[a,Math.max(a,c)],Ms(e)||(e.range=Tz(e)),e.scale.range(e.range)}Iz(e)}function _z(e,t){if(e.range===void 0){let{insetTop:r,insetBottom:n}=e,{height:i,marginTop:o=0,marginBottom:s=0}=t,a=o+r,c=i-s-n;e.range=[Math.max(a,c),a],Ms(e)?e.range.reverse():e.range=Tz(e),e.scale.range(e.range)}Iz(e)}function Iz(e){e.round===void 0&&Mit(e)&&Ait(e)<=30&&e.scale.round(!0)}function Ait({scale:e}){let t=e.domain().length,[r,n]=e.range(),i=e.paddingInner?e.paddingInner():1,o=e.paddingOuter?e.paddingOuter():e.padding(),s=t-i,a=Math.abs(n-r)/Math.max(1,s+o*2);return(a-Math.floor(a))*s}function Tz(e){let t=e.scale.domain().length+Z4(e);if(!(t>2))return e.range;let[r,n]=e.range;return Array.from({length:t},(i,o)=>r+o/(t-1)*(n-r))}function _S(e,t,r){return Az(e,r===void 0?void 0:[{hint:r}],{...t})}function Az(e,t=[],r={}){let n=Eit(e,t,r);if(r.type===void 0&&r.domain===void 0&&r.range===void 0&&r.interval==null&&e!=="fx"&&e!=="fy"&&Ms({type:n})){let i=t.map(({value:o})=>o).filter(o=>o!==void 0);i.some(Ve)?mn(`Warning: some data associated with the ${e} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${Rh(n)}" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can specify the interval of the ${e} scale (e.g., d3.utcDay), or you can suppress this warning by setting the type of the ${e} scale to "${Rh(n)}".`):i.some(m$)?mn(`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 "${Rh(n)}" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can suppress this warning by setting the type of the ${e} scale to "${Rh(n)}".`):i.some(y$)&&mn(`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 "${Rh(n)}" scale. If you want to treat this data as ordinal, you can specify the interval of the ${e} scale (e.g., 1 for integers), or you can suppress this warning by setting the type of the ${e} scale to "${Rh(n)}".`)}switch(r.type=n,n){case"diverging":case"diverging-sqrt":case"diverging-pow":case"diverging-log":case"diverging-symlog":case"cyclical":case"sequential":case"linear":case"sqrt":case"threshold":case"quantile":case"pow":case"log":case"symlog":r=gS(t,r,pr);break;case"identity":switch(_e.get(e)){case Ji:r=gS(t,r,pr);break;case vh:r=gS(t,r,Nit);break}break;case"utc":case"time":r=gS(t,r,g4);break}switch(n){case"diverging":return oz(e,t,r);case"diverging-sqrt":return sz(e,t,r);case"diverging-pow":return G4(e,t,r);case"diverging-log":return az(e,t,r);case"diverging-symlog":return cz(e,t,r);case"categorical":case"ordinal":case Oh:return pz(e,t,r);case"cyclical":case"sequential":case"linear":return Q$(e,t,r);case"sqrt":return Z$(e,t,r);case"threshold":return mS(e,t,r);case"quantile":return tz(e,t,r);case"quantize":return ez(e,t,r);case"pow":return V4(e,t,r);case"log":return K$(e,t,r);case"symlog":return J$(e,t,r);case"utc":return fz(e,t,r);case"time":return uz(e,t,r);case"point":return mz(e,t,r);case"band":return yz(e,t,r);case"identity":return rz(e);case void 0:return;default:throw new Error(`unknown scale type: ${n}`)}}function Rh(e){return typeof e=="symbol"?e.description:e}function wz(e){return typeof e=="string"?`${e}`.toLowerCase():e}var vz={toString:()=>"projection"};function Eit(e,t,{type:r,domain:n,range:i,scheme:o,pivot:s,projection:a}){if(r=wz(r),e==="fx"||e==="fy")return"band";(e==="x"||e==="y")&&a!=null&&(r=vz);for(let l of t){let u=wz(l.type);if(u!==void 0){if(r===void 0)r=u;else if(r!==u)throw new Error(`scale incompatible with channel: ${r} !== ${u}`)}}if(r===vz)return;if(r!==void 0)return r;if(n===void 0&&!t.some(({value:l})=>l!==void 0))return;let c=_e.get(e);if(c===ef)return"sqrt";if(c===nf||c===rf)return"linear";if(c===vh)return"ordinal";if((n||i||[]).length>2)return X4(c);if(n!==void 0){if(Ue(n))return X4(c);if(Ve(n))return"utc"}else{let l=t.map(({value:u})=>u).filter(u=>u!==void 0);if(l.some(Ue))return X4(c);if(l.some(Ve))return"utc"}if(c===_i){if(s!=null||X$(o))return"diverging";if(W$(o))return"categorical"}return"linear"}function X4(e){switch(e){case Ji:return"point";case _i:return Oh;default:return"ordinal"}}function Ms({type:e}){return e==="ordinal"||e==="point"||e==="band"||e===Oh}function Z4({type:e}){return e==="threshold"}function Mit({type:e}){return e==="point"||e==="band"}function wi(e){if(e===void 0)return!0;let t=e.domain(),r=e(t[0]);for(let n=1,i=t.length;n<i;++n)if(e(t[n])-r)return!1;return!0}function gS(e,{domain:t,...r},n){for(let i of e)i.value!==void 0&&(t===void 0&&(t=i.value?.domain),i.value=n(i.value));return{domain:t===void 0?t:n(t),...r}}function Nit(e){return Xt(e,Sh)}function dl(e={}){let t;for(let r in e)if(_e.has(r)&&vs(e[r])){if(t!==void 0)throw new Error("ambiguous scale definition; multiple scales found");t=Mz(_S(r,e[r]))}if(t===void 0)throw new Error("invalid scale definition; no scale found");return t}function Ez(e){return t=>{if(!_e.has(t=`${t}`))throw new Error(`unknown scale: ${t}`);return e[t]}}function Mz({scale:e,type:t,domain:r,range:n,interpolate:i,interval:o,transform:s,percent:a,pivot:c}){if(t==="identity")return{type:"identity",apply:u=>u,invert:u=>u};let l=e.unknown?e.unknown():void 0;return{type:t,domain:sl(r),...n!==void 0&&{range:sl(n)},...s!==void 0&&{transform:s},...a&&{percent:a},...l!==void 0&&{unknown:l},...o!==void 0&&{interval:o},...i!==void 0&&{interpolate:i},...e.clamp&&{clamp:e.clamp()},...c!==void 0&&{pivot:c,symmetric:!1},...e.base&&{base:e.base()},...e.exponent&&{exponent:e.exponent()},...e.constant&&{constant:e.constant()},...e.align&&{align:e.align(),round:e.round()},...e.padding&&(e.paddingInner?{paddingInner:e.paddingInner(),paddingOuter:e.paddingOuter()}:{padding:e.padding()}),...e.bandwidth&&{bandwidth:e.bandwidth(),step:e.step()},apply:u=>e(u),...e.invert&&{invert:u=>e.invert(u)}}}function Oz(e,t){let{fx:r,fy:n}=r0(e,t),i=r?.scale.domain(),o=n?.scale.domain();return i&&o?j_(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 Rz(e,{x:t,y:r}){return t&&=rN(t),r&&=rN(r),e.filter(t&&r?n=>t.has(n.x)&&r.has(n.y):t?n=>t.has(n.x):n=>r.has(n.y)).sort(t&&r?(n,i)=>t.get(n.x)-t.get(i.x)||r.get(n.y)-r.get(i.y):t?(n,i)=>t.get(n.x)-t.get(i.x):(n,i)=>r.get(n.y)-r.get(i.y))}function vS(e,{fx:t,fy:r}){let n=Cn(e),i=t?.value,o=r?.value;return t&&r?Ao(n,s=>(s.fx=i[s[0]],s.fy=o[s[0]],s),s=>i[s],s=>o[s]):t?Ao(n,s=>(s.fx=i[s[0]],s),s=>i[s]):Ao(n,s=>(s.fy=o[s[0]],s),s=>o[s])}function Dz(e,t,{marginTop:r,marginLeft:n}){return e&&t?({x:i,y:o})=>`translate(${e(i)-n},${t(o)-r})`:e?({x:i})=>`translate(${e(i)-n},0)`:({y:i})=>`translate(0,${t(i)-r})`}function Lz(e){let t=[],r=new Uint32Array(Zr(e,n=>n.length));for(let n of e){let i=0;for(let o of e)n!==o&&(r.set(o,i),i+=o.length);t.push(r.slice(0,i))}return t}var Oit=new Map([["top",K4],["right",eN],["bottom",J4],["left",tN],["top-left",wS(K4,tN)],["top-right",wS(K4,eN)],["bottom-left",wS(J4,tN)],["bottom-right",wS(J4,eN)],["top-empty",Dit],["right-empty",Cit],["bottom-empty",Lit],["left-empty",Fit],["empty",kit]]);function Fz(e){if(e==null)return null;let t=Oit.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid facet anchor: ${e}`)}var Nz=new WeakMap;function rN(e){let t=Nz.get(e);return t||Nz.set(e,t=new Sn(Xt(e,(r,n)=>[r,n]))),t}function hl(e,t){return rN(e).get(t)}function Rit(e,t,r){return t=Zi(t),r=Zi(r),e.find(n=>Object.is(Zi(n.x),t)&&Object.is(Zi(n.y),r))}function SS(e,t,r){return Rit(e,t,r)?.empty}function K4(e,{y:t},{y:r}){return t?hl(t,r)===0:!0}function J4(e,{y:t},{y:r}){return t?hl(t,r)===t.length-1:!0}function tN(e,{x:t},{x:r}){return t?hl(t,r)===0:!0}function eN(e,{x:t},{x:r}){return t?hl(t,r)===t.length-1:!0}function Dit(e,{y:t},{x:r,y:n,empty:i}){if(i)return!1;if(!t)return;let o=hl(t,n);if(o>0)return SS(e,r,t[o-1])}function Lit(e,{y:t},{x:r,y:n,empty:i}){if(i)return!1;if(!t)return;let o=hl(t,n);if(o<t.length-1)return SS(e,r,t[o+1])}function Fit(e,{x:t},{x:r,y:n,empty:i}){if(i)return!1;if(!t)return;let o=hl(t,r);if(o>0)return SS(e,t[o-1],n)}function Cit(e,{x:t},{x:r,y:n,empty:i}){if(i)return!1;if(!t)return;let o=hl(t,r);if(o<t.length-1)return SS(e,t[o+1],n)}function kit(e,t,{empty:r}){return r}function wS(e,t){return function(){return e.apply(null,arguments)&&t.apply(null,arguments)}}function IS(e,{channels:{fx:t,fy:r},groups:n}){return t&&r?e.map(({x:i,y:o})=>n.get(i)?.get(o)??[]):t?e.map(({x:i})=>n.get(i)??[]):e.map(({y:i})=>n.get(i)??[])}var Cz=Math.PI,rc=2*Cz,nN=.618;function kz({projection:e,inset:t=0,insetTop:r=t,insetRight:n=t,insetBottom:i=t,insetLeft:o=t}={},s){if(e==null)return;if(typeof e.stream=="function")return e;let a,c,l="frame";if(kr(e)){let v;if({type:e,domain:c,inset:v,insetTop:r=v!==void 0?v:r,insetRight:n=v!==void 0?v:n,insetBottom:i=v!==void 0?v:i,insetLeft:o=v!==void 0?v:o,clip:l=l,...a}=e,e==null)return}typeof e!="function"&&({type:e}=iN(e));let{width:u,height:f,marginLeft:d,marginRight:h,marginTop:p,marginBottom:m}=s,y=u-d-h-o-n,g=f-p-m-r-i;if(e=e?.({width:y,height:g,clip:l,...a}),e==null)return;l=Bit(l,d,p,u-h,f-m);let x=d+o,b=p+r,_;if(c!=null){let[[v,w],[T,A]]=Dr(e).bounds(c),E=Math.min(y/(T-v),g/(A-w));E>0?(x-=(E*(v+T)-y)/2,b-=(E*(w+A)-g)/2,_=Pu({point(N,I){this.stream.point(N*E+x,I*E+b)}})):mn("Warning: the projection could not be fit to the specified domain; using the default scale.")}return _??=x===0&&b===0?Bz():Pu({point(v,w){this.stream.point(v+x,w+b)}}),{stream:v=>e.stream(_.stream(l(v)))}}function iN(e){switch(`${e}`.toLowerCase()){case"albers-usa":return Ro(C3,.7463,.4673);case"albers":return TS(Jy,.7463,.4673);case"azimuthal-equal-area":return Ro(B3,4,4);case"azimuthal-equidistant":return Ro(U3,rc,rc);case"conic-conformal":return TS(j3,rc,rc);case"conic-equal-area":return TS(Hc,6.1702,2.9781);case"conic-equidistant":return TS(V3,7.312,3.6282);case"equal-earth":return Ro(W3,5.4133,2.6347);case"equirectangular":return Ro(q3,rc,Cz);case"gnomonic":return Ro(X3,3.4641,3.4641);case"identity":return{type:Bz};case"reflect-y":return{type:Pit};case"mercator":return Ro($3,rc,rc);case"orthographic":return Ro(Q3,2,2);case"stereographic":return Ro(K3,2,2);case"transverse-mercator":return Ro(t6,rc,rc);default:throw new Error(`unknown projection type: ${e}`)}}function Bit(e,t,r,n,i){if(e===!1||e==null||typeof e=="number")return o=>o;switch(e===!0&&(e="frame"),`${e}`.toLowerCase()){case"frame":return Wd(t,r,n,i);default:throw new Error(`unknown projection clip type: ${e}`)}}function Ro(e,t,r){return{type:({width:n,height:i,rotate:o,precision:s=.15,clip:a})=>{let c=e();return s!=null&&c.precision?.(s),o!=null&&c.rotate?.(o),typeof a=="number"&&c.clipAngle?.(a),n!=null&&(c.scale(Math.min(n/t,i/r)),c.translate([n/2,i/2])),c},aspectRatio:r/t}}function TS(e,t,r){let{type:n,aspectRatio:i}=Ro(e,t,r);return{type:o=>{let{parallels:s,domain:a,width:c,height:l}=o,u=n(o);return s!=null&&(u.parallels(s),a===void 0&&c!=null&&u.fitSize([c,l],{type:"Sphere"})),u},aspectRatio:i}}var Bz=Ye({stream:e=>e}),Pit=Ye(Pu({point(e,t){this.stream.point(e,-t)}}));function oN(e,t,r,n){let i=r[e],o=r[t],s=i.length,a=r[e]=new Float64Array(s).fill(NaN),c=r[t]=new Float64Array(s).fill(NaN),l,u=n.stream({point(f,d){a[l]=f,c[l]=d}});for(l=0;l<s;++l)u.point(i[l],o[l])}function Pz({projection:e}={}){return e==null?!1:typeof e.stream=="function"?!0:(kr(e)&&(e=e.type),e!=null)}function Uz(e){if(typeof e?.stream=="function")return nN;if(kr(e)){let t,r;if({domain:t,type:e,...r}=e,t!=null&&e!=null){let n=typeof e=="string"?iN(e).type:e,[[i,o],[s,a]]=Dr(n({...r,width:100,height:100})).bounds(t),c=(a-o)/(s-i);return c&&isFinite(c)?c<.2?.2:c>5?5:c:nN}}if(e!=null){if(typeof e!="function"){let{aspectRatio:t}=iN(e);if(t)return t}return nN}}function Ns(e,t,{projection:r}){let{x:n,y:i}=e,o={};return n&&(o.x=n),i&&(o.y=i),o=Ah(o,t),r&&n?.scale==="x"&&i?.scale==="y"&&oN("x","y",o,r),n&&(o.x=pr(o.x)),i&&(o.y=pr(o.y)),o}function $z(e){let t=[],r=[],n={scale:"x",value:t},i={scale:"y",value:r},o={point(s,a){t.push(s),r.push(a)},lineStart(){},lineEnd(){},polygonStart(){},polygonEnd(){},sphere(){}};for(let s of e.value)pi(s,o);return[n,i]}function pl(e={}){let{document:t=typeof window<"u"?window.document:void 0,clip:r}=e;return{document:t,clip:sS(r)}}function lt(e,{document:t}){return Qt(Na(e).call(t.documentElement))}var AS=Symbol("unset");function ml(e){return(e.length===1?Uit:$it)(e)}function Uit(e){let t,r=AS;return n=>(Object.is(r,n)||(r=n,t=e(n)),t)}function $it(e){let t,r;return(...n)=>((r?.length!==n.length||r.some((i,o)=>!Object.is(i,n[o])))&&(r=n,t=e(...n)),t)}var zit=ml(e=>new Intl.NumberFormat(e)),jit=ml((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{month:t}})),qit=ml((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{weekday:t}}));function sN(e="en-US"){let t=zit(e);return r=>r!=null&&!isNaN(r)?t.format(r):void 0}function zz(e="en-US",t="short"){let r=jit(e,t);return n=>n!=null&&!isNaN(n=+new Date(Date.UTC(2e3,+n)))?r.format(n):void 0}function jz(e="en-US",t="short"){let r=qit(e,t);return n=>n!=null&&!isNaN(n=+new Date(Date.UTC(2001,0,+n)))?r.format(n):void 0}function aN(e){return ph(e,"Invalid Date")}function Vit(e="en-US"){let t=sN(e);return r=>(r instanceof Date?aN:typeof r=="number"?t:rr)(r)}var Os=Vit();var We=(typeof window<"u"?window.devicePixelRatio>1:typeof it>"u")?0:.5,Yit=0,Wit=0;function cN(){return`plot-clip-${++Yit}`}function qz(){return`plot-pattern-${++Wit}`}function ES(e,{title:t,href:r,ariaLabel:n,ariaDescription:i,ariaHidden:o,target:s,fill:a,fillOpacity:c,stroke:l,strokeWidth:u,strokeOpacity:f,strokeLinejoin:d,strokeLinecap:h,strokeMiterlimit:p,strokeDasharray:m,strokeDashoffset:y,opacity:g,mixBlendMode:x,imageFilter:b,paintOrder:_,pointerEvents:v,shapeRendering:w,channels:T},{ariaLabel:A,fill:E="currentColor",fillOpacity:N,stroke:I="none",strokeOpacity:R,strokeWidth:C,strokeLinecap:S,strokeLinejoin:M,strokeMiterlimit:O,paintOrder:L}){E===null&&(a=null,c=null),I===null&&(l=null,f=null),fe(E)?!fe(I)&&(!fe(a)||T?.fill)&&(I="none"):fe(I)&&(!fe(l)||T?.stroke)&&(E="none");let[B,k]=qe(a,E),[P,U]=ye(c,N),[$,X]=qe(l,I),[rt,ot]=ye(f,R),[at,Y]=ye(g);Ka(X)||(u===void 0&&(u=C),h===void 0&&(h=S),d===void 0&&(d=M),p===void 0&&!x$(d)&&(p=O),!Ka(k)&&_===void 0&&(_=L));let[st,q]=ye(u);return E!==null&&(e.fill=Oe(k,"currentColor"),e.fillOpacity=n0(U,1)),I!==null&&(e.stroke=Oe(X,"none"),e.strokeWidth=n0(q,1),e.strokeOpacity=n0(ot,1),e.strokeLinejoin=Oe(d,"miter"),e.strokeLinecap=Oe(h,"butt"),e.strokeMiterlimit=n0(p,4),e.strokeDasharray=Oe(m,"none"),e.strokeDashoffset=Oe(y,"0")),e.target=rr(s),e.ariaLabel=rr(A),e.ariaDescription=rr(i),e.ariaHidden=rr(o),e.opacity=n0(Y,1),e.mixBlendMode=Oe(x,"normal"),e.imageFilter=Oe(b,"none"),e.paintOrder=Oe(_,"normal"),e.pointerEvents=Oe(v,"auto"),e.shapeRendering=Oe(w,"auto"),{title:{value:t,optional:!0,filter:null},href:{value:r,optional:!0,filter:null},ariaLabel:{value:n,optional:!0,filter:null},fill:{value:B,scale:"auto",optional:!0},fillOpacity:{value:P,scale:"auto",optional:!0},stroke:{value:$,scale:"auto",optional:!0},strokeOpacity:{value:rt,scale:"auto",optional:!0},strokeWidth:{value:st,optional:!0},opacity:{value:at,scale:"auto",optional:!0}}}function Git(e,t){t&&e.filter(r=>zg(t[r])).append("title").call(Hit,t)}function Xit(e,t){t&&e.filter(([r])=>zg(t[r])).append("title").call(Qit,t)}function Hit(e,t){t&&e.text(r=>Os(t[r]))}function Qit(e,t){t&&e.text(([r])=>Os(t[r]))}function Wt(e,{target:t,tip:r},{ariaLabel:n,title:i,fill:o,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:l,opacity:u,href:f}){n&&dt(e,"aria-label",d=>n[d]),o&&dt(e,"fill",d=>o[d]),s&&dt(e,"fill-opacity",d=>s[d]),a&&dt(e,"stroke",d=>a[d]),c&&dt(e,"stroke-opacity",d=>c[d]),l&&dt(e,"stroke-width",d=>l[d]),u&&dt(e,"opacity",d=>u[d]),f&&Yz(e,d=>f[d],t),r||Git(e,i)}function of(e,{target:t,tip:r},{ariaLabel:n,title:i,fill:o,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:l,opacity:u,href:f}){n&&dt(e,"aria-label",([d])=>n[d]),o&&dt(e,"fill",([d])=>o[d]),s&&dt(e,"fill-opacity",([d])=>s[d]),a&&dt(e,"stroke",([d])=>a[d]),c&&dt(e,"stroke-opacity",([d])=>c[d]),l&&dt(e,"stroke-width",([d])=>l[d]),u&&dt(e,"opacity",([d])=>u[d]),f&&Yz(e,([d])=>f[d],t),r||Xit(e,i)}function Zit({ariaLabel:e,title:t,fill:r,fillOpacity:n,stroke:i,strokeOpacity:o,strokeWidth:s,opacity:a,href:c},{tip:l}){return[e,l?void 0:t,r,n,i,o,s,a,c].filter(u=>u!==void 0)}function i0(e,t,r){let n=Hr(e,i=>t[i]);return r===void 0&&n.size>1+e.length>>1&&mn("Warning: the implicit z channel has high cardinality. This may occur when the fill or stroke channel is associated with quantitative data rather than ordinal or categorical data. You can suppress this warning by setting the z option explicitly; if this data represents a single series, set z to null."),n.values()}function*MS(e,t,r,n){let{z:i}=r,{z:o}=n,s=Zit(n,r),a=[...t,...s];for(let c of o?i0(e,o,i):[e]){let l,u;t:for(let f of c){for(let d of a)if(!Pe(d[f])){u&&u.push(-1);continue t}if(l===void 0){u&&(yield u),l=s.map(d=>Zi(d[f])),u=[f];continue}u.push(f);for(let d=0;d<s.length;++d)if(Zi(s[d][f])!==l[d]){yield u,l=s.map(p=>Zi(p[f])),u=[f];continue t}}u&&(yield u)}}function Kit(e,t,r,n){let i,{clip:o=n.clip}=t;switch(o){case"frame":{e=lt("svg:g",n).each(function(){this.appendChild(e.node()),e.node=()=>this}),i=Jit(n,r);break}case"sphere":{i=tot(n);break}}dt(e,"aria-label",t.ariaLabel),dt(e,"aria-description",t.ariaDescription),dt(e,"aria-hidden",t.ariaHidden),dt(e,"clip-path",i)}function Vz(e){let t=new WeakMap;return(r,n)=>{let i=t.get(r);if(!i){let o=cN();Qt(r.ownerSVGElement).append("clipPath").attr("id",o).call(e,r,n),t.set(r,i=`url(#${o})`)}return i}}var Jit=Vz((e,t,r)=>{let{width:n,height:i,marginLeft:o,marginRight:s,marginTop:a,marginBottom:c}=r;e.append("rect").attr("x",o).attr("y",a).attr("width",n-s-o).attr("height",i-a-c)}),tot=Vz((e,t)=>{let{projection:r}=t;if(!r)throw new Error('the "sphere" clip option requires a projection');e.append("path").attr("d",Dr(r)({type:"Sphere"}))});function kt(e,t,r,n){Kit(e,t,r,n),dt(e,"class",t.className),dt(e,"fill",t.fill),dt(e,"fill-opacity",t.fillOpacity),dt(e,"stroke",t.stroke),dt(e,"stroke-width",t.strokeWidth),dt(e,"stroke-opacity",t.strokeOpacity),dt(e,"stroke-linejoin",t.strokeLinejoin),dt(e,"stroke-linecap",t.strokeLinecap),dt(e,"stroke-miterlimit",t.strokeMiterlimit),dt(e,"stroke-dasharray",t.strokeDasharray),dt(e,"stroke-dashoffset",t.strokeDashoffset),dt(e,"shape-rendering",t.shapeRendering),dt(e,"filter",t.imageFilter),dt(e,"paint-order",t.paintOrder);let{pointerEvents:i=n.pointerSticky===!1?"none":void 0}=t;dt(e,"pointer-events",i)}function Et(e,t){eot(e,"mix-blend-mode",t.mixBlendMode),dt(e,"opacity",t.opacity)}function Yz(e,t,r){e.each(function(n){let i=t(n);if(i!=null){let o=this.ownerDocument.createElementNS(An.svg,"a");o.setAttribute("fill","inherit"),o.setAttributeNS(An.xlink,"href",i),r!=null&&o.setAttribute("target",r),this.parentNode.insertBefore(o,this).appendChild(this)}})}function dt(e,t,r){r!=null&&e.attr(t,r)}function eot(e,t,r){r!=null&&e.style(t,r)}function Rt(e,t,{x:r,y:n},i=We,o=We){i+=t.dx,o+=t.dy,r?.bandwidth&&(i+=r.bandwidth()/2),n?.bandwidth&&(o+=n.bandwidth()/2),(i||o)&&e.attr("transform",`translate(${i},${o})`)}function Oe(e,t){if((e=rr(e))!==t)return e}function n0(e,t){if((e=ie(e))!==t)return e}var rot=/^-?([_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 yl(e){if(e===void 0)return"plot-d6a7b5";if(e=`${e}`,!rot.test(e))throw new Error(`invalid class name: ${e}`);return e}function Dh(e,t){if(typeof t=="string")e.property("style",t);else if(t!=null)for(let r of e)Object.assign(r.style,t)}function Ur({frameAnchor:e},{width:t,height:r,marginTop:n,marginRight:i,marginBottom:o,marginLeft:s}){return[/left$/.test(e)?s:/right$/.test(e)?t-i:(s+t-i)/2,/^top/.test(e)?n:/^bottom/.test(e)?r-o:(n+r-o)/2]}var vt=class{constructor(t,r={},n={},i){let{facet:o="auto",facetAnchor:s,fx:a,fy:c,sort:l,dx:u=0,dy:f=0,margin:d=0,marginTop:h=d,marginRight:p=d,marginBottom:m=d,marginLeft:y=d,className:g,clip:x=i?.clip,channels:b,tip:_,render:v}=n;if(this.data=t,this.sort=Ss(l)?l:null,this.initializer=Ne(n).initializer,this.transform=this.initializer?n.transform:mr(n).transform,o===null||o===!1?this.facet=null:(this.facet=Sr(o===!0?"include":o,"facet",["auto","include","exclude","super"]),this.fx=t===il&&typeof a=="string"?[a]:a,this.fy=t===il&&typeof c=="string"?[c]:c),this.facetAnchor=Fz(s),r=Xg(r),b!==void 0&&(r={...not(b),...r}),i!==void 0&&(r={...ES(this,n,i),...r}),this.channels=Object.fromEntries(Object.entries(r).map(([w,T])=>{if(bi(T.value)){let{value:A,label:E=T.label,scale:N=T.scale}=T.value;T={...T,label:E,scale:N,value:A}}if(t===il&&typeof T.value=="string"){let{value:A}=T;T={...T,value:[A]}}return[w,T]}).filter(([w,{value:T,optional:A}])=>{if(T!=null)return!0;if(A)return!1;throw new Error(`missing channel value: ${w}`)})),this.dx=+u,this.dy=+f,this.marginTop=+h,this.marginRight=+p,this.marginBottom=+m,this.marginLeft=+y,this.clip=sS(x),this.tip=iot(_),this.className=g?yl(g):null,this.facet==="super"){if(a||c)throw new Error("super-faceting cannot use fx or fy");for(let w in this.channels){let{scale:T}=r[w];if(!(T!=="x"&&T!=="y"))throw new Error("super-faceting cannot use x or y")}}v!=null&&(this.render=nc(v,this.render))}initialize(t,r,n){let i=Xa(this.data);t===void 0&&i!=null&&(t=[Cn(i)]);let o=t;this.transform!=null&&({facets:t,data:i}=this.transform(i,t,n),i=Xa(i)),t!==void 0&&(t.original=o);let s=pS(this.channels,i);return this.sort!=null&&P$(i,t,s,r,this.sort),{data:i,facets:t,channels:s}}filter(t,r,n){for(let i in r){let{filter:o=Pe}=r[i];if(o!==null){let s=n[i];t=t.filter(a=>o(s[a]))}}return t}project(t,r,n){for(let i in t)if(t[i].scale==="x"&&/^x|x$/.test(i)){let o=i.replace(/^x|x$/,"y");o in t&&t[o].scale==="y"&&oN(i,o,r,n.projection)}}scale(t,r,n){let i=Ah(t,r);return n.projection&&this.project(t,i,n),i}};function yr(...e){return e.plot=vt.prototype.plot,e}function nc(e,t){if(e==null)return t===null?void 0:t;if(t==null)return e===null?void 0:e;if(typeof e!="function")throw new TypeError(`invalid render transform: ${e}`);if(typeof t!="function")throw new TypeError(`invalid render transform: ${t}`);return function(r,n,i,o,s,a){return e.call(this,r,n,i,o,s,(c,l,u,f,d)=>t.call(this,c,l,u,f,d,a))}}function not(e){return Object.fromEntries(Object.entries(Xg(e)).map(([t,r])=>(r=typeof r=="string"?{value:r,label:t}:Ki(r),r.filter===void 0&&r.scale==null&&(r={...r,filter:null}),[t,r])))}function iot(e){return e===!0?"xy":e===!1||e==null?null:typeof e=="string"?Sr(e,"tip",["x","y","xy"]):e}function Do(e,t){return e?.tip===!0?{...e,tip:t}:kr(e?.tip)&&e.tip.pointer===void 0?{...e,tip:{...e.tip,pointer:t}}:e}function Gz(e,t,r={}){let n=.5-We,i=.5+We,o=.5+We,s=.5-We;for(let{marginTop:m,marginRight:y,marginBottom:g,marginLeft:x}of t)m>n&&(n=m),y>i&&(i=y),g>o&&(o=g),x>s&&(s=x);let{margin:a,marginTop:c=a!==void 0?a:n,marginRight:l=a!==void 0?a:i,marginBottom:u=a!==void 0?a:o,marginLeft:f=a!==void 0?a:s}=r;c=+c,l=+l,u=+u,f=+f;let{width:d=640,height:h=oot(e,r,{width:d,marginTopDefault:n,marginRightDefault:i,marginBottomDefault:o,marginLeftDefault:s})+Math.max(0,c-n+u-o)}=r;d=+d,h=+h;let p={width:d,height:h,marginTop:c,marginRight:l,marginBottom:u,marginLeft:f};if(e.fx||e.fy){let{margin:m,marginTop:y=m!==void 0?m:c,marginRight:g=m!==void 0?m:l,marginBottom:x=m!==void 0?m:u,marginLeft:b=m!==void 0?m:f}=r.facet??{};y=+y,g=+g,x=+x,b=+b,p.facet={marginTop:y,marginRight:g,marginBottom:x,marginLeft:b}}return p}function oot({x:e,y:t,fy:r,fx:n},{projection:i,aspectRatio:o},{width:s,marginTopDefault:a,marginRightDefault:c,marginBottomDefault:l,marginLeftDefault:u}){let f=r&&r.scale.domain().length||1,d=Uz(i);if(d){let p=n?n.scale.domain().length:1,m=(1.1*f-.1)/(1.1*p-.1)*d,y=Math.max(.1,Math.min(10,m));return Math.round((s-u-c)*y+a+l)}let h=t?Ms(t)?t.scale.domain().length||1:Math.max(7,17/f):1;if(o!=null){if(o=+o,!(isFinite(o)&&o>0))throw new Error(`invalid aspectRatio: ${o}`);let p=Wz("y",t)/(Wz("x",e)*o),m=n?n.scale.bandwidth():1,y=r?r.scale.bandwidth():1,g=m*(s-u-c)-e.insetLeft-e.insetRight;return(p*g+t.insetTop+t.insetBottom)/y+a+l}return!!(t||r)*Math.max(1,Math.min(60,h*f))*20+!!n*30+60}function Wz(e,t){if(!t)throw new Error(`aspectRatio requires ${e} scale`);let{type:r,domain:n}=t,i;switch(r){case"linear":case"utc":case"time":i=Number;break;case"pow":{let a=t.scale.exponent();i=c=>Math.pow(c,a);break}case"log":i=Math.log;break;case"point":case"band":return n.length;default:throw new Error(`unsupported ${e} scale for aspectRatio: ${r}`)}let[o,s]=ce(n);return Math.abs(i(s)-i(o))}var Xz=new WeakMap;function lN(e,t,{x:r,y:n,px:i,py:o,maxRadius:s=40,channels:a,render:c,...l}={}){return s=+s,i!=null&&(r??=null,a={...a,px:{value:i,scale:"x"}}),o!=null&&(n??=null,a={...a,py:{value:o,scale:"y"}}),{x:r,y:n,channels:a,...l,render:nc(function(u,f,d,h,p,m){p={...p,pointerSticky:!1};let y=p.ownerSVGElement,{data:g}=p.getMarkState(this),x=Xz.get(y);x||Xz.set(y,x={sticky:!1,roots:[],renders:[]});let b=x.renders.push(X)-1,{x:_,y:v,fx:w,fy:T}=f,A=w?w(u.fx)-h.marginLeft:0,E=T?T(u.fy)-h.marginTop:0;_?.bandwidth&&(A+=_.bandwidth()/2),v?.bandwidth&&(E+=v.bandwidth()/2);let N=u.fi!=null,I;if(N){let Y=x.facetStates;Y||(x.facetStates=Y=new Map),I=Y.get(this),I||Y.set(this,I=new Map)}let[R,C]=Ur(this,h),{px:S,py:M}=d,O=S?Y=>S[Y]:uN(d,R),L=M?Y=>M[Y]:fN(d,C),B,k,P,U;function $(Y,st){if(N)if(U&&(U=cancelAnimationFrame(U)),Y==null)I.delete(u.fi);else{I.set(u.fi,st),U=requestAnimationFrame(()=>{U=null;for(let[q,H]of I)if(H<st||H===st&&q<u.fi){Y=null;break}X(Y)});return}X(Y)}function X(Y){if(B===Y&&P===x.sticky)return;B=Y,P=p.pointerSticky=x.sticky;let st=B==null?[]:[B];N&&(st.fx=u.fx,st.fy=u.fy,st.fi=u.fi);let q=m(st,f,d,h,p);if(k){if(N){let H=k.parentNode,nt=k.getAttribute("transform"),z=q.getAttribute("transform");nt?q.setAttribute("transform",nt):q.removeAttribute("transform"),z?H.setAttribute("transform",z):H.removeAttribute("transform"),q.removeAttribute("aria-label"),q.removeAttribute("aria-description"),q.removeAttribute("aria-hidden")}k.replaceWith(q)}if(x.roots[b]=k=q,!(B==null&&I?.size>1)){let H=B==null?null:Qn(g)?g[B]:g.get(B);p.dispatchValue(H)}return q}function rt(Y){if(x.sticky||Y.pointerType==="mouse"&&Y.buttons===1)return;let[st,q]=an(Y);st-=A,q-=E;let H=st<h.marginLeft||st>h.width-h.marginRight?1:e,nt=q<h.marginTop||q>h.height-h.marginBottom?1:t,z=null,Pt=s*s;for(let ht of u){let Zt=H*(O(ht)-st),Jt=nt*(L(ht)-q),tt=Zt*Zt+Jt*Jt;tt<=Pt&&(z=ht,Pt=tt)}if(z!=null&&(e!==1||t!==1)){let ht=O(z)-st,Zt=L(z)-q;Pt=ht*ht+Zt*Zt}$(z,Pt)}function ot(Y){Y.pointerType==="mouse"&&B!=null&&(x.sticky&&x.roots.some(st=>st?.contains(Y.target))||(x.sticky?(x.sticky=!1,x.renders.forEach(st=>st(null))):(x.sticky=!0,X(B)),Y.stopImmediatePropagation()))}function at(Y){Y.pointerType==="mouse"&&(x.sticky||$(null))}return y.addEventListener("pointerenter",rt),y.addEventListener("pointermove",rt),y.addEventListener("pointerdown",ot),y.addEventListener("pointerleave",at),X(null)},c)}}function gl(e){return lN(1,1,e)}function xl(e){return lN(1,.01,e)}function ic(e){return lN(.01,1,e)}function uN({x1:e,x2:t,x:r=e},n){return e&&t?i=>(e[i]+t[i])/2:r?i=>r[i]:()=>n}function fN({y1:e,y2:t,y:r=e},n){return e&&t?i=>(e[i]+t[i])/2:r?i=>r[i]:()=>n}function NS(e){return Ms(e)&&e.interval===void 0?void 0:"tabular-nums"}function Hz(e,t){let{label:r=e.label,tickSize:n=6,width:i=240,height:o=44+n,marginTop:s=18,marginRight:a=0,marginBottom:c=16+n,marginLeft:l=0,style:u,ticks:f=(i-l-a)/64,tickFormat:d,fontVariant:h=NS(e),round:p=!0,opacity:m,className:y}=t,g=pl(t);y=yl(y),m=ye(m)[1],d===null&&(d=()=>null);let x=lt("svg",g).attr("class",`${y}-ramp`).attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("width",i).attr("height",o).attr("viewBox",`0 0 ${i} ${o}`).call(R=>R.append("style").text(`:where(.${y}-ramp) {
15
+ ${r}`}function jnt(e){return e==="time"?tS:e==="utc"?qg:$nt}function a$(e,t,r){let n=Kt(Q_(t,(i,o)=>Math.abs(o-i)));if(n<1e3)return i$("millisecond","utc",r);for(let[i,o,s,a]of jnt(e)){if(n>a||i==="hour"&&!n)break;if(t.every(c=>o.floor(c)>=c))return i$(i,s,r)}}function ph(e,t,r){return(n,i,o)=>{let s=e(n,i),a=t(n,i),c=i-Ga(o);return i!==c&&o[c]!==void 0&&a===t(o[c],c)?s:r(s,a)}}var Yg=Object.getPrototypeOf(Uint8Array),qnt=Object.prototype.toString;function Qn(e){return e instanceof Array||e instanceof Yg}function l$(e){return e instanceof Yg&&!Vnt(e)}function u$(e){return e?.prototype instanceof Yg&&!Ynt(e)}function Vnt(e){return e instanceof BigInt64Array||e instanceof BigUint64Array}function Ynt(e){return e===BigInt64Array||e===BigUint64Array}var h4=Symbol("reindex");function _t(e,t,r){let n=typeof t;return n==="string"?v$(e)?p4(e.getChild(t),r):c$(e,m4(t),r):n==="function"?c$(e,t,r):n==="number"||t instanceof Date||n==="boolean"?Xt(e,Ye(t),r):typeof t?.transform=="function"?d4(t.transform(e),r):Wnt(d4(t,r),e?.[h4])}function Wnt(e,t){return e!=null&&t?Gg(e,t):e}function c$(e,t,r){return Xt(e,u$(r)?(n,i)=>y4(t(n,i)):t,r)}function d4(e,t){return t===void 0?xi(e):S$(e)?p4(e,t):e instanceof t?e:t.from(e,u$(t)&&!l$(e)?y4:void 0)}function p4(e,t){return e==null?e:(t===void 0||t===Array)&&Hnt(e.type)?g4(e.toArray()):d4(e.toArray(),t)}var ol=[null],m4=e=>t=>{let r=t[e];return r===void 0&&t.type==="Feature"?t.properties?.[e]:r},Ee={transform:Cn},G={transform:e=>e};var Wg=()=>1,f$=()=>!0,rr=e=>e==null?e:`${e}`,ie=e=>e==null?e:+e;var Ju=e=>e?e[0]:void 0,sl=e=>e?e[1]:void 0,d$=e=>e?e[2]:void 0,Ye=e=>()=>e;function gh(e){let t=+`${e}`.slice(1)/100;return(r,n)=>Tn(r,t,n)}function pr(e){return l$(e)?e:Xt(e,y4,Float64Array)}function y4(e){return e==null?NaN:Number(e)}function g4(e){return Xt(e,x4)}function x4(e){return e instanceof Date&&!isNaN(e)?e:typeof e=="string"?jg(e):e==null||isNaN(e=Number(e))?void 0:new Date(e)}function qe(e,t){return e===void 0&&(e=t),e===null?[void 0,"none"]:ul(e)?[void 0,e]:[e,void 0]}function ye(e,t){return e===void 0&&(e=t),e===null||typeof e=="number"?[void 0,e]:[e,void 0]}function b4(e,t,r){if(e!=null)return Sr(e,t,r)}function Sr(e,t,r){let n=`${e}`.toLowerCase();if(!r.includes(n))throw new Error(`invalid ${t}: ${e}`);return n}function Xa(e){return v$(e)?e:xi(e)}function xi(e){if(e==null||Qn(e))return e;if(S$(e))return p4(e);switch(e.type){case"FeatureCollection":return e.features;case"GeometryCollection":return e.geometries;case"Feature":case"LineString":case"MultiLineString":case"MultiPoint":case"MultiPolygon":case"Point":case"Polygon":case"Sphere":return[e]}return Array.from(e)}function Xt(e,t,r=Array){return e==null?e:e instanceof r?e.map(t):r.from(e,t)}function al(e,t=Array){return e instanceof t?e.slice():t.from(e)}function _4({x:e,x1:t,x2:r}){return e!==void 0||t!==void 0||r!==void 0}function w4({y:e,y1:t,y2:r}){return e!==void 0||t!==void 0||r!==void 0}function Ha(e){return _4(e)||w4(e)||e.interval!==void 0}function kr(e){return e?.toString===qnt}function vs(e){return kr(e)&&(e.type!==void 0||e.domain!==void 0)}function bi(e){return kr(e)&&typeof e.transform!="function"}function Ss(e){return bi(e)&&e.value===void 0&&e.channel===void 0}function v4(e,t,r,n=G){return t===void 0&&r===void 0?(t=0,r=e===void 0?n:e):t===void 0?t=e===void 0?0:e:r===void 0&&(r=e===void 0?0:e),[t,r]}function Ke(e,t){return e===void 0&&t===void 0?[Ju,sl]:[e,t]}function pn({z:e,fill:t,stroke:r}={}){return e===void 0&&([e]=qe(t)),e===void 0&&([e]=qe(r)),e}function cl(e){return Qn(e)?e.length:e?.numRows}function Cn(e){let t=cl(e),r=new Uint32Array(t);for(let n=0;n<t;++n)r[n]=n;return r}function Gg(e,t){return Qn(e)?Xt(t,r=>e[r],e.constructor):Xt(t,r=>e.at(r))}function xh(e){return e.length===1?(t,r)=>e(Gg(r,t)):e}function Qa(e,t,r){return e.subarray?e.subarray(t,r):e.slice(t,r)}function Zi(e){return e!==null&&typeof e=="object"?e.valueOf():e}function nS(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 Br(e){let t;return[{transform:()=>t,label:en(e)},r=>t=r]}function tn(e){return e==null?[e]:Br(e)}function en(e,t){return typeof e=="string"?e:e&&e.label!==void 0?e.label:t}function bh(e,t){return{transform(r){let n=e.transform(r),i=t.transform(r);return Ve(n)||Ve(i)?Xt(n,(o,s)=>new Date((+n[s]+ +i[s])/2)):Xt(n,(o,s)=>(+n[s]+ +i[s])/2,Float64Array)},label:e.label}}function tf(e,t){let r=S4(t?.interval,t?.type);return r?Xt(e,r):e}function S4(e,t){let r=_h(e,t);return r&&(n=>Pe(n)?r.floor(n):n)}function _h(e,t){if(e!=null){if(typeof e=="number")return I4(e);if(typeof e=="string")return(t==="time"?Vg:Ku)(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 I4(e){e=+e,0<e&&e<1&&Number.isInteger(1/e)&&(e=-1/e);let t=Math.abs(e);return e<0?{floor:r=>Math.floor(r*t)/t,offset:(r,n=1)=>(r*t+Math.floor(n))/t,range:(r,n)=>er(Math.ceil(r*t),n*t).map(i=>i/t)}:{floor:r=>Math.floor(r/t)*t,offset:(r,n=1)=>r+t*Math.floor(n),range:(r,n)=>er(Math.ceil(r/t),n/t).map(i=>i*t)}}function Is(e,t){if(e=_h(e,t),e&&typeof e.range!="function")throw new Error("invalid interval: missing range method");return e}function h$(e,t){if(e=Is(e,t),e&&typeof e.ceil!="function")throw new Error("invalid interval: missing ceil method");return e}function p$(e){return ll(e)&&typeof e?.floor=="function"&&e.floor()instanceof Date}function ll(e){return typeof e?.range=="function"}function Ki(e){return e===void 0||bi(e)?e:{value:e}}function m$(e){return e==null?null:{transform:t=>_t(t,e,Float64Array),label:en(e)}}function y$(e){if(!kn(e))return!1;for(let t of e)if(t!=null)return typeof t=="object"&&"0"in t&&"1"in t}function kn(e){return e&&typeof e[Symbol.iterator]=="function"}function iS(e){for(let t of e)if(t!=null)return typeof t!="object"||t instanceof Date}function Ue(e){for(let t of e){if(t==null)continue;let r=typeof t;return r==="string"||r==="boolean"}}function Ve(e){for(let t of e)if(t!=null)return t instanceof Date}function g$(e){for(let t of e)if(t!=null)return typeof t=="string"&&isNaN(t)&&jg(t)}function x$(e){for(let t of e)if(t!=null){if(typeof t!="string")return!1;if(t.trim())return!isNaN(t)}}function Za(e){for(let t of e)if(t!=null)return typeof t=="number"}function oS(e,t){let r;for(let n of e)if(n!=null){if(!t(n))return!1;r=!0}return r}var Gnt=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 ul(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)||Gnt.has(e))}function b$(e){return typeof e=="number"&&(0<=e&&e<=1||isNaN(e))}function fe(e){return e==null||Ka(e)}function Ka(e){return/^\s*none\s*$/i.test(e)}function _$(e){return/^\s*round\s*$/i.test(e)}function sS(e,t){return b4(e,t,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function Ts(e="middle"){return sS(e,"frameAnchor")}function w$(e={},...t){let r=e;for(let n of t)for(let i in n)if(r[i]===void 0){let o=n[i];r===e?r={...r,[i]:o}:r[i]=o}return r}function Xnt(e){console.warn("named iterables are deprecated; please use an object instead");let t=new Set;return Object.fromEntries(Array.from(e,r=>{let{name:n}=r;if(n==null)throw new Error("missing name");let i=`${n}`;if(i==="__proto__")throw new Error(`illegal name: ${i}`);if(t.has(i))throw new Error(`duplicate name: ${i}`);return t.add(i),[n,r]}))}function Xg(e){return kn(e)?Xnt(e):e}function aS(e){return e===!0?e="frame":e===!1?e=null:e!=null&&(e=Sr(e,"clip",["frame","sphere"])),e}function v$(e){return e&&typeof e.getChild=="function"&&typeof e.toArray=="function"&&e.schema&&Array.isArray(e.schema.fields)}function S$(e){return e&&typeof e.toArray=="function"&&e.type}function Hnt(e){return e&&(e.typeId===8||e.typeId===10)&&e.unit===1}var Ji=Symbol("position"),_i=Symbol("color"),ef=Symbol("radius"),rf=Symbol("length"),nf=Symbol("opacity"),wh=Symbol("symbol"),I$=Symbol("projection"),_e=new Map([["x",Ji],["y",Ji],["fx",Ji],["fy",Ji],["r",ef],["color",_i],["opacity",nf],["symbol",wh],["length",rf],["projection",I$]]);function T$(e){return e===Ji||e===I$}function A$(e){return e===Ji||e===ef||e===rf||e===nf}var T4=Math.sqrt(3),A4=2/T4,Qnt={draw(e,t){let r=Math.sqrt(t/Math.PI),n=r*A4,i=n/2;e.moveTo(0,n),e.lineTo(r,i),e.lineTo(r,-i),e.lineTo(0,-n),e.lineTo(-r,-i),e.lineTo(-r,i),e.closePath()}},E4=new Map([["asterisk",Ag],["circle",Ya],["cross",Eg],["diamond",Mg],["diamond2",Ng],["hexagon",Qnt],["plus",Og],["square",Rg],["square2",Dg],["star",Lg],["times",ch],["triangle",Fg],["triangle2",Cg],["wye",kg]]);function M4(e){return e&&typeof e.draw=="function"}function E$(e){return M4(e)?!0:typeof e!="string"?!1:E4.has(e.toLowerCase())}function vh(e){if(e==null||M4(e))return e;let t=E4.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid symbol: ${e}`)}function M$(e){if(e==null||M4(e))return[void 0,e];if(typeof e=="string"){let t=E4.get(`${e}`.toLowerCase());if(t)return[void 0,t]}return[e,void 0]}function mr({filter:e,sort:t,reverse:r,transform:n,initializer:i,...o}={},s){if(n===void 0&&(e!=null&&(n=R4(e)),t!=null&&!Ss(t)&&(n=N4(n,L4(t))),r&&(n=N4(n,D4))),s!=null&&i!=null)throw new Error("transforms cannot be applied after initializers");return{...o,...(t===null||Ss(t))&&{sort:t},transform:N4(n,s)}}function Ne({filter:e,sort:t,reverse:r,initializer:n,...i}={},o){return n===void 0&&(e!=null&&(n=R4(e)),t!=null&&!Ss(t)&&(n=O4(n,L4(t))),r&&(n=O4(n,D4))),{...i,...(t===null||Ss(t))&&{sort:t},initializer:O4(n,o)}}function N4(e,t){return e==null?t===null?void 0:t:t==null?e===null?void 0:e:function(r,n,i){return{data:r,facets:n}=e.call(this,r,n,i),t.call(this,Xa(r),n,i)}}function O4(e,t){return e==null?t===null?void 0:t:t==null?e===null?void 0:e:function(r,n,i,...o){let s,a,c,l,u,f;return{data:a=r,facets:c=n,channels:s}=e.call(this,r,n,i,...o),{data:u=a,facets:f=c,channels:l}=t.call(this,a,c,{...i,...s},...o),{data:u,facets:f,channels:{...s,...l}}}}function cS(e,t){return(e.initializer!=null?Ne:mr)(e,t)}function N$(e,t){return cS(t,R4(e))}function R4(e){return(t,r)=>{let n=_t(t,e);return{data:t,facets:r.map(i=>i.filter(o=>n[o]))}}}function O$({sort:e,...t}={}){return{...cS(t,D4),sort:Ss(e)?e:null}}function D4(e,t){return{data:e,facets:t.map(r=>r.slice().reverse())}}function R$({seed:e,sort:t,...r}={}){return{...cS(r,D$(e==null?Math.random:$u(e))),sort:Ss(t)?t:null}}function lS(e,{sort:t,...r}={}){return{...(bi(e)&&e.channel!==void 0?Ne:cS)(r,L4(e)),sort:Ss(t)?t:null}}function L4(e){return(typeof e=="function"&&e.length!==1?Znt:D$)(e)}function Znt(e){return(t,r)=>{let n=Qn(t)?(i,o)=>e(t[i],t[o]):(i,o)=>e(t.get(i),t.get(o));return{data:t,facets:r.map(i=>i.slice().sort(n))}}}function D$(e){let t,r;({channel:t,value:e,order:r}={...Ki(e)});let n=t?.startsWith("-");if(n&&(t=t.slice(1)),r===void 0&&(r=n?Qu:Cr),typeof r!="function")switch(`${r}`.toLowerCase()){case"ascending":r=Cr;break;case"descending":r=Qu;break;default:throw new Error(`invalid order: ${r}`)}return(i,o,s)=>{let a;if(t===void 0)a=_t(i,e);else{if(s===void 0)throw new Error("channel sort requires an initializer");if(a=s[t],!a)return{};a=a.value}let c=(l,u)=>r(a[l],a[u]);return{data:i,facets:o.map(l=>l.slice().sort(c))}}}function Qg(e,t){return uS(null,null,e,t)}function fl(e={y:"count"},t={}){let{x:r=G}=t;if(r==null)throw new Error("missing channel: x");return uS(r,null,e,t)}function dl(e={x:"count"},t={}){let{y:r=G}=t;if(r==null)throw new Error("missing channel: y");return uS(null,r,e,t)}function Zg(e={fill:"count"},t={}){let{x:r,y:n}=t;if([r,n]=Ke(r,n),r==null)throw new Error("missing channel: x");if(n==null)throw new Error("missing channel: y");return uS(r,n,e,t)}function uS(e,t,{data:r=hS,filter:n,sort:i,reverse:o,...s}={},a={}){s=C4(s,a),r=B$(r,G),i=i==null?void 0:C$("sort",i,a),n=n==null?void 0:k$("filter",n,a);let[c,l]=tn(e),[u,f]=tn(t),{z:d,fill:h,stroke:p,x1:m,x2:y,y1:g,y2:x,...b}=a,[_,v]=tn(d),[w]=qe(h),[T]=qe(p),[A,E]=tn(w),[N,I]=tn(T);return{..."z"in a&&{z:_||d},..."fill"in a&&{fill:A||h},..."stroke"in a&&{stroke:N||p},...mr(b,(R,C,S)=>{let M=tf(_t(R,e),S?.x),O=tf(_t(R,t),S?.y),L=_t(R,d),B=_t(R,w),k=_t(R,T),P=Kg(s,{z:L,fill:B,stroke:k}),U=[],$=[],X=M&&l([]),rt=O&&f([]),ot=L&&v([]),at=B&&E([]),Y=k&&I([]),st=0;for(let q of s)q.initialize(R);i&&i.initialize(R),n&&n.initialize(R);for(let q of C){let H=[];for(let nt of s)nt.scope("facet",q);i&&i.scope("facet",q),n&&n.scope("facet",q);for(let[nt,z]of As(q,P))for(let[Pt,ht]of As(z,O))for(let[Zt,Jt]of As(ht,M)){let tt={data:R};if(M&&(tt.x=Zt),O&&(tt.y=Pt),P&&(tt.z=nt),!(n&&!n.reduce(Jt,tt))){H.push(st++),$.push(r.reduceIndex(Jt,R,tt)),M&&X.push(Zt),O&&rt.push(Pt),L&&ot.push(P===L?nt:L[Jt[0]]),B&&at.push(P===B?nt:B[Jt[0]]),k&&Y.push(P===k?nt:k[Jt[0]]);for(let ge of s)ge.reduce(Jt,tt);i&&i.reduce(Jt,tt)}}U.push(H)}return k4(U,i,o),{data:$,facets:U}}),...!Es(s,"x")&&(c?{x:c}:{x1:m,x2:y}),...!Es(s,"y")&&(u?{y:u}:{y1:g,y2:x}),...Object.fromEntries(s.map(({name:R,output:C})=>[R,C]))}}function Es(e,...t){for(let{name:r}of e)if(t.includes(r))return!0;return!1}function F4(e,t,r=fS){let n=Object.entries(e);return t.title!=null&&e.title===void 0&&n.push(["title",nit]),t.href!=null&&e.href===void 0&&n.push(["href",pS]),n.filter(([,i])=>i!==void 0).map(([i,o])=>o===null?Knt(i):r(i,o,t))}function fS(e,t,r,n=dS){let i;kr(t)&&"reduce"in t&&(i=t.scale,t=t.reduce);let o=n(e,t,r),[s,a]=Br(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 Knt(e){return{name:e,initialize(){},scope(){},reduce(){}}}function dS(e,t,r,n=Sh){let i=nS(e,r),o=n(t,i),s,a;return{label:en(o===Hg?null:i,o.label),initialize(c){s=i===void 0?c:_t(c,i),o.scope==="data"&&(a=o.reduceIndex(Cn(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 As(e,t){return t?Hr(e,r=>t[r]):[[,e]]}function Sh(e,t,r=Jnt){if(e==null)return r(e);if(typeof e.reduceIndex=="function")return e;if(typeof e.reduce=="function"&&kr(e))return eit(e);if(typeof e=="function")return rit(e);if(/^p\d{2}$/i.test(e))return Ja(gh(e));switch(`${e}`.toLowerCase()){case"first":return pS;case"last":return iit;case"identity":return hS;case"count":return Hg;case"distinct":return oit;case"sum":return t==null?Hg:sit;case"proportion":return F$(t,"data");case"proportion-facet":return F$(t,"facet");case"deviation":return Ja(zi);case"min":return Ja(Ht);case"min-index":return Ja(G_);case"max":return Ja(Kt);case"max-index":return Ja(W_);case"mean":return L$(Ea);case"median":return L$(Eo);case"variance":return Ja(Uc);case"mode":return Ja(Ad)}return r(e)}function Jnt(e){throw new Error(`invalid reduce: ${e}`)}function C4(e,t){return F4(e,t,C$)}function C$(e,t,r){return fS(e,t,r,k$)}function k$(e,t,r){return dS(e,t,r,B$)}function B$(e,t){return Sh(e,t,tit)}function tit(e){switch(`${e}`.toLowerCase()){case"x":return ait;case"y":return cit;case"z":return B4}throw new Error(`invalid group reduce: ${e}`)}function Kg(e,t){for(let r in t){let n=t[r];if(n!==void 0&&!e.some(i=>i.name===r))return n}}function k4(e,t,r){if(t){let n=t.output.transform(),i=(o,s)=>Cr(n[o],n[s]);e.forEach(o=>o.sort(i))}r&&e.forEach(n=>n.reverse())}function eit(e){return console.warn("deprecated reduce interface; implement reduceIndex instead."),{...e,reduceIndex:e.reduce.bind(e)}}function rit(e){return{reduceIndex(t,r,n){return e(Gg(r,t),n)}}}function Ja(e){return{reduceIndex(t,r){return e(t,n=>r[n])}}}function L$(e){return{reduceIndex(t,r){let n=e(t,i=>r[i]);return Ve(r)?new Date(n):n}}}var hS={reduceIndex(e,t){return Gg(t,e)}},pS={reduceIndex(e,t){return t[e[0]]}},nit={reduceIndex(e,t){let n=Ta(Ao(e,o=>o.length,o=>t[o]),sl),i=n.slice(-5).reverse();if(i.length<n.length){let o=n.slice(0,-4);i[4]=[`\u2026 ${o.length.toLocaleString("en-US")} more`,Zr(o,sl)]}return i.map(([o,s])=>`${o} (${s.toLocaleString("en-US")})`).join(`
16
+ `)}},iit={reduceIndex(e,t){return t[e[e.length-1]]}},Hg={label:"Frequency",reduceIndex(e){return e.length}},oit={label:"Distinct",reduceIndex(e,t){let r=new In;for(let n of e)r.add(t[n]);return r.size}},sit=Ja(Zr);function F$(e,t){return e==null?{scope:t,label:"Frequency",reduceIndex:(r,n,i=1)=>r.length/i}:{scope:t,reduceIndex:(r,n,i=1)=>Zr(r,o=>n[o])/i}}var ait={reduceIndex(e,t,{x:r}){return r}},cit={reduceIndex(e,t,{y:r}){return r}},B4={reduceIndex(e,t,{z:r}){return r}};function P$(e){if(typeof e!="function")throw new Error(`invalid test function: ${e}`);return{reduceIndex(t,r,{data:n}){return r[t.find(Qn(n)?i=>e(n[i],i,n):i=>e(n.get(i),i,n))]}}}function Ih(e,{scale:t,type:r,value:n,filter:i,hint:o,label:s=en(n)},a){return o===void 0&&typeof n?.transform=="function"&&(o=n.hint),U4(a,{scale:t,type:r,value:_t(e,n),label:s,filter:i,hint:o})}function mS(e,t){return Object.fromEntries(Object.entries(e).map(([r,n])=>[r,Ih(t,n,r)]))}function Th(e,t){let r=Object.fromEntries(Object.entries(e).map(([n,{scale:i,value:o}])=>{let s=i==null?null:t[i];return[n,s==null?o:Xt(o,s)]}));return r.channels=e,r}function U4(e,t){let{scale:r,value:n}=t;if(r===!0||r==="auto")switch(e){case"fill":case"stroke":case"color":t.scale=r!==!0&&oS(n,ul)?null:"color",t.defaultScale="color";break;case"fillOpacity":case"strokeOpacity":case"opacity":t.scale=r!==!0&&oS(n,b$)?null:"opacity",t.defaultScale="opacity";break;case"symbol":r!==!0&&oS(n,E$)?(t.scale=null,t.value=Xt(n,vh)):t.scale="symbol",t.defaultScale="symbol";break;default:t.scale=_e.has(e)?e:null;break}else if(r===!1)t.scale=null;else if(r!=null&&!_e.has(r))throw new Error(`unknown scale: ${r}`);return t}function $$(e,t,r,n,i){let{order:o,reverse:s,reduce:a=!0,limit:c}=i;for(let l in i){if(!_e.has(l))continue;let{value:u,order:f=o,reverse:d=s,reduce:h=a,limit:p=c}=Ki(i[l]),m=u?.startsWith("-");if(m&&(u=u.slice(1)),f=f===void 0?m!==(u==="width"||u==="height")?j$:z$:fit(f),h==null||h===!1)continue;let y=l==="fx"||l==="fy"?uit(t,n[l]):lit(r,l);if(!y)throw new Error(`missing channel for scale: ${l}`);let g=y.value,[x=0,b=1/0]=kn(p)?p:p<0?[p]:[0,p];if(u==null)y.domain=()=>{let _=Array.from(new In(g));return d&&(_=_.reverse()),(x!==0||b!==1/0)&&(_=_.slice(x,b)),_};else{let _=u==="data"?e:u==="height"?U$(r,"y1","y2"):u==="width"?U$(r,"x1","x2"):P4(r,u,u==="y"?"y2":u==="x"?"x2":void 0),v=Sh(h===!0?"max":h,_);y.domain=()=>{let w=lM(Cn(g),T=>v.reduceIndex(T,_),T=>g[T]);return f&&w.sort(f),d&&w.reverse(),(x!==0||b!==1/0)&&(w=w.slice(x,b)),w.map(Ju)}}}}function lit(e,t){for(let r in e){let n=e[r];if(n.scale===t)return n}}function uit(e,t){let r=e.original;if(r===e)return t;let n=t.value,i=t.value=[];for(let o=0;o<r.length;++o){let s=n[r[o][0]];for(let a of e[o])i[a]=s}return t}function U$(e,t,r){let n=P4(e,t),i=P4(e,r);return Xt(i,(o,s)=>Math.abs(o-n[s]),Float64Array)}function P4(e,t,r){let n=e[t];if(!n&&r!==void 0&&(n=e[r]),n)return n.value;throw new Error(`missing channel: ${t}`)}function fit(e){if(e==null||typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"ascending":return z$;case"descending":return j$}throw new Error(`invalid order: ${e}`)}function z$([e,t],[r,n]){return Cr(t,n)||Cr(e,r)}function j$([e,t],[r,n]){return Qu(t,n)||Cr(e,r)}function Jg(e,t){let r=e[t];if(r){for(;r.source;)r=r.source;return r.source===null?null:r}}var G$=new Map([["accent",I6],["category10",S6],["dark2",T6],["observable10",A6],["paired",E6],["pastel1",M6],["pastel2",N6],["set1",O6],["set2",R6],["set3",D6],["tableau10",L6]]);function X$(e){return e!=null&&G$.has(`${e}`.toLowerCase())}var q$=new Map([...G$,["brbg",tc(Dv,Lv)],["prgn",tc(Fv,Cv)],["piyg",tc(kv,Bv)],["puor",tc(Pv,Uv)],["rdbu",tc(vg,nh)],["rdgy",tc($v,zv)],["rdylbu",tc(Sg,ih)],["rdylgn",tc(jv,qv)],["spectral",tc(Vv,Yv)],["burd",V$(vg,nh)],["buylrd",V$(Sg,ih)],["blues",Pr(y2,g2)],["greens",Pr(x2,b2)],["greys",Pr(_2,w2)],["oranges",Pr(A2,E2)],["purples",Pr(v2,S2)],["reds",Pr(I2,T2)],["turbo",ec(k2)],["viridis",ec(P2)],["magma",ec(U2)],["inferno",ec($2)],["plasma",ec(z2)],["cividis",ec(M2)],["cubehelix",ec(N2)],["warm",ec(R2)],["cool",ec(D2)],["bugn",Pr(Wv,Gv)],["bupu",Pr(Xv,Hv)],["gnbu",Pr(Qv,Zv)],["orrd",Pr(Kv,Jv)],["pubu",Pr(r2,n2)],["pubugn",Pr(t2,e2)],["purd",Pr(i2,o2)],["rdpu",Pr(s2,a2)],["ylgn",Pr(u2,f2)],["ylgnbu",Pr(c2,l2)],["ylorbr",Pr(d2,h2)],["ylorrd",Pr(p2,m2)],["rainbow",Y$(L2)],["sinebow",Y$(C2)]]);function Pr(e,t){return({length:r})=>r===1?[e[3][1]]:r===2?[e[3][1],e[3][2]]:(r=Math.max(3,Math.floor(r)),r>9?cn(t,r):e[r])}function tc(e,t){return({length:r})=>r===2?[e[3][0],e[3][2]]:(r=Math.max(3,Math.floor(r)),r>11?cn(t,r):e[r])}function V$(e,t){return({length:r})=>r===2?[e[3][2],e[3][0]]:(r=Math.max(3,Math.floor(r)),r>11?cn(n=>t(1-n),r):e[r].slice().reverse())}function ec(e){return({length:t})=>cn(e,Math.max(2,Math.floor(t)))}function Y$(e){return({length:t})=>cn(e,Math.floor(t)+1).slice(0,-1)}function $4(e){let t=`${e}`.toLowerCase();if(!q$.has(t))throw new Error(`unknown ordinal scheme: ${t}`);return q$.get(t)}function t0(e,t){let r=$4(e),n=typeof r=="function"?r({length:t}):r;return n.length!==t?n.slice(0,t):n}function H$(e,t="greys"){let r=new Set,[n,i]=t0(t,2);for(let o of e)if(o!=null)if(o===!0)r.add(i);else if(o===!1)r.add(n);else return;return[...r]}var W$=new Map([["brbg",Lv],["prgn",Cv],["piyg",Bv],["puor",Uv],["rdbu",nh],["rdgy",zv],["rdylbu",ih],["rdylgn",qv],["spectral",Yv],["burd",e=>nh(1-e)],["buylrd",e=>ih(1-e)],["blues",g2],["greens",b2],["greys",w2],["purples",S2],["reds",T2],["oranges",E2],["turbo",k2],["viridis",P2],["magma",U2],["inferno",$2],["plasma",z2],["cividis",M2],["cubehelix",N2],["warm",R2],["cool",D2],["bugn",Gv],["bupu",Hv],["gnbu",Zv],["orrd",Jv],["pubugn",e2],["pubu",n2],["purd",o2],["rdpu",a2],["ylgnbu",l2],["ylgn",f2],["ylorbr",h2],["ylorrd",m2],["rainbow",L2],["sinebow",C2]]);function Ah(e){let t=`${e}`.toLowerCase();if(!W$.has(t))throw new Error(`unknown quantitative scheme: ${t}`);return W$.get(t)}var dit=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function Q$(e){return e!=null&&dit.has(`${e}`.toLowerCase())}var j4=e=>t=>e(1-t),z4=[0,1],Z$=new Map([["number",Fe],["rgb",ji],["hsl",CM],["hcl",kM],["lab",mw]]);function q4(e){let t=`${e}`.toLowerCase();if(!Z$.has(t))throw new Error(`unknown interpolator: ${t}`);return Z$.get(t)}function Mh(e,t,r,{type:n,nice:i,clamp:o,zero:s,domain:a=oz(e,r),unknown:c,round:l,scheme:u,interval:f,range:d=_e.get(e)===ef?yit(r,a):_e.get(e)===rf?git(r,a):_e.get(e)===nf?z4:void 0,interpolate:h=_e.get(e)===_i?u==null&&d!==void 0?ji:Ah(u!==void 0?u:n==="cyclical"?"rainbow":"turbo"):l?Nu:Fe,reverse:p}){if(f=Is(f,n),(n==="cyclical"||n==="sequential")&&(n="linear"),typeof h!="function"&&(h=q4(h)),p=!!p,d!==void 0){let m=(a=xi(a)).length,y=(d=xi(d)).length;if(m!==y){if(h.length===1)throw new Error("invalid piecewise interpolator");h=ss(h,d),d=void 0}}if(h.length===1?(p&&(h=j4(h),p=!1),d===void 0&&(d=Float64Array.from(a,(m,y)=>y/(a.length-1)),d.length===2&&(d=z4)),t.interpolate((d===z4?Ye:e0)(h))):t.interpolate(h),s){let[m,y]=ce(a);(m>0||y<0)&&(a=al(a),(Ga(a)||1)===Math.sign(m)?a[0]=0:a[a.length-1]=0)}return p&&(a=zc(a)),t.domain(a).unknown(c),i&&(t.nice(hit(i,n)),a=t.domain()),d!==void 0&&t.range(d),o&&t.clamp(o),{type:n,domain:a,range:d,scale:t,interpolate:h,interval:f}}function hit(e,t){return e===!0?void 0:typeof e=="number"?e:h$(e,t)}function K$(e,t,r){return Mh(e,Ba(),t,r)}function J$(e,t,r){return V4(e,t,{...r,exponent:.5})}function V4(e,t,{exponent:r=1,...n}){return Mh(e,fg().exponent(r),t,{...n,type:"pow"})}function tz(e,t,{base:r=10,domain:n=xit(t),...i}){return Mh(e,lg().base(r),t,{...i,domain:n})}function ez(e,t,{constant:r=1,...n}){return Mh(e,ug().constant(r),t,n)}function rz(e,t,{range:r,quantiles:n=r===void 0?5:(r=[...r]).length,n:i=n,scheme:o="rdylbu",domain:s=bit(t),unknown:a,interpolate:c,reverse:l}){return r===void 0&&(r=c!==void 0?cn(c,i):_e.get(e)===_i?t0(o,i):void 0),s.length>0&&(s=dg(s,r===void 0?{length:i}:r).quantiles()),yS(e,t,{domain:s,range:r,reverse:l,unknown:a})}function nz(e,t,{range:r,n=r===void 0?5:(r=[...r]).length,scheme:i="rdylbu",domain:o=oz(e,t),unknown:s,interpolate:a,reverse:c}){let[l,u]=ce(o),f;return r===void 0?(f=Qr(l,u,n),f[0]<=l&&f.splice(0,1),f[f.length-1]>=u&&f.pop(),n=f.length+1,r=a!==void 0?cn(a,n):_e.get(e)===_i?t0(i,n):void 0):(f=cn(Fe(l,u),n+1).slice(1,-1),l instanceof Date&&(f=f.map(d=>new Date(d)))),Ga(xi(o))<0&&f.reverse(),yS(e,t,{domain:f,range:r,reverse:c,unknown:s})}function yS(e,t,{domain:r=[0],unknown:n,scheme:i="rdylbu",interpolate:o,range:s=o!==void 0?cn(o,r.length+1):_e.get(e)===_i?t0(i,r.length+1):void 0,reverse:a}){r=xi(r);let c=Ga(r);if(!isNaN(c)&&!pit(r,c))throw new Error(`the ${e} scale has a non-monotonic domain`);return a&&(s=zc(s)),{type:"threshold",scale:hg(c<0?zc(r):r,s===void 0?[]:s).unknown(n),domain:r,range:s}}function pit(e,t){for(let r=1,n=e.length,i=e[0];r<n;++r){let o=vn(i,i=e[r]);if(o!==0&&o!==t)return!1}return!0}function iz(e){return{type:"identity",scale:A$(_e.get(e))?ag():t=>t}}function Eh(e,t=dh){return e.length?[Ht(e,({value:r})=>r===void 0?r:Ht(r,t)),Kt(e,({value:r})=>r===void 0?r:Kt(r,t))]:[0,1]}function oz(e,t){let r=_e.get(e);return(r===ef||r===nf||r===rf?mit:Eh)(t)}function mit(e){return[0,e.length?Kt(e,({value:t})=>t===void 0?t:Kt(t,dh)):1]}function yit(e,t){let r=e.find(({radius:s})=>s!==void 0);if(r!==void 0)return[0,r.radius];let n=Tn(e,.5,({value:s})=>s===void 0?NaN:Tn(s,.25,Fn)),i=t.map(s=>3*Math.sqrt(s/n)),o=30/Kt(i);return o<1?i.map(s=>s*o):i}function git(e,t){let r=Eo(e,({value:o})=>o===void 0?NaN:Eo(o,Math.abs)),n=t.map(o=>12*o/r),i=60/Kt(n);return i<1?n.map(o=>o*i):n}function xit(e){for(let{value:t}of e)if(t!==void 0)for(let r of t){if(r>0)return Eh(e,Fn);if(r<0)return Eh(e,el)}return[1,10]}function bit(e){let t=[];for(let{value:r}of e)if(r!==void 0)for(let n of r)t.push(n);return t}function e0(e){return(t,r)=>n=>e(t+n*(r-t))}var Y4=0,W4;function sz(){let e=Y4;return Y4=0,W4=void 0,e}function mn(e){e!==W4&&(W4=e,console.warn(e),++Y4)}function gS(e,t,r,n,{type:i,nice:o,clamp:s,domain:a=Eh(n),unknown:c,pivot:l=0,scheme:u,range:f,symmetric:d=!0,interpolate:h=_e.get(e)===_i?u==null&&f!==void 0?ji:Ah(u!==void 0?u:"rdbu"):Fe,reverse:p}){l=+l,a=xi(a);let[m,y]=a;if(a.length>2&&mn(`Warning: the diverging ${e} scale domain contains extra elements.`),vn(m,y)<0&&([m,y]=[y,m],p=!p),m=Math.min(m,l),y=Math.max(y,l),typeof h!="function"&&(h=q4(h)),f!==void 0&&(h=h.length===1?e0(h)(...f):ss(h,f)),p&&(h=j4(h)),d){let g=r.apply(l),x=g-r.apply(m),b=r.apply(y)-g;x<b?m=r.invert(g-b):x>b&&(y=r.invert(g+x))}return t.domain([m,l,y]).unknown(c).interpolator(h),s&&t.clamp(s),o&&t.nice(o),{type:i,domain:[m,y],pivot:l,interpolate:h,scale:t}}function az(e,t,r){return gS(e,wg(),_it,t,r)}function cz(e,t,r){return G4(e,t,{...r,exponent:.5})}function G4(e,t,{exponent:r=1,...n}){return gS(e,Rv().exponent(r=+r),Sit(r),t,{...n,type:"diverging-pow"})}function lz(e,t,{base:r=10,pivot:n=1,domain:i=Eh(t,n<0?el:Fn),...o}){return gS(e,Nv().base(r=+r),wit,t,{domain:i,pivot:n,...o})}function uz(e,t,{constant:r=1,...n}){return gS(e,Ov().constant(r=+r),Iit(r),t,n)}var _it={apply(e){return e},invert(e){return e}},wit={apply:Math.log,invert:Math.exp},vit={apply(e){return Math.sign(e)*Math.sqrt(Math.abs(e))},invert(e){return Math.sign(e)*(e*e)}};function Sit(e){return e===.5?vit:{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 Iit(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 fz(e,t,r,n){return Mh(e,t,r,n)}function dz(e,t,r){return fz(e,Av(),t,r)}function hz(e,t,r){return fz(e,Ev(),t,r)}var Nh=Symbol("ordinal");function mz(e,t,r,{type:n,interval:i,domain:o,range:s,reverse:a,hint:c}){return i=Is(i,n),o===void 0&&(o=_z(r,i,e)),(n==="categorical"||n===Nh)&&(n="ordinal"),a&&(o=zc(o)),o=t.domain(o).domain(),s!==void 0&&(typeof s=="function"&&(s=s(o)),t.range(s)),{type:n,domain:o,range:s,scale:t,hint:c,interval:i}}function yz(e,t,{type:r,interval:n,domain:i,range:o,scheme:s,unknown:a,...c}){n=Is(n,r),i===void 0&&(i=_z(t,n,e));let l;if(_e.get(e)===wh)l=Tit(t),o=o===void 0?Ait(l):Xt(o,vh);else if(_e.get(e)===_i&&(o===void 0&&(r==="ordinal"||r===Nh)&&(o=H$(i,s),o!==void 0&&(s=void 0)),s===void 0&&o===void 0&&(s=r==="ordinal"?"turbo":"observable10"),s!==void 0))if(o!==void 0){let u=Ah(s),f=o[0],d=o[1]-o[0];o=({length:h})=>cn(p=>u(f+d*p),h)}else o=$4(s);if(a===og)throw new Error(`implicit unknown on ${e} scale is not supported`);return mz(e,zu().unknown(a),t,{...c,type:r,domain:i,range:o,hint:l})}function gz(e,t,{align:r=.5,padding:n=.5,...i}){return bz(a6().align(r).padding(n),t,i,e)}function xz(e,t,{align:r=.5,padding:n=.1,paddingInner:i=n,paddingOuter:o=e==="fx"||e==="fy"?0:n,...s}){return bz(Kc().align(r).paddingInner(i).paddingOuter(o),t,s,e)}function bz(e,t,r,n){let{round:i}=r;return i!==void 0&&e.round(i=!!i),e=mz(n,e,t,r),e.round=i,e}function _z(e,t,r){let n=new In;for(let{value:i,domain:o}of e){if(o!==void 0)return o();if(i!==void 0)for(let s of i)n.add(s)}if(t!==void 0){let[i,o]=ce(n).map(t.floor,t);return t.range(i,t.offset(o))}if(n.size>1e4&&_e.get(r)===Ji)throw new Error(`implicit ordinal domain of ${r} scale has more than 10,000 values`);return Ta(n,Cr)}function pz(e,t){let r;for(let{hint:n}of e){let i=n?.[t];if(i!==void 0){if(r===void 0)r=i;else if(r!==i)return}}return r}function Tit(e){return{fill:pz(e,"fill"),stroke:pz(e,"stroke")}}function Ait(e){return fe(e.fill)?$6:G2}function r0(e,{label:t,inset:r=0,insetTop:n=r,insetRight:i=r,insetBottom:o=r,insetLeft:s=r,round:a,nice:c,clamp:l,zero:u,align:f,padding:d,projection:h,facet:{label:p=t}={},...m}={}){let y={};for(let[g,x]of e){let b=m[g],_=Mz(g,x,{round:_e.get(g)===Ji?a:void 0,nice:c,clamp:l,zero:u,align:f,padding:d,projection:h,...b});if(_){let{label:v=g==="fx"||g==="fy"?p:t,percent:w,transform:T,inset:A,insetTop:E=A!==void 0?A:g==="y"?n:0,insetRight:N=A!==void 0?A:g==="x"?i:0,insetBottom:I=A!==void 0?A:g==="y"?o:0,insetLeft:R=A!==void 0?A:g==="x"?s:0}=b||{};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?Eit(x,_):v,_.transform=T,g==="x"||g==="fx"?(_.insetLeft=+R,_.insetRight=+N):(g==="y"||g==="fy")&&(_.insetTop=+E,_.insetBottom=+I),y[g]=_}}return y}function H4(e){let t={},r={scales:t};for(let[n,i]of Object.entries(e)){let{scale:o,type:s,interval:a,label:c}=i;t[n]=Oz(i),r[n]=o,o.type=s,a!=null&&(o.interval=a),c!=null&&(o.label=c)}return r}function Tz(e,t){let{x:r,y:n,fx:i,fy:o}=e,s=i||o?_S(t):t;i&&wz(i,s),o&&vz(o,s);let a=i||o?Q4(e,t):t;r&&wz(r,a),n&&vz(n,a)}function Eit(e=[],t){let r;for(let{label:n}of e)if(n!==void 0){if(r===void 0)r=n;else if(r!==n)return}if(r!==void 0)return!Ms(t)&&t.percent&&(r=`${r} (%)`),{inferred:!0,toString:()=>r}}function bS(e){return Math.sign(Ga(e.domain()))*Math.sign(Ga(e.range()))}function _S(e){let{marginTop:t,marginRight:r,marginBottom:n,marginLeft:i,width:o,height:s,facet:{marginTop:a,marginRight:c,marginBottom:l,marginLeft:u}}=e;return{marginTop:Math.max(t,a),marginRight:Math.max(r,c),marginBottom:Math.max(n,l),marginLeft:Math.max(i,u),width:o,height:s}}function Q4({fx:e,fy:t},r){let{marginTop:n,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=_S(r);return{marginTop:n,marginRight:i,marginBottom:o,marginLeft:s,width:e?e.scale.bandwidth()+s+i:a,height:t?t.scale.bandwidth()+n+o:c,facet:{width:a,height:c}}}function wz(e,t){if(e.range===void 0){let{insetLeft:r,insetRight:n}=e,{width:i,marginLeft:o=0,marginRight:s=0}=t,a=o+r,c=i-s-n;e.range=[a,Math.max(a,c)],Ms(e)||(e.range=Ez(e)),e.scale.range(e.range)}Az(e)}function vz(e,t){if(e.range===void 0){let{insetTop:r,insetBottom:n}=e,{height:i,marginTop:o=0,marginBottom:s=0}=t,a=o+r,c=i-s-n;e.range=[Math.max(a,c),a],Ms(e)?e.range.reverse():e.range=Ez(e),e.scale.range(e.range)}Az(e)}function Az(e){e.round===void 0&&Oit(e)&&Mit(e)<=30&&e.scale.round(!0)}function Mit({scale:e}){let t=e.domain().length,[r,n]=e.range(),i=e.paddingInner?e.paddingInner():1,o=e.paddingOuter?e.paddingOuter():e.padding(),s=t-i,a=Math.abs(n-r)/Math.max(1,s+o*2);return(a-Math.floor(a))*s}function Ez(e){let t=e.scale.domain().length+Z4(e);if(!(t>2))return e.range;let[r,n]=e.range;return Array.from({length:t},(i,o)=>r+o/(t-1)*(n-r))}function wS(e,t,r){return Mz(e,r===void 0?void 0:[{hint:r}],{...t})}function Mz(e,t=[],r={}){let n=Nit(e,t,r);if(r.type===void 0&&r.domain===void 0&&r.range===void 0&&r.interval==null&&e!=="fx"&&e!=="fy"&&Ms({type:n})){let i=t.map(({value:o})=>o).filter(o=>o!==void 0);i.some(Ve)?mn(`Warning: some data associated with the ${e} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${Oh(n)}" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can specify the interval of the ${e} scale (e.g., d3.utcDay), or you can suppress this warning by setting the type of the ${e} scale to "${Oh(n)}".`):i.some(g$)?mn(`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 "${Oh(n)}" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can suppress this warning by setting the type of the ${e} scale to "${Oh(n)}".`):i.some(x$)&&mn(`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 "${Oh(n)}" scale. If you want to treat this data as ordinal, you can specify the interval of the ${e} scale (e.g., 1 for integers), or you can suppress this warning by setting the type of the ${e} scale to "${Oh(n)}".`)}switch(r.type=n,n){case"diverging":case"diverging-sqrt":case"diverging-pow":case"diverging-log":case"diverging-symlog":case"cyclical":case"sequential":case"linear":case"sqrt":case"threshold":case"quantile":case"pow":case"log":case"symlog":r=xS(t,r,pr);break;case"identity":switch(_e.get(e)){case Ji:r=xS(t,r,pr);break;case wh:r=xS(t,r,Rit);break}break;case"utc":case"time":r=xS(t,r,g4);break}switch(n){case"diverging":return az(e,t,r);case"diverging-sqrt":return cz(e,t,r);case"diverging-pow":return G4(e,t,r);case"diverging-log":return lz(e,t,r);case"diverging-symlog":return uz(e,t,r);case"categorical":case"ordinal":case Nh:return yz(e,t,r);case"cyclical":case"sequential":case"linear":return K$(e,t,r);case"sqrt":return J$(e,t,r);case"threshold":return yS(e,t,r);case"quantile":return rz(e,t,r);case"quantize":return nz(e,t,r);case"pow":return V4(e,t,r);case"log":return tz(e,t,r);case"symlog":return ez(e,t,r);case"utc":return hz(e,t,r);case"time":return dz(e,t,r);case"point":return gz(e,t,r);case"band":return xz(e,t,r);case"identity":return iz(e);case void 0:return;default:throw new Error(`unknown scale type: ${n}`)}}function Oh(e){return typeof e=="symbol"?e.description:e}function Sz(e){return typeof e=="string"?`${e}`.toLowerCase():e}var Iz={toString:()=>"projection"};function Nit(e,t,{type:r,domain:n,range:i,scheme:o,pivot:s,projection:a}){if(r=Sz(r),e==="fx"||e==="fy")return"band";(e==="x"||e==="y")&&a!=null&&(r=Iz);for(let l of t){let u=Sz(l.type);if(u!==void 0){if(r===void 0)r=u;else if(r!==u)throw new Error(`scale incompatible with channel: ${r} !== ${u}`)}}if(r===Iz)return;if(r!==void 0)return r;if(n===void 0&&!t.some(({value:l})=>l!==void 0))return;let c=_e.get(e);if(c===ef)return"sqrt";if(c===nf||c===rf)return"linear";if(c===wh)return"ordinal";if((n||i||[]).length>2)return X4(c);if(n!==void 0){if(Ue(n))return X4(c);if(Ve(n))return"utc"}else{let l=t.map(({value:u})=>u).filter(u=>u!==void 0);if(l.some(Ue))return X4(c);if(l.some(Ve))return"utc"}if(c===_i){if(s!=null||Q$(o))return"diverging";if(X$(o))return"categorical"}return"linear"}function X4(e){switch(e){case Ji:return"point";case _i:return Nh;default:return"ordinal"}}function Ms({type:e}){return e==="ordinal"||e==="point"||e==="band"||e===Nh}function Z4({type:e}){return e==="threshold"}function Oit({type:e}){return e==="point"||e==="band"}function wi(e){if(e===void 0)return!0;let t=e.domain(),r=e(t[0]);for(let n=1,i=t.length;n<i;++n)if(e(t[n])-r)return!1;return!0}function xS(e,{domain:t,...r},n){for(let i of e)i.value!==void 0&&(t===void 0&&(t=i.value?.domain),i.value=n(i.value));return{domain:t===void 0?t:n(t),...r}}function Rit(e){return Xt(e,vh)}function hl(e={}){let t;for(let r in e)if(_e.has(r)&&vs(e[r])){if(t!==void 0)throw new Error("ambiguous scale definition; multiple scales found");t=Oz(wS(r,e[r]))}if(t===void 0)throw new Error("invalid scale definition; no scale found");return t}function Nz(e){return t=>{if(!_e.has(t=`${t}`))throw new Error(`unknown scale: ${t}`);return e[t]}}function Oz({scale:e,type:t,domain:r,range:n,interpolate:i,interval:o,transform:s,percent:a,pivot:c}){if(t==="identity")return{type:"identity",apply:u=>u,invert:u=>u};let l=e.unknown?e.unknown():void 0;return{type:t,domain:al(r),...n!==void 0&&{range:al(n)},...s!==void 0&&{transform:s},...a&&{percent:a},...l!==void 0&&{unknown:l},...o!==void 0&&{interval:o},...i!==void 0&&{interpolate:i},...e.clamp&&{clamp:e.clamp()},...c!==void 0&&{pivot:c,symmetric:!1},...e.base&&{base:e.base()},...e.exponent&&{exponent:e.exponent()},...e.constant&&{constant:e.constant()},...e.align&&{align:e.align(),round:e.round()},...e.padding&&(e.paddingInner?{paddingInner:e.paddingInner(),paddingOuter:e.paddingOuter()}:{padding:e.padding()}),...e.bandwidth&&{bandwidth:e.bandwidth(),step:e.step()},apply:u=>e(u),...e.invert&&{invert:u=>e.invert(u)}}}function Dz(e,t){let{fx:r,fy:n}=r0(e,t),i=r?.scale.domain(),o=n?.scale.domain();return i&&o?q_(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 Lz(e,{x:t,y:r}){return t&&=rN(t),r&&=rN(r),e.filter(t&&r?n=>t.has(n.x)&&r.has(n.y):t?n=>t.has(n.x):n=>r.has(n.y)).sort(t&&r?(n,i)=>t.get(n.x)-t.get(i.x)||r.get(n.y)-r.get(i.y):t?(n,i)=>t.get(n.x)-t.get(i.x):(n,i)=>r.get(n.y)-r.get(i.y))}function SS(e,{fx:t,fy:r}){let n=Cn(e),i=t?.value,o=r?.value;return t&&r?Ao(n,s=>(s.fx=i[s[0]],s.fy=o[s[0]],s),s=>i[s],s=>o[s]):t?Ao(n,s=>(s.fx=i[s[0]],s),s=>i[s]):Ao(n,s=>(s.fy=o[s[0]],s),s=>o[s])}function Fz(e,t,{marginTop:r,marginLeft:n}){return e&&t?({x:i,y:o})=>`translate(${e(i)-n},${t(o)-r})`:e?({x:i})=>`translate(${e(i)-n},0)`:({y:i})=>`translate(0,${t(i)-r})`}function Cz(e){let t=[],r=new Uint32Array(Zr(e,n=>n.length));for(let n of e){let i=0;for(let o of e)n!==o&&(r.set(o,i),i+=o.length);t.push(r.slice(0,i))}return t}var Dit=new Map([["top",K4],["right",eN],["bottom",J4],["left",tN],["top-left",vS(K4,tN)],["top-right",vS(K4,eN)],["bottom-left",vS(J4,tN)],["bottom-right",vS(J4,eN)],["top-empty",Fit],["right-empty",Bit],["bottom-empty",Cit],["left-empty",kit],["empty",Pit]]);function kz(e){if(e==null)return null;let t=Dit.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid facet anchor: ${e}`)}var Rz=new WeakMap;function rN(e){let t=Rz.get(e);return t||Rz.set(e,t=new Sn(Xt(e,(r,n)=>[r,n]))),t}function pl(e,t){return rN(e).get(t)}function Lit(e,t,r){return t=Zi(t),r=Zi(r),e.find(n=>Object.is(Zi(n.x),t)&&Object.is(Zi(n.y),r))}function IS(e,t,r){return Lit(e,t,r)?.empty}function K4(e,{y:t},{y:r}){return t?pl(t,r)===0:!0}function J4(e,{y:t},{y:r}){return t?pl(t,r)===t.length-1:!0}function tN(e,{x:t},{x:r}){return t?pl(t,r)===0:!0}function eN(e,{x:t},{x:r}){return t?pl(t,r)===t.length-1:!0}function Fit(e,{y:t},{x:r,y:n,empty:i}){if(i)return!1;if(!t)return;let o=pl(t,n);if(o>0)return IS(e,r,t[o-1])}function Cit(e,{y:t},{x:r,y:n,empty:i}){if(i)return!1;if(!t)return;let o=pl(t,n);if(o<t.length-1)return IS(e,r,t[o+1])}function kit(e,{x:t},{x:r,y:n,empty:i}){if(i)return!1;if(!t)return;let o=pl(t,r);if(o>0)return IS(e,t[o-1],n)}function Bit(e,{x:t},{x:r,y:n,empty:i}){if(i)return!1;if(!t)return;let o=pl(t,r);if(o<t.length-1)return IS(e,t[o+1],n)}function Pit(e,t,{empty:r}){return r}function vS(e,t){return function(){return e.apply(null,arguments)&&t.apply(null,arguments)}}function TS(e,{channels:{fx:t,fy:r},groups:n}){return t&&r?e.map(({x:i,y:o})=>n.get(i)?.get(o)??[]):t?e.map(({x:i})=>n.get(i)??[]):e.map(({y:i})=>n.get(i)??[])}var Bz=Math.PI,rc=2*Bz,nN=.618;function Pz({projection:e,inset:t=0,insetTop:r=t,insetRight:n=t,insetBottom:i=t,insetLeft:o=t}={},s){if(e==null)return;if(typeof e.stream=="function")return e;let a,c,l="frame";if(kr(e)){let v;if({type:e,domain:c,inset:v,insetTop:r=v!==void 0?v:r,insetRight:n=v!==void 0?v:n,insetBottom:i=v!==void 0?v:i,insetLeft:o=v!==void 0?v:o,clip:l=l,...a}=e,e==null)return}typeof e!="function"&&({type:e}=iN(e));let{width:u,height:f,marginLeft:d,marginRight:h,marginTop:p,marginBottom:m}=s,y=u-d-h-o-n,g=f-p-m-r-i;if(e=e?.({width:y,height:g,clip:l,...a}),e==null)return;l=Uit(l,d,p,u-h,f-m);let x=d+o,b=p+r,_;if(c!=null){let[[v,w],[T,A]]=Dr(e).bounds(c),E=Math.min(y/(T-v),g/(A-w));E>0?(x-=(E*(v+T)-y)/2,b-=(E*(w+A)-g)/2,_=Pu({point(N,I){this.stream.point(N*E+x,I*E+b)}})):mn("Warning: the projection could not be fit to the specified domain; using the default scale.")}return _??=x===0&&b===0?Uz():Pu({point(v,w){this.stream.point(v+x,w+b)}}),{stream:v=>e.stream(_.stream(l(v)))}}function iN(e){switch(`${e}`.toLowerCase()){case"albers-usa":return Ro(C3,.7463,.4673);case"albers":return AS(Jy,.7463,.4673);case"azimuthal-equal-area":return Ro(B3,4,4);case"azimuthal-equidistant":return Ro(U3,rc,rc);case"conic-conformal":return AS(j3,rc,rc);case"conic-equal-area":return AS(Qc,6.1702,2.9781);case"conic-equidistant":return AS(V3,7.312,3.6282);case"equal-earth":return Ro(W3,5.4133,2.6347);case"equirectangular":return Ro(q3,rc,Bz);case"gnomonic":return Ro(X3,3.4641,3.4641);case"identity":return{type:Uz};case"reflect-y":return{type:$it};case"mercator":return Ro($3,rc,rc);case"orthographic":return Ro(Q3,2,2);case"stereographic":return Ro(K3,2,2);case"transverse-mercator":return Ro(t6,rc,rc);default:throw new Error(`unknown projection type: ${e}`)}}function Uit(e,t,r,n,i){if(e===!1||e==null||typeof e=="number")return o=>o;switch(e===!0&&(e="frame"),`${e}`.toLowerCase()){case"frame":return Yd(t,r,n,i);default:throw new Error(`unknown projection clip type: ${e}`)}}function Ro(e,t,r){return{type:({width:n,height:i,rotate:o,precision:s=.15,clip:a})=>{let c=e();return s!=null&&c.precision?.(s),o!=null&&c.rotate?.(o),typeof a=="number"&&c.clipAngle?.(a),n!=null&&(c.scale(Math.min(n/t,i/r)),c.translate([n/2,i/2])),c},aspectRatio:r/t}}function AS(e,t,r){let{type:n,aspectRatio:i}=Ro(e,t,r);return{type:o=>{let{parallels:s,domain:a,width:c,height:l}=o,u=n(o);return s!=null&&(u.parallels(s),a===void 0&&c!=null&&u.fitSize([c,l],{type:"Sphere"})),u},aspectRatio:i}}var Uz=Ye({stream:e=>e}),$it=Ye(Pu({point(e,t){this.stream.point(e,-t)}}));function oN(e,t,r,n){let i=r[e],o=r[t],s=i.length,a=r[e]=new Float64Array(s).fill(NaN),c=r[t]=new Float64Array(s).fill(NaN),l,u=n.stream({point(f,d){a[l]=f,c[l]=d}});for(l=0;l<s;++l)u.point(i[l],o[l])}function $z({projection:e}={}){return e==null?!1:typeof e.stream=="function"?!0:(kr(e)&&(e=e.type),e!=null)}function zz(e){if(typeof e?.stream=="function")return nN;if(kr(e)){let t,r;if({domain:t,type:e,...r}=e,t!=null&&e!=null){let n=typeof e=="string"?iN(e).type:e,[[i,o],[s,a]]=Dr(n({...r,width:100,height:100})).bounds(t),c=(a-o)/(s-i);return c&&isFinite(c)?c<.2?.2:c>5?5:c:nN}}if(e!=null){if(typeof e!="function"){let{aspectRatio:t}=iN(e);if(t)return t}return nN}}function Ns(e,t,{projection:r}){let{x:n,y:i}=e,o={};return n&&(o.x=n),i&&(o.y=i),o=Th(o,t),r&&n?.scale==="x"&&i?.scale==="y"&&oN("x","y",o,r),n&&(o.x=pr(o.x)),i&&(o.y=pr(o.y)),o}function jz(e){let t=[],r=[],n={scale:"x",value:t},i={scale:"y",value:r},o={point(s,a){t.push(s),r.push(a)},lineStart(){},lineEnd(){},polygonStart(){},polygonEnd(){},sphere(){}};for(let s of e.value)pi(s,o);return[n,i]}function ml(e={}){let{document:t=typeof window<"u"?window.document:void 0,clip:r}=e;return{document:t,clip:aS(r)}}function lt(e,{document:t}){return Qt(Na(e).call(t.documentElement))}var ES=Symbol("unset");function yl(e){return(e.length===1?zit:jit)(e)}function zit(e){let t,r=ES;return n=>(Object.is(r,n)||(r=n,t=e(n)),t)}function jit(e){let t,r;return(...n)=>((r?.length!==n.length||r.some((i,o)=>!Object.is(i,n[o])))&&(r=n,t=e(...n)),t)}var qit=yl(e=>new Intl.NumberFormat(e)),Vit=yl((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{month:t}})),Yit=yl((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{weekday:t}}));function sN(e="en-US"){let t=qit(e);return r=>r!=null&&!isNaN(r)?t.format(r):void 0}function qz(e="en-US",t="short"){let r=Vit(e,t);return n=>n!=null&&!isNaN(n=+new Date(Date.UTC(2e3,+n)))?r.format(n):void 0}function Vz(e="en-US",t="short"){let r=Yit(e,t);return n=>n!=null&&!isNaN(n=+new Date(Date.UTC(2001,0,+n)))?r.format(n):void 0}function aN(e){return hh(e,"Invalid Date")}function Wit(e="en-US"){let t=sN(e);return r=>(r instanceof Date?aN:typeof r=="number"?t:rr)(r)}var Os=Wit();var We=(typeof window<"u"?window.devicePixelRatio>1:typeof it>"u")?0:.5,Git=0,Xit=0;function cN(){return`plot-clip-${++Git}`}function Yz(){return`plot-pattern-${++Xit}`}function MS(e,{title:t,href:r,ariaLabel:n,ariaDescription:i,ariaHidden:o,target:s,fill:a,fillOpacity:c,stroke:l,strokeWidth:u,strokeOpacity:f,strokeLinejoin:d,strokeLinecap:h,strokeMiterlimit:p,strokeDasharray:m,strokeDashoffset:y,opacity:g,mixBlendMode:x,imageFilter:b,paintOrder:_,pointerEvents:v,shapeRendering:w,channels:T},{ariaLabel:A,fill:E="currentColor",fillOpacity:N,stroke:I="none",strokeOpacity:R,strokeWidth:C,strokeLinecap:S,strokeLinejoin:M,strokeMiterlimit:O,paintOrder:L}){E===null&&(a=null,c=null),I===null&&(l=null,f=null),fe(E)?!fe(I)&&(!fe(a)||T?.fill)&&(I="none"):fe(I)&&(!fe(l)||T?.stroke)&&(E="none");let[B,k]=qe(a,E),[P,U]=ye(c,N),[$,X]=qe(l,I),[rt,ot]=ye(f,R),[at,Y]=ye(g);Ka(X)||(u===void 0&&(u=C),h===void 0&&(h=S),d===void 0&&(d=M),p===void 0&&!_$(d)&&(p=O),!Ka(k)&&_===void 0&&(_=L));let[st,q]=ye(u);return E!==null&&(e.fill=Oe(k,"currentColor"),e.fillOpacity=n0(U,1)),I!==null&&(e.stroke=Oe(X,"none"),e.strokeWidth=n0(q,1),e.strokeOpacity=n0(ot,1),e.strokeLinejoin=Oe(d,"miter"),e.strokeLinecap=Oe(h,"butt"),e.strokeMiterlimit=n0(p,4),e.strokeDasharray=Oe(m,"none"),e.strokeDashoffset=Oe(y,"0")),e.target=rr(s),e.ariaLabel=rr(A),e.ariaDescription=rr(i),e.ariaHidden=rr(o),e.opacity=n0(Y,1),e.mixBlendMode=Oe(x,"normal"),e.imageFilter=Oe(b,"none"),e.paintOrder=Oe(_,"normal"),e.pointerEvents=Oe(v,"auto"),e.shapeRendering=Oe(w,"auto"),{title:{value:t,optional:!0,filter:null},href:{value:r,optional:!0,filter:null},ariaLabel:{value:n,optional:!0,filter:null},fill:{value:B,scale:"auto",optional:!0},fillOpacity:{value:P,scale:"auto",optional:!0},stroke:{value:$,scale:"auto",optional:!0},strokeOpacity:{value:rt,scale:"auto",optional:!0},strokeWidth:{value:st,optional:!0},opacity:{value:at,scale:"auto",optional:!0}}}function Hit(e,t){t&&e.filter(r=>zg(t[r])).append("title").call(Zit,t)}function Qit(e,t){t&&e.filter(([r])=>zg(t[r])).append("title").call(Kit,t)}function Zit(e,t){t&&e.text(r=>Os(t[r]))}function Kit(e,t){t&&e.text(([r])=>Os(t[r]))}function Wt(e,{target:t,tip:r},{ariaLabel:n,title:i,fill:o,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:l,opacity:u,href:f}){n&&dt(e,"aria-label",d=>n[d]),o&&dt(e,"fill",d=>o[d]),s&&dt(e,"fill-opacity",d=>s[d]),a&&dt(e,"stroke",d=>a[d]),c&&dt(e,"stroke-opacity",d=>c[d]),l&&dt(e,"stroke-width",d=>l[d]),u&&dt(e,"opacity",d=>u[d]),f&&Gz(e,d=>f[d],t),r||Hit(e,i)}function of(e,{target:t,tip:r},{ariaLabel:n,title:i,fill:o,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:l,opacity:u,href:f}){n&&dt(e,"aria-label",([d])=>n[d]),o&&dt(e,"fill",([d])=>o[d]),s&&dt(e,"fill-opacity",([d])=>s[d]),a&&dt(e,"stroke",([d])=>a[d]),c&&dt(e,"stroke-opacity",([d])=>c[d]),l&&dt(e,"stroke-width",([d])=>l[d]),u&&dt(e,"opacity",([d])=>u[d]),f&&Gz(e,([d])=>f[d],t),r||Qit(e,i)}function Jit({ariaLabel:e,title:t,fill:r,fillOpacity:n,stroke:i,strokeOpacity:o,strokeWidth:s,opacity:a,href:c},{tip:l}){return[e,l?void 0:t,r,n,i,o,s,a,c].filter(u=>u!==void 0)}function i0(e,t,r){let n=Hr(e,i=>t[i]);return r===void 0&&n.size>1+e.length>>1&&mn("Warning: the implicit z channel has high cardinality. This may occur when the fill or stroke channel is associated with quantitative data rather than ordinal or categorical data. You can suppress this warning by setting the z option explicitly; if this data represents a single series, set z to null."),n.values()}function*NS(e,t,r,n){let{z:i}=r,{z:o}=n,s=Jit(n,r),a=[...t,...s];for(let c of o?i0(e,o,i):[e]){let l,u;t:for(let f of c){for(let d of a)if(!Pe(d[f])){u&&u.push(-1);continue t}if(l===void 0){u&&(yield u),l=s.map(d=>Zi(d[f])),u=[f];continue}u.push(f);for(let d=0;d<s.length;++d)if(Zi(s[d][f])!==l[d]){yield u,l=s.map(p=>Zi(p[f])),u=[f];continue t}}u&&(yield u)}}function tot(e,t,r,n){let i,{clip:o=n.clip}=t;switch(o){case"frame":{e=lt("svg:g",n).each(function(){this.appendChild(e.node()),e.node=()=>this}),i=eot(n,r);break}case"sphere":{i=rot(n);break}}dt(e,"aria-label",t.ariaLabel),dt(e,"aria-description",t.ariaDescription),dt(e,"aria-hidden",t.ariaHidden),dt(e,"clip-path",i)}function Wz(e){let t=new WeakMap;return(r,n)=>{let i=t.get(r);if(!i){let o=cN();Qt(r.ownerSVGElement).append("clipPath").attr("id",o).call(e,r,n),t.set(r,i=`url(#${o})`)}return i}}var eot=Wz((e,t,r)=>{let{width:n,height:i,marginLeft:o,marginRight:s,marginTop:a,marginBottom:c}=r;e.append("rect").attr("x",o).attr("y",a).attr("width",n-s-o).attr("height",i-a-c)}),rot=Wz((e,t)=>{let{projection:r}=t;if(!r)throw new Error('the "sphere" clip option requires a projection');e.append("path").attr("d",Dr(r)({type:"Sphere"}))});function kt(e,t,r,n){tot(e,t,r,n),dt(e,"class",t.className),dt(e,"fill",t.fill),dt(e,"fill-opacity",t.fillOpacity),dt(e,"stroke",t.stroke),dt(e,"stroke-width",t.strokeWidth),dt(e,"stroke-opacity",t.strokeOpacity),dt(e,"stroke-linejoin",t.strokeLinejoin),dt(e,"stroke-linecap",t.strokeLinecap),dt(e,"stroke-miterlimit",t.strokeMiterlimit),dt(e,"stroke-dasharray",t.strokeDasharray),dt(e,"stroke-dashoffset",t.strokeDashoffset),dt(e,"shape-rendering",t.shapeRendering),dt(e,"filter",t.imageFilter),dt(e,"paint-order",t.paintOrder);let{pointerEvents:i=n.pointerSticky===!1?"none":void 0}=t;dt(e,"pointer-events",i)}function Mt(e,t){not(e,"mix-blend-mode",t.mixBlendMode),dt(e,"opacity",t.opacity)}function Gz(e,t,r){e.each(function(n){let i=t(n);if(i!=null){let o=this.ownerDocument.createElementNS(An.svg,"a");o.setAttribute("fill","inherit"),o.setAttributeNS(An.xlink,"href",i),r!=null&&o.setAttribute("target",r),this.parentNode.insertBefore(o,this).appendChild(this)}})}function dt(e,t,r){r!=null&&e.attr(t,r)}function not(e,t,r){r!=null&&e.style(t,r)}function Rt(e,t,{x:r,y:n},i=We,o=We){i+=t.dx,o+=t.dy,r?.bandwidth&&(i+=r.bandwidth()/2),n?.bandwidth&&(o+=n.bandwidth()/2),(i||o)&&e.attr("transform",`translate(${i},${o})`)}function Oe(e,t){if((e=rr(e))!==t)return e}function n0(e,t){if((e=ie(e))!==t)return e}var iot=/^-?([_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 gl(e){if(e===void 0)return"plot-d6a7b5";if(e=`${e}`,!iot.test(e))throw new Error(`invalid class name: ${e}`);return e}function Rh(e,t){if(typeof t=="string")e.property("style",t);else if(t!=null)for(let r of e)Object.assign(r.style,t)}function Ur({frameAnchor:e},{width:t,height:r,marginTop:n,marginRight:i,marginBottom:o,marginLeft:s}){return[/left$/.test(e)?s:/right$/.test(e)?t-i:(s+t-i)/2,/^top/.test(e)?n:/^bottom/.test(e)?r-o:(n+r-o)/2]}var vt=class{constructor(t,r={},n={},i){let{facet:o="auto",facetAnchor:s,fx:a,fy:c,sort:l,dx:u=0,dy:f=0,margin:d=0,marginTop:h=d,marginRight:p=d,marginBottom:m=d,marginLeft:y=d,className:g,clip:x=i?.clip,channels:b,tip:_,render:v}=n;if(this.data=t,this.sort=Ss(l)?l:null,this.initializer=Ne(n).initializer,this.transform=this.initializer?n.transform:mr(n).transform,o===null||o===!1?this.facet=null:(this.facet=Sr(o===!0?"include":o,"facet",["auto","include","exclude","super"]),this.fx=t===ol&&typeof a=="string"?[a]:a,this.fy=t===ol&&typeof c=="string"?[c]:c),this.facetAnchor=kz(s),r=Xg(r),b!==void 0&&(r={...oot(b),...r}),i!==void 0&&(r={...MS(this,n,i),...r}),this.channels=Object.fromEntries(Object.entries(r).map(([w,T])=>{if(bi(T.value)){let{value:A,label:E=T.label,scale:N=T.scale}=T.value;T={...T,label:E,scale:N,value:A}}if(t===ol&&typeof T.value=="string"){let{value:A}=T;T={...T,value:[A]}}return[w,T]}).filter(([w,{value:T,optional:A}])=>{if(T!=null)return!0;if(A)return!1;throw new Error(`missing channel value: ${w}`)})),this.dx=+u,this.dy=+f,this.marginTop=+h,this.marginRight=+p,this.marginBottom=+m,this.marginLeft=+y,this.clip=aS(x),this.tip=sot(_),this.className=g?gl(g):null,this.facet==="super"){if(a||c)throw new Error("super-faceting cannot use fx or fy");for(let w in this.channels){let{scale:T}=r[w];if(!(T!=="x"&&T!=="y"))throw new Error("super-faceting cannot use x or y")}}v!=null&&(this.render=nc(v,this.render))}initialize(t,r,n){let i=Xa(this.data);t===void 0&&i!=null&&(t=[Cn(i)]);let o=t;this.transform!=null&&({facets:t,data:i}=this.transform(i,t,n),i=Xa(i)),t!==void 0&&(t.original=o);let s=mS(this.channels,i);return this.sort!=null&&$$(i,t,s,r,this.sort),{data:i,facets:t,channels:s}}filter(t,r,n){for(let i in r){let{filter:o=Pe}=r[i];if(o!==null){let s=n[i];t=t.filter(a=>o(s[a]))}}return t}project(t,r,n){for(let i in t)if(t[i].scale==="x"&&/^x|x$/.test(i)){let o=i.replace(/^x|x$/,"y");o in t&&t[o].scale==="y"&&oN(i,o,r,n.projection)}}scale(t,r,n){let i=Th(t,r);return n.projection&&this.project(t,i,n),i}};function yr(...e){return e.plot=vt.prototype.plot,e}function nc(e,t){if(e==null)return t===null?void 0:t;if(t==null)return e===null?void 0:e;if(typeof e!="function")throw new TypeError(`invalid render transform: ${e}`);if(typeof t!="function")throw new TypeError(`invalid render transform: ${t}`);return function(r,n,i,o,s,a){return e.call(this,r,n,i,o,s,(c,l,u,f,d)=>t.call(this,c,l,u,f,d,a))}}function oot(e){return Object.fromEntries(Object.entries(Xg(e)).map(([t,r])=>(r=typeof r=="string"?{value:r,label:t}:Ki(r),r.filter===void 0&&r.scale==null&&(r={...r,filter:null}),[t,r])))}function sot(e){return e===!0?"xy":e===!1||e==null?null:typeof e=="string"?Sr(e,"tip",["x","y","xy"]):e}function Do(e,t){return e?.tip===!0?{...e,tip:t}:kr(e?.tip)&&e.tip.pointer===void 0?{...e,tip:{...e.tip,pointer:t}}:e}function Hz(e,t,r={}){let n=.5-We,i=.5+We,o=.5+We,s=.5-We;for(let{marginTop:m,marginRight:y,marginBottom:g,marginLeft:x}of t)m>n&&(n=m),y>i&&(i=y),g>o&&(o=g),x>s&&(s=x);let{margin:a,marginTop:c=a!==void 0?a:n,marginRight:l=a!==void 0?a:i,marginBottom:u=a!==void 0?a:o,marginLeft:f=a!==void 0?a:s}=r;c=+c,l=+l,u=+u,f=+f;let{width:d=640,height:h=aot(e,r,{width:d,marginTopDefault:n,marginRightDefault:i,marginBottomDefault:o,marginLeftDefault:s})+Math.max(0,c-n+u-o)}=r;d=+d,h=+h;let p={width:d,height:h,marginTop:c,marginRight:l,marginBottom:u,marginLeft:f};if(e.fx||e.fy){let{margin:m,marginTop:y=m!==void 0?m:c,marginRight:g=m!==void 0?m:l,marginBottom:x=m!==void 0?m:u,marginLeft:b=m!==void 0?m:f}=r.facet??{};y=+y,g=+g,x=+x,b=+b,p.facet={marginTop:y,marginRight:g,marginBottom:x,marginLeft:b}}return p}function aot({x:e,y:t,fy:r,fx:n},{projection:i,aspectRatio:o},{width:s,marginTopDefault:a,marginRightDefault:c,marginBottomDefault:l,marginLeftDefault:u}){let f=r&&r.scale.domain().length||1,d=zz(i);if(d){let p=n?n.scale.domain().length:1,m=(1.1*f-.1)/(1.1*p-.1)*d,y=Math.max(.1,Math.min(10,m));return Math.round((s-u-c)*y+a+l)}let h=t?Ms(t)?t.scale.domain().length||1:Math.max(7,17/f):1;if(o!=null){if(o=+o,!(isFinite(o)&&o>0))throw new Error(`invalid aspectRatio: ${o}`);let p=Xz("y",t)/(Xz("x",e)*o),m=n?n.scale.bandwidth():1,y=r?r.scale.bandwidth():1,g=m*(s-u-c)-e.insetLeft-e.insetRight;return(p*g+t.insetTop+t.insetBottom)/y+a+l}return!!(t||r)*Math.max(1,Math.min(60,h*f))*20+!!n*30+60}function Xz(e,t){if(!t)throw new Error(`aspectRatio requires ${e} scale`);let{type:r,domain:n}=t,i;switch(r){case"linear":case"utc":case"time":i=Number;break;case"pow":{let a=t.scale.exponent();i=c=>Math.pow(c,a);break}case"log":i=Math.log;break;case"point":case"band":return n.length;default:throw new Error(`unsupported ${e} scale for aspectRatio: ${r}`)}let[o,s]=ce(n);return Math.abs(i(s)-i(o))}var Qz=new WeakMap;function lN(e,t,{x:r,y:n,px:i,py:o,maxRadius:s=40,channels:a,render:c,...l}={}){return s=+s,i!=null&&(r??=null,a={...a,px:{value:i,scale:"x"}}),o!=null&&(n??=null,a={...a,py:{value:o,scale:"y"}}),{x:r,y:n,channels:a,...l,render:nc(function(u,f,d,h,p,m){p={...p,pointerSticky:!1};let y=p.ownerSVGElement,{data:g}=p.getMarkState(this),x=Qz.get(y);x||Qz.set(y,x={sticky:!1,roots:[],renders:[]});let b=x.renders.push(X)-1,{x:_,y:v,fx:w,fy:T}=f,A=w?w(u.fx)-h.marginLeft:0,E=T?T(u.fy)-h.marginTop:0;_?.bandwidth&&(A+=_.bandwidth()/2),v?.bandwidth&&(E+=v.bandwidth()/2);let N=u.fi!=null,I;if(N){let Y=x.facetStates;Y||(x.facetStates=Y=new Map),I=Y.get(this),I||Y.set(this,I=new Map)}let[R,C]=Ur(this,h),{px:S,py:M}=d,O=S?Y=>S[Y]:uN(d,R),L=M?Y=>M[Y]:fN(d,C),B,k,P,U;function $(Y,st){if(N)if(U&&(U=cancelAnimationFrame(U)),Y==null)I.delete(u.fi);else{I.set(u.fi,st),U=requestAnimationFrame(()=>{U=null;for(let[q,H]of I)if(H<st||H===st&&q<u.fi){Y=null;break}X(Y)});return}X(Y)}function X(Y){if(B===Y&&P===x.sticky)return;B=Y,P=p.pointerSticky=x.sticky;let st=B==null?[]:[B];N&&(st.fx=u.fx,st.fy=u.fy,st.fi=u.fi);let q=m(st,f,d,h,p);if(k){if(N){let H=k.parentNode,nt=k.getAttribute("transform"),z=q.getAttribute("transform");nt?q.setAttribute("transform",nt):q.removeAttribute("transform"),z?H.setAttribute("transform",z):H.removeAttribute("transform"),q.removeAttribute("aria-label"),q.removeAttribute("aria-description"),q.removeAttribute("aria-hidden")}k.replaceWith(q)}if(x.roots[b]=k=q,!(B==null&&I?.size>1)){let H=B==null?null:Qn(g)?g[B]:g.get(B);p.dispatchValue(H)}return q}function rt(Y){if(x.sticky||Y.pointerType==="mouse"&&Y.buttons===1)return;let[st,q]=an(Y);st-=A,q-=E;let H=st<h.marginLeft||st>h.width-h.marginRight?1:e,nt=q<h.marginTop||q>h.height-h.marginBottom?1:t,z=null,Pt=s*s;for(let ht of u){let Zt=H*(O(ht)-st),Jt=nt*(L(ht)-q),tt=Zt*Zt+Jt*Jt;tt<=Pt&&(z=ht,Pt=tt)}if(z!=null&&(e!==1||t!==1)){let ht=O(z)-st,Zt=L(z)-q;Pt=ht*ht+Zt*Zt}$(z,Pt)}function ot(Y){Y.pointerType==="mouse"&&B!=null&&(x.sticky&&x.roots.some(st=>st?.contains(Y.target))||(x.sticky?(x.sticky=!1,x.renders.forEach(st=>st(null))):(x.sticky=!0,X(B)),Y.stopImmediatePropagation()))}function at(Y){Y.pointerType==="mouse"&&(x.sticky||$(null))}return y.addEventListener("pointerenter",rt),y.addEventListener("pointermove",rt),y.addEventListener("pointerdown",ot),y.addEventListener("pointerleave",at),X(null)},c)}}function xl(e){return lN(1,1,e)}function bl(e){return lN(1,.01,e)}function ic(e){return lN(.01,1,e)}function uN({x1:e,x2:t,x:r=e},n){return e&&t?i=>(e[i]+t[i])/2:r?i=>r[i]:()=>n}function fN({y1:e,y2:t,y:r=e},n){return e&&t?i=>(e[i]+t[i])/2:r?i=>r[i]:()=>n}function OS(e){return Ms(e)&&e.interval===void 0?void 0:"tabular-nums"}function Zz(e,t){let{label:r=e.label,tickSize:n=6,width:i=240,height:o=44+n,marginTop:s=18,marginRight:a=0,marginBottom:c=16+n,marginLeft:l=0,style:u,ticks:f=(i-l-a)/64,tickFormat:d,fontVariant:h=OS(e),round:p=!0,opacity:m,className:y}=t,g=ml(t);y=gl(y),m=ye(m)[1],d===null&&(d=()=>null);let x=lt("svg",g).attr("class",`${y}-ramp`).attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("width",i).attr("height",o).attr("viewBox",`0 0 ${i} ${o}`).call(R=>R.append("style").text(`:where(.${y}-ramp) {
17
17
  display: block;
18
18
  height: auto;
19
19
  height: intrinsic;
@@ -22,9 +22,9 @@ ${r}`}function $nt(e){return e==="time"?J2:e==="utc"?qg:Pnt}function o$(e,t,r){l
22
22
  }
23
23
  :where(.${y}-ramp text) {
24
24
  white-space: pre;
25
- }`)).call(Dh,u),b=R=>R.selectAll(".tick line").attr("y1",s+c-o),_,v=p?(R,C)=>R.rangeRound(C):(R,C)=>R.range(C),{type:w,domain:T,range:A,interpolate:E,scale:N,pivot:I}=e;if(E){let R=A===void 0?E:ss(E.length===1?e0(E):E,A);_=v(N.copy(),cn(Fe(l,i-a),Math.min(T.length+(I!==void 0),A===void 0?1/0:A.length)));let C=256,S=g.document.createElement("canvas");S.width=C,S.height=1;let M=S.getContext("2d");for(let O=0,L=C-1;O<C;++O)M.fillStyle=R(O/L),M.fillRect(O,0,1,1);x.append("image").attr("opacity",m).attr("x",l).attr("y",s).attr("width",i-l-a).attr("height",o-s-c).attr("preserveAspectRatio","none").attr("xlink:href",S.toDataURL())}else if(w==="threshold"){let R=T,C=d===void 0?S=>S:typeof d=="string"?Yi(d):d;_=v(Ba().domain([-1,A.length-1]),[l,i-a]),x.append("g").attr("fill-opacity",m).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=Xt(R,(S,M)=>M),d=S=>C(R[S],S)}else _=v(Zc().domain(T),[l,i-a]),x.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",N),b=()=>{};return x.append("g").attr("transform",`translate(0,${o-c})`).call(yM(_).ticks(Array.isArray(f)?null:f,typeof d=="string"?d:void 0).tickFormat(typeof d=="function"?d:void 0).tickSize(n).tickValues(Array.isArray(f)?f:null)).attr("font-size",null).attr("font-family",null).attr("font-variant",Oe(h,"normal")).call(b).call(R=>R.select(".domain").remove()),r!==void 0&&x.append("text").attr("x",l).attr("y",s-6).attr("fill","currentColor").attr("font-weight","bold").text(r),x.node()}var Lh=Math.PI/180;function Lo(e,{marker:t,markerStart:r=t,markerMid:n=t,markerEnd:i=t}={}){e.markerStart=dN(r),e.markerMid=dN(n),e.markerEnd=dN(i)}function dN(e){if(e==null||e===!1)return null;if(e===!0)return Zz;if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"none":return null;case"arrow":return Qz("auto");case"arrow-reverse":return Qz("auto-start-reverse");case"dot":return sot;case"circle":case"circle-fill":return Zz;case"circle-stroke":return aot;case"tick":return hN("auto");case"tick-x":return hN(90);case"tick-y":return hN(0)}throw new Error(`invalid marker: ${e}`)}function Qz(e){return(t,r)=>lt("svg:marker",r).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("orient",e).attr("fill","none").attr("stroke",t).attr("stroke-width",1.5).attr("stroke-linecap","round").attr("stroke-linejoin","round").call(n=>n.append("path").attr("d","M-1.5,-3l3,3l-3,3")).node()}function sot(e,t){return lt("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",e).attr("stroke","none").call(r=>r.append("circle").attr("r",2.5)).node()}function Zz(e,t){return lt("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",e).attr("stroke","var(--plot-background)").attr("stroke-width",1.5).call(r=>r.append("circle").attr("r",3)).node()}function aot(e,t){return lt("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill","var(--plot-background)").attr("stroke",e).attr("stroke-width",1.5).call(r=>r.append("circle").attr("r",3)).node()}function hN(e){return(t,r)=>lt("svg:marker",r).attr("viewBox","-3 -3 6 6").attr("markerWidth",6).attr("markerHeight",6).attr("orient",e).attr("stroke",t).call(n=>n.append("path").attr("d","M0,-3v6")).node()}var cot=0;function oc(e,t,{stroke:r},n){return tj(e,t,r&&(i=>r[i]),null,n)}function Kz(e,t,{stroke:r,z:n},i){return tj(e,t,r&&(([o])=>r[o]),n,i)}var pN=1,Jz=2;function lot(e,t){let r=new Uint8Array(t.length),n=e.data().filter(o=>o.length>1),i=n.length;for(let o=0,s=AS;o<i;++o){let a=n[o];if(a.length>1){let c=a[0];s!==(s=Zi(t[c]))&&(r[c]|=pN)}}for(let o=i-1,s=AS;o>=0;--o){let a=n[o];if(a.length>1){let c=a[0];s!==(s=Zi(t[c]))&&(r[c]|=Jz)}}return([o])=>r[o]}function tj(e,{markerStart:t,markerMid:r,markerEnd:n,stroke:i},o=()=>i,s,a){if(!t&&!r&&!n)return;let c=new Map,l=s&&lot(e,s);function u(f,d,h){return function(p){if(h&&!h(p))return;let m=o(p),y=c.get(d);y||c.set(d,y=new Map);let g=y.get(m);if(!g){let x=this.parentNode.insertBefore(d(m,a),this),b=`plot-marker-${++cot}`;x.setAttribute("id",b),y.set(m,g=`url(#${b})`)}this.setAttribute(f,g)}}t&&e.each(u("marker-start",t,l&&(f=>l(f)&pN))),r&&l&&e.each(u("marker-start",r,f=>!(l(f)&pN))),r&&e.each(u("marker-mid",r)),n&&e.each(u("marker-end",n,l&&(f=>l(f)&Jz)))}function sf({inset:e,insetLeft:t,insetRight:r,...n}={}){return[t,r]=ej(e,t,r),{inset:e,insetLeft:t,insetRight:r,...n}}function af({inset:e,insetTop:t,insetBottom:r,...n}={}){return[t,r]=ej(e,t,r),{inset:e,insetTop:t,insetBottom:r,...n}}function ej(e,t,r){return e===void 0&&t===void 0&&r===void 0?We?[1,0]:[.5,.5]:[t,r]}function rj(e,{interval:t}){return e={...Ki(e)},e.interval=wh(e.interval===void 0?t:e.interval),e}function OS(e,t,r,n){let{[e]:i,[`${e}1`]:o,[`${e}2`]:s}=r,{value:a,interval:c}=rj(i,r);if(a==null||c==null&&!n)return r;let l=en(i);if(c==null){let h,p={transform:m=>h||(h=_t(m,a)),label:l};return{...r,[e]:void 0,[`${e}1`]:o===void 0?p:o,[`${e}2`]:s===void 0&&!(o===s&&n)?p:s}}let u,f;function d(h){return f!==void 0&&h===u?f:f=Xt(_t(u=h,a),p=>c.floor(p))}return t({...r,[e]:void 0,[`${e}1`]:o===void 0?{transform:d,label:l}:o,[`${e}2`]:s===void 0?{transform:h=>d(h).map(p=>c.offset(p)),label:l}:s})}function nj(e,t,r){let{[e]:n}=r,{value:i,interval:o}=rj(n,r);return i==null||o==null?r:t({...r,[e]:{label:en(n),transform:s=>{let a=Xt(_t(s,i),l=>o.floor(l)),c=a.map(l=>o.offset(l));return a.map(Ve(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 mN(e={}){return OS("x",sf,e,!0)}function yN(e={}){return OS("y",af,e,!0)}function Fh(e={}){return OS("x",sf,e)}function Ch(e={}){return OS("y",af,e)}function RS(e={}){return nj("x",sf,e)}function DS(e={}){return nj("y",af,e)}var ij={ariaLabel:"rule",fill:null,stroke:"currentColor"},o0=class extends vt{constructor(t,r={}){let{x:n,y1:i,y2:o,inset:s=0,insetTop:a=s,insetBottom:c=s}=r;super(t,{x:{value:n,scale:"x",optional:!0},y1:{value:i,scale:"y",optional:!0},y2:{value:o,scale:"y",optional:!0}},Do(r,"x"),ij),this.insetTop=ie(a),this.insetBottom=ie(c),Lo(this,r)}render(t,r,n,i,o){let{x:s,y:a}=r,{x:c,y1:l,y2:u}=n,{width:f,height:d,marginTop:h,marginRight:p,marginLeft:m,marginBottom:y}=i,{insetTop:g,insetBottom:x}=this;return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,{x:c&&s},We,0).call(b=>b.selectAll().data(t).enter().append("line").call(Et,this).attr("x1",c?_=>c[_]:(m+f-p)/2).attr("x2",c?_=>c[_]:(m+f-p)/2).attr("y1",l&&!wi(a)?_=>l[_]+g:h+g).attr("y2",u&&!wi(a)?a.bandwidth?_=>u[_]+a.bandwidth()-x:_=>u[_]-x:d-y-x).call(Wt,this,n).call(oc,this,n,o)).node()}},s0=class extends vt{constructor(t,r={}){let{x1:n,x2:i,y:o,inset:s=0,insetRight:a=s,insetLeft:c=s}=r;super(t,{y:{value:o,scale:"y",optional:!0},x1:{value:n,scale:"x",optional:!0},x2:{value:i,scale:"x",optional:!0}},Do(r,"y"),ij),this.insetRight=ie(a),this.insetLeft=ie(c),Lo(this,r)}render(t,r,n,i,o){let{x:s,y:a}=r,{y:c,x1:l,x2:u}=n,{width:f,height:d,marginTop:h,marginRight:p,marginLeft:m,marginBottom:y}=i,{insetLeft:g,insetRight:x}=this;return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,{y:c&&a},0,We).call(b=>b.selectAll().data(t).enter().append("line").call(Et,this).attr("x1",l&&!wi(s)?_=>l[_]+g:m+g).attr("x2",u&&!wi(s)?s.bandwidth?_=>u[_]+s.bandwidth()-x:_=>u[_]-x:f-p-x).attr("y1",c?_=>c[_]:(h+d-y)/2).attr("y2",c?_=>c[_]:(h+d-y)/2).call(Wt,this,n).call(oc,this,n,o)).node()}};function vi(e,t){let{x:r=G,y:n,y1:i,y2:o,...s}=Ch(t);return[i,o]=oj(n,i,o),new o0(e,{...s,x:r,y1:i,y2:o})}function Si(e,t){let{y:r=G,x:n,x1:i,x2:o,...s}=Fh(t);return[i,o]=oj(n,i,o),new s0(e,{...s,y:r,x1:i,x2:o})}function oj(e,t,r){if(e==null){if(t===void 0){if(r!==void 0)return[0,r]}else if(r===void 0)return[0,t]}else{if(t===void 0)return r===void 0?[0,e]:[e,r];if(r===void 0)return[e,t]}return[t,r]}function Fo(e,...t){let r=t.length;for(let n=0,i=!0;n<r;++n)typeof t[n]!="function"&&(i&&(e=e.slice(),i=!1),e.splice(n,2,e[n]+t[n]+e[n+1]),t.splice(n,1),--n,--r);return n=>{let i=e[0];for(let o=0;o<r;++o)i+=t[o](n)+e[o+1];return i}}var uot={ariaLabel:"text",strokeLinejoin:"round",strokeWidth:3,paintOrder:"stroke"},uj="\xAD",lf=class extends vt{constructor(t,r={}){let{x:n,y:i,text:o=kn(t)&&nS(t)?G:Ee,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:y,fontWeight:g,rotate:x}=r,[b,_]=ye(x,0),[v,w]=pot(p);if(super(t,{x:{value:n,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},fontSize:{value:v,optional:!0},rotate:{value:h$(b),optional:!0},text:{value:o,filter:zg,optional:!0}},r,uot),this.rotate=_,this.textAnchor=Oe(a,"middle"),this.lineAnchor=Sr(c,"lineAnchor",["top","middle","bottom"]),this.lineHeight=+l,this.lineWidth=+u,this.textOverflow=xN(f),this.monospace=!!d,this.fontFamily=rr(h),this.fontSize=w,this.fontStyle=rr(m),this.fontVariant=rr(y),this.fontWeight=rr(g),this.frameAnchor=Ts(s),!(this.lineWidth>=0))throw new Error(`invalid lineWidth: ${u}`);this.splitLines=_N(this),this.clipLine=wN(this)}render(t,r,n,i,o){let{x:s,y:a}=r,{x:c,y:l,rotate:u,text:f,title:d,fontSize:h}=n,{rotate:p}=this,[m,y]=Ur(this,i);return lt("svg:g",o).call(kt,this,i,o).call(bN,this,f,i).call(Rt,this,{x:c&&s,y:l&&a}).call(g=>g.selectAll().data(t).enter().append("text").call(Et,this).call(fot,this,f,d).attr("transform",Fo`translate(${c?x=>c[x]:m},${l?x=>l[x]:y})${u?x=>` rotate(${u[x]})`:p?` rotate(${p})`:""}`).call(dt,"font-size",h&&(x=>h[x])).call(Wt,this,n)).node()}};function xN(e){return e==null?null:Sr(e,"textOverflow",["clip","ellipsis","clip-start","clip-end","ellipsis-start","ellipsis-middle","ellipsis-end"]).replace(/^(clip|ellipsis)$/,"$1-end")}function fot(e,t,r,n){if(!r)return;let{lineAnchor:i,lineHeight:o,textOverflow:s,splitLines:a,clipLine:c}=t;e.each(function(l){let u=a(Os(r[l])??"").map(c),f=u.length,d=i==="top"?.71:i==="bottom"?1-f:(164-f*100)/200;if(f>1){let h=0;for(let p=0;p<f;++p){if(++h,!u[p])continue;let m=this.ownerDocument.createElementNS(An.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&&!n&&u[0]!==r[l]){let h=this.ownerDocument.createElementNS(An.svg,"title");h.textContent=r[l],this.appendChild(h)}})}function Rs(e,{x:t,y:r,...n}={}){return n.frameAnchor===void 0&&([t,r]=Ke(t,r)),new lf(e,{...n,x:t,y:r})}function LS(e,{x:t=G,...r}={}){return new lf(e,DS({...r,x:t}))}function FS(e,{y:t=G,...r}={}){return new lf(e,RS({...r,y:t}))}function bN(e,t,r){dt(e,"text-anchor",t.textAnchor),dt(e,"font-family",t.fontFamily),dt(e,"font-size",t.fontSize),dt(e,"font-style",t.fontStyle),dt(e,"font-variant",t.fontVariant===void 0?dot(r):t.fontVariant),dt(e,"font-weight",t.fontWeight)}function dot(e){return e&&(Za(e)||Ve(e))?"tabular-nums":void 0}var hot=new Set(["inherit","initial","revert","unset","xx-small","x-small","small","medium","large","x-large","xx-large","xxx-large","larger","smaller"]);function pot(e){return e==null||typeof e=="number"?[void 0,e]:typeof e!="string"?[e,void 0]:(e=e.trim().toLowerCase(),hot.has(e)||/^[+-]?\d*\.?\d+(e[+-]?\d+)?(\w*|%)$/.test(e)?[void 0,e]:[e,void 0])}function mot(e,t,r){let n=[],i,o=0;for(let[s,a,c]of yot(e)){if(i===void 0&&(i=s),o>i&&r(e,i,a)>t&&(n.push(e.slice(i,o)+(e[o-1]===uj?"-":"")),i=s),c){n.push(e.slice(i,a)),i=void 0;continue}o=a}return n}function*yot(e){let t=0,r=0,n=e.length;for(;r<n;){let i=1;switch(e[r]){case uj:case"-":++r,yield[t,r,!1],t=r;break;case" ":for(yield[t,r,!1];e[++r]===" ";);t=r;break;case"\r":e[r+1]===`
25
+ }`)).call(Rh,u),b=R=>R.selectAll(".tick line").attr("y1",s+c-o),_,v=p?(R,C)=>R.rangeRound(C):(R,C)=>R.range(C),{type:w,domain:T,range:A,interpolate:E,scale:N,pivot:I}=e;if(E){let R=A===void 0?E:ss(E.length===1?e0(E):E,A);_=v(N.copy(),cn(Fe(l,i-a),Math.min(T.length+(I!==void 0),A===void 0?1/0:A.length)));let C=256,S=g.document.createElement("canvas");S.width=C,S.height=1;let M=S.getContext("2d");for(let O=0,L=C-1;O<C;++O)M.fillStyle=R(O/L),M.fillRect(O,0,1,1);x.append("image").attr("opacity",m).attr("x",l).attr("y",s).attr("width",i-l-a).attr("height",o-s-c).attr("preserveAspectRatio","none").attr("xlink:href",S.toDataURL())}else if(w==="threshold"){let R=T,C=d===void 0?S=>S:typeof d=="string"?Yi(d):d;_=v(Ba().domain([-1,A.length-1]),[l,i-a]),x.append("g").attr("fill-opacity",m).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=Xt(R,(S,M)=>M),d=S=>C(R[S],S)}else _=v(Kc().domain(T),[l,i-a]),x.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",N),b=()=>{};return x.append("g").attr("transform",`translate(0,${o-c})`).call(yM(_).ticks(Array.isArray(f)?null:f,typeof d=="string"?d:void 0).tickFormat(typeof d=="function"?d:void 0).tickSize(n).tickValues(Array.isArray(f)?f:null)).attr("font-size",null).attr("font-family",null).attr("font-variant",Oe(h,"normal")).call(b).call(R=>R.select(".domain").remove()),r!==void 0&&x.append("text").attr("x",l).attr("y",s-6).attr("fill","currentColor").attr("font-weight","bold").text(r),x.node()}var Dh=Math.PI/180;function Lo(e,{marker:t,markerStart:r=t,markerMid:n=t,markerEnd:i=t}={}){e.markerStart=dN(r),e.markerMid=dN(n),e.markerEnd=dN(i)}function dN(e){if(e==null||e===!1)return null;if(e===!0)return Jz;if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"none":return null;case"arrow":return Kz("auto");case"arrow-reverse":return Kz("auto-start-reverse");case"dot":return cot;case"circle":case"circle-fill":return Jz;case"circle-stroke":return lot;case"tick":return hN("auto");case"tick-x":return hN(90);case"tick-y":return hN(0)}throw new Error(`invalid marker: ${e}`)}function Kz(e){return(t,r)=>lt("svg:marker",r).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("orient",e).attr("fill","none").attr("stroke",t).attr("stroke-width",1.5).attr("stroke-linecap","round").attr("stroke-linejoin","round").call(n=>n.append("path").attr("d","M-1.5,-3l3,3l-3,3")).node()}function cot(e,t){return lt("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",e).attr("stroke","none").call(r=>r.append("circle").attr("r",2.5)).node()}function Jz(e,t){return lt("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",e).attr("stroke","var(--plot-background)").attr("stroke-width",1.5).call(r=>r.append("circle").attr("r",3)).node()}function lot(e,t){return lt("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill","var(--plot-background)").attr("stroke",e).attr("stroke-width",1.5).call(r=>r.append("circle").attr("r",3)).node()}function hN(e){return(t,r)=>lt("svg:marker",r).attr("viewBox","-3 -3 6 6").attr("markerWidth",6).attr("markerHeight",6).attr("orient",e).attr("stroke",t).call(n=>n.append("path").attr("d","M0,-3v6")).node()}var uot=0;function oc(e,t,{stroke:r},n){return rj(e,t,r&&(i=>r[i]),null,n)}function tj(e,t,{stroke:r,z:n},i){return rj(e,t,r&&(([o])=>r[o]),n,i)}var pN=1,ej=2;function fot(e,t){let r=new Uint8Array(t.length),n=e.data().filter(o=>o.length>1),i=n.length;for(let o=0,s=ES;o<i;++o){let a=n[o];if(a.length>1){let c=a[0];s!==(s=Zi(t[c]))&&(r[c]|=pN)}}for(let o=i-1,s=ES;o>=0;--o){let a=n[o];if(a.length>1){let c=a[0];s!==(s=Zi(t[c]))&&(r[c]|=ej)}}return([o])=>r[o]}function rj(e,{markerStart:t,markerMid:r,markerEnd:n,stroke:i},o=()=>i,s,a){if(!t&&!r&&!n)return;let c=new Map,l=s&&fot(e,s);function u(f,d,h){return function(p){if(h&&!h(p))return;let m=o(p),y=c.get(d);y||c.set(d,y=new Map);let g=y.get(m);if(!g){let x=this.parentNode.insertBefore(d(m,a),this),b=`plot-marker-${++uot}`;x.setAttribute("id",b),y.set(m,g=`url(#${b})`)}this.setAttribute(f,g)}}t&&e.each(u("marker-start",t,l&&(f=>l(f)&pN))),r&&l&&e.each(u("marker-start",r,f=>!(l(f)&pN))),r&&e.each(u("marker-mid",r)),n&&e.each(u("marker-end",n,l&&(f=>l(f)&ej)))}function sf({inset:e,insetLeft:t,insetRight:r,...n}={}){return[t,r]=nj(e,t,r),{inset:e,insetLeft:t,insetRight:r,...n}}function af({inset:e,insetTop:t,insetBottom:r,...n}={}){return[t,r]=nj(e,t,r),{inset:e,insetTop:t,insetBottom:r,...n}}function nj(e,t,r){return e===void 0&&t===void 0&&r===void 0?We?[1,0]:[.5,.5]:[t,r]}function ij(e,{interval:t}){return e={...Ki(e)},e.interval=_h(e.interval===void 0?t:e.interval),e}function RS(e,t,r,n){let{[e]:i,[`${e}1`]:o,[`${e}2`]:s}=r,{value:a,interval:c}=ij(i,r);if(a==null||c==null&&!n)return r;let l=en(i);if(c==null){let h,p={transform:m=>h||(h=_t(m,a)),label:l};return{...r,[e]:void 0,[`${e}1`]:o===void 0?p:o,[`${e}2`]:s===void 0&&!(o===s&&n)?p:s}}let u,f;function d(h){return f!==void 0&&h===u?f:f=Xt(_t(u=h,a),p=>c.floor(p))}return t({...r,[e]:void 0,[`${e}1`]:o===void 0?{transform:d,label:l}:o,[`${e}2`]:s===void 0?{transform:h=>d(h).map(p=>c.offset(p)),label:l}:s})}function oj(e,t,r){let{[e]:n}=r,{value:i,interval:o}=ij(n,r);return i==null||o==null?r:t({...r,[e]:{label:en(n),transform:s=>{let a=Xt(_t(s,i),l=>o.floor(l)),c=a.map(l=>o.offset(l));return a.map(Ve(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 mN(e={}){return RS("x",sf,e,!0)}function yN(e={}){return RS("y",af,e,!0)}function Lh(e={}){return RS("x",sf,e)}function Fh(e={}){return RS("y",af,e)}function DS(e={}){return oj("x",sf,e)}function LS(e={}){return oj("y",af,e)}var sj={ariaLabel:"rule",fill:null,stroke:"currentColor"},o0=class extends vt{constructor(t,r={}){let{x:n,y1:i,y2:o,inset:s=0,insetTop:a=s,insetBottom:c=s}=r;super(t,{x:{value:n,scale:"x",optional:!0},y1:{value:i,scale:"y",optional:!0},y2:{value:o,scale:"y",optional:!0}},Do(r,"x"),sj),this.insetTop=ie(a),this.insetBottom=ie(c),Lo(this,r)}render(t,r,n,i,o){let{x:s,y:a}=r,{x:c,y1:l,y2:u}=n,{width:f,height:d,marginTop:h,marginRight:p,marginLeft:m,marginBottom:y}=i,{insetTop:g,insetBottom:x}=this;return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,{x:c&&s},We,0).call(b=>b.selectAll().data(t).enter().append("line").call(Mt,this).attr("x1",c?_=>c[_]:(m+f-p)/2).attr("x2",c?_=>c[_]:(m+f-p)/2).attr("y1",l&&!wi(a)?_=>l[_]+g:h+g).attr("y2",u&&!wi(a)?a.bandwidth?_=>u[_]+a.bandwidth()-x:_=>u[_]-x:d-y-x).call(Wt,this,n).call(oc,this,n,o)).node()}},s0=class extends vt{constructor(t,r={}){let{x1:n,x2:i,y:o,inset:s=0,insetRight:a=s,insetLeft:c=s}=r;super(t,{y:{value:o,scale:"y",optional:!0},x1:{value:n,scale:"x",optional:!0},x2:{value:i,scale:"x",optional:!0}},Do(r,"y"),sj),this.insetRight=ie(a),this.insetLeft=ie(c),Lo(this,r)}render(t,r,n,i,o){let{x:s,y:a}=r,{y:c,x1:l,x2:u}=n,{width:f,height:d,marginTop:h,marginRight:p,marginLeft:m,marginBottom:y}=i,{insetLeft:g,insetRight:x}=this;return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,{y:c&&a},0,We).call(b=>b.selectAll().data(t).enter().append("line").call(Mt,this).attr("x1",l&&!wi(s)?_=>l[_]+g:m+g).attr("x2",u&&!wi(s)?s.bandwidth?_=>u[_]+s.bandwidth()-x:_=>u[_]-x:f-p-x).attr("y1",c?_=>c[_]:(h+d-y)/2).attr("y2",c?_=>c[_]:(h+d-y)/2).call(Wt,this,n).call(oc,this,n,o)).node()}};function vi(e,t){let{x:r=G,y:n,y1:i,y2:o,...s}=Fh(t);return[i,o]=aj(n,i,o),new o0(e,{...s,x:r,y1:i,y2:o})}function Si(e,t){let{y:r=G,x:n,x1:i,x2:o,...s}=Lh(t);return[i,o]=aj(n,i,o),new s0(e,{...s,y:r,x1:i,x2:o})}function aj(e,t,r){if(e==null){if(t===void 0){if(r!==void 0)return[0,r]}else if(r===void 0)return[0,t]}else{if(t===void 0)return r===void 0?[0,e]:[e,r];if(r===void 0)return[e,t]}return[t,r]}function Fo(e,...t){let r=t.length;for(let n=0,i=!0;n<r;++n)typeof t[n]!="function"&&(i&&(e=e.slice(),i=!1),e.splice(n,2,e[n]+t[n]+e[n+1]),t.splice(n,1),--n,--r);return n=>{let i=e[0];for(let o=0;o<r;++o)i+=t[o](n)+e[o+1];return i}}var dot={ariaLabel:"text",strokeLinejoin:"round",strokeWidth:3,paintOrder:"stroke"},dj="\xAD",lf=class extends vt{constructor(t,r={}){let{x:n,y:i,text:o=kn(t)&&iS(t)?G:Ee,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:y,fontWeight:g,rotate:x}=r,[b,_]=ye(x,0),[v,w]=yot(p);if(super(t,{x:{value:n,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},fontSize:{value:v,optional:!0},rotate:{value:m$(b),optional:!0},text:{value:o,filter:zg,optional:!0}},r,dot),this.rotate=_,this.textAnchor=Oe(a,"middle"),this.lineAnchor=Sr(c,"lineAnchor",["top","middle","bottom"]),this.lineHeight=+l,this.lineWidth=+u,this.textOverflow=xN(f),this.monospace=!!d,this.fontFamily=rr(h),this.fontSize=w,this.fontStyle=rr(m),this.fontVariant=rr(y),this.fontWeight=rr(g),this.frameAnchor=Ts(s),!(this.lineWidth>=0))throw new Error(`invalid lineWidth: ${u}`);this.splitLines=_N(this),this.clipLine=wN(this)}render(t,r,n,i,o){let{x:s,y:a}=r,{x:c,y:l,rotate:u,text:f,title:d,fontSize:h}=n,{rotate:p}=this,[m,y]=Ur(this,i);return lt("svg:g",o).call(kt,this,i,o).call(bN,this,f,i).call(Rt,this,{x:c&&s,y:l&&a}).call(g=>g.selectAll().data(t).enter().append("text").call(Mt,this).call(hot,this,f,d).attr("transform",Fo`translate(${c?x=>c[x]:m},${l?x=>l[x]:y})${u?x=>` rotate(${u[x]})`:p?` rotate(${p})`:""}`).call(dt,"font-size",h&&(x=>h[x])).call(Wt,this,n)).node()}};function xN(e){return e==null?null:Sr(e,"textOverflow",["clip","ellipsis","clip-start","clip-end","ellipsis-start","ellipsis-middle","ellipsis-end"]).replace(/^(clip|ellipsis)$/,"$1-end")}function hot(e,t,r,n){if(!r)return;let{lineAnchor:i,lineHeight:o,textOverflow:s,splitLines:a,clipLine:c}=t;e.each(function(l){let u=a(Os(r[l])??"").map(c),f=u.length,d=i==="top"?.71:i==="bottom"?1-f:(164-f*100)/200;if(f>1){let h=0;for(let p=0;p<f;++p){if(++h,!u[p])continue;let m=this.ownerDocument.createElementNS(An.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&&!n&&u[0]!==r[l]){let h=this.ownerDocument.createElementNS(An.svg,"title");h.textContent=r[l],this.appendChild(h)}})}function Rs(e,{x:t,y:r,...n}={}){return n.frameAnchor===void 0&&([t,r]=Ke(t,r)),new lf(e,{...n,x:t,y:r})}function FS(e,{x:t=G,...r}={}){return new lf(e,LS({...r,x:t}))}function CS(e,{y:t=G,...r}={}){return new lf(e,DS({...r,y:t}))}function bN(e,t,r){dt(e,"text-anchor",t.textAnchor),dt(e,"font-family",t.fontFamily),dt(e,"font-size",t.fontSize),dt(e,"font-style",t.fontStyle),dt(e,"font-variant",t.fontVariant===void 0?pot(r):t.fontVariant),dt(e,"font-weight",t.fontWeight)}function pot(e){return e&&(Za(e)||Ve(e))?"tabular-nums":void 0}var mot=new Set(["inherit","initial","revert","unset","xx-small","x-small","small","medium","large","x-large","xx-large","xxx-large","larger","smaller"]);function yot(e){return e==null||typeof e=="number"?[void 0,e]:typeof e!="string"?[e,void 0]:(e=e.trim().toLowerCase(),mot.has(e)||/^[+-]?\d*\.?\d+(e[+-]?\d+)?(\w*|%)$/.test(e)?[void 0,e]:[e,void 0])}function got(e,t,r){let n=[],i,o=0;for(let[s,a,c]of xot(e)){if(i===void 0&&(i=s),o>i&&r(e,i,a)>t&&(n.push(e.slice(i,o)+(e[o-1]===dj?"-":"")),i=s),c){n.push(e.slice(i,a)),i=void 0;continue}o=a}return n}function*xot(e){let t=0,r=0,n=e.length;for(;r<n;){let i=1;switch(e[r]){case dj:case"-":++r,yield[t,r,!1],t=r;break;case" ":for(yield[t,r,!1];e[++r]===" ";);t=r;break;case"\r":e[r+1]===`
26
26
  `&&++i;case`
27
- `:yield[t,r,!0],r+=i,t=r;break;default:++r;break}}yield[t,r,!0]}var sj={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 CS(e,t=0,r=e.length){let n=0;for(let i=t;i<r;i=kh(e,i))n+=sj[e[i]]??(dj(e,i)?120:sj.e);return n}function kS(e,t=0,r=e.length){let n=0;for(let i=t;i<r;i=kh(e,i))n+=dj(e,i)?126:63;return n}function _N({monospace:e,lineWidth:t,textOverflow:r}){if(r!=null||t==1/0)return o=>o.split(/\r\n?|\n/g);let n=e?kS:CS,i=t*100;return o=>mot(o,i,n)}function wN({monospace:e,lineWidth:t,textOverflow:r}){if(r==null||t==1/0)return o=>o;let n=e?kS:CS,i=t*100;switch(r){case"clip-start":return o=>cj(o,i,n,"");case"clip-end":return o=>aj(o,i,n,"");case"ellipsis-start":return o=>cj(o,i,n,cf);case"ellipsis-middle":return o=>got(o,i,n,cf);case"ellipsis-end":return o=>aj(o,i,n,cf)}}var cf="\u2026";function uf(e,t,r,n){let i=[],o=0;for(let s=0,a=0,c=e.length;s<c;s=a){a=kh(e,s);let l=r(e,s,a);if(o+l>t){for(o+=n;o>t&&s>0;)a=s,s=i.pop(),o-=r(e,s,a);return[s,t-o]}o+=l,i.push(s)}return[-1,0]}function aj(e,t,r,n){e=e.trim();let i=r(n),[o]=uf(e,t,r,i);return o<0?e:e.slice(0,o).trimEnd()+n}function got(e,t,r,n){e=e.trim();let i=r(e);if(i<=t)return e;let o=r(n)/2,[s,a]=uf(e,t/2,r,o),[c]=uf(e,i-t/2-a+o,r,-o);return c<0?n:e.slice(0,s).trimEnd()+n+e.slice(kh(e,c)).trimStart()}function cj(e,t,r,n){e=e.trim();let i=r(e);if(i<=t)return e;let o=r(n),[s]=uf(e,i-t+o,r,-o);return s<0?n:n+e.slice(kh(e,s)).trimStart()}var gN=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,lj=/\p{Extended_Pictographic}/uy;function kh(e,t){return t+=xot(e,t)?2:1,_ot(e,t)&&(t=gN.lastIndex),bot(e,t)?kh(e,t+1):t}function fj(e,t){return e.charCodeAt(t)<128}function xot(e,t){let r=e.charCodeAt(t);if(r>=55296&&r<56320){let n=e.charCodeAt(t+1);return n>=56320&&n<57344}return!1}function bot(e,t){return e.charCodeAt(t)===8205}function _ot(e,t){return fj(e,t)?!1:(gN.lastIndex=t,gN.test(e))}function dj(e,t){return fj(e,t)?!1:(lj.lastIndex=t,lj.test(e))}var hj={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},pj=3.5,wot=pj*5,mj={draw(e,t,r){let n=t*r/wot;e.moveTo(0,0),e.lineTo(0,-t),e.moveTo(-n,n-t),e.lineTo(0,-t),e.lineTo(n,n-t)}},yj={draw(e,t,r){e.moveTo(-r,0),e.lineTo(0,-t),e.lineTo(r,0)}},vot=new Map([["arrow",mj],["spike",yj]]);function Sot(e){return e&&typeof e.draw=="function"}function Iot(e){if(Sot(e))return e;let t=vot.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid shape: ${e}`)}var ff=class extends vt{constructor(t,r={}){let{x:n,y:i,r:o=pj,length:s,rotate:a,shape:c=mj,anchor:l="middle",frameAnchor:u}=r,[f,d]=ye(s,12),[h,p]=ye(a,0);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},length:{value:f,scale:"length",optional:!0},rotate:{value:h,optional:!0}},r,hj),this.r=+o,this.length=d,this.rotate=p,this.shape=Iot(c),this.anchor=Sr(l,"anchor",["start","middle","end"]),this.frameAnchor=Ts(u)}render(t,r,n,i,o){let{x:s,y:a}=r,{x:c,y:l,length:u,rotate:f}=n,{length:d,rotate:h,anchor:p,shape:m,r:y}=this,[g,x]=Ur(this,i);return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,{x:c&&s,y:l&&a}).call(b=>b.selectAll().data(t).enter().append("path").call(Et,this).attr("transform",Fo`translate(${c?_=>c[_]:g},${l?_=>l[_]:x})${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=Nn();return m.draw(v,u[_],y),v}:(()=>{let _=Nn();return m.draw(_,d,y),_})()).call(Wt,this,n)).node()}};function vN(e,t={}){let{x:r,y:n,...i}=t;return t.frameAnchor===void 0&&([r,n]=Ke(r,n)),new ff(e,{...i,x:r,y:n})}function BS(e,t={}){let{x:r=G,...n}=t;return new ff(e,{...n,x:r})}function PS(e,t={}){let{y:r=G,...n}=t;return new ff(e,{...n,y:r})}function gj(e,t={}){let{shape:r=yj,stroke:n=hj.stroke,strokeWidth:i=1,fill:o=n,fillOpacity:s=.3,anchor:a="start",...c}=t;return vN(e,{...c,shape:r,stroke:n,strokeWidth:i,fill:o,fillOpacity:s,anchor:a})}function bl(e,t){return arguments.length<2&&!kn(e)&&(t=e,e=null),t===void 0&&(t={}),[e,t]}function US({anchor:e}={},t){return e===void 0?t[0]:Sr(e,"anchor",t)}function xj(e){return US(e,["left","right"])}function bj(e){return US(e,["right","left"])}function _j(e){return US(e,["bottom","top"])}function wj(e){return US(e,["top","bottom"])}function a0(){let[e,t]=bl(...arguments);return vj("y",xj(t),e,t)}function $S(){let[e,t]=bl(...arguments);return vj("fy",bj(t),e,t)}function c0(){let[e,t]=bl(...arguments);return Sj("x",_j(t),e,t)}function zS(){let[e,t]=bl(...arguments);return Sj("fx",wj(t),e,t)}function vj(e,t,r,{color:n="currentColor",opacity:i=1,stroke:o=n,strokeOpacity:s=i,strokeWidth:a=1,fill:c=n,fillOpacity:l=i,textAnchor:u,textStroke:f,textStrokeOpacity:d,textStrokeWidth:h,tickSize:p=e==="y"?6:0,tickPadding:m,tickRotate:y,x:g,margin:x,marginTop:b=x===void 0?20:x,marginRight:_=x===void 0?t==="right"?40:0:x,marginBottom:v=x===void 0?20:x,marginLeft:w=x===void 0?t==="left"?40:0:x,label:T,labelAnchor:A,labelArrow:E,labelOffset:N,...I}){return p=ie(p),m=ie(m),y=ie(y),A!==void 0&&(A=Sr(A,"labelAnchor",["center","top","bottom"])),E=Rj(E),yr(p&&!fe(o)?Tot(e,t,r,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:m,tickRotate:y,x:g,...I}):null,fe(c)?null:Eot(e,t,r,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:d,strokeWidth:h,textAnchor:u,tickSize:p,tickPadding:m,tickRotate:y,x:g,marginTop:b,marginRight:_,marginBottom:v,marginLeft:w,...I}),!fe(c)&&T!==null?Rs([],Ej({fill:c,fillOpacity:l,...I},function(R,C,S,M,O){let L=M[e],{marginTop:B,marginRight:k,marginBottom:P,marginLeft:U}=e==="y"&&O.inset||O,$=A??(L.bandwidth?"center":"top"),X=N??(t==="right"?k: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:[Oj(e,L,{anchor:t,label:T,labelAnchor:$,labelArrow:E})]}}}})):null)}function Sj(e,t,r,{color:n="currentColor",opacity:i=1,stroke:o=n,strokeOpacity:s=i,strokeWidth:a=1,fill:c=n,fillOpacity:l=i,textAnchor:u,textStroke:f,textStrokeOpacity:d,textStrokeWidth:h,tickSize:p=e==="x"?6:0,tickPadding:m,tickRotate:y,y:g,margin:x,marginTop:b=x===void 0?t==="top"?30:0:x,marginRight:_=x===void 0?20:x,marginBottom:v=x===void 0?t==="bottom"?30:0:x,marginLeft:w=x===void 0?20:x,label:T,labelAnchor:A,labelArrow:E,labelOffset:N,...I}){return p=ie(p),m=ie(m),y=ie(y),A!==void 0&&(A=Sr(A,"labelAnchor",["center","left","right"])),E=Rj(E),yr(p&&!fe(o)?Aot(e,t,r,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:m,tickRotate:y,y:g,...I}):null,fe(c)?null:Mot(e,t,r,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:d,strokeWidth:h,textAnchor:u,tickSize:p,tickPadding:m,tickRotate:y,y:g,marginTop:b,marginRight:_,marginBottom:v,marginLeft:w,...I}),!fe(c)&&T!==null?Rs([],Ej({fill:c,fillOpacity:l,...I},function(R,C,S,M,O){let L=M[e],{marginTop:B,marginRight:k,marginBottom:P,marginLeft:U}=e==="x"&&O.inset||O,$=A??(L.bandwidth?"center":"right"),X=N??(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"?k-3:$==="left"?3-U:0,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[Oj(e,L,{anchor:t,label:T,labelAnchor:$,labelArrow:E})]}}}})):null)}function Tot(e,t,r,{strokeWidth:n=1,strokeLinecap:i=null,strokeLinejoin:o=null,facetAnchor:s=t+(e==="y"?"-empty":""),frameAnchor:a=t,tickSize:c,inset:l=0,insetLeft:u=l,insetRight:f=l,dx:d=0,y:h=e==="y"?void 0:null,...p}){return Bh(PS,e,r,{ariaLabel:`${e}-axis tick`,ariaHidden:!0},{strokeWidth:n,strokeLinecap:i,strokeLinejoin:o,facetAnchor:s,frameAnchor:a,y:h,...p,dx:t==="left"?+d-We+ +u:+d+We-f,anchor:"start",length:c,shape:t==="left"?Dot:Lot})}function Aot(e,t,r,{strokeWidth:n=1,strokeLinecap:i=null,strokeLinejoin:o=null,facetAnchor:s=t+(e==="x"?"-empty":""),frameAnchor:a=t,tickSize:c,inset:l=0,insetTop:u=l,insetBottom:f=l,dy:d=0,x:h=e==="x"?void 0:null,...p}){return Bh(BS,e,r,{ariaLabel:`${e}-axis tick`,ariaHidden:!0},{strokeWidth:n,strokeLinejoin:o,strokeLinecap:i,facetAnchor:s,frameAnchor:a,x:h,...p,dy:t==="bottom"?+d-We-f:+d+We+ +u,anchor:"start",length:c,shape:t==="bottom"?Oot:Rot})}function Eot(e,t,r,{facetAnchor:n=t+(e==="y"?"-empty":""),frameAnchor:i=t,tickSize:o,tickRotate:s=0,tickPadding:a=Math.max(3,9-o)+(Math.abs(s)>60?4*Math.cos(s*Lh):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=e==="y"?void 0:null,...g}){return Bh(FS,e,r,{ariaLabel:`${e}-axis tick label`},{facetAnchor:n,frameAnchor:i,text:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,y,...g,dx:t==="left"?+m-o-a+ +h:+m+ +o+ +a-p},function(x,b,_,v,w){f===void 0&&(this.fontVariant=Nj(x)),c===void 0&&(w.text=Mj(x,b,_,v,t))})}function Mot(e,t,r,{facetAnchor:n=t+(e==="x"?"-empty":""),frameAnchor:i=t,tickSize:o,tickRotate:s=0,tickPadding:a=Math.max(3,9-o)+(Math.abs(s)>=10?4*Math.cos(s*Lh):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:y=e==="x"?void 0:null,...g}){return Bh(LS,e,r,{ariaLabel:`${e}-axis tick label`},{facetAnchor:n,frameAnchor:i,text:c===void 0?null:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,x:y,...g,dy:t==="bottom"?+m+ +o+ +a-p:+m-o-a+ +h},function(x,b,_,v,w){f===void 0&&(this.fontVariant=Nj(x)),c===void 0&&(w.text=Mj(x,b,_,v,t))})}function jS(){let[e,t]=bl(...arguments);return Ij("y",xj(t),e,t)}function qS(){let[e,t]=bl(...arguments);return Ij("fy",bj(t),e,t)}function VS(){let[e,t]=bl(...arguments);return Tj("x",_j(t),e,t)}function YS(){let[e,t]=bl(...arguments);return Tj("fx",wj(t),e,t)}function Ij(e,t,r,{y:n=e==="y"?void 0:null,x:i=null,x1:o=t==="left"?i:null,x2:s=t==="right"?i:null,...a}){return Bh(Si,e,r,{ariaLabel:`${e}-grid`,ariaHidden:!0},{y:n,x1:o,x2:s,...Aj(a)})}function Tj(e,t,r,{x:n=e==="x"?void 0:null,y:i=null,y1:o=t==="top"?i:null,y2:s=t==="bottom"?i:null,...a}){return Bh(vi,e,r,{ariaLabel:`${e}-grid`,ariaHidden:!0},{x:n,y1:o,y2:s,...Aj(a)})}function Aj({color:e="currentColor",opacity:t=.1,stroke:r=e,strokeOpacity:n=t,strokeWidth:i=1,...o}){return{stroke:r,strokeOpacity:n,strokeWidth:i,...o}}function Ej({fill:e,fillOpacity:t,fontFamily:r,fontSize:n,fontStyle:i,fontVariant:o,fontWeight:s,monospace:a,pointerEvents:c,shapeRendering:l,clip:u=!1},f){return[,e]=qe(e),[,t]=ye(t),{facet:"super",x:null,y:null,fill:e,fillOpacity:t,fontFamily:r,fontSize:n,fontStyle:i,fontVariant:o,fontWeight:s,monospace:a,pointerEvents:c,shapeRendering:l,clip:u,initializer:f}}function Bh(e,t,r,n,i,o){let s;function a(u,f,d,h,p,m){let y=u==null&&(t==="fx"||t==="fy"),{[t]:g}=h;if(!g)throw new Error(`missing scale: ${t}`);let x=g.domain(),{interval:b,ticks:_,tickFormat:v,tickSpacing:w=t==="x"?80:35}=i;if(typeof _=="string"&&Dj(g)&&(b=_,_=void 0),_===void 0&&(_=Is(b,g.type)??Not(g,w)),u==null){if(kn(_))u=xi(_);else if(cl(_))u=SN(_,...ce(x));else if(g.interval){let A=g.interval;if(g.ticks){let[E,N]=ce(x),I=(N-E)/A[gh];A=f4(A,I/_)??A,u=SN(A,E,N)}else{u=x;let E=u.length;A=f4(A,E/_)??A,A!==g.interval&&(u=SN(A,...ce(u)))}if(A===g.interval){let E=Math.round(u.length/_);E>1&&(u=u.filter((N,I)=>I%E===0))}}else g.ticks?u=g.ticks(_):u=x;if(!g.ticks&&u.length&&u!==x){let A=new In(x);u=u.filter(E=>A.has(E)),u.length||mn(`Warning: the ${t}-axis ticks appear to not align with the scale domain, resulting in no ticks. Try different ticks?`)}t==="y"||t==="x"?f=[Cn(u)]:s[t]={scale:t,value:G}}o?.call(this,g,u,_,v,s);let T=Object.fromEntries(Object.entries(s).map(([A,E])=>[A,{...E,value:_t(u,E.value)}]));return y&&(f=m.filterFacets(u,T)),{data:u,facets:f,channels:T}}let c=Ne(i).initializer,l=e(r,Ne({...i,initializer:a},c));return r==null?(s=l.channels,l.channels={}):s={},n!==void 0&&Object.assign(l,n),l.clip===void 0&&(l.clip=!1),l}function Not(e,t){let[r,n]=ce(e.range());return(n-r)/t}function Mj(e,t,r,n,i){return{value:l0(e,t,r,n,i)}}function l0(e,t,r,n,i){return typeof n=="function"&&!(e.type==="log"&&e.tickFormat)?n:n===void 0&&t&&Ve(t)?o$(e.type,t,i)??Os:e.tickFormat?e.tickFormat(typeof r=="number"?r:null,n):n===void 0?Os:typeof n=="string"?(Ve(e.domain())?bs:Yi)(n):Ye(n)}function SN(e,t,r){return e.range(t,e.offset(e.floor(r)))}var Oot={draw(e,t){e.moveTo(0,0),e.lineTo(0,t)}},Rot={draw(e,t){e.moveTo(0,0),e.lineTo(0,-t)}},Dot={draw(e,t){e.moveTo(0,0),e.lineTo(-t,0)}},Lot={draw(e,t){e.moveTo(0,0),e.lineTo(t,0)}};function Nj(e){return e.bandwidth&&!e.interval?void 0:"tabular-nums"}function Oj(e,t,{anchor:r,label:n=t.label,labelAnchor:i,labelArrow:o}={}){if(!(n==null||n.inferred&&Dj(t)&&/^(date|time|year)$/i.test(n))){if(n=String(n),o==="auto"&&(o=(!t.bandwidth||t.interval)&&!/[↑↓→←]/.test(n)),!o)return n;if(o===!0){let s=xS(t);s&&(o=/x$/.test(e)||i==="center"?/x$/.test(e)===s<0?"left":"right":s<0?"up":"down")}switch(o){case"left":return`\u2190 ${n}`;case"right":return`${n} \u2192`;case"up":return r==="right"?`${n} \u2191`:`\u2191 ${n}`;case"down":return r==="right"?`${n} \u2193`:`\u2193 ${n}`}return n}}function Rj(e="auto"){return fe(e)?!1:typeof e=="boolean"?e:Sr(e,"labelArrow",["auto","up","right","down","left"])}function Dj(e){return Ve(e.domain())}function Lj(e,t){if(t==null)return t;let r=e(t);if(!r)throw new Error(`scale not found: ${t}`);return r}function Fj(e,{opacity:t,...r}={}){if(!Ms(e)&&!Z4(e))throw new Error(`swatches legend requires ordinal or threshold color scale (not ${e.type})`);return kj(e,r,(n,i,o,s)=>n.append("svg").attr("width",o).attr("height",s).attr("fill",i.scale).attr("fill-opacity",ye(t)[1]).append("rect").attr("width","100%").attr("height","100%"))}function Cj(e,{fill:t=e.hint?.fill!==void 0?e.hint.fill:"none",fillOpacity:r=1,stroke:n=e.hint?.stroke!==void 0?e.hint.stroke:fe(t)?"currentColor":"none",strokeOpacity:i=1,strokeWidth:o=1.5,r:s=4.5,...a}={},c){let[l,u]=qe(t),[f,d]=qe(n),h=Lj(c,l),p=Lj(c,f),m=s*s*Math.PI;return r=ye(r)[1],i=ye(i)[1],o=ye(o)[1],kj(e,a,(y,g,x,b)=>y.append("svg").attr("viewBox","-8 -8 16 16").attr("width",x).attr("height",b).attr("fill",l==="color"?_=>h.scale(_):u).attr("fill-opacity",r).attr("stroke",f==="color"?_=>p.scale(_):d).attr("stroke-opacity",i).attr("stroke-width",o).append("path").attr("d",_=>{let v=Nn();return e.scale(_).draw(v,m),v}))}function kj(e,t={},r){let{columns:n,tickFormat:i,fontVariant:o=NS(e),swatchSize:s=15,swatchWidth:a=s,swatchHeight:c=s,marginLeft:l=0,className:u,style:f,width:d}=t,h=pl(t);u=yl(u),i=l0(e.scale,e.domain,void 0,i);let p=lt("div",h).attr("class",`${u}-swatches ${u}-swatches-${n!=null?"columns":"wrap"}`),m;return n!=null?(m=`:where(.${u}-swatches-columns .${u}-swatch) {
27
+ `:yield[t,r,!0],r+=i,t=r;break;default:++r;break}}yield[t,r,!0]}var cj={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 kS(e,t=0,r=e.length){let n=0;for(let i=t;i<r;i=Ch(e,i))n+=cj[e[i]]??(pj(e,i)?120:cj.e);return n}function BS(e,t=0,r=e.length){let n=0;for(let i=t;i<r;i=Ch(e,i))n+=pj(e,i)?126:63;return n}function _N({monospace:e,lineWidth:t,textOverflow:r}){if(r!=null||t==1/0)return o=>o.split(/\r\n?|\n/g);let n=e?BS:kS,i=t*100;return o=>got(o,i,n)}function wN({monospace:e,lineWidth:t,textOverflow:r}){if(r==null||t==1/0)return o=>o;let n=e?BS:kS,i=t*100;switch(r){case"clip-start":return o=>uj(o,i,n,"");case"clip-end":return o=>lj(o,i,n,"");case"ellipsis-start":return o=>uj(o,i,n,cf);case"ellipsis-middle":return o=>bot(o,i,n,cf);case"ellipsis-end":return o=>lj(o,i,n,cf)}}var cf="\u2026";function uf(e,t,r,n){let i=[],o=0;for(let s=0,a=0,c=e.length;s<c;s=a){a=Ch(e,s);let l=r(e,s,a);if(o+l>t){for(o+=n;o>t&&s>0;)a=s,s=i.pop(),o-=r(e,s,a);return[s,t-o]}o+=l,i.push(s)}return[-1,0]}function lj(e,t,r,n){e=e.trim();let i=r(n),[o]=uf(e,t,r,i);return o<0?e:e.slice(0,o).trimEnd()+n}function bot(e,t,r,n){e=e.trim();let i=r(e);if(i<=t)return e;let o=r(n)/2,[s,a]=uf(e,t/2,r,o),[c]=uf(e,i-t/2-a+o,r,-o);return c<0?n:e.slice(0,s).trimEnd()+n+e.slice(Ch(e,c)).trimStart()}function uj(e,t,r,n){e=e.trim();let i=r(e);if(i<=t)return e;let o=r(n),[s]=uf(e,i-t+o,r,-o);return s<0?n:n+e.slice(Ch(e,s)).trimStart()}var gN=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,fj=/\p{Extended_Pictographic}/uy;function Ch(e,t){return t+=_ot(e,t)?2:1,vot(e,t)&&(t=gN.lastIndex),wot(e,t)?Ch(e,t+1):t}function hj(e,t){return e.charCodeAt(t)<128}function _ot(e,t){let r=e.charCodeAt(t);if(r>=55296&&r<56320){let n=e.charCodeAt(t+1);return n>=56320&&n<57344}return!1}function wot(e,t){return e.charCodeAt(t)===8205}function vot(e,t){return hj(e,t)?!1:(gN.lastIndex=t,gN.test(e))}function pj(e,t){return hj(e,t)?!1:(fj.lastIndex=t,fj.test(e))}var mj={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},yj=3.5,Sot=yj*5,gj={draw(e,t,r){let n=t*r/Sot;e.moveTo(0,0),e.lineTo(0,-t),e.moveTo(-n,n-t),e.lineTo(0,-t),e.lineTo(n,n-t)}},xj={draw(e,t,r){e.moveTo(-r,0),e.lineTo(0,-t),e.lineTo(r,0)}},Iot=new Map([["arrow",gj],["spike",xj]]);function Tot(e){return e&&typeof e.draw=="function"}function Aot(e){if(Tot(e))return e;let t=Iot.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid shape: ${e}`)}var ff=class extends vt{constructor(t,r={}){let{x:n,y:i,r:o=yj,length:s,rotate:a,shape:c=gj,anchor:l="middle",frameAnchor:u}=r,[f,d]=ye(s,12),[h,p]=ye(a,0);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},length:{value:f,scale:"length",optional:!0},rotate:{value:h,optional:!0}},r,mj),this.r=+o,this.length=d,this.rotate=p,this.shape=Aot(c),this.anchor=Sr(l,"anchor",["start","middle","end"]),this.frameAnchor=Ts(u)}render(t,r,n,i,o){let{x:s,y:a}=r,{x:c,y:l,length:u,rotate:f}=n,{length:d,rotate:h,anchor:p,shape:m,r:y}=this,[g,x]=Ur(this,i);return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,{x:c&&s,y:l&&a}).call(b=>b.selectAll().data(t).enter().append("path").call(Mt,this).attr("transform",Fo`translate(${c?_=>c[_]:g},${l?_=>l[_]:x})${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=Nn();return m.draw(v,u[_],y),v}:(()=>{let _=Nn();return m.draw(_,d,y),_})()).call(Wt,this,n)).node()}};function vN(e,t={}){let{x:r,y:n,...i}=t;return t.frameAnchor===void 0&&([r,n]=Ke(r,n)),new ff(e,{...i,x:r,y:n})}function PS(e,t={}){let{x:r=G,...n}=t;return new ff(e,{...n,x:r})}function US(e,t={}){let{y:r=G,...n}=t;return new ff(e,{...n,y:r})}function bj(e,t={}){let{shape:r=xj,stroke:n=mj.stroke,strokeWidth:i=1,fill:o=n,fillOpacity:s=.3,anchor:a="start",...c}=t;return vN(e,{...c,shape:r,stroke:n,strokeWidth:i,fill:o,fillOpacity:s,anchor:a})}function _l(e,t){return arguments.length<2&&!kn(e)&&(t=e,e=null),t===void 0&&(t={}),[e,t]}function $S({anchor:e}={},t){return e===void 0?t[0]:Sr(e,"anchor",t)}function _j(e){return $S(e,["left","right"])}function wj(e){return $S(e,["right","left"])}function vj(e){return $S(e,["bottom","top"])}function Sj(e){return $S(e,["top","bottom"])}function a0(){let[e,t]=_l(...arguments);return Ij("y",_j(t),e,t)}function zS(){let[e,t]=_l(...arguments);return Ij("fy",wj(t),e,t)}function c0(){let[e,t]=_l(...arguments);return Tj("x",vj(t),e,t)}function jS(){let[e,t]=_l(...arguments);return Tj("fx",Sj(t),e,t)}function Ij(e,t,r,{color:n="currentColor",opacity:i=1,stroke:o=n,strokeOpacity:s=i,strokeWidth:a=1,fill:c=n,fillOpacity:l=i,textAnchor:u,textStroke:f,textStrokeOpacity:d,textStrokeWidth:h,tickSize:p=e==="y"?6:0,tickPadding:m,tickRotate:y,x:g,margin:x,marginTop:b=x===void 0?20:x,marginRight:_=x===void 0?t==="right"?40:0:x,marginBottom:v=x===void 0?20:x,marginLeft:w=x===void 0?t==="left"?40:0:x,label:T,labelAnchor:A,labelArrow:E,labelOffset:N,...I}){return p=ie(p),m=ie(m),y=ie(y),A!==void 0&&(A=Sr(A,"labelAnchor",["center","top","bottom"])),E=Lj(E),yr(p&&!fe(o)?Eot(e,t,r,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:m,tickRotate:y,x:g,...I}):null,fe(c)?null:Not(e,t,r,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:d,strokeWidth:h,textAnchor:u,tickSize:p,tickPadding:m,tickRotate:y,x:g,marginTop:b,marginRight:_,marginBottom:v,marginLeft:w,...I}),!fe(c)&&T!==null?Rs([],Nj({fill:c,fillOpacity:l,...I},function(R,C,S,M,O){let L=M[e],{marginTop:B,marginRight:k,marginBottom:P,marginLeft:U}=e==="y"&&O.inset||O,$=A??(L.bandwidth?"center":"top"),X=N??(t==="right"?k: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:[Dj(e,L,{anchor:t,label:T,labelAnchor:$,labelArrow:E})]}}}})):null)}function Tj(e,t,r,{color:n="currentColor",opacity:i=1,stroke:o=n,strokeOpacity:s=i,strokeWidth:a=1,fill:c=n,fillOpacity:l=i,textAnchor:u,textStroke:f,textStrokeOpacity:d,textStrokeWidth:h,tickSize:p=e==="x"?6:0,tickPadding:m,tickRotate:y,y:g,margin:x,marginTop:b=x===void 0?t==="top"?30:0:x,marginRight:_=x===void 0?20:x,marginBottom:v=x===void 0?t==="bottom"?30:0:x,marginLeft:w=x===void 0?20:x,label:T,labelAnchor:A,labelArrow:E,labelOffset:N,...I}){return p=ie(p),m=ie(m),y=ie(y),A!==void 0&&(A=Sr(A,"labelAnchor",["center","left","right"])),E=Lj(E),yr(p&&!fe(o)?Mot(e,t,r,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:m,tickRotate:y,y:g,...I}):null,fe(c)?null:Oot(e,t,r,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:d,strokeWidth:h,textAnchor:u,tickSize:p,tickPadding:m,tickRotate:y,y:g,marginTop:b,marginRight:_,marginBottom:v,marginLeft:w,...I}),!fe(c)&&T!==null?Rs([],Nj({fill:c,fillOpacity:l,...I},function(R,C,S,M,O){let L=M[e],{marginTop:B,marginRight:k,marginBottom:P,marginLeft:U}=e==="x"&&O.inset||O,$=A??(L.bandwidth?"center":"right"),X=N??(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"?k-3:$==="left"?3-U:0,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[Dj(e,L,{anchor:t,label:T,labelAnchor:$,labelArrow:E})]}}}})):null)}function Eot(e,t,r,{strokeWidth:n=1,strokeLinecap:i=null,strokeLinejoin:o=null,facetAnchor:s=t+(e==="y"?"-empty":""),frameAnchor:a=t,tickSize:c,inset:l=0,insetLeft:u=l,insetRight:f=l,dx:d=0,y:h=e==="y"?void 0:null,...p}){return kh(US,e,r,{ariaLabel:`${e}-axis tick`,ariaHidden:!0},{strokeWidth:n,strokeLinecap:i,strokeLinejoin:o,facetAnchor:s,frameAnchor:a,y:h,...p,dx:t==="left"?+d-We+ +u:+d+We-f,anchor:"start",length:c,shape:t==="left"?Fot:Cot})}function Mot(e,t,r,{strokeWidth:n=1,strokeLinecap:i=null,strokeLinejoin:o=null,facetAnchor:s=t+(e==="x"?"-empty":""),frameAnchor:a=t,tickSize:c,inset:l=0,insetTop:u=l,insetBottom:f=l,dy:d=0,x:h=e==="x"?void 0:null,...p}){return kh(PS,e,r,{ariaLabel:`${e}-axis tick`,ariaHidden:!0},{strokeWidth:n,strokeLinejoin:o,strokeLinecap:i,facetAnchor:s,frameAnchor:a,x:h,...p,dy:t==="bottom"?+d-We-f:+d+We+ +u,anchor:"start",length:c,shape:t==="bottom"?Dot:Lot})}function Not(e,t,r,{facetAnchor:n=t+(e==="y"?"-empty":""),frameAnchor:i=t,tickSize:o,tickRotate:s=0,tickPadding:a=Math.max(3,9-o)+(Math.abs(s)>60?4*Math.cos(s*Dh):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=e==="y"?void 0:null,...g}){return kh(CS,e,r,{ariaLabel:`${e}-axis tick label`},{facetAnchor:n,frameAnchor:i,text:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,y,...g,dx:t==="left"?+m-o-a+ +h:+m+ +o+ +a-p},function(x,b,_,v,w){f===void 0&&(this.fontVariant=Rj(x)),c===void 0&&(w.text=Oj(x,b,_,v,t))})}function Oot(e,t,r,{facetAnchor:n=t+(e==="x"?"-empty":""),frameAnchor:i=t,tickSize:o,tickRotate:s=0,tickPadding:a=Math.max(3,9-o)+(Math.abs(s)>=10?4*Math.cos(s*Dh):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:y=e==="x"?void 0:null,...g}){return kh(FS,e,r,{ariaLabel:`${e}-axis tick label`},{facetAnchor:n,frameAnchor:i,text:c===void 0?null:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,x:y,...g,dy:t==="bottom"?+m+ +o+ +a-p:+m-o-a+ +h},function(x,b,_,v,w){f===void 0&&(this.fontVariant=Rj(x)),c===void 0&&(w.text=Oj(x,b,_,v,t))})}function qS(){let[e,t]=_l(...arguments);return Aj("y",_j(t),e,t)}function VS(){let[e,t]=_l(...arguments);return Aj("fy",wj(t),e,t)}function YS(){let[e,t]=_l(...arguments);return Ej("x",vj(t),e,t)}function WS(){let[e,t]=_l(...arguments);return Ej("fx",Sj(t),e,t)}function Aj(e,t,r,{y:n=e==="y"?void 0:null,x:i=null,x1:o=t==="left"?i:null,x2:s=t==="right"?i:null,...a}){return kh(Si,e,r,{ariaLabel:`${e}-grid`,ariaHidden:!0},{y:n,x1:o,x2:s,...Mj(a)})}function Ej(e,t,r,{x:n=e==="x"?void 0:null,y:i=null,y1:o=t==="top"?i:null,y2:s=t==="bottom"?i:null,...a}){return kh(vi,e,r,{ariaLabel:`${e}-grid`,ariaHidden:!0},{x:n,y1:o,y2:s,...Mj(a)})}function Mj({color:e="currentColor",opacity:t=.1,stroke:r=e,strokeOpacity:n=t,strokeWidth:i=1,...o}){return{stroke:r,strokeOpacity:n,strokeWidth:i,...o}}function Nj({fill:e,fillOpacity:t,fontFamily:r,fontSize:n,fontStyle:i,fontVariant:o,fontWeight:s,monospace:a,pointerEvents:c,shapeRendering:l,clip:u=!1},f){return[,e]=qe(e),[,t]=ye(t),{facet:"super",x:null,y:null,fill:e,fillOpacity:t,fontFamily:r,fontSize:n,fontStyle:i,fontVariant:o,fontWeight:s,monospace:a,pointerEvents:c,shapeRendering:l,clip:u,initializer:f}}function kh(e,t,r,n,i,o){let s;function a(u,f,d,h,p,m){let y=u==null&&(t==="fx"||t==="fy"),{[t]:g}=h;if(!g)throw new Error(`missing scale: ${t}`);let x=g.domain(),{interval:b,ticks:_,tickFormat:v,tickSpacing:w=t==="x"?80:35}=i;if(typeof _=="string"&&Fj(g)&&(b=_,_=void 0),_===void 0&&(_=Is(b,g.type)??Rot(g,w)),u==null){if(kn(_))u=xi(_);else if(ll(_))u=SN(_,...ce(x));else if(g.interval){let A=g.interval;if(g.ticks){let[E,N]=ce(x),I=(N-E)/A[yh];A=f4(A,I/_)??A,u=SN(A,E,N)}else{u=x;let E=u.length;A=f4(A,E/_)??A,A!==g.interval&&(u=SN(A,...ce(u)))}if(A===g.interval){let E=Math.round(u.length/_);E>1&&(u=u.filter((N,I)=>I%E===0))}}else g.ticks?u=g.ticks(_):u=x;if(!g.ticks&&u.length&&u!==x){let A=new In(x);u=u.filter(E=>A.has(E)),u.length||mn(`Warning: the ${t}-axis ticks appear to not align with the scale domain, resulting in no ticks. Try different ticks?`)}t==="y"||t==="x"?f=[Cn(u)]:s[t]={scale:t,value:G}}o?.call(this,g,u,_,v,s);let T=Object.fromEntries(Object.entries(s).map(([A,E])=>[A,{...E,value:_t(u,E.value)}]));return y&&(f=m.filterFacets(u,T)),{data:u,facets:f,channels:T}}let c=Ne(i).initializer,l=e(r,Ne({...i,initializer:a},c));return r==null?(s=l.channels,l.channels={}):s={},n!==void 0&&Object.assign(l,n),l.clip===void 0&&(l.clip=!1),l}function Rot(e,t){let[r,n]=ce(e.range());return(n-r)/t}function Oj(e,t,r,n,i){return{value:l0(e,t,r,n,i)}}function l0(e,t,r,n,i){return typeof n=="function"&&!(e.type==="log"&&e.tickFormat)?n:n===void 0&&t&&Ve(t)?a$(e.type,t,i)??Os:e.tickFormat?e.tickFormat(typeof r=="number"?r:null,n):n===void 0?Os:typeof n=="string"?(Ve(e.domain())?bs:Yi)(n):Ye(n)}function SN(e,t,r){return e.range(t,e.offset(e.floor(r)))}var Dot={draw(e,t){e.moveTo(0,0),e.lineTo(0,t)}},Lot={draw(e,t){e.moveTo(0,0),e.lineTo(0,-t)}},Fot={draw(e,t){e.moveTo(0,0),e.lineTo(-t,0)}},Cot={draw(e,t){e.moveTo(0,0),e.lineTo(t,0)}};function Rj(e){return e.bandwidth&&!e.interval?void 0:"tabular-nums"}function Dj(e,t,{anchor:r,label:n=t.label,labelAnchor:i,labelArrow:o}={}){if(!(n==null||n.inferred&&Fj(t)&&/^(date|time|year)$/i.test(n))){if(n=String(n),o==="auto"&&(o=(!t.bandwidth||t.interval)&&!/[↑↓→←]/.test(n)),!o)return n;if(o===!0){let s=bS(t);s&&(o=/x$/.test(e)||i==="center"?/x$/.test(e)===s<0?"left":"right":s<0?"up":"down")}switch(o){case"left":return`\u2190 ${n}`;case"right":return`${n} \u2192`;case"up":return r==="right"?`${n} \u2191`:`\u2191 ${n}`;case"down":return r==="right"?`${n} \u2193`:`\u2193 ${n}`}return n}}function Lj(e="auto"){return fe(e)?!1:typeof e=="boolean"?e:Sr(e,"labelArrow",["auto","up","right","down","left"])}function Fj(e){return Ve(e.domain())}function Cj(e,t){if(t==null)return t;let r=e(t);if(!r)throw new Error(`scale not found: ${t}`);return r}function kj(e,{opacity:t,...r}={}){if(!Ms(e)&&!Z4(e))throw new Error(`swatches legend requires ordinal or threshold color scale (not ${e.type})`);return Pj(e,r,(n,i,o,s)=>n.append("svg").attr("width",o).attr("height",s).attr("fill",i.scale).attr("fill-opacity",ye(t)[1]).append("rect").attr("width","100%").attr("height","100%"))}function Bj(e,{fill:t=e.hint?.fill!==void 0?e.hint.fill:"none",fillOpacity:r=1,stroke:n=e.hint?.stroke!==void 0?e.hint.stroke:fe(t)?"currentColor":"none",strokeOpacity:i=1,strokeWidth:o=1.5,r:s=4.5,...a}={},c){let[l,u]=qe(t),[f,d]=qe(n),h=Cj(c,l),p=Cj(c,f),m=s*s*Math.PI;return r=ye(r)[1],i=ye(i)[1],o=ye(o)[1],Pj(e,a,(y,g,x,b)=>y.append("svg").attr("viewBox","-8 -8 16 16").attr("width",x).attr("height",b).attr("fill",l==="color"?_=>h.scale(_):u).attr("fill-opacity",r).attr("stroke",f==="color"?_=>p.scale(_):d).attr("stroke-opacity",i).attr("stroke-width",o).append("path").attr("d",_=>{let v=Nn();return e.scale(_).draw(v,m),v}))}function Pj(e,t={},r){let{columns:n,tickFormat:i,fontVariant:o=OS(e),swatchSize:s=15,swatchWidth:a=s,swatchHeight:c=s,marginLeft:l=0,className:u,style:f,width:d}=t,h=ml(t);u=gl(u),i=l0(e.scale,e.domain,void 0,i);let p=lt("div",h).attr("class",`${u}-swatches ${u}-swatches-${n!=null?"columns":"wrap"}`),m;return n!=null?(m=`:where(.${u}-swatches-columns .${u}-swatch) {
28
28
  display: flex;
29
29
  align-items: center;
30
30
  break-inside: avoid;
@@ -56,7 +56,7 @@ ${r}`}function $nt(e){return e==="time"?J2:e==="utc"?qg:Pnt}function o$(e,t,r){l
56
56
  margin-right: 0.5em;
57
57
  overflow: visible;
58
58
  }
59
- ${m}`)).style("margin-left",l?`${+l}px`:null).style("width",d===void 0?null:`${+d}px`).style("font-variant",Oe(o,"normal")).call(Dh,f).node()}var WS=new Map([["symbol",Cj],["color",Uj],["opacity",Fot]]);function Bj(e={}){for(let[t,r]of WS){let n=e[t];if(vs(n)){let i=pl(e),o;if(t==="symbol"){let{fill:s,stroke:a=s===void 0&&vs(e.color)?"color":void 0}=e;o={fill:s,stroke:a}}return r(_S(t,n,o),IN(i,n,e),s=>vs(e[s])?_S(s,e[s]):null)}}throw new Error("unknown legend type; no scale found")}function Pj(e,t,r={}){return(n,i)=>{if(!WS.has(n))throw new Error(`unknown legend type: ${n}`);if(n in e)return WS.get(n)(e[n],IN(t,r[n],i),o=>e[o])}}function IN({className:e,...t},{label:r,ticks:n,tickFormat:i}={},o){return b$(o,{className:e,...t},{label:r,ticks:n,tickFormat:i})}function Uj(e,{legend:t=!0,...r}){if(t===!0&&(t=e.type==="ordinal"?"swatches":"ramp"),e.domain!==void 0)switch(`${t}`.toLowerCase()){case"swatches":return Fj(e,r);case"ramp":return Hz(e,r);default:throw new Error(`unknown legend type: ${t}`)}}function Fot({type:e,interpolate:t,...r},{legend:n=!0,color:i=wr(0,0,0),...o}){if(!t)throw new Error(`${e} opacity scales are not supported`);if(n===!0&&(n="ramp"),`${n}`.toLowerCase()!=="ramp")throw new Error(`${n} opacity legends are not supported`);return Uj({type:e,...r,interpolate:Cot(i)},{legend:n,...o})}function Cot(e){let{r:t,g:r,b:n}=wr(e)||wr(0,0,0);return i=>`rgba(${t},${r},${n},${i})`}function $j(e,t,r){let n=[];for(let[i,o]of WS){let s=r[i];if(s?.legend&&i in e){let a=o(e[i],IN(t,e[i],s),c=>e[c]);a!=null&&n.push(a)}}return n}function _l(e={}){return _4(e)?e:{...e,x:G}}function wl(e={}){return w4(e)?e:{...e,y:G}}function GS(e,t){if(t.length===1)return{data:e,facets:t};let r=al(e),n=new Uint8Array(r),i=0;for(let a of t)for(let c of a)n[c]&&++i,n[c]=1;if(i===0)return{data:e,facets:t};e=sl(e);let o=e[h4]=new Uint32Array(r+i);t=t.map(a=>sl(a,Uint32Array));let s=r;n.fill(0);for(let a of t)for(let c=0,l=a.length;c<l;++c){let u=a[c];n[u]?(a[c]=s,e[s]=e[u],o[s]=u,++s):o[u]=u,n[u]=1}return{data:e,facets:t}}function TN(e={},t={}){arguments.length===1&&([e,t]=Ph(e));let{y1:r,y:n=r,x:i,...o}=t,[s,a,c,l]=Uh(n,i,"y","x",e,o);return{...s,y1:r,y:a,x1:c,x2:l,x:_h(c,l)}}function qj(e={},t={}){arguments.length===1&&([e,t]=Ph(e));let{y1:r,y:n=r,x:i}=t,[o,s,a]=Uh(n,i,"y","x",e,t);return{...o,y1:r,y:s,x:a}}function Vj(e={},t={}){arguments.length===1&&([e,t]=Ph(e));let{y1:r,y:n=r,x:i}=t,[o,s,,a]=Uh(n,i,"y","x",e,t);return{...o,y1:r,y:s,x:a}}function AN(e={},t={}){arguments.length===1&&([e,t]=Ph(e));let{x1:r,x:n=r,y:i,...o}=t,[s,a,c,l]=Uh(n,i,"x","y",e,o);return{...s,x1:r,x:a,y1:c,y2:l,y:_h(c,l)}}function Yj(e={},t={}){arguments.length===1&&([e,t]=Ph(e));let{x1:r,x:n=r,y:i}=t,[o,s,a]=Uh(n,i,"x","y",e,t);return{...o,x1:r,x:s,y:a}}function Wj(e={},t={}){arguments.length===1&&([e,t]=Ph(e));let{x1:r,x:n=r,y:i}=t,[o,s,,a]=Uh(n,i,"x","y",e,t);return{...o,x1:r,x:s,y:a}}function vl({x:e,x1:t,x2:r,...n}={}){return n=Do(n,"y"),t===void 0&&r===void 0?TN({x:e,...n}):([t,r]=v4(e,t,r),{...n,x1:t,x2:r})}function Sl({y:e,y1:t,y2:r,...n}={}){return n=Do(n,"x"),t===void 0&&r===void 0?AN({y:e,...n}):([t,r]=v4(e,t,r),{...n,y1:t,y2:r})}function Ph(e){let{offset:t,order:r,reverse:n,...i}=e;return[{offset:t,order:r,reverse:n},i]}var kot={length:!0};function Uh(e,t=Wg,r,n,{offset:i,order:o,reverse:s},a){if(t===null)throw new Error(`stack requires ${n}`);let c=pn(a),[l,u]=tn(e),[f,d]=Br(t),[h,p]=Br(t);return f.hint=h.hint=kot,i=Bot(i),o=$ot(o,i,n),[mr(a,(m,y,g)=>{({data:m,facets:y}=GS(m,y));let x=e==null?void 0:u(tf(_t(m,e),g?.[r])),b=_t(m,t,Float64Array),_=_t(m,c),v=o&&o(m,x,b,_),w=al(m),T=d(new Float64Array(w)),A=p(new Float64Array(w)),E=[];for(let N of y){let I=x?Array.from(Hr(N,R=>x[R]).values()):[N];if(v)for(let R of I)R.sort(v);for(let R of I){let C=0,S=0;s&&R.reverse();for(let M of R){let O=b[M];O<0?C=A[M]=(T[M]=C)+O:O>0?S=A[M]=(T[M]=S)+O:A[M]=T[M]=S}}E.push(I)}return i&&i(E,T,A,_),{data:m,facets:y}}),l,f,h]}function Bot(e){if(e!=null){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"expand":case"normalize":return Pot;case"center":case"silhouette":return Uot;case"wiggle":return Xj}throw new Error(`unknown offset: ${e}`)}}function Gj(e,t){let r=0,n=0;for(let i of e){let o=t[i];o<r&&(r=o),o>n&&(n=o)}return[r,n]}function Pot(e,t,r){for(let n of e)for(let i of n){let[o,s]=Gj(i,r);for(let a of i){let c=1/(s-o||1);t[a]=c*(t[a]-o),r[a]=c*(r[a]-o)}}}function Uot(e,t,r){for(let n of e){for(let i of n){let[o,s]=Gj(i,r);for(let a of i){let c=(s+o)/2;t[a]-=c,r[a]-=c}}Hj(n,t,r)}Qj(e,t,r)}function Xj(e,t,r,n){for(let i of e){let o=new Sn,s=0;for(let a of i){let c=-1,l=a.map(h=>Math.abs(r[h]-t[h])),u=a.map(h=>{c=n?n[h]:++c;let p=r[h]-t[h],m=o.has(c)?p-o.get(c):0;return o.set(c,p),m}),f=[0,...q_(u)];for(let h of a)t[h]+=s,r[h]+=s;let d=Zr(l);d&&(s-=Zr(l,(h,p)=>(u[p]/2+f[p])*h)/d)}Hj(i,t,r)}Qj(e,t,r)}function Hj(e,t,r){let n=Ht(e,i=>Ht(i,o=>t[o]));for(let i of e)for(let o of i)t[o]-=n,r[o]-=n}function Qj(e,t,r){let n=e.length;if(n===1)return;let i=e.map(a=>a.flat()),o=i.map(a=>(Ht(a,c=>t[c])+Kt(a,c=>r[c]))/2),s=Ht(o);for(let a=0;a<n;a++){let c=s-o[a];for(let l of i[a])t[l]+=c,r[l]+=c}}function $ot(e,t,r){if(e===void 0&&t===Xj)return zj(Cr);if(e!=null){if(typeof e=="string"){let n=e.startsWith("-"),i=n?Qu:Cr;switch((n?e.slice(1):e).toLowerCase()){case"value":case r:return zot(i);case"z":return jot(i);case"sum":return qot(i);case"appearance":return Vot(i);case"inside-out":return zj(i)}return jj(m4(e))}if(typeof e=="function")return(e.length===1?jj:Yot)(e);if(Qn(e))return Wot(e);throw new Error(`invalid order: ${e}`)}}function zot(e){return(t,r,n)=>(i,o)=>e(n[i],n[o])}function jot(e){return(t,r,n,i)=>(o,s)=>e(i[o],i[s])}function qot(e){return XS(e,(t,r,n,i)=>Sd(Cn(t),o=>Zr(o,s=>n[s]),o=>i[o]))}function Vot(e){return XS(e,(t,r,n,i)=>Sd(Cn(t),o=>r[vu(o,s=>n[s])],o=>i[o]))}function zj(e){return XS(e,(t,r,n,i)=>{let o=Cn(t),s=Sd(o,f=>r[vu(f,d=>n[d])],f=>i[f]),a=Ao(o,f=>Zr(f,d=>n[d]),f=>i[f]),c=[],l=[],u=0;for(let f of s)u<0?(u+=a.get(f),c.push(f)):(u-=a.get(f),l.push(f));return l.reverse().concat(c)})}function jj(e){return t=>{let r=_t(t,e);return(n,i)=>Cr(r[n],r[i])}}function Yot(e){return t=>Qn(t)?(r,n)=>e(t[r],t[n]):(r,n)=>e(t.get(r),t.get(n))}function Wot(e){return XS(Cr,()=>e)}function XS(e,t){return(r,n,i,o)=>{if(!o)throw new Error("missing channel: z");let s=new Sn(t(r,n,i,o).map((a,c)=>[a,c]));return(a,c)=>e(s.get(o[a]),s.get(o[c]))}}var Got={ariaLabel:"rect"},df=class extends vt{constructor(t,r={}){let{x1:n,y1:i,x2:o,y2:s}=r;super(t,{x1:{value:n,scale:"x",type:n!=null&&o==null?"band":void 0,optional:!0},y1:{value:i,scale:"y",type:i!=null&&s==null?"band":void 0,optional:!0},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},r,Got),u0(this,r),f0(this,r)}render(t,r,n,i,o){let{x:s,y:a}=r,{x1:c,y1:l,x2:u,y2:f}=n,{marginTop:d,marginRight:h,marginBottom:p,marginLeft:m,width:y,height:g}=i,{projection:x}=o,{insetTop:b,insetRight:_,insetBottom:v,insetLeft:w}=this,{rx:T,ry:A,rx1y1:E,rx1y2:N,rx2y1:I,rx2y2:R}=this;(c||u)&&!x&&wi(s)&&(c=u=null),(l||f)&&!x&&wi(a)&&(l=f=null);let C=s?.bandwidth?s.bandwidth():0,S=a?.bandwidth?a.bandwidth():0;return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,{},0,0).call(M=>M.selectAll().data(t).enter().call(E||N||I||R?O=>O.append("path").call(Et,this).call(d0,c&&u?L=>c[L]+(u[L]<c[L]?-_:w):c?L=>c[L]+w:m+w,l&&f?L=>l[L]+(f[L]<l[L]?-v:b):l?L=>l[L]+b:d+b,c&&u?L=>u[L]-(u[L]<c[L]?-w:_):c?L=>c[L]+C-_:y-h-_,l&&f?L=>f[L]-(f[L]<l[L]?-b:v):l?L=>l[L]+S-v:g-p-v,this).call(Wt,this,n):O=>O.append("rect").call(Et,this).attr("x",c?u?L=>Math.min(c[L],u[L])+w:L=>c[L]+w:m+w).attr("y",l?f?L=>Math.min(l[L],f[L])+b:L=>l[L]+b:d+b).attr("width",c?u?L=>Math.max(0,Math.abs(u[L]-c[L])+C-w-_):C-w-_:y-h-m-_-w).attr("height",l?f?L=>Math.max(0,Math.abs(l[L]-f[L])+S-b-v):S-b-v:g-d-p-b-v).call(dt,"rx",T).call(dt,"ry",A).call(Wt,this,n))).node()}};function u0(e,{inset:t=0,insetTop:r=t,insetRight:n=t,insetBottom:i=t,insetLeft:o=t}={}){e.insetTop=ie(r),e.insetRight=ie(n),e.insetBottom=ie(i),e.insetLeft=ie(o)}function f0(e,{r:t,rx:r,ry:n,rx1:i=t,ry1:o=t,rx2:s=t,ry2:a=t,rx1y1:c=i!==void 0?+i:o!==void 0?+o:0,rx1y2:l=i!==void 0?+i:a!==void 0?+a:0,rx2y1:u=s!==void 0?+s:o!==void 0?+o:0,rx2y2:f=s!==void 0?+s:a!==void 0?+a:0}={}){c||l||u||f?(e.rx1y1=c,e.rx1y2=l,e.rx2y1=u,e.rx2y2=f):(e.rx=Oe(r,"auto"),e.ry=Oe(n,"auto"))}function d0(e,t,r,n,i,o){let{rx1y1:s,rx1y2:a,rx2y1:c,rx2y2:l}=o;typeof t!="function"&&(t=Ye(t)),typeof r!="function"&&(r=Ye(r)),typeof n!="function"&&(n=Ye(n)),typeof i!="function"&&(i=Ye(i));let u=Math.max(Math.abs(s+c),Math.abs(a+l)),f=Math.max(Math.abs(s+a),Math.abs(c+l));e.attr("d",d=>{let h=t(d),p=r(d),m=n(d),y=i(d),g=h>m,x=p>y,b=g?m:h,_=g?h:m,v=x?y:p,w=x?p:y,T=Math.min(1,(_-b)/u,(w-v)/f),A=T*(g?x?l:c:x?a:s),E=T*(g?x?a:s:x?l:c),N=T*(g?x?s:a:x?c:l),I=T*(g?x?c:l:x?s:a);return`M${b},${v+QS(A,I)}A${A},${A} 0 0 ${A<0?0:1} ${b+HS(A,I)},${v}H${_-HS(E,N)}A${E},${E} 0 0 ${E<0?0:1} ${_},${v+QS(E,N)}V${w-QS(N,E)}A${N},${N} 0 0 ${N<0?0:1} ${_-HS(N,E)},${w}H${b+HS(I,A)}A${I},${I} 0 0 ${I<0?0:1} ${b},${w-QS(I,A)}Z`})}function HS(e,t){return t<0?e:Math.abs(e)}function QS(e,t){return t<0?Math.abs(e):e}function h0(e,t){return new df(e,mN(yN(t)))}function $h(e,t={}){return Ha(t)||(t={...t,y:Ee,x2:G,interval:1}),new df(e,vl(yN(_l(t))))}function zh(e,t={}){return Ha(t)||(t={...t,x:Ee,y2:G,interval:1}),new df(e,Sl(mN(wl(t))))}var Xot={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},Hot={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1},p0=class extends vt{constructor(t={}){let{anchor:r=null}=t;super(il,void 0,t,r==null?Xot:Hot),this.anchor=b4(r,"anchor",["top","right","bottom","left"]),u0(this,t),r||f0(this,t)}render(t,r,n,i,o){let{marginTop:s,marginRight:a,marginBottom:c,marginLeft:l,width:u,height:f}=i,{anchor:d,insetTop:h,insetRight:p,insetBottom:m,insetLeft:y}=this,{rx:g,ry:x,rx1y1:b,rx1y2:_,rx2y1:v,rx2y2:w}=this,T=l+y,A=u-a-p,E=s+h,N=f-c-m;return lt(d?"svg:line":b||_||v||w?"svg:path":"svg:rect",o).datum(0).call(kt,this,i,o).call(Et,this).call(Wt,this,n).call(Rt,this,{}).call(d==="left"?I=>I.attr("x1",T).attr("x2",T).attr("y1",E).attr("y2",N):d==="right"?I=>I.attr("x1",A).attr("x2",A).attr("y1",E).attr("y2",N):d==="top"?I=>I.attr("x1",T).attr("x2",A).attr("y1",E).attr("y2",E):d==="bottom"?I=>I.attr("x1",T).attr("x2",A).attr("y1",N).attr("y2",N):b||_||v||w?I=>I.call(d0,T,E,A,N,this):I=>I.attr("x",T).attr("y",E).attr("width",A-T).attr("height",N-E).attr("rx",g).attr("ry",x)).node()}};function jh(e){return new p0(e)}var EN={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},Qot=new Set(["geometry","href","src","ariaLabel","scales"]),m0=class extends vt{constructor(t,r={}){r.tip&&(r={...r,tip:!1}),r.title===void 0&&kn(t)&&nS(t)&&(r={...r,title:G});let{x:n,y:i,x1:o,x2:s,y1:a,y2:c,anchor:l,preferredAnchor:u="bottom",monospace:f,fontFamily:d=f?"ui-monospace, monospace":void 0,fontSize:h,fontStyle:p,fontVariant:m,fontWeight:y,lineHeight:g=1,lineWidth:x=20,frameAnchor:b,format:_,textAnchor:v="start",textOverflow:w,textPadding:T=8,title:A,pointerSize:E=12,pathFilter:N="drop-shadow(0 3px 4px rgba(0,0,0,0.2))"}=r;super(t,{x:{value:o!=null&&s!=null?null:n,scale:"x",optional:!0},y:{value:a!=null&&c!=null?null:i,scale:"y",optional:!0},x1:{value:o,scale:"x",optional:s==null},y1:{value:a,scale:"y",optional:c==null},x2:{value:s,scale:"x",optional:o==null},y2:{value:c,scale:"y",optional:a==null},title:{value:A,optional:!0}},r,EN),this.anchor=oS(l,"anchor"),this.preferredAnchor=oS(u,"preferredAnchor"),this.frameAnchor=Ts(b),this.textAnchor=Oe(v,"middle"),this.textPadding=+T,this.pointerSize=+E,this.pathFilter=rr(N),this.lineHeight=+g,this.lineWidth=+x,this.textOverflow=xN(w),this.monospace=!!f,this.fontFamily=rr(d),this.fontSize=ie(h),this.fontStyle=rr(p),this.fontVariant=rr(m),this.fontWeight=rr(y);for(let I in EN)I in this.channels&&(this[I]=EN[I]);this.splitLines=_N(this),this.clipLine=wN(this),this.format=typeof _=="string"||typeof _=="function"?{title:_}:{..._}}render(t,r,n,i,o){let s=this,{x:a,y:c,fx:l,fy:u}=r,{ownerSVGElement:f,document:d}=o,{anchor:h,monospace:p,lineHeight:m,lineWidth:y}=this,{textPadding:g,pointerSize:x,pathFilter:b}=this,{marginTop:_,marginLeft:v}=i,{x1:w,y1:T,x2:A,y2:E,x:N=w??A,y:I=T??E}=n,R=l?l(t.fx)-v:0,C=u?u(t.fy)-_:0,[S,M]=Ur(this,i),O=uN(n,S),L=fN(n,M),B=p?kS:CS,k=B(cf),P,U;"title"in n?(P=Zj.call(this,{title:n.channels.title},r),U=tst):(P=Zj.call(this,n.channels,r),U=est);let $=lt("svg:g",o).call(kt,this,i,o).call(bN,this).call(Rt,this,{x:N&&a,y:I&&c}).call(ot=>ot.selectAll().data(t).enter().append("g").attr("transform",at=>`translate(${Math.round(O(at))},${Math.round(L(at))})`).call(Et,this).call(at=>at.append("path").attr("filter",b)).call(at=>at.append("text").each(function(Y){let st=Qt(this);this.setAttribute("fill","currentColor"),this.setAttribute("fill-opacity",1),this.setAttribute("stroke","none");let q=U.call(s,Y,t,P,r,n);if(typeof q=="string")for(let H of s.splitLines(q))X(st,{value:s.clipLine(H)});else{let H=new Set;for(let nt of q){let{label:z=""}=nt;z&&H.has(z)||(H.add(z),X(st,nt))}}})));function X(ot,{label:at,value:Y,color:st,opacity:q}){at??="",Y??="";let H=st!=null||q!=null,nt,z=y*100,[Pt]=uf(at,z,B,k);if(Pt>=0)at=at.slice(0,Pt).trimEnd()+cf,nt=Y.trim(),Y="";else{(at||!Y&&!H)&&(Y=" "+Y);let[Zt]=uf(Y,z-B(at),B,k);Zt>=0&&(nt=Y.trim(),Y=Y.slice(0,Zt).trimEnd()+cf)}let ht=ot.append("tspan").attr("x",0).attr("dy",`${m}em`).text("\u200B");at&&ht.append("tspan").attr("font-weight","bold").text(at),Y&&ht.append(()=>d.createTextNode(Y)),H&&ht.append("tspan").text(" \u25A0").attr("fill",st).attr("fill-opacity",q).style("user-select","none"),nt&&ht.append("title").text(nt)}function rt(){let{width:ot,height:at}=i.facet??i;$.selectChildren().each(function(Y){let{x:st,width:q,height:H}=this.getBBox();q=Math.round(q),H=Math.round(H);let nt=h;if(nt===void 0){let ht=O(Y)+R,Zt=L(Y)+C,Jt=ht+q+x+g*2<ot,tt=ht-q-x-g*2>0,ge=Zt+H+x+g*2<at,Kn=Zt-H-x-g*2>0;nt=Jt&&tt?ge&&Kn?s.preferredAnchor:Kn?"bottom":"top":ge&&Kn?Jt?"left":"right":(Jt||tt)&&(ge||Kn)?`${Kn?"bottom":"top"}-${Jt?"left":"right"}`:s.preferredAnchor}let z=this.firstChild,Pt=this.lastChild;if(z.setAttribute("d",Jot(nt,x,g,q,H)),st)for(let ht of Pt.childNodes)ht.setAttribute("x",-st);Pt.setAttribute("y",`${+Zot(nt,Pt.childNodes.length,m).toFixed(6)}em`),Pt.setAttribute("transform",`translate(${Kot(nt,x,g,q,H)})`)}),$.attr("visibility",null)}return t.length&&($.attr("visibility","hidden"),f.isConnected?Promise.resolve().then(rt):typeof requestAnimationFrame<"u"&&requestAnimationFrame(rt)),$.node()}};function KS(e,{x:t,y:r,...n}={}){return n.frameAnchor===void 0&&([t,r]=Ke(t,r)),new m0(e,{...n,x:t,y:r})}function Zot(e,t,r){return/^top(?:-|$)/.test(e)?.94-r:-.29-t*r}function Kot(e,t,r,n,i){switch(e){case"middle":return[-n/2,i/2];case"top-left":return[r,t+r];case"top":return[-n/2,t/2+r];case"top-right":return[-n-r,t+r];case"right":return[-t/2-n-r,i/2];case"bottom-left":return[r,-t-r];case"bottom":return[-n/2,-t/2-r];case"bottom-right":return[-n-r,-t-r];case"left":return[r+t/2,i/2]}}function Jot(e,t,r,n,i){let o=n+r*2,s=i+r*2;switch(e){case"middle":return`M${-o/2},${-s/2}h${o}v${s}h${-o}z`;case"top-left":return`M0,0l${t},${t}h${o-t}v${s}h${-o}z`;case"top":return`M0,0l${t/2},${t/2}h${(o-t)/2}v${s}h${-o}v${-s}h${(o-t)/2}z`;case"top-right":return`M0,0l${-t},${t}h${t-o}v${s}h${o}z`;case"right":return`M0,0l${-t/2},${-t/2}v${t/2-s/2}h${-o}v${s}h${o}v${t/2-s/2}z`;case"bottom-left":return`M0,0l${t},${-t}h${o-t}v${-s}h${-o}z`;case"bottom":return`M0,0l${t/2},${-t/2}h${(o-t)/2}v${-s}h${-o}v${s}h${(o-t)/2}z`;case"bottom-right":return`M0,0l${-t},${-t}h${t-o}v${-s}h${o}z`;case"left":return`M0,0l${t/2},${-t/2}v${t/2-s/2}h${o}v${s}h${-o}v${t/2-s/2}z`}}function Zj(e,t){let r={},n=this.format;n=Kj(n,e,"x"),n=Kj(n,e,"y"),this.format=n;for(let i in n){let o=n[i];if(!(o===null||o===!1))if(i==="fx"||i==="fy")r[i]=!0;else{let s=Jg(e,i);s&&(r[i]=s)}}for(let i in e){if(i in r||i in n||Qot.has(i)||(i==="x"||i==="y")&&e.geometry)continue;let o=Jg(e,i);if(o){if(o.scale==null&&o.defaultScale==="color")continue;r[i]=o}}this.facet&&(t.fx&&!("fx"in n)&&(r.fx=!0),t.fy&&!("fy"in n)&&(r.fy=!0));for(let i in r){let o=this.format[i];if(typeof o=="string"){let s=r[i]?.value??t[i]?.domain()??[];this.format[i]=(Ve(s)?bs:Yi)(o)}else if(o===void 0||o===!0){let s=t[i];this.format[i]=s?.bandwidth?l0(s,s.domain()):Os}}return r}function Kj(e,t,r){if(!(r in e))return e;let n=`${r}1`,i=`${r}2`;if((n in e||!(n in t))&&(i in e||!(i in t)))return e;let o=Object.entries(e),s=e[r];return o.splice(o.findIndex(([a])=>a===r)+1,0,[n,s],[i,s]),Object.fromEntries(o)}function tst(e,t,{title:r}){return this.format.title(r.value[e],e)}function*est(e,t,r,n,i){for(let o in r){if(o==="fx"||o==="fy"){yield{label:ZS(n,r,o),value:this.format[o](t[o],e)};continue}if(o==="x1"&&"x2"in r||o==="y1"&&"y2"in r)continue;let s=r[o];if(o==="x2"&&"x1"in r)yield{label:tq(n,r,"x"),value:Jj(this.format.x2,r.x1,s,e)};else if(o==="y2"&&"y1"in r)yield{label:tq(n,r,"y"),value:Jj(this.format.y2,r.y1,s,e)};else{let a=s.value[e],c=s.scale;if(!Pe(a)&&c==null)continue;yield{label:ZS(n,r,o),value:this.format[o](a,e),color:c==="color"?i[o][e]:null,opacity:c==="opacity"?i[o][e]:null}}}}function Jj(e,t,r,n){return r.hint?.length?`${e(r.value[n]-t.value[n],n)}`:`${e(t.value[n],n)}\u2013${e(r.value[n],n)}`}function tq(e,t,r){let n=ZS(e,t,`${r}1`,r),i=ZS(e,t,`${r}2`,r);return n===i?n:`${n}\u2013${i}`}function ZS(e,t,r,n=r){let i=t[r],o=e[i?.scale??r];return String(o?.label??i?.label??n)}function qh(e={}){let{facet:t,style:r,title:n,subtitle:i,caption:o,ariaLabel:s,ariaDescription:a}=e,c=yl(e.className),l=e.marks===void 0?[]:rq(e.marks);l.push(...ast(l));let u=ost(t,e),f=new Map;for(let k of l){let P=nq(k,u,e);P&&f.set(k,P)}let d=new Map;u&&y0(d,[u],e),y0(d,f,e);let h=rq(cst(l,d,e));for(let k of h){let P=nq(k,u,e);P&&f.set(k,P)}l.unshift(...h);let p=Oz(d,e);if(p!==void 0){let k=u?IS(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?IS(p,$):k)}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=Lz($.facetsIndex))}}for(let k of _e.keys())vs(e[k])&&k!=="fx"&&k!=="fy"&&d.set(k,[]);let m=new Map;for(let k of l){if(m.has(k))throw new Error("duplicate mark; each mark must be unique");let{facetsIndex:P,channels:U}=f.get(k)??{},{data:$,facets:X,channels:rt}=k.initialize(P,U,e);ON(rt,e),m.set(k,{data:$,facets:X,channels:rt})}let y=r0(y0(d,m,e),e),g=Gz(y,l,e);Sz(y,g);let x=H4(y),{fx:b,fy:_}=x,v=b||_?Q4(y,g):g,w=b||_?mst(x,g):g,T=pl(e),A=T.document,E=Na("svg").call(A.documentElement),N=E;T.ownerSVGElement=E,T.className=c,T.projection=kz(e,v),T.filterFacets=(k,P)=>IS(p,{channels:P,groups:vS(k,P)}),T.getMarkState=k=>{let P=m.get(k),U=f.get(k);return{...P,channels:{...P.channels,...U?.channels}}},T.dispatchValue=k=>{N.value!==k&&(N.value=k,N.dispatchEvent(new Event("input",{bubbles:!0})))};let I=new Set;for(let[k,P]of m)if(k.initializer!=null){let U=k.facet==="super"?w:v,$=k.initializer(P.data,P.facets,P.channels,x,U,T);if($.data!==void 0&&(P.data=$.data),$.facets!==void 0&&(P.facets=$.facets),$.channels!==void 0){let{fx:X,fy:rt,...ot}=$.channels;ist(ot),Object.assign(P.channels,ot);for(let at of Object.values(ot)){let{scale:Y}=at;Y!=null&&!S$(_e.get(Y))&&(sq(at,e),I.add(Y))}(X!=null||rt!=null)&&f.set(k,!0)}}if(I.size){let k=new Map;y0(k,m,e,X=>I.has(X)),y0(d,m,e,X=>I.has(X));let P=pst(r0(k,e),y),{scales:U,...$}=H4(P);Object.assign(y,P),Object.assign(x,$),Object.assign(x.scales,U)}let R,C;p!==void 0&&(R={x:b?.domain(),y:_?.domain()},p=Rz(p,R),C=Dz(b,_,g));for(let[k,P]of m)P.values=k.scale(P.channels,x,T);let{width:S,height:M}=g;Qt(E).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(k=>k.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",Oe(o,"normal")).call(Rh,f).node()}var GS=new Map([["symbol",Bj],["color",zj],["opacity",kot]]);function Uj(e={}){for(let[t,r]of GS){let n=e[t];if(vs(n)){let i=ml(e),o;if(t==="symbol"){let{fill:s,stroke:a=s===void 0&&vs(e.color)?"color":void 0}=e;o={fill:s,stroke:a}}return r(wS(t,n,o),IN(i,n,e),s=>vs(e[s])?wS(s,e[s]):null)}}throw new Error("unknown legend type; no scale found")}function $j(e,t,r={}){return(n,i)=>{if(!GS.has(n))throw new Error(`unknown legend type: ${n}`);if(n in e)return GS.get(n)(e[n],IN(t,r[n],i),o=>e[o])}}function IN({className:e,...t},{label:r,ticks:n,tickFormat:i}={},o){return w$(o,{className:e,...t},{label:r,ticks:n,tickFormat:i})}function zj(e,{legend:t=!0,...r}){if(t===!0&&(t=e.type==="ordinal"?"swatches":"ramp"),e.domain!==void 0)switch(`${t}`.toLowerCase()){case"swatches":return kj(e,r);case"ramp":return Zz(e,r);default:throw new Error(`unknown legend type: ${t}`)}}function kot({type:e,interpolate:t,...r},{legend:n=!0,color:i=wr(0,0,0),...o}){if(!t)throw new Error(`${e} opacity scales are not supported`);if(n===!0&&(n="ramp"),`${n}`.toLowerCase()!=="ramp")throw new Error(`${n} opacity legends are not supported`);return zj({type:e,...r,interpolate:Bot(i)},{legend:n,...o})}function Bot(e){let{r:t,g:r,b:n}=wr(e)||wr(0,0,0);return i=>`rgba(${t},${r},${n},${i})`}function jj(e,t,r){let n=[];for(let[i,o]of GS){let s=r[i];if(s?.legend&&i in e){let a=o(e[i],IN(t,e[i],s),c=>e[c]);a!=null&&n.push(a)}}return n}function wl(e={}){return _4(e)?e:{...e,x:G}}function vl(e={}){return w4(e)?e:{...e,y:G}}function XS(e,t){if(t.length===1)return{data:e,facets:t};let r=cl(e),n=new Uint8Array(r),i=0;for(let a of t)for(let c of a)n[c]&&++i,n[c]=1;if(i===0)return{data:e,facets:t};e=al(e);let o=e[h4]=new Uint32Array(r+i);t=t.map(a=>al(a,Uint32Array));let s=r;n.fill(0);for(let a of t)for(let c=0,l=a.length;c<l;++c){let u=a[c];n[u]?(a[c]=s,e[s]=e[u],o[s]=u,++s):o[u]=u,n[u]=1}return{data:e,facets:t}}function TN(e={},t={}){arguments.length===1&&([e,t]=Bh(e));let{y1:r,y:n=r,x:i,...o}=t,[s,a,c,l]=Ph(n,i,"y","x",e,o);return{...s,y1:r,y:a,x1:c,x2:l,x:bh(c,l)}}function Yj(e={},t={}){arguments.length===1&&([e,t]=Bh(e));let{y1:r,y:n=r,x:i}=t,[o,s,a]=Ph(n,i,"y","x",e,t);return{...o,y1:r,y:s,x:a}}function Wj(e={},t={}){arguments.length===1&&([e,t]=Bh(e));let{y1:r,y:n=r,x:i}=t,[o,s,,a]=Ph(n,i,"y","x",e,t);return{...o,y1:r,y:s,x:a}}function AN(e={},t={}){arguments.length===1&&([e,t]=Bh(e));let{x1:r,x:n=r,y:i,...o}=t,[s,a,c,l]=Ph(n,i,"x","y",e,o);return{...s,x1:r,x:a,y1:c,y2:l,y:bh(c,l)}}function Gj(e={},t={}){arguments.length===1&&([e,t]=Bh(e));let{x1:r,x:n=r,y:i}=t,[o,s,a]=Ph(n,i,"x","y",e,t);return{...o,x1:r,x:s,y:a}}function Xj(e={},t={}){arguments.length===1&&([e,t]=Bh(e));let{x1:r,x:n=r,y:i}=t,[o,s,,a]=Ph(n,i,"x","y",e,t);return{...o,x1:r,x:s,y:a}}function Sl({x:e,x1:t,x2:r,...n}={}){return n=Do(n,"y"),t===void 0&&r===void 0?TN({x:e,...n}):([t,r]=v4(e,t,r),{...n,x1:t,x2:r})}function Il({y:e,y1:t,y2:r,...n}={}){return n=Do(n,"x"),t===void 0&&r===void 0?AN({y:e,...n}):([t,r]=v4(e,t,r),{...n,y1:t,y2:r})}function Bh(e){let{offset:t,order:r,reverse:n,...i}=e;return[{offset:t,order:r,reverse:n},i]}var Pot={length:!0};function Ph(e,t=Wg,r,n,{offset:i,order:o,reverse:s},a){if(t===null)throw new Error(`stack requires ${n}`);let c=pn(a),[l,u]=tn(e),[f,d]=Br(t),[h,p]=Br(t);return f.hint=h.hint=Pot,i=Uot(i),o=jot(o,i,n),[mr(a,(m,y,g)=>{({data:m,facets:y}=XS(m,y));let x=e==null?void 0:u(tf(_t(m,e),g?.[r])),b=_t(m,t,Float64Array),_=_t(m,c),v=o&&o(m,x,b,_),w=cl(m),T=d(new Float64Array(w)),A=p(new Float64Array(w)),E=[];for(let N of y){let I=x?Array.from(Hr(N,R=>x[R]).values()):[N];if(v)for(let R of I)R.sort(v);for(let R of I){let C=0,S=0;s&&R.reverse();for(let M of R){let O=b[M];O<0?C=A[M]=(T[M]=C)+O:O>0?S=A[M]=(T[M]=S)+O:A[M]=T[M]=S}}E.push(I)}return i&&i(E,T,A,_),{data:m,facets:y}}),l,f,h]}function Uot(e){if(e!=null){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"expand":case"normalize":return $ot;case"center":case"silhouette":return zot;case"wiggle":return Qj}throw new Error(`unknown offset: ${e}`)}}function Hj(e,t){let r=0,n=0;for(let i of e){let o=t[i];o<r&&(r=o),o>n&&(n=o)}return[r,n]}function $ot(e,t,r){for(let n of e)for(let i of n){let[o,s]=Hj(i,r);for(let a of i){let c=1/(s-o||1);t[a]=c*(t[a]-o),r[a]=c*(r[a]-o)}}}function zot(e,t,r){for(let n of e){for(let i of n){let[o,s]=Hj(i,r);for(let a of i){let c=(s+o)/2;t[a]-=c,r[a]-=c}}Zj(n,t,r)}Kj(e,t,r)}function Qj(e,t,r,n){for(let i of e){let o=new Sn,s=0;for(let a of i){let c=-1,l=a.map(h=>Math.abs(r[h]-t[h])),u=a.map(h=>{c=n?n[h]:++c;let p=r[h]-t[h],m=o.has(c)?p-o.get(c):0;return o.set(c,p),m}),f=[0,...V_(u)];for(let h of a)t[h]+=s,r[h]+=s;let d=Zr(l);d&&(s-=Zr(l,(h,p)=>(u[p]/2+f[p])*h)/d)}Zj(i,t,r)}Kj(e,t,r)}function Zj(e,t,r){let n=Ht(e,i=>Ht(i,o=>t[o]));for(let i of e)for(let o of i)t[o]-=n,r[o]-=n}function Kj(e,t,r){let n=e.length;if(n===1)return;let i=e.map(a=>a.flat()),o=i.map(a=>(Ht(a,c=>t[c])+Kt(a,c=>r[c]))/2),s=Ht(o);for(let a=0;a<n;a++){let c=s-o[a];for(let l of i[a])t[l]+=c,r[l]+=c}}function jot(e,t,r){if(e===void 0&&t===Qj)return qj(Cr);if(e!=null){if(typeof e=="string"){let n=e.startsWith("-"),i=n?Qu:Cr;switch((n?e.slice(1):e).toLowerCase()){case"value":case r:return qot(i);case"z":return Vot(i);case"sum":return Yot(i);case"appearance":return Wot(i);case"inside-out":return qj(i)}return Vj(m4(e))}if(typeof e=="function")return(e.length===1?Vj:Got)(e);if(Qn(e))return Xot(e);throw new Error(`invalid order: ${e}`)}}function qot(e){return(t,r,n)=>(i,o)=>e(n[i],n[o])}function Vot(e){return(t,r,n,i)=>(o,s)=>e(i[o],i[s])}function Yot(e){return HS(e,(t,r,n,i)=>vd(Cn(t),o=>Zr(o,s=>n[s]),o=>i[o]))}function Wot(e){return HS(e,(t,r,n,i)=>vd(Cn(t),o=>r[vu(o,s=>n[s])],o=>i[o]))}function qj(e){return HS(e,(t,r,n,i)=>{let o=Cn(t),s=vd(o,f=>r[vu(f,d=>n[d])],f=>i[f]),a=Ao(o,f=>Zr(f,d=>n[d]),f=>i[f]),c=[],l=[],u=0;for(let f of s)u<0?(u+=a.get(f),c.push(f)):(u-=a.get(f),l.push(f));return l.reverse().concat(c)})}function Vj(e){return t=>{let r=_t(t,e);return(n,i)=>Cr(r[n],r[i])}}function Got(e){return t=>Qn(t)?(r,n)=>e(t[r],t[n]):(r,n)=>e(t.get(r),t.get(n))}function Xot(e){return HS(Cr,()=>e)}function HS(e,t){return(r,n,i,o)=>{if(!o)throw new Error("missing channel: z");let s=new Sn(t(r,n,i,o).map((a,c)=>[a,c]));return(a,c)=>e(s.get(o[a]),s.get(o[c]))}}var Hot={ariaLabel:"rect"},df=class extends vt{constructor(t,r={}){let{x1:n,y1:i,x2:o,y2:s}=r;super(t,{x1:{value:n,scale:"x",type:n!=null&&o==null?"band":void 0,optional:!0},y1:{value:i,scale:"y",type:i!=null&&s==null?"band":void 0,optional:!0},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},r,Hot),u0(this,r),f0(this,r)}render(t,r,n,i,o){let{x:s,y:a}=r,{x1:c,y1:l,x2:u,y2:f}=n,{marginTop:d,marginRight:h,marginBottom:p,marginLeft:m,width:y,height:g}=i,{projection:x}=o,{insetTop:b,insetRight:_,insetBottom:v,insetLeft:w}=this,{rx:T,ry:A,rx1y1:E,rx1y2:N,rx2y1:I,rx2y2:R}=this;(c||u)&&!x&&wi(s)&&(c=u=null),(l||f)&&!x&&wi(a)&&(l=f=null);let C=s?.bandwidth?s.bandwidth():0,S=a?.bandwidth?a.bandwidth():0;return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,{},0,0).call(M=>M.selectAll().data(t).enter().call(E||N||I||R?O=>O.append("path").call(Mt,this).call(d0,c&&u?L=>c[L]+(u[L]<c[L]?-_:w):c?L=>c[L]+w:m+w,l&&f?L=>l[L]+(f[L]<l[L]?-v:b):l?L=>l[L]+b:d+b,c&&u?L=>u[L]-(u[L]<c[L]?-w:_):c?L=>c[L]+C-_:y-h-_,l&&f?L=>f[L]-(f[L]<l[L]?-b:v):l?L=>l[L]+S-v:g-p-v,this).call(Wt,this,n):O=>O.append("rect").call(Mt,this).attr("x",c?u?L=>Math.min(c[L],u[L])+w:L=>c[L]+w:m+w).attr("y",l?f?L=>Math.min(l[L],f[L])+b:L=>l[L]+b:d+b).attr("width",c?u?L=>Math.max(0,Math.abs(u[L]-c[L])+C-w-_):C-w-_:y-h-m-_-w).attr("height",l?f?L=>Math.max(0,Math.abs(l[L]-f[L])+S-b-v):S-b-v:g-d-p-b-v).call(dt,"rx",T).call(dt,"ry",A).call(Wt,this,n))).node()}};function u0(e,{inset:t=0,insetTop:r=t,insetRight:n=t,insetBottom:i=t,insetLeft:o=t}={}){e.insetTop=ie(r),e.insetRight=ie(n),e.insetBottom=ie(i),e.insetLeft=ie(o)}function f0(e,{r:t,rx:r,ry:n,rx1:i=t,ry1:o=t,rx2:s=t,ry2:a=t,rx1y1:c=i!==void 0?+i:o!==void 0?+o:0,rx1y2:l=i!==void 0?+i:a!==void 0?+a:0,rx2y1:u=s!==void 0?+s:o!==void 0?+o:0,rx2y2:f=s!==void 0?+s:a!==void 0?+a:0}={}){c||l||u||f?(e.rx1y1=c,e.rx1y2=l,e.rx2y1=u,e.rx2y2=f):(e.rx=Oe(r,"auto"),e.ry=Oe(n,"auto"))}function d0(e,t,r,n,i,o){let{rx1y1:s,rx1y2:a,rx2y1:c,rx2y2:l}=o;typeof t!="function"&&(t=Ye(t)),typeof r!="function"&&(r=Ye(r)),typeof n!="function"&&(n=Ye(n)),typeof i!="function"&&(i=Ye(i));let u=Math.max(Math.abs(s+c),Math.abs(a+l)),f=Math.max(Math.abs(s+a),Math.abs(c+l));e.attr("d",d=>{let h=t(d),p=r(d),m=n(d),y=i(d),g=h>m,x=p>y,b=g?m:h,_=g?h:m,v=x?y:p,w=x?p:y,T=Math.min(1,(_-b)/u,(w-v)/f),A=T*(g?x?l:c:x?a:s),E=T*(g?x?a:s:x?l:c),N=T*(g?x?s:a:x?c:l),I=T*(g?x?c:l:x?s:a);return`M${b},${v+ZS(A,I)}A${A},${A} 0 0 ${A<0?0:1} ${b+QS(A,I)},${v}H${_-QS(E,N)}A${E},${E} 0 0 ${E<0?0:1} ${_},${v+ZS(E,N)}V${w-ZS(N,E)}A${N},${N} 0 0 ${N<0?0:1} ${_-QS(N,E)},${w}H${b+QS(I,A)}A${I},${I} 0 0 ${I<0?0:1} ${b},${w-ZS(I,A)}Z`})}function QS(e,t){return t<0?e:Math.abs(e)}function ZS(e,t){return t<0?Math.abs(e):e}function h0(e,t){return new df(e,mN(yN(t)))}function Uh(e,t={}){return Ha(t)||(t={...t,y:Ee,x2:G,interval:1}),new df(e,Sl(yN(wl(t))))}function $h(e,t={}){return Ha(t)||(t={...t,x:Ee,y2:G,interval:1}),new df(e,Il(mN(vl(t))))}var Qot={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},Zot={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1},p0=class extends vt{constructor(t={}){let{anchor:r=null}=t;super(ol,void 0,t,r==null?Qot:Zot),this.anchor=b4(r,"anchor",["top","right","bottom","left"]),u0(this,t),r||f0(this,t)}render(t,r,n,i,o){let{marginTop:s,marginRight:a,marginBottom:c,marginLeft:l,width:u,height:f}=i,{anchor:d,insetTop:h,insetRight:p,insetBottom:m,insetLeft:y}=this,{rx:g,ry:x,rx1y1:b,rx1y2:_,rx2y1:v,rx2y2:w}=this,T=l+y,A=u-a-p,E=s+h,N=f-c-m;return lt(d?"svg:line":b||_||v||w?"svg:path":"svg:rect",o).datum(0).call(kt,this,i,o).call(Mt,this).call(Wt,this,n).call(Rt,this,{}).call(d==="left"?I=>I.attr("x1",T).attr("x2",T).attr("y1",E).attr("y2",N):d==="right"?I=>I.attr("x1",A).attr("x2",A).attr("y1",E).attr("y2",N):d==="top"?I=>I.attr("x1",T).attr("x2",A).attr("y1",E).attr("y2",E):d==="bottom"?I=>I.attr("x1",T).attr("x2",A).attr("y1",N).attr("y2",N):b||_||v||w?I=>I.call(d0,T,E,A,N,this):I=>I.attr("x",T).attr("y",E).attr("width",A-T).attr("height",N-E).attr("rx",g).attr("ry",x)).node()}};function zh(e){return new p0(e)}var EN={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},Kot=new Set(["geometry","href","src","ariaLabel","scales"]),m0=class extends vt{constructor(t,r={}){r.tip&&(r={...r,tip:!1}),r.title===void 0&&kn(t)&&iS(t)&&(r={...r,title:G});let{x:n,y:i,x1:o,x2:s,y1:a,y2:c,anchor:l,preferredAnchor:u="bottom",monospace:f,fontFamily:d=f?"ui-monospace, monospace":void 0,fontSize:h,fontStyle:p,fontVariant:m,fontWeight:y,lineHeight:g=1,lineWidth:x=20,frameAnchor:b,format:_,textAnchor:v="start",textOverflow:w,textPadding:T=8,title:A,pointerSize:E=12,pathFilter:N="drop-shadow(0 3px 4px rgba(0,0,0,0.2))"}=r;super(t,{x:{value:o!=null&&s!=null?null:n,scale:"x",optional:!0},y:{value:a!=null&&c!=null?null:i,scale:"y",optional:!0},x1:{value:o,scale:"x",optional:s==null},y1:{value:a,scale:"y",optional:c==null},x2:{value:s,scale:"x",optional:o==null},y2:{value:c,scale:"y",optional:a==null},title:{value:A,optional:!0}},r,EN),this.anchor=sS(l,"anchor"),this.preferredAnchor=sS(u,"preferredAnchor"),this.frameAnchor=Ts(b),this.textAnchor=Oe(v,"middle"),this.textPadding=+T,this.pointerSize=+E,this.pathFilter=rr(N),this.lineHeight=+g,this.lineWidth=+x,this.textOverflow=xN(w),this.monospace=!!f,this.fontFamily=rr(d),this.fontSize=ie(h),this.fontStyle=rr(p),this.fontVariant=rr(m),this.fontWeight=rr(y);for(let I in EN)I in this.channels&&(this[I]=EN[I]);this.splitLines=_N(this),this.clipLine=wN(this),this.format=typeof _=="string"||typeof _=="function"?{title:_}:{..._}}render(t,r,n,i,o){let s=this,{x:a,y:c,fx:l,fy:u}=r,{ownerSVGElement:f,document:d}=o,{anchor:h,monospace:p,lineHeight:m,lineWidth:y}=this,{textPadding:g,pointerSize:x,pathFilter:b}=this,{marginTop:_,marginLeft:v}=i,{x1:w,y1:T,x2:A,y2:E,x:N=w??A,y:I=T??E}=n,R=l?l(t.fx)-v:0,C=u?u(t.fy)-_:0,[S,M]=Ur(this,i),O=uN(n,S),L=fN(n,M),B=p?BS:kS,k=B(cf),P,U;"title"in n?(P=Jj.call(this,{title:n.channels.title},r),U=rst):(P=Jj.call(this,n.channels,r),U=nst);let $=lt("svg:g",o).call(kt,this,i,o).call(bN,this).call(Rt,this,{x:N&&a,y:I&&c}).call(ot=>ot.selectAll().data(t).enter().append("g").attr("transform",at=>`translate(${Math.round(O(at))},${Math.round(L(at))})`).call(Mt,this).call(at=>at.append("path").attr("filter",b)).call(at=>at.append("text").each(function(Y){let st=Qt(this);this.setAttribute("fill","currentColor"),this.setAttribute("fill-opacity",1),this.setAttribute("stroke","none");let q=U.call(s,Y,t,P,r,n);if(typeof q=="string")for(let H of s.splitLines(q))X(st,{value:s.clipLine(H)});else{let H=new Set;for(let nt of q){let{label:z=""}=nt;z&&H.has(z)||(H.add(z),X(st,nt))}}})));function X(ot,{label:at,value:Y,color:st,opacity:q}){at??="",Y??="";let H=st!=null||q!=null,nt,z=y*100,[Pt]=uf(at,z,B,k);if(Pt>=0)at=at.slice(0,Pt).trimEnd()+cf,nt=Y.trim(),Y="";else{(at||!Y&&!H)&&(Y=" "+Y);let[Zt]=uf(Y,z-B(at),B,k);Zt>=0&&(nt=Y.trim(),Y=Y.slice(0,Zt).trimEnd()+cf)}let ht=ot.append("tspan").attr("x",0).attr("dy",`${m}em`).text("\u200B");at&&ht.append("tspan").attr("font-weight","bold").text(at),Y&&ht.append(()=>d.createTextNode(Y)),H&&ht.append("tspan").text(" \u25A0").attr("fill",st).attr("fill-opacity",q).style("user-select","none"),nt&&ht.append("title").text(nt)}function rt(){let{width:ot,height:at}=i.facet??i;$.selectChildren().each(function(Y){let{x:st,width:q,height:H}=this.getBBox();q=Math.round(q),H=Math.round(H);let nt=h;if(nt===void 0){let ht=O(Y)+R,Zt=L(Y)+C,Jt=ht+q+x+g*2<ot,tt=ht-q-x-g*2>0,ge=Zt+H+x+g*2<at,Kn=Zt-H-x-g*2>0;nt=Jt&&tt?ge&&Kn?s.preferredAnchor:Kn?"bottom":"top":ge&&Kn?Jt?"left":"right":(Jt||tt)&&(ge||Kn)?`${Kn?"bottom":"top"}-${Jt?"left":"right"}`:s.preferredAnchor}let z=this.firstChild,Pt=this.lastChild;if(z.setAttribute("d",est(nt,x,g,q,H)),st)for(let ht of Pt.childNodes)ht.setAttribute("x",-st);Pt.setAttribute("y",`${+Jot(nt,Pt.childNodes.length,m).toFixed(6)}em`),Pt.setAttribute("transform",`translate(${tst(nt,x,g,q,H)})`)}),$.attr("visibility",null)}return t.length&&($.attr("visibility","hidden"),f.isConnected?Promise.resolve().then(rt):typeof requestAnimationFrame<"u"&&requestAnimationFrame(rt)),$.node()}};function JS(e,{x:t,y:r,...n}={}){return n.frameAnchor===void 0&&([t,r]=Ke(t,r)),new m0(e,{...n,x:t,y:r})}function Jot(e,t,r){return/^top(?:-|$)/.test(e)?.94-r:-.29-t*r}function tst(e,t,r,n,i){switch(e){case"middle":return[-n/2,i/2];case"top-left":return[r,t+r];case"top":return[-n/2,t/2+r];case"top-right":return[-n-r,t+r];case"right":return[-t/2-n-r,i/2];case"bottom-left":return[r,-t-r];case"bottom":return[-n/2,-t/2-r];case"bottom-right":return[-n-r,-t-r];case"left":return[r+t/2,i/2]}}function est(e,t,r,n,i){let o=n+r*2,s=i+r*2;switch(e){case"middle":return`M${-o/2},${-s/2}h${o}v${s}h${-o}z`;case"top-left":return`M0,0l${t},${t}h${o-t}v${s}h${-o}z`;case"top":return`M0,0l${t/2},${t/2}h${(o-t)/2}v${s}h${-o}v${-s}h${(o-t)/2}z`;case"top-right":return`M0,0l${-t},${t}h${t-o}v${s}h${o}z`;case"right":return`M0,0l${-t/2},${-t/2}v${t/2-s/2}h${-o}v${s}h${o}v${t/2-s/2}z`;case"bottom-left":return`M0,0l${t},${-t}h${o-t}v${-s}h${-o}z`;case"bottom":return`M0,0l${t/2},${-t/2}h${(o-t)/2}v${-s}h${-o}v${s}h${(o-t)/2}z`;case"bottom-right":return`M0,0l${-t},${-t}h${t-o}v${-s}h${o}z`;case"left":return`M0,0l${t/2},${-t/2}v${t/2-s/2}h${o}v${s}h${-o}v${t/2-s/2}z`}}function Jj(e,t){let r={},n=this.format;n=tq(n,e,"x"),n=tq(n,e,"y"),this.format=n;for(let i in n){let o=n[i];if(!(o===null||o===!1))if(i==="fx"||i==="fy")r[i]=!0;else{let s=Jg(e,i);s&&(r[i]=s)}}for(let i in e){if(i in r||i in n||Kot.has(i)||(i==="x"||i==="y")&&e.geometry)continue;let o=Jg(e,i);if(o){if(o.scale==null&&o.defaultScale==="color")continue;r[i]=o}}this.facet&&(t.fx&&!("fx"in n)&&(r.fx=!0),t.fy&&!("fy"in n)&&(r.fy=!0));for(let i in r){let o=this.format[i];if(typeof o=="string"){let s=r[i]?.value??t[i]?.domain()??[];this.format[i]=(Ve(s)?bs:Yi)(o)}else if(o===void 0||o===!0){let s=t[i];this.format[i]=s?.bandwidth?l0(s,s.domain()):Os}}return r}function tq(e,t,r){if(!(r in e))return e;let n=`${r}1`,i=`${r}2`;if((n in e||!(n in t))&&(i in e||!(i in t)))return e;let o=Object.entries(e),s=e[r];return o.splice(o.findIndex(([a])=>a===r)+1,0,[n,s],[i,s]),Object.fromEntries(o)}function rst(e,t,{title:r}){return this.format.title(r.value[e],e)}function*nst(e,t,r,n,i){for(let o in r){if(o==="fx"||o==="fy"){yield{label:KS(n,r,o),value:this.format[o](t[o],e)};continue}if(o==="x1"&&"x2"in r||o==="y1"&&"y2"in r)continue;let s=r[o];if(o==="x2"&&"x1"in r)yield{label:rq(n,r,"x"),value:eq(this.format.x2,r.x1,s,e)};else if(o==="y2"&&"y1"in r)yield{label:rq(n,r,"y"),value:eq(this.format.y2,r.y1,s,e)};else{let a=s.value[e],c=s.scale;if(!Pe(a)&&c==null)continue;yield{label:KS(n,r,o),value:this.format[o](a,e),color:c==="color"?i[o][e]:null,opacity:c==="opacity"?i[o][e]:null}}}}function eq(e,t,r,n){return r.hint?.length?`${e(r.value[n]-t.value[n],n)}`:`${e(t.value[n],n)}\u2013${e(r.value[n],n)}`}function rq(e,t,r){let n=KS(e,t,`${r}1`,r),i=KS(e,t,`${r}2`,r);return n===i?n:`${n}\u2013${i}`}function KS(e,t,r,n=r){let i=t[r],o=e[i?.scale??r];return String(o?.label??i?.label??n)}function jh(e={}){let{facet:t,style:r,title:n,subtitle:i,caption:o,ariaLabel:s,ariaDescription:a}=e,c=gl(e.className),l=e.marks===void 0?[]:iq(e.marks);l.push(...lst(l));let u=ast(t,e),f=new Map;for(let k of l){let P=oq(k,u,e);P&&f.set(k,P)}let d=new Map;u&&y0(d,[u],e),y0(d,f,e);let h=iq(ust(l,d,e));for(let k of h){let P=oq(k,u,e);P&&f.set(k,P)}l.unshift(...h);let p=Dz(d,e);if(p!==void 0){let k=u?TS(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?TS(p,$):k)}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=Cz($.facetsIndex))}}for(let k of _e.keys())vs(e[k])&&k!=="fx"&&k!=="fy"&&d.set(k,[]);let m=new Map;for(let k of l){if(m.has(k))throw new Error("duplicate mark; each mark must be unique");let{facetsIndex:P,channels:U}=f.get(k)??{},{data:$,facets:X,channels:rt}=k.initialize(P,U,e);ON(rt,e),m.set(k,{data:$,facets:X,channels:rt})}let y=r0(y0(d,m,e),e),g=Hz(y,l,e);Tz(y,g);let x=H4(y),{fx:b,fy:_}=x,v=b||_?Q4(y,g):g,w=b||_?gst(x,g):g,T=ml(e),A=T.document,E=Na("svg").call(A.documentElement),N=E;T.ownerSVGElement=E,T.className=c,T.projection=Pz(e,v),T.filterFacets=(k,P)=>TS(p,{channels:P,groups:SS(k,P)}),T.getMarkState=k=>{let P=m.get(k),U=f.get(k);return{...P,channels:{...P.channels,...U?.channels}}},T.dispatchValue=k=>{N.value!==k&&(N.value=k,N.dispatchEvent(new Event("input",{bubbles:!0})))};let I=new Set;for(let[k,P]of m)if(k.initializer!=null){let U=k.facet==="super"?w:v,$=k.initializer(P.data,P.facets,P.channels,x,U,T);if($.data!==void 0&&(P.data=$.data),$.facets!==void 0&&(P.facets=$.facets),$.channels!==void 0){let{fx:X,fy:rt,...ot}=$.channels;sst(ot),Object.assign(P.channels,ot);for(let at of Object.values(ot)){let{scale:Y}=at;Y!=null&&!T$(_e.get(Y))&&(cq(at,e),I.add(Y))}(X!=null||rt!=null)&&f.set(k,!0)}}if(I.size){let k=new Map;y0(k,m,e,X=>I.has(X)),y0(d,m,e,X=>I.has(X));let P=yst(r0(k,e),y),{scales:U,...$}=H4(P);Object.assign(y,P),Object.assign(x,$),Object.assign(x.scales,U)}let R,C;p!==void 0&&(R={x:b?.domain(),y:_?.domain()},p=Lz(p,R),C=Fz(b,_,g));for(let[k,P]of m)P.values=k.scale(P.channels,x,T);let{width:S,height:M}=g;Qt(E).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(k=>k.append("style").text(`:where(.${c}) {
60
60
  --plot-background: white;
61
61
  display: block;
62
62
  height: auto;
@@ -66,4 +66,4 @@ ${m}`)).style("margin-left",l?`${+l}px`:null).style("width",d===void 0?null:`${+
66
66
  :where(.${c} text),
67
67
  :where(.${c} tspan) {
68
68
  white-space: pre;
69
- }`)).call(Dh,r);for(let k of l){let{channels:P,values:U,facets:$}=m.get(k);if(p===void 0||k.facet==="super"){let X=null;if($&&(X=$[0],X=k.filter(X,P,U),X.length===0))continue;let rt=k.render(X,x,U,w,T);if(rt==null)continue;E.appendChild(rt)}else{let X;for(let rt of p){if(!(k.facetAnchor?.(p,R,rt)??!rt.empty))continue;let ot=null;if($){let Y=f.has(k);if(ot=$[Y?rt.i:0],ot=k.filter(ot,P,U),ot.length===0)continue;!Y&&ot===$[0]&&(ot=Qa(ot)),ot.fx=rt.x,ot.fy=rt.y,ot.fi=rt.i}let at=k.render(ot,x,U,v,T);if(at!=null){(X??=Qt(E).append("g")).append(()=>at).datum(rt);for(let Y of["aria-label","aria-description","aria-hidden","transform"])at.hasAttribute(Y)&&(X.attr(Y,at.getAttribute(Y)),at.removeAttribute(Y))}}X?.selectChildren().attr("transform",C)}}let O=$j(y,T,e),{figure:L=n!=null||i!=null||o!=null||O.length>0}=e;L&&(N=A.createElement("figure"),N.className=`${c}-figure`,N.style.maxWidth="initial",n!=null&&N.append(eq(A,n,"h2")),i!=null&&N.append(eq(A,i,"h3")),N.append(...O,E),o!=null&&N.append(rst(A,o)),"value"in E&&(N.value=E.value,delete E.value)),N.scale=Ez(x.scales),N.legend=Pj(y,T,e);let B=iz();return B>0&&Qt(E).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.`),N}function eq(e,t,r){if(t.ownerDocument)return t;let n=e.createElement(r);return n.append(t),n}function rst(e,t){let r=e.createElement("figcaption");return r.append(t),r}function rq(e){return e.flat(1/0).filter(t=>t!=null).map(nst)}function nst(e){return typeof e.render=="function"?e:new NN(e)}var NN=class extends vt{constructor(t){if(typeof t!="function")throw new TypeError("invalid mark; missing render function");super(),this.render=t}render(){}};function ON(e,t){for(let r in e)sq(e[r],t);return e}function sq(e,t){let{scale:r,transform:n=!0}=e;if(r==null||!n)return;let{type:i,percent:o,interval:s,transform:a=o?c=>c==null?NaN:c*100:S4(s,i)}=t[r]??{};a!=null&&(e.value=Xt(e.value,a),e.transform=!1)}function ist(e){for(let t in e)U4(t,e[t])}function y0(e,t,r,n=l$){for(let{channels:i}of t.values())for(let o in i){let s=i[o],{scale:a}=s;if(a!=null&&n(a))if(a==="projection"){if(!Pz(r)){let c=r.x?.domain===void 0,l=r.y?.domain===void 0;if(c||l){let[u,f]=$z(s);c&&MN(e,"x",u),l&&MN(e,"y",f)}}}else MN(e,a,s)}return e}function MN(e,t,r){let n=e.get(t);n!==void 0?n.push(r):e.set(t,[r])}function ost(e,t){if(e==null)return;let{x:r,y:n}=e;if(r==null&&n==null)return;let i=Xa(e.data);if(i==null)throw new Error("missing facet data");let o={};r!=null&&(o.fx=Th(i,{value:r,scale:"fx"})),n!=null&&(o.fy=Th(i,{value:n,scale:"fy"})),ON(o,t);let s=vS(i,o);return{channels:o,groups:s,data:e.data}}function nq(e,t,r){if(e.facet===null||e.facet==="super")return;let{fx:n,fy:i}=e;if(n!=null||i!=null){let c=Xa(e.data??n??i);if(c===void 0)throw new Error(`missing facet data in ${e.ariaLabel}`);if(c===null)return;let l={};return n!=null&&(l.fx=Th(c,{value:n,scale:"fx"})),i!=null&&(l.fy=Th(c,{value:i,scale:"fy"})),ON(l,r),{channels:l,groups:vS(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)&&al(Xa(e.data))===al(a)&&mn(`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 sst(e,t={}){return Ne({...t,x:null,y:null},(r,n,i,o,s,a)=>a.getMarkState(e))}function ast(e){let t=[];for(let r of e){let n=r.tip;if(n){n===!0?n={}:typeof n=="string"&&(n={pointer:n});let{pointer:i,preferredAnchor:o}=n;i=/^x$/i.test(i)?xl:/^y$/i.test(i)?ic:gl,n=i(sst(r,n)),n.title=null,o===void 0&&(n.preferredAnchor=i===ic?"left":"bottom");let s=KS(r.data,n);s.facet=r.facet,s.facetAnchor=r.facetAnchor,t.push(s)}}return t}function cst(e,t,r){let{projection:n,x:i={},y:o={},fx:s={},fy:a={},axis:c,grid:l,facet:u={},facet:{axis:f=c,grid:d}=u,x:{axis:h=c,grid:p=h===null?null:l}=i,y:{axis:m=c,grid:y=m===null?null:l}=o,fx:{axis:g=f,grid:x=g===null?null:d}=s,fy:{axis:b=f,grid:_=b===null?null:d}=a}=r;(n||!vs(i)&&!iq("x",e))&&(h=p=null),(n||!vs(o)&&!iq("y",e))&&(m=y=null),t.has("fx")||(g=x=null),t.has("fy")||(b=_=null),h===void 0&&(h=!eI(e,"x")),m===void 0&&(m=!eI(e,"y")),g===void 0&&(g=!eI(e,"fx")),b===void 0&&(b=!eI(e,"fy")),h===!0&&(h="bottom"),m===!0&&(m="left"),g===!0&&(g=h==="top"||h===null?"bottom":"top"),b===!0&&(b=m==="right"||m===null?"left":"right");let v=[];return tI(v,_,qS,a),JS(v,b,$S,"right","left",u,a),tI(v,x,YS,s),JS(v,g,zS,"top","bottom",u,s),tI(v,y,jS,o),JS(v,m,a0,"left","right",r,o),tI(v,p,VS,i),JS(v,h,c0,"bottom","top",r,i),v}function JS(e,t,r,n,i,o,s){if(!t)return;let a=lst(t);s=ust(a?n:t,o,s);let{line:c}=s;(r===a0||r===c0)&&c&&!Ka(c)&&e.push(jh(fst(s))),e.push(r(s)),a&&e.push(r({...s,anchor:i,label:null}))}function tI(e,t,r,n){!t||Ka(t)||e.push(r(dst(t,n)))}function lst(e){return/^\s*both\s*$/i.test(e)}function ust(e,t,{line:r=t.line,ticks:n,tickSize:i,tickSpacing:o,tickPadding:s,tickFormat:a,tickRotate:c,fontVariant:l,ariaLabel:u,ariaDescription:f,label:d=t.label,labelAnchor:h,labelArrow:p=t.labelArrow,labelOffset:m}){return{anchor:e,line:r,ticks:n,tickSize:i,tickSpacing:o,tickPadding:s,tickFormat:a,tickRotate:c,fontVariant:l,ariaLabel:u,ariaDescription:f,label:d,labelAnchor:h,labelArrow:p,labelOffset:m}}function fst(e){let{anchor:t,line:r}=e;return{anchor:t,facetAnchor:t+"-empty",stroke:r===!0?void 0:r}}function dst(e,{stroke:t=ll(e)?e:void 0,ticks:r=hst(e)?e:void 0,tickSpacing:n,ariaLabel:i,ariaDescription:o}){return{stroke:t,ticks:r,tickSpacing:n,ariaLabel:i,ariaDescription:o}}function hst(e){switch(typeof e){case"number":return!0;case"string":return!ll(e)}return kn(e)||typeof e?.range=="function"}function eI(e,t){let r=`${t}-axis `;return e.some(n=>n.ariaLabel?.startsWith(r))}function iq(e,t){for(let r of t)for(let n in r.channels){let{scale:i}=r.channels[n];if(i===e||i==="projection")return!0}return!1}function pst(e,t){for(let r in e){let n=e[r],i=t[r];n.label===void 0&&i&&(n.label=i.label)}return e}function mst({fx:e,fy:t},r){let{marginTop:n,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=bS(r),l=e&&oq(e),u=t&&oq(t);return{marginTop:t?u[0]:n,marginRight:e?a-l[1]:i,marginBottom:t?c-u[1]:o,marginLeft:e?l[0]:s,inset:{marginTop:r.marginTop,marginRight:r.marginRight,marginBottom:r.marginBottom,marginLeft:r.marginLeft},width:a,height:c}}function oq(e){let t=e.domain();if(t.length===0)return[0,e.bandwidth()];let r=e(t[0]),n=e(t[t.length-1]);return n<r&&([r,n]=[n,r]),[r,n+e.bandwidth()]}var yst=new Map([["basis",z6],["basis-closed",j6],["basis-open",q6],["bundle",V6],["bump-x",k6],["bump-y",B6],["cardinal",Y6],["cardinal-closed",W6],["cardinal-open",G6],["catmull-rom",X6],["catmull-rom-closed",H6],["catmull-rom-open",Q6],["linear",Va],["linear-closed",Z6],["monotone-x",J6],["monotone-y",t4],["natural",e4],["step",r4],["step-after",i4],["step-before",n4]]);function g0(e=Va,t){if(typeof e=="function")return e;let r=yst.get(`${e}`.toLowerCase());if(!r)throw new Error(`unknown curve: ${e}`);if(t!==void 0){if("beta"in r)return r.beta(t);if("tension"in r)return r.tension(t);if("alpha"in r)return r.alpha(t)}return r}function rI(e=Il,t){return typeof e!="function"&&`${e}`.toLowerCase()==="auto"?Il:g0(e,t)}function Il(e){return Va(e)}function Ds(e={y:"count"},t={}){[e,t]=DN(e,t);let{x:r,y:n}=t;return RN(nI(r,t,G),null,null,n,e,sf(t))}function Ls(e={x:"count"},t={}){[e,t]=DN(e,t);let{x:r,y:n}=t;return RN(null,nI(n,t,G),r,null,e,af(t))}function sc(e={fill:"count"},t={}){[e,t]=DN(e,t);let{x:r,y:n}=gst(t);return RN(r,n,null,null,e,sf(af(t)))}function lq(e,t,r={}){if(r?.interval==null)return r;let{reduce:n=hS}=r,i={filter:null};return r[t]!=null&&(i[t]=n),r[`${t}1`]!=null&&(i[`${t}1`]=n),r[`${t}2`]!=null&&(i[`${t}2`]=n),e(i,r)}function Vh(e={}){return lq(Ds,"y",Do(e,"x"))}function Yh(e={}){return lq(Ls,"x",Do(e,"y"))}function RN(e,t,r,n,{data:i=dS,filter:o=Hg,sort:s,reverse:a,...c}={},l={}){e=aq(e),t=aq(t),c=xst(c,l),i=dq(i,G),s=s==null?void 0:uq("sort",s,l),o=o==null?void 0:fq("filter",o,l),r!=null&&Es(c,"x","x1","x2")&&(r=null),n!=null&&Es(c,"y","y1","y2")&&(n=null);let[u,f]=tn(e),[d,h]=tn(e),[p,m]=tn(t),[y,g]=tn(t),[x,b]=r!=null?[r,"x"]:n!=null?[n,"y"]:[],[_,v]=tn(x),{x:w,y:T,z:A,fill:E,stroke:N,x1:I,x2:R,y1:C,y2:S,domain:M,cumulative:O,thresholds:L,interval:B,...k}=l,[P,U]=tn(A),[$]=qe(E),[X]=qe(N),[rt,ot]=tn($),[at,Y]=tn(X);return{..."z"in l&&{z:P||A},..."fill"in l&&{fill:rt||E},..."stroke"in l&&{stroke:at||N},...mr(k,(st,q,H)=>{let nt=tf(_t(st,x),H?.[b]),z=_t(st,A),Pt=_t(st,$),ht=_t(st,X),Zt=Kg(c,{z,fill:Pt,stroke:ht}),Jt=[],tt=[],ge=nt&&v([]),Kn=z&&U([]),Bo=Pt&&ot([]),wW=ht&&Y([]),cC=e&&f([]),vW=e&&h([]),lC=t&&m([]),SW=t&&g([]),IW=wst(e,t,st),TW=0;for(let Af of c)Af.initialize(st);s&&s.initialize(st),o&&o.initialize(st);for(let Af of q){let uC=[];for(let Ef of c)Ef.scope("facet",Af);s&&s.scope("facet",Af),o&&o.scope("facet",Af);for(let[Ef,AW]of As(Af,Zt))for(let[EW,vx]of As(AW,nt))for(let[Po,zs]of IW(vx))if(Zt&&(zs.z=Ef),!(o&&!o.reduce(Po,zs))){uC.push(TW++),tt.push(i.reduceIndex(Po,st,zs)),nt&&ge.push(EW),z&&Kn.push(Zt===z?Ef:z[(Po.length>0?Po:vx)[0]]),Pt&&Bo.push(Zt===Pt?Ef:Pt[(Po.length>0?Po:vx)[0]]),ht&&wW.push(Zt===ht?Ef:ht[(Po.length>0?Po:vx)[0]]),cC&&(cC.push(zs.x1),vW.push(zs.x2)),lC&&(lC.push(zs.y1),SW.push(zs.y2));for(let MW of c)MW.reduce(Po,zs);s&&s.reduce(Po,zs)}Jt.push(uC)}return k4(Jt,s,a),{data:tt,facets:Jt}}),...!Es(c,"x")&&(u?{x1:u,x2:d,x:_h(u,d)}:{x:w,x1:I,x2:R}),...!Es(c,"y")&&(p?{y1:p,y2:y,y:_h(p,y)}:{y:T,y1:C,y2:S}),..._&&{[b]:_},...Object.fromEntries(c.map(({name:st,output:q})=>[st,q]))}}function DN({cumulative:e,domain:t,thresholds:r,interval:n,...i},o){return[i,{cumulative:e,domain:t,thresholds:r,interval:n,...o}]}function nI(e,{cumulative:t,domain:r,thresholds:n,interval:i},o){return e={...Ki(e)},e.domain===void 0&&(e.domain=r),e.cumulative===void 0&&(e.cumulative=t),e.thresholds===void 0&&(e.thresholds=n),e.interval===void 0&&(e.interval=i),e.value===void 0&&(e.value=o),e.thresholds=LN(e.thresholds,e.interval),e}function gst(e){let{x:t,y:r}=e;return t=nI(t,e),r=nI(r,e),[t.value,r.value]=Ke(t.value,r.value),{x:t,y:r}}function aq(e){if(e==null)return;let{value:t,cumulative:r,domain:n=ce,thresholds:i}=e,o=s=>{let a=_t(s,t),c;if(Ve(a)||_st(i)){a=Xt(a,x4,Float64Array);let[u,f]=typeof n=="function"?n(a):n,d=typeof i=="function"&&!cl(i)?i(a,u,f):i;typeof d=="number"&&(d=yg(u,f,d)),cl(d)&&(n===ce&&(u=d.floor(u),f=d.offset(d.floor(f))),d=d.range(u,d.offset(f))),c=d}else{a=pr(a);let[u,f]=typeof n=="function"?n(a):n,d=typeof i=="function"&&!cl(i)?i(a,u,f):i;if(typeof d=="number")if(n===ce){let h=Aa(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 y=m-p+1;d=new Float64Array(y);for(let g=0;g<y;++g)d[g]=(p+g)*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 y=m-p+1;d=new Float64Array(y);for(let g=0;g<y;++g)d[g]=(p+g)/h}else d=[u];else d=[u]}else d=Qr(u,f,d);else cl(d)&&(n===ce&&(u=d.floor(u),f=d.offset(d.floor(f))),d=d.range(u,d.offset(f)));c=d}let l=[];if(c.length===1)l.push([c[0],c[0]]);else for(let u=1;u<c.length;++u)l.push([c[u-1],c[u]]);return l.bin=(r<0?Sst:r>0?vst:FN)(l,c,a),l};return o.label=en(t),o}function LN(e,t,r=cq){if(e===void 0)return t===void 0?r:Is(t);if(typeof e=="string"){switch(e.toLowerCase()){case"freedman-diaconis":return X_;case"scott":return fy;case"sturges":return Uc;case"auto":return cq}return Ku(e)}return e}function xst(e,t){return F4(e,t,uq)}function uq(e,t,r){return uS(e,t,r,fq)}function fq(e,t,r){return fS(e,t,r,dq)}function dq(e,t){return Ih(e,t,bst)}function bst(e){switch(`${e}`.toLowerCase()){case"x":return Ist;case"x1":return Ast;case"x2":return Est;case"y":return Tst;case"y1":return Mst;case"y2":return Nst;case"z":return B4}throw new Error(`invalid bin reduce: ${e}`)}function cq(e,t,r){return Math.min(200,fy(e,t,r))}function _st(e){return d$(e)||kn(e)&&Ve(e)}function wst(e,t,r){let n=e?.(r),i=t?.(r);return n&&i?function*(o){let s=n.bin(o);for(let[a,[c,l]]of n.entries()){let u=i.bin(s[a]);for(let[f,[d,h]]of i.entries())yield[u[f],{data:r,x1:c,y1:d,x2:l,y2:h}]}}:n?function*(o){let s=n.bin(o);for(let[a,[c,l]]of n.entries())yield[s[a],{data:r,x1:c,x2:l}]}:function*(o){let s=i.bin(o);for(let[a,[c,l]]of i.entries())yield[s[a],{data:r,y1:c,y2:l}]}}function FN(e,t,r){return t=pr(t),n=>{let i=e.map(()=>[]);for(let o of n)i[Ia(t,r[o])-1]?.push(o);return i}}function vst(e,t,r){let n=FN(e,t,r);return i=>{let o=n(i);for(let s=1,a=o.length;s<a;++s){let c=o[s-1],l=o[s];for(let u of c)l.push(u)}return o}}function Sst(e,t,r){let n=FN(e,t,r);return i=>{let o=n(i);for(let s=o.length-2;s>=0;--s){let a=o[s+1],c=o[s];for(let l of a)c.push(l)}return o}}function hq(e,t){let r=(+e+ +t)/2;return e instanceof Date?new Date(r):r}var Ist={reduceIndex(e,t,{x1:r,x2:n}){return hq(r,n)}},Tst={reduceIndex(e,t,{y1:r,y2:n}){return hq(r,n)}},Ast={reduceIndex(e,t,{x1:r}){return r}},Est={reduceIndex(e,t,{x2:r}){return r}},Mst={reduceIndex(e,t,{y1:r}){return r}},Nst={reduceIndex(e,t,{y2:r}){return r}};var Ost={ariaLabel:"area",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},hf=class extends vt{constructor(t,r={}){let{x1:n,y1:i,x2:o,y2:s,z:a,curve:c,tension:l}=r;super(t,{x1:{value:n,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0},z:{value:pn(r),optional:!0}},r,Ost),this.z=a,this.curve=g0(c,l)}filter(t){return t}render(t,r,n,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a}=n;return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,r,0,0).call(u=>u.selectAll().data(MS(t,[s,a,c,l],this,n)).enter().append("path").call(Et,this).call(of,this,n).attr("d",ch().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 x0(e,t){return t===void 0?ac(e,{x:Ju,y:ol}):new hf(e,t)}function Tl(e,t){let{y:r=Ee,...n}=Yh(t);return new hf(e,vl(_l({...n,y1:r,y2:void 0})))}function ac(e,t){let{x:r=Ee,...n}=Vh(t);return new hf(e,Sl(wl({...n,x1:r,x2:void 0})))}var Rst={ariaLabel:"link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},b0=class extends vt{constructor(t,r={}){let{x1:n,y1:i,x2:o,y2:s,curve:a,tension:c}=r;super(t,{x1:{value:n,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},r,Rst),this.curve=rI(a,c),Lo(this,r)}project(t,r,n){this.curve!==Il&&super.project(t,r,n)}render(t,r,n,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a}=n,{curve:u}=this;return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,r).call(f=>f.selectAll().data(t).enter().append("path").call(Et,this).attr("d",u===Il&&o.projection?Dst(o.projection,s,a,c,l):d=>{let h=Nn(),p=u(h);return p.lineStart(),p.point(s[d],a[d]),p.point(c[d],l[d]),p.lineEnd(),h}).call(Wt,this,n).call(oc,this,n,o)).node()}};function Dst(e,t,r,n,i){let o=Dr(e);return t=pr(t),r=pr(r),n=pr(n),i=pr(i),s=>o({type:"LineString",coordinates:[[t[s],r[s]],[n[s],i[s]]]})}function iI(e,{x:t,x1:r,x2:n,y:i,y1:o,y2:s,...a}={}){return[r,n]=_0(t,r,n),[o,s]=_0(i,o,s),new b0(e,{...a,x1:r,x2:n,y1:o,y2:s})}function _0(e,t,r){if(e===void 0){if(t===void 0){if(r!==void 0)return[r]}else if(r===void 0)return[t]}else{if(t===void 0)return r===void 0?[e]:[e,r];if(r===void 0)return[e,t]}return[t,r]}var Lst={ariaLabel:"arrow",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:1,strokeWidth:1.5},w0=class extends vt{constructor(t,r={}){let{x1:n,y1:i,x2:o,y2:s,bend:a=0,headAngle:c=60,headLength:l=8,inset:u=0,insetStart:f=u,insetEnd:d=u,sweep:h}=r;super(t,{x1:{value:n,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},r,Lst),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=Fst(h)}render(t,r,n,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a,SW:u}=n,{strokeWidth:f,bend:d,headAngle:h,headLength:p,insetStart:m,insetEnd:y}=this,g=u?_=>u[_]:Ye(f===void 0?1:f),x=h*Lh/2,b=p/1.5;return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,r).call(_=>_.selectAll().data(t).enter().append("path").call(Et,this).attr("d",v=>{let w=s[v],T=a[v],A=c[v],E=l[v],N=Math.hypot(A-w,E-T);if(N<=m+y)return null;let I=Math.atan2(E-T,A-w),R=Math.min(b*g(v),N/3),C=this.sweep(w,T,A,E)*d*Lh,S=Math.hypot(N/Math.tan(C),N)/2;if(m||y)if(S<1e5){let rt=Math.sign(C),[ot,at]=Cst([w,T],[A,E],S,rt);if(m&&([w,T]=pq([ot,at,S],[w,T,m],-rt*Math.sign(m))),y){let[Y,st]=pq([ot,at,S],[A,E,y],rt*Math.sign(y));I+=Math.atan2(st-at,Y-ot)-Math.atan2(E-at,A-ot),A=Y,E=st}}else{let rt=A-w,ot=E-T,at=Math.hypot(rt,ot);m&&(w+=rt/at*m,T+=ot/at*m),y&&(A-=rt/at*y,E-=ot/at*y)}let M=I+C,O=M+x,L=M-x,B=A-R*Math.cos(O),k=E-R*Math.sin(O),P=A-R*Math.cos(L),U=E-R*Math.sin(L),$=S<1e5?`A${S},${S} 0,0,${C>0?1:0} `:"L",X=R?`M${B},${k}L${A},${E}L${P},${U}`:"";return`M${w},${T}${$}${A},${E}${X}`}).call(Wt,this,n)).node()}};function Fst(e=1){if(typeof e=="number")return Ye(Math.sign(e));if(typeof e=="function")return(t,r,n,i)=>Math.sign(e(t,r,n,i));switch(Sr(e,"sweep",["+x","-x","+y","-y"])){case"+x":return(t,r,n)=>Ft(t,n);case"-x":return(t,r,n)=>vn(t,n);case"+y":return(t,r,n,i)=>Ft(r,i);case"-y":return(t,r,n,i)=>vn(r,i)}}function Cst([e,t],[r,n],i,o){let s=r-e,a=n-t,c=Math.hypot(s,a),l=o*Math.sqrt(i*i-c*c/4)/c;return[(e+r)/2-a*l,(t+n)/2+s*l]}function pq([e,t,r],[n,i,o],s){let a=n-e,c=i-t,l=Math.hypot(a,c),u=(a*a+c*c-o*o+r*r)/(2*l),f=s*Math.sqrt(r*r-u*u);return[e+(a*u+c*f)/l,t+(c*u-a*f)/l]}function mq(e,{x:t,x1:r,x2:n,y:i,y1:o,y2:s,...a}={}){return[r,n]=_0(t,r,n),[o,s]=_0(i,o,s),new w0(e,{...a,x1:r,x2:n,y1:o,y2:s})}var kst={ariaLabel:"bar"},Wh=class extends vt{constructor(t,r,n={},i=kst){super(t,r,n,i),u0(this,n),f0(this,n)}render(t,r,n,i,o){let{rx:s,ry:a,rx1y1:c,rx1y2:l,rx2y1:u,rx2y2:f}=this,d=this._x(r,n,i),h=this._y(r,n,i),p=this._width(r,n,i),m=this._height(r,n,i);return lt("svg:g",o).call(kt,this,i,o).call(this._transform,this,r).call(y=>y.selectAll().data(t).enter().call(c||l||u||f?g=>g.append("path").call(Et,this).call(d0,d,h,yq(d,p),yq(h,m),this).call(Wt,this,n):g=>g.append("rect").call(Et,this).attr("x",d).attr("width",p).attr("y",h).attr("height",m).call(dt,"rx",s).call(dt,"ry",a).call(Wt,this,n))).node()}_x(t,{x:r},{marginLeft:n}){let{insetLeft:i}=this;return r?o=>r[o]+i:n+i}_y(t,{y:r},{marginTop:n}){let{insetTop:i}=this;return r?o=>r[o]+i:n+i}_width({x:t},{x:r},{marginRight:n,marginLeft:i,width:o}){let{insetLeft:s,insetRight:a}=this,c=r&&t?t.bandwidth():o-n-i;return Math.max(0,c-s-a)}_height({y:t},{y:r},{marginTop:n,marginBottom:i,height:o}){let{insetTop:s,insetBottom:a}=this,c=r&&t?t.bandwidth():o-n-i;return Math.max(0,c-s-a)}};function yq(e,t){return typeof e=="function"&&typeof t=="function"?r=>e(r)+t(r):typeof e=="function"?r=>e(r)+t:typeof t=="function"?r=>e+t(r):e+t}var pf=class extends Wh{constructor(t,r={},n){let{x1:i,x2:o,y:s}=r;super(t,{x1:{value:i,scale:"x"},x2:{value:o,scale:"x"},y:{value:s,scale:"y",type:"band",optional:!0}},r,n)}_transform(t,r,{x:n}){t.call(Rt,r,{x:n},0,0)}_x({x:t},{x1:r,x2:n},{marginLeft:i}){let{insetLeft:o}=this;return wi(t)?i+o:s=>Math.min(r[s],n[s])+o}_width({x:t},{x1:r,x2:n},{marginRight:i,marginLeft:o,width:s}){let{insetLeft:a,insetRight:c}=this;return wi(t)?s-i-o-a-c:l=>Math.max(0,Math.abs(n[l]-r[l])-a-c)}},mf=class extends Wh{constructor(t,r={},n){let{x:i,y1:o,y2:s}=r;super(t,{y1:{value:o,scale:"y"},y2:{value:s,scale:"y"},x:{value:i,scale:"x",type:"band",optional:!0}},r,n)}_transform(t,r,{y:n}){t.call(Rt,r,{y:n},0,0)}_y({y:t},{y1:r,y2:n},{marginTop:i}){let{insetTop:o}=this;return wi(t)?i+o:s=>Math.min(r[s],n[s])+o}_height({y:t},{y1:r,y2:n},{marginTop:i,marginBottom:o,height:s}){let{insetTop:a,insetBottom:c}=this;return wi(t)?s-i-o-a-c:l=>Math.max(0,Math.abs(n[l]-r[l])-a-c)}};function Fs(e,t={}){return Ha(t)||(t={...t,y:Ee,x2:G}),new pf(e,vl(Fh(_l(t))))}function Cs(e,t={}){return Ha(t)||(t={...t,x:Ee,y2:G}),new mf(e,Sl(Ch(wl(t))))}var Bst={ariaLabel:"cell"},yf=class extends Wh{constructor(t,{x:r,y:n,...i}={}){super(t,{x:{value:r,scale:"x",type:"band",optional:!0},y:{value:n,scale:"y",type:"band",optional:!0}},i,Bst)}_transform(t,r){t.call(Rt,r,{},0,0)}};function Al(e,{x:t,y:r,...n}={}){return[t,r]=Ke(t,r),new yf(e,{...n,x:t,y:r})}function gq(e,{x:t=Ee,fill:r,stroke:n,...i}={}){return r===void 0&&qe(n)[0]===void 0&&(r=G),new yf(e,{...i,x:t,fill:r,stroke:n})}function xq(e,{y:t=Ee,fill:r,stroke:n,...i}={}){return r===void 0&&qe(n)[0]===void 0&&(r=G),new yf(e,{...i,y:t,fill:r,stroke:n})}var Pst={ariaLabel:"dot",fill:"none",stroke:"currentColor",strokeWidth:1.5};function v0(e){return e.sort===void 0&&e.reverse===void 0?cS({channel:"-r"},e):e}var gf=class extends vt{constructor(t,r={}){let{x:n,y:i,r:o,rotate:s,symbol:a=Ya,frameAnchor:c}=r,[l,u]=ye(s,0),[f,d]=A$(a),[h,p]=ye(o,f==null?3:4.5);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:h,scale:"r",filter:Fn,optional:!0},rotate:{value:l,optional:!0},symbol:{value:f,scale:"auto",optional:!0}},v0(r),Pst),this.r=p,this.rotate=u,this.symbol=d,this.frameAnchor=Ts(c);let{channels:m}=this,{symbol:y}=m;if(y){let{fill:g,stroke:x}=m;y.hint={fill:g?g.value===y.value?"color":"currentColor":this.fill??"currentColor",stroke:x?x.value===y.value?"color":"currentColor":this.stroke??"none"}}}render(t,r,n,i,o){let{x:s,y:a}=r,{x:c,y:l,r:u,rotate:f,symbol:d}=n,{r:h,rotate:p,symbol:m}=this,[y,g]=Ur(this,i),x=m===Ya,b=u?void 0:h*h*Math.PI;return tl(h)&&(t=[]),lt("svg:g",o).call(kt,this,i,o).call(Rt,this,{x:c&&s,y:l&&a}).call(_=>_.selectAll().data(t).enter().append(x?"circle":"path").call(Et,this).call(x?v=>{v.attr("cx",c?w=>c[w]:y).attr("cy",l?w=>l[w]:g).attr("r",u?w=>u[w]:h)}:v=>{v.attr("transform",Fo`translate(${c?w=>c[w]:y},${l?w=>l[w]:g})${f?w=>` rotate(${f[w]})`:p?` rotate(${p})`:""}`).attr("d",u&&d?w=>{let T=Nn();return d[w].draw(T,u[w]*u[w]*Math.PI),T}:u?w=>{let T=Nn();return m.draw(T,u[w]*u[w]*Math.PI),T}:d?w=>{let T=Nn();return d[w].draw(T,b),T}:(()=>{let w=Nn();return m.draw(w,b),w})())}).call(Wt,this,n)).node()}};function to(e,{x:t,y:r,...n}={}){return n.frameAnchor===void 0&&([t,r]=Ke(t,r)),new gf(e,{...n,x:t,y:r})}function bq(e,{x:t=G,...r}={}){return new gf(e,DS({...r,x:t}))}function _q(e,{y:t=G,...r}={}){return new gf(e,RS({...r,y:t}))}function wq(e,t){return to(e,{...t,symbol:"circle"})}function vq(e,t){return to(e,{...t,symbol:"hexagon"})}var Ust={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},xf=class extends vt{constructor(t,r={}){let{x:n,y:i,z:o,curve:s,tension:a}=r;super(t,{x:{value:n,scale:"x"},y:{value:i,scale:"y"},z:{value:pn(r),optional:!0}},r,Ust),this.z=o,this.curve=rI(s,a),Lo(this,r)}filter(t){return t}project(t,r,n){this.curve!==Il&&super.project(t,r,n)}render(t,r,n,i,o){let{x:s,y:a}=n,{curve:c}=this;return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,r).call(l=>l.selectAll().data(MS(t,[s,a],this,n)).enter().append("path").call(Et,this).call(of,this,n).call(Kz,this,n,o).attr("d",c===Il&&o.projection?$st(o.projection,s,a):Tg().curve(c).defined(u=>u>=0).x(u=>s[u]).y(u=>a[u]))).node()}};function $st(e,t,r){let n=Dr(e);return t=pr(t),r=pr(r),i=>{let o=[],s=[o];for(let a of i)a===-1?(o=[],s.push(o)):o.push([t[a],r[a]]);return n({type:"MultiLineString",coordinates:s})}}function bf(e,{x:t,y:r,...n}={}){return[t,r]=Ke(t,r),new xf(e,{...n,x:t,y:r})}function El(e,{x:t=G,y:r=Ee,...n}={}){return new xf(e,Yh({...n,x:t,y:r}))}function Ml(e,{x:t=Ee,y:r=G,...n}={}){return new xf(e,Vh({...n,x:t,y:r}))}function kN(e,t){t=zst(t);let{x:r,y:n,color:i,size:o}=t,s=oI(e,r),a=oI(e,n),c=oI(e,i),l=oI(e,o),{fx:u,fy:f,x:{value:d,reduce:h,zero:p,...m},y:{value:y,reduce:g,zero:x,...b},color:{value:_,color:v,reduce:w},size:{value:T,reduce:A},mark:E}=t;if(h===void 0&&(h=g==null&&d==null&&T==null&&y!=null?"count":null),g===void 0&&(g=h==null&&y==null&&T==null&&d!=null?"count":null),A===void 0&&T==null&&w==null&&h==null&&g==null&&(d==null||Ue(s))&&(y==null||Ue(a))&&(A="count"),p===void 0&&(p=sI(h)?!0:void 0),x===void 0&&(x=sI(g)?!0:void 0),d==null&&y==null)throw new Error("must specify x or y");if(h!=null&&y==null)throw new Error("reducing x requires y");if(g!=null&&d==null)throw new Error("reducing y requires x");E===void 0&&(E=T!=null||A!=null?"dot":sI(h)||sI(g)||w!=null?"bar":d!=null&&y!=null?Ue(s)||Ue(a)||h==null&&g==null&&!S0(s)&&!S0(a)?"dot":"line":d!=null||y!=null?"rule":null);let N,I,R;switch(E){case"dot":R=to,I="stroke";break;case"line":R=s&&a||h!=null||g!=null?x||g!=null||s&&S0(s)?Ml:p||h!=null||a&&S0(a)?El:bf:s?El:Ml,I="stroke",Iq(c)&&(N=null);break;case"area":R=!(x||g!=null)&&(p||h!=null||a&&S0(a))?Tl:ac,I="fill",Iq(c)&&(N=null);break;case"rule":R=s?vi:Si,I="stroke";break;case"bar":R=h!=null?Ue(a)?Sq(h)&&s&&Ue(s)?Al:Fs:$h:g!=null?Ue(s)?Sq(g)&&a&&Ue(a)?Al:Cs:zh:w!=null||A!=null?s&&Ue(s)&&a&&Ue(a)?Al:s&&Ue(s)?Cs:a&&Ue(a)?Fs:h0:s&&Za(s)&&!(a&&Za(a))?Fs:a&&Za(a)&&!(s&&Za(s))?Cs:Al,I="fill";break;default:throw new Error(`invalid mark: ${E}`)}let C={fx:u,fy:f,x:s??void 0,y:a??void 0,[I]:c??v,z:N,r:l??void 0,tip:!0},S,M={[I]:w??void 0,r:A??void 0};if(h!=null&&g!=null)throw new Error("cannot reduce both x and y");return g!=null?(M.y=g,S=Ue(s)?ul:Ds):h!=null?(M.x=h,S=Ue(a)?fl:Ls):(w!=null||A!=null)&&(s&&a?S=Ue(s)&&Ue(a)?Zg:Ue(s)?Ls:Ue(a)?Ds:sc:s?S=Ue(s)?ul:Ds:a&&(S=Ue(a)?fl:Ls)),(S===sc||S===Ds)&&(C.x={value:s,...m}),(S===sc||S===Ls)&&(C.y={value:a,...b}),p===void 0&&(p=s&&!(S===sc||S===Ds)&&(R===Fs||R===Tl||R===$h||R===Si)),x===void 0&&(x=a&&!(S===sc||S===Ls)&&(R===Cs||R===ac||R===zh||R===vi)),{fx:u??null,fy:f??null,x:{value:d??null,reduce:h??null,zero:!!p,...m},y:{value:y??null,reduce:g??null,zero:!!x,...b},color:{value:_??null,reduce:w??null,...v!==void 0&&{color:v}},size:{value:T??null,reduce:A??null},mark:E,markImpl:Tq[R],markOptions:C,transformImpl:Tq[S],transformOptions:M,colorMode:I}}function Aq(e,t){let r=kN(e,t),{fx:n,fy:i,x:{zero:o},y:{zero:s},markOptions:a,transformOptions:c,colorMode:l}=r,u=CN[r.markImpl],f=CN[r.transformImpl],d=n!=null||i!=null?jh({strokeOpacity:.1}):null,h=[o?vi([0]):null,s?Si([0]):null],p=u(e,f?f(c,a):a);return l==="stroke"?yr(d,h,p):yr(d,p,h)}function S0(e){let t,r;for(let n of e){if(n==null)continue;if(t===void 0){t=n;continue}let i=Math.sign(Ft(t,n));if(i){if(r!==void 0&&i!==r)return!1;t=n,r=i}}return!0}function zst({x:e,y:t,color:r,size:n,fx:i,fy:o,mark:s}={}){return bi(e)||(e=Gh(e)),bi(t)||(t=Gh(t)),bi(r)||(r=ll(r)?{color:r}:Gh(r)),bi(n)||(n=Gh(n)),bi(i)&&({value:i}=Gh(i)),bi(o)&&({value:o}=Gh(o)),s!=null&&(s=`${s}`.toLowerCase()),{x:e,y:t,color:r,size:n,fx:i,fy:o,mark:s}}function oI(e,t){let r=_t(e,t.value);return r&&(r.label=en(t.value)),r}function Gh(e){return jst(e)?{reduce:e}:{value:e}}function sI(e){return/^(?:distinct|count|sum|proportion)$/i.test(e)}function Sq(e){return/^(?:first|last|mode)$/i.test(e)}function jst(e){if(e==null)return!1;if(typeof e.reduceIndex=="function"||typeof e.reduce=="function"&&kr(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 Iq(e){return e?new In(e).size>e.length>>1:!1}var CN={dot:to,line:bf,lineX:El,lineY:Ml,areaX:Tl,areaY:ac,ruleX:vi,ruleY:Si,barX:Fs,barY:Cs,rect:h0,rectX:$h,rectY:zh,cell:Al,bin:sc,binX:Ds,binY:Ls,group:Zg,groupX:ul,groupY:fl},Tq=Object.fromEntries(Object.entries(CN).map(([e,t])=>[t,e]));function Xh(e,t={}){let{x:r,x1:n,x2:i}=t;r===void 0&&n===void 0&&i===void 0&&(t={...t,x:r=G});let o={};return r!=null&&(o.x=e),n!=null&&(o.x1=e),i!=null&&(o.x2=e),Zn(o,t)}function Hh(e,t={}){let{y:r,y1:n,y2:i}=t;r===void 0&&n===void 0&&i===void 0&&(t={...t,y:r=G});let o={};return r!=null&&(o.y=e),n!=null&&(o.y1=e),i!=null&&(o.y2=e),Zn(o,t)}function Zn(e={},t={}){let r=pn(t),n=Object.entries(e).map(([i,o])=>{let s=rS(i,t);if(s==null)throw new Error(`missing channel: ${i}`);let[a,c]=Br(s);return{key:i,input:s,output:a,setOutput:c,map:qst(o)}});return{...mr(t,(i,o)=>{let s=_t(i,r),a=n.map(({input:l})=>_t(i,l)),c=n.map(({setOutput:l})=>l(new Array(i.length)));for(let l of o)for(let u of s?Hr(l,f=>s[f]).values():[l])n.forEach(({map:f},d)=>f.mapIndex(u,a[d],c[d]));return{data:i,facets:o}}),...Object.fromEntries(n.map(({key:i,output:o})=>[i,o]))}}function qst(e){if(e==null)throw new Error("missing map");if(typeof e.mapIndex=="function")return e;if(typeof e.map=="function"&&kr(e))return Vst(e);if(typeof e=="function")return BN(bh(e));switch(`${e}`.toLowerCase()){case"cumsum":return Wst;case"rank":return BN((t,r)=>dy(t,n=>r[n]));case"quantile":return BN((t,r)=>Yst(t,n=>r[n]))}throw new Error(`invalid map: ${e}`)}function Vst(e){return console.warn("deprecated map interface; implement mapIndex instead."),{mapIndex:e.map.bind(e)}}function Yst(e,t){let r=rs(e,t)-1;return dy(e,t).map(n=>n/r)}function BN(e){return{mapIndex(t,r,n){let i=e(t,r);if(i.length!==t.length)throw new Error("map function returned a mismatched length");for(let o=0,s=t.length;o<s;++o)n[t[o]]=i[o]}}}var Wst={mapIndex(e,t,r){let n=0;for(let i of e)r[i]=n+=t[i]}};function Eq(e={},t){return arguments.length===1&&(t=e),Xh(Qh(e),t)}function Mq(e={},t){return arguments.length===1&&(t=e),Hh(Qh(e),t)}function Qh(e={}){typeof e=="number"&&(e={k:e});let{k:t,reduce:r,shift:n,anchor:i,strict:o}=e;if(i===void 0&&n!==void 0&&(i=Xst(n),mn(`Warning: the shift option is deprecated; please use anchor "${i}" instead.`)),!((t=Math.floor(t))>0))throw new Error(`invalid k: ${t}`);return Hst(r)(t,Gst(i,t),o)}function Gst(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 Xst(e){switch(`${e}`.toLowerCase()){case"centered":return"middle";case"leading":return"start";case"trailing":return"end"}throw new Error(`invalid shift: ${e}`)}function Hst(e="mean"){if(typeof e=="string"){if(/^p\d{2}$/i.test(e))return aI(xh(e));switch(e.toLowerCase()){case"deviation":return aI(zi);case"max":return cI((t,r)=>Kt(t,n=>r[n]));case"mean":return Qst;case"median":return aI(Eo);case"min":return cI((t,r)=>Ht(t,n=>r[n]));case"mode":return cI((t,r)=>Ed(t,n=>r[n]));case"sum":return Nq;case"variance":return aI(Pc);case"difference":return Jst;case"ratio":return tat;case"first":return eat;case"last":return rat}}if(typeof e!="function")throw new Error(`invalid reduce: ${e}`);return cI(bh(e))}function aI(e){return(t,r,n)=>n?{mapIndex(i,o,s){let a=l=>o[l]==null?NaN:+o[l],c=0;for(let l=0;l<t-1;++l)isNaN(a(l))&&++c;for(let l=0,u=i.length-t+1;l<u;++l)isNaN(a(l+t-1))&&++c,s[i[l+r]]=c===0?e(Qa(i,l,l+t),a):NaN,isNaN(a(l))&&--c}}:{mapIndex(i,o,s){let a=c=>o[c]==null?NaN:+o[c];for(let c=-r;c<0;++c)s[i[c+r]]=e(Qa(i,0,c+t),a);for(let c=0,l=i.length-r;c<l;++c)s[i[c+r]]=e(Qa(i,c,c+t),a)}}}function cI(e){return(t,r,n)=>n?{mapIndex(i,o,s){let a=0;for(let c=0;c<t-1;++c)a+=Pe(o[i[c]]);for(let c=0,l=i.length-t+1;c<l;++c)a+=Pe(o[i[c+t-1]]),a===t&&(s[i[c+r]]=e(Qa(i,c,c+t),o)),a-=Pe(o[i[c]])}}:{mapIndex(i,o,s){for(let a=-r;a<0;++a)s[i[a+r]]=e(Qa(i,0,a+t),o);for(let a=0,c=i.length-r;a<c;++a)s[i[a+r]]=e(Qa(i,a,a+t),o)}}}function Nq(e,t,r){return r?{mapIndex(n,i,o){let s=0,a=0;for(let c=0;c<e-1;++c){let l=i[n[c]];l===null||isNaN(l)?++s:a+=+l}for(let c=0,l=n.length-e+1;c<l;++c){let u=i[n[c]],f=i[n[c+e-1]];f===null||isNaN(f)?++s:a+=+f,o[n[c+t]]=s===0?a:NaN,u===null||isNaN(u)?--s:a-=+u}}}:{mapIndex(n,i,o){let s=0,a=n.length;for(let c=0,l=Math.min(a,e-t-1);c<l;++c)s+=+i[n[c]]||0;for(let c=-t,l=a-t;c<l;++c)s+=+i[n[c+e-1]]||0,o[n[c+t]]=s,s-=+i[n[c]]||0}}}function Qst(e,t,r){if(r){let n=Nq(e,t,r);return{mapIndex(i,o,s){n.mapIndex(i,o,s);for(let a=0,c=i.length-e+1;a<c;++a)s[i[a+t]]/=e}}}else return{mapIndex(n,i,o){let s=0,a=0,c=n.length;for(let l=0,u=Math.min(c,e-t-1);l<u;++l){let f=i[n[l]];f!==null&&!isNaN(f=+f)&&(s+=f,++a)}for(let l=-t,u=c-t;l<u;++l){let f=i[n[l+e-1]],d=i[n[l]];f!==null&&!isNaN(f=+f)&&(s+=f,++a),o[n[l+t]]=s/a,d!==null&&!isNaN(d=+d)&&(s-=d,--a)}}}}function Zst(e,t,r,n){for(let i=r+n;r<i;++r){let o=e[t[r]];if(Pe(o))return o}}function Kst(e,t,r,n){for(let i=r+n-1;i>=r;--i){let o=e[t[i]];if(Pe(o))return o}}function Oq(e,t,r,n){for(let i=r+n;r<i;++r){let o=e[t[r]];if(o!==null&&!isNaN(o=+o))return o}}function Rq(e,t,r,n){for(let i=r+n-1;i>=r;--i){let o=e[t[i]];if(o!==null&&!isNaN(o=+o))return o}}function Jst(e,t,r){return r?{mapIndex(n,i,o){for(let s=0,a=n.length-e;s<a;++s){let c=i[n[s]],l=i[n[s+e-1]];o[n[s+t]]=c===null||l===null?NaN:l-c}}}:{mapIndex(n,i,o){for(let s=-t,a=n.length-e+t+1;s<a;++s)o[n[s+t]]=Rq(i,n,s,e)-Oq(i,n,s,e)}}}function tat(e,t,r){return r?{mapIndex(n,i,o){for(let s=0,a=n.length-e;s<a;++s){let c=i[n[s]],l=i[n[s+e-1]];o[n[s+t]]=c===null||l===null?NaN:l/c}}}:{mapIndex(n,i,o){for(let s=-t,a=n.length-e+t+1;s<a;++s)o[n[s+t]]=Rq(i,n,s,e)/Oq(i,n,s,e)}}}function eat(e,t,r){return r?{mapIndex(n,i,o){for(let s=0,a=n.length-e;s<a;++s)o[n[s+t]]=i[n[s]]}}:{mapIndex(n,i,o){for(let s=-t,a=n.length-e+t+1;s<a;++s)o[n[s+t]]=Zst(i,n,s,e)}}}function rat(e,t,r){return r?{mapIndex(n,i,o){for(let s=0,a=n.length-e;s<a;++s)o[n[s+t]]=i[n[s+e-1]]}}:{mapIndex(n,i,o){for(let s=-t,a=n.length-e+t+1;s<a;++s)o[n[s+t]]=Kst(i,n,s,e)}}}var cc={n:20,k:2,color:"currentColor",opacity:.2,strict:!0,anchor:"end"};function Dq(e,{x:t=G,y:r,k:n=cc.k,color:i=cc.color,opacity:o=cc.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return yr(fe(s)?null:Tl(e,Zn({x1:Nl({k:-n,...f}),x2:Nl({k:n,...f})},{x1:t,x2:t,y:r,fill:s,fillOpacity:a,...f})),fe(c)?null:El(e,Zn({x:Nl(f)},{x:t,y:r,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function Lq(e,{x:t,y:r=G,k:n=cc.k,color:i=cc.color,opacity:o=cc.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return yr(fe(s)?null:ac(e,Zn({y1:Nl({k:-n,...f}),y2:Nl({k:n,...f})},{x:t,y1:r,y2:r,fill:s,fillOpacity:a,...f})),fe(c)?null:Ml(e,Zn({y:Nl(f)},{x:t,y:r,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function Nl({n:e=cc.n,k:t=0,strict:r=cc.strict,anchor:n=cc.anchor}={}){return Qh({k:e,reduce:i=>Ea(i)+t*(zi(i)||0),strict:r,anchor:n})}var nat={ariaLabel:"tick",fill:null,stroke:"currentColor"},lI=class extends vt{constructor(t,r,n){super(t,r,n,nat),Lo(this,n)}render(t,r,n,i,o){return lt("svg:g",o).call(kt,this,i,o).call(this._transform,this,r).call(s=>s.selectAll().data(t).enter().append("line").call(Et,this).attr("x1",this._x1(r,n,i)).attr("x2",this._x2(r,n,i)).attr("y1",this._y1(r,n,i)).attr("y2",this._y2(r,n,i)).call(Wt,this,n).call(oc,this,n,o)).node()}},I0=class extends lI{constructor(t,r={}){let{x:n,y:i,inset:o=0,insetTop:s=o,insetBottom:a=o}=r;super(t,{x:{value:n,scale:"x"},y:{value:i,scale:"y",type:"band",optional:!0}},r),this.insetTop=ie(s),this.insetBottom=ie(a)}_transform(t,r,{x:n}){t.call(Rt,r,{x:n},We,0)}_x1(t,{x:r}){return n=>r[n]}_x2(t,{x:r}){return n=>r[n]}_y1({y:t},{y:r},{marginTop:n}){let{insetTop:i}=this;return r&&t?o=>r[o]+i:n+i}_y2({y:t},{y:r},{height:n,marginBottom:i}){let{insetBottom:o}=this;return r&&t?s=>r[s]+t.bandwidth()-o:n-i-o}},T0=class extends lI{constructor(t,r={}){let{x:n,y:i,inset:o=0,insetRight:s=o,insetLeft:a=o}=r;super(t,{y:{value:i,scale:"y"},x:{value:n,scale:"x",type:"band",optional:!0}},r),this.insetRight=ie(s),this.insetLeft=ie(a)}_transform(t,r,{y:n}){t.call(Rt,r,{y:n},0,We)}_x1({x:t},{x:r},{marginLeft:n}){let{insetLeft:i}=this;return r&&t?o=>r[o]+i:n+i}_x2({x:t},{x:r},{width:n,marginRight:i}){let{insetRight:o}=this;return r&&t?s=>r[s]+t.bandwidth()-o:n-i-o}_y1(t,{y:r}){return n=>r[n]}_y2(t,{y:r}){return n=>r[n]}};function uI(e,{x:t=G,...r}={}){return new I0(e,{...r,x:t})}function fI(e,{y:t=G,...r}={}){return new T0(e,{...r,y:t})}function Fq(e,{x:t=G,y:r=null,r:n,fill:i="#ccc",fillOpacity:o,stroke:s="currentColor",strokeOpacity:a,strokeWidth:c=2,sort:l,...u}={}){let f=r!=null?fl:Qg;return yr(Si(e,f({x1:PN,x2:UN},{x:t,y:r,stroke:s,strokeOpacity:a,...u})),Fs(e,f({x1:"p25",x2:"p75"},{x:t,y:r,fill:i,fillOpacity:o,...u})),uI(e,f({x:"p50"},{x:t,y:r,stroke:s,strokeOpacity:a,strokeWidth:c,sort:l,...u})),to(e,Zn({x:kq},{x:t,y:r,z:r,r:n,stroke:s,strokeOpacity:a,...u})))}function Cq(e,{y:t=G,x:r=null,r:n,fill:i="#ccc",fillOpacity:o,stroke:s="currentColor",strokeOpacity:a,strokeWidth:c=2,sort:l,...u}={}){let f=r!=null?ul:Qg;return yr(vi(e,f({y1:PN,y2:UN},{x:r,y:t,stroke:s,strokeOpacity:a,...u})),Cs(e,f({y1:"p25",y2:"p75"},{x:r,y:t,fill:i,fillOpacity:o,...u})),fI(e,f({y:"p50"},{x:r,y:t,stroke:s,strokeOpacity:a,strokeWidth:c,sort:l,...u})),to(e,Zn({y:kq},{x:r,y:t,z:r,r:n,stroke:s,strokeOpacity:a,...u})))}function kq(e){let t=PN(e),r=UN(e);return e.map(n=>n<t||n>r?n:NaN)}function PN(e){let t=Bq(e)*2.5-Pq(e)*1.5;return Ht(e,r=>r>=t?r:NaN)}function UN(e){let t=Pq(e)*2.5-Bq(e)*1.5;return Kt(e,r=>r<=t?r:NaN)}function Bq(e){return Tn(e,.25)}function Pq(e){return Tn(e,.75)}var iat={ariaLabel:"raster",stroke:null,pixelSize:1};function Zh(e,t){let r=+e;if(isNaN(r))throw new Error(`invalid ${t}: ${e}`);return r}function Uq(e,t){let r=Math.floor(e);if(isNaN(r))throw new Error(`invalid ${t}: ${e}`);return r}var E0=class extends vt{constructor(t,r,n={},i){let{width:o,height:s,x:a,y:c,x1:l=a==null?0:void 0,y1:u=c==null?0:void 0,x2:f=a==null?o:void 0,y2:d=c==null?s:void 0,pixelSize:h=i.pixelSize,blur:p=0,interpolate:m}=n;if(o!=null&&(o=Uq(o,"width")),s!=null&&(s=Uq(s,"height")),l!=null&&(l=Zh(l,"x1")),u!=null&&(u=Zh(u,"y1")),f!=null&&(f=Zh(f,"x2")),d!=null&&(d=Zh(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=dat(l,f,o,s)),c===void 0&&u!=null&&d!=null&&(c=hat(u,d,o,s))),super(t,{x:{value:a,scale:"x",optional:!0},y:{value:c,scale:"y",optional:!0},x1:{value:l==null?null:[l],scale:"x",optional:!0,filter:null},y1:{value:u==null?null:[u],scale:"y",optional:!0,filter:null},x2:{value:f==null?null:[f],scale:"x",optional:!0,filter:null},y2:{value:d==null?null:[d],scale:"y",optional:!0,filter:null},...r},n,i),this.width=o,this.height=s,this.pixelSize=Zh(h,"pixelSize"),this.blur=Zh(p,"blur"),this.interpolate=a==null||c==null?null:oat(m)}},M0=class extends E0{constructor(t,r={}){let{imageRendering:n}=r;if(t==null){let{fill:i,fillOpacity:o}=r;ye(o)[0]!==void 0&&(r=dI("fillOpacity",r)),qe(i)[0]!==void 0&&(r=dI("fill",r))}super(t,void 0,r,iat),this.imageRendering=Oe(n,"auto")}scale(t,{color:r,...n},i){return super.scale(t,n,i)}render(t,r,n,i,o){let s=r[n.channels.fill?.scale]??(M=>M),{x:a,y:c}=n,{document:l}=o,[u,f,d,h]=zq(n,i,o),p=d-u,m=h-f,{pixelSize:y,width:g=Math.round(Math.abs(p)/y),height:x=Math.round(Math.abs(m)/y)}=this,b=g*x,{fill:_,fillOpacity:v}=n,w=0;if(this.interpolate){let M=g/p,O=x/m,L=Xt(a,k=>(k-u)*M,Float64Array),B=Xt(c,k=>(k-f)*O,Float64Array);_&&(_=this.interpolate(t,g,x,L,B,_)),v&&(v=this.interpolate(t,g,x,L,B,v))}else this.data==null&&t&&(w=t.fi*b);let T=l.createElement("canvas");T.width=g,T.height=x;let A=T.getContext("2d"),E=A.createImageData(g,x),N=E.data,{r:I,g:R,b:C}=wr(this.fill)??{r:0,g:0,b:0},S=(this.fillOpacity??1)*255;for(let M=0;M<b;++M){let O=M<<2;if(_){let L=s(_[M+w]);if(L==null){N[O+3]=0;continue}({r:I,g:R,b:C}=wr(L))}v&&(S=v[M+w]*255),N[O+0]=I,N[O+1]=R,N[O+2]=C,N[O+3]=S}return this.blur>0&&aM(E,this.blur),A.putImageData(E,0,0),lt("svg:g",o).call(kt,this,i,o).call(Rt,this,r).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(m)).attr("preserveAspectRatio","none").call(dt,"image-rendering",this.imageRendering).call(Et,this).attr("xlink:href",T.toDataURL())).node()}};function $N(e,t,r){arguments.length<3&&(r=t,t=null);let{x:n,y:i,[e]:o,...s}=r;return n===void 0&&i===void 0&&p$(t)&&(n=Ju,i=ol,o===void 0&&(o=u$)),[t,{...s,x:n,y:i,[e]:o}]}function $q(){let[e,t]=$N("fill",...arguments);return new M0(e,e==null||t.fill!==void 0||t.fillOpacity!==void 0?t:{...t,fill:G})}function zq({x1:e,y1:t,x2:r,y2:n},i,{projection:o}){let{width:s,height:a,marginTop:c,marginRight:l,marginBottom:u,marginLeft:f}=i;return[e&&o==null?e[0]:f,t&&o==null?t[0]:c,r&&o==null?r[0]:s-l,n&&o==null?n[0]:a-u]}function zN({x1:e,y1:t,x2:r,y2:n},i,o,s){let a={};return e&&(a.x1=e),t&&(a.y1=t),r&&(a.x2=r),n&&(a.y2=n),zq(Ah(a,i),o,s)}function dI(e,t={}){let{[e]:r}=t;if(typeof r!="function")throw new Error(`invalid ${e}: not a function`);return Ne({...t,[e]:void 0},function(n,i,o,s,a,c){let{x:l,y:u}=s;if(!l)throw new Error("missing scale: x");if(!u)throw new Error("missing scale: y");let[f,d,h,p]=zN(o,s,a,c),m=h-f,y=p-d,{pixelSize:g}=this,{width:x=Math.round(Math.abs(m)/g),height:b=Math.round(Math.abs(y)/g)}=t,_=new Array(x*b*(i?i.length:1)),v=m/x,w=y/b,T=0;for(let A of i??[void 0])for(let E=.5;E<b;++E)for(let N=.5;N<x;++N,++T)_[T]=r(l.invert(f+N*v),u.invert(d+E*w),A);return{data:_,facets:i,channels:{[e]:{value:_,scale:"auto"}}}})}function oat(e){if(typeof e=="function")return e;if(e==null)return hI;switch(`${e}`.toLowerCase()){case"none":return hI;case"nearest":return O0;case"barycentric":return N0();case"random-walk":return R0()}throw new Error(`invalid interpolate: ${e}`)}function hI(e,t,r,n,i,o){let s=new Array(t*r);for(let a of e)n[a]<0||n[a]>=t||i[a]<0||i[a]>=r||(s[Math.floor(i[a])*t+Math.floor(n[a])]=o[a]);return s}function N0({random:e=$u(42)}={}){return(t,r,n,i,o,s)=>{let{points:a,triangles:c,hull:l}=Vi.from(t,h=>i[h],h=>o[h]),u=new s.constructor(r*n).fill(NaN),f=new Uint8Array(r*n),d=fat(s,e);for(let h=0;h<c.length;h+=3){let p=c[h],m=c[h+1],y=c[h+2],g=a[2*p],x=a[2*m],b=a[2*y],_=a[2*p+1],v=a[2*m+1],w=a[2*y+1],T=Math.min(g,x,b),A=Math.max(g,x,b),E=Math.min(_,v,w),N=Math.max(_,v,w),I=(v-w)*(g-b)+(_-w)*(b-x);if(!I)continue;let R=s[t[p]],C=s[t[m]],S=s[t[y]];for(let M=Math.floor(T);M<A;++M)for(let O=Math.floor(E);O<N;++O){if(M<0||M>=r||O<0||O>=n)continue;let L=M+.5,B=O+.5,k=Math.sign(I),P=(v-w)*(L-b)+(B-w)*(b-x);if(P*k<0)continue;let U=(w-_)*(L-b)+(B-w)*(g-b);if(U*k<0)continue;let $=I-(P+U);if($*k<0)continue;let X=M+r*O;u[X]=d(R,P/I,C,U/I,S,$/I,M,O),f[X]=1}}return sat(u,f,i,o,s,r,n,l,t,d),u}}function sat(e,t,r,n,i,o,s,a,c,l){r=Float64Array.from(a,h=>r[c[h]]),n=Float64Array.from(a,h=>n[c[h]]),i=Array.from(a,h=>i[c[h]]);let u=r.length,f=Array.from({length:u},(h,p)=>cat(p,r,n)),d=0;for(let h=0;h<s;++h){let p=h+.5;for(let m=0;m<o;++m){let y=m+o*h;if(!t[y]){let g=m+.5;for(let x=0;x<u;++x){let b=(u+d+(x%2?(x+1)/2:-x/2))%u;if(f[b](g,p)){let _=aat(r.at(b-1),n.at(b-1),r[b],n[b],g,p);e[y]=l(i.at(b-1),_,i[b],1-_,i[b],0,m,h),d=b;break}}}}}}function aat(e,t,r,n,i,o){let s=r-e,a=n-t,c=s*(r-i)+a*(n-o),l=s*(i-e)+a*(o-t);return c>0&&l>0?c/(c+l):+(c>l)}function A0(e,t,r,n){return e*n-r*t}function cat(e,t,r){let n=t.length,i=t.at(e-2),o=r.at(e-2),s=t.at(e-1),a=r.at(e-1),c=t[e],l=r[e],u=t.at(e+1-n),f=r.at(e+1-n),d=s-c,h=a-l,p=i-s,m=o-a,y=c-u,g=l-f,x=Math.hypot(d,h),b=Math.hypot(p,m),_=Math.hypot(y,g);return(v,w)=>{let T=v-s,A=w-a,E=v-c,N=w-l;return A0(T,A,E,N)>-1e-6&&A0(T,A,d,h)*b-A0(T,A,p,m)*x>-1e-6&&A0(E,N,y,g)*x-A0(E,N,d,h)*_<=0}}function O0(e,t,r,n,i,o){let s=new o.constructor(t*r),a=Vi.from(e,u=>n[u],u=>i[u]),c,l;for(let u=.5,f=0;u<r;++u){l=c;for(let d=.5;d<t;++d,++f)l=a.find(d,u,l),d===.5&&(c=l),s[f]=o[e[l]]}return s}function R0({random:e=$u(42),minDistance:t=.5,maxSteps:r=2}={}){return(n,i,o,s,a,c)=>{let l=new c.constructor(i*o),u=Vi.from(n,p=>s[p],p=>a[p]),f,d,h;for(let p=.5,m=0;p<o;++p){d=f;for(let y=.5;y<i;++y,++m){let g=y,x=p;h=d=u.find(g,x,d),y===.5&&(f=d);let b,_=0;for(;(b=Math.hypot(s[n[h]]-g,a[n[h]]-x))>t&&_<r;){let v=e(y,p,_)*2*Math.PI;g+=Math.cos(v)*b,x+=Math.sin(v)*b,h=u.find(g,x,h),++_}l[m]=c[n[h]]}}return l}}function lat(e,t,r,n,i,o){return t*e+n*r+o*i}function uat(e){return(t,r,n,i,o,s,a,c)=>{let l=e(a,c);return l<r?t:l<r+i?n:o}}function fat(e,t){return Za(e)||Ve(e)?lat:uat(t)}function dat(e,t,r){return{transform(n){let i=n.length,o=new Float64Array(i),s=(t-e)/r,a=e+s/2;for(let c=0;c<i;++c)o[c]=c%r*s+a;return o}}}function hat(e,t,r,n){return{transform(i){let o=i.length,s=new Float64Array(o),a=(t-e)/n,c=e+a/2;for(let l=0;l<o;++l)s[l]=Math.floor(l/r)%n*a+c;return s}}}var jq={ariaLabel:"contour",fill:"none",stroke:"currentColor",strokeMiterlimit:1,pixelSize:2},D0=class extends E0{constructor(t,{smooth:r=!0,value:n,...i}={}){let o=ES({},i,jq);if(n===void 0){for(let a in o)if(o[a].value!=null){if(n!==void 0)throw new Error("ambiguous contour value");n=i[a],i[a]="value"}}if(n!=null){let a={transform:c=>c.map(l=>l.value),label:en(n)};for(let c in o)i[c]==="value"&&(i[c]=a)}if(t==null){if(n==null)throw new Error("missing contour value");i=dI("value",{value:n,...i}),n=null}else{let{interpolate:a}=i;n===void 0&&(n=G),a===void 0&&(i.interpolate="nearest")}super(t,{value:{value:n,optional:!0}},pat(i),jq);let s={geometry:{value:G}};for(let a in this.channels){let c=this.channels[a],{scale:l}=c;l==="x"||l==="y"||a==="value"||(s[a]=c,delete this.channels[a])}this.contourChannels=s,this.smooth=!!r}filter(t,{x:r,y:n,value:i,...o},s){return super.filter(t,o,s)}render(t,r,n,i,o){let{geometry:s}=n,a=Dr();return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,r).call(c=>{c.selectAll().data(t).enter().append("path").call(Et,this).attr("d",l=>a(s[l])).call(Wt,this,n)}).node()}};function pat({thresholds:e,interval:t,...r}){return e=LN(e,t,Uc),Ne(r,function(n,i,o,s,a,c){let[l,u,f,d]=zN(o,s,a,c),h=f-l,p=d-u,{pixelSize:m,width:y=Math.round(Math.abs(h)/m),height:g=Math.round(Math.abs(p)/m)}=this,x=y/h,b=g/p,_=o.value.value,v=[];if(this.interpolate){let{x:N,y:I}=Ns(o,s,c),R=Xt(N,O=>(O-l)*x,Float64Array),C=Xt(I,O=>(O-u)*b,Float64Array),S=[o.x,o.y,o.value],M=[R,C,_];for(let O of i){let L=this.filter(O,S,M);v.push(this.interpolate(L,y,g,R,C,_))}}else if(i){let N=y*g,I=i.length;for(let R=0;R<I;++R)v.push(_.slice(R*N,R*N+N))}else v.push(_);if(this.blur>0)for(let N of v)ay({data:N,width:y,height:g},this.blur);let w=mat(e,_,...yat(v));if(w===null)throw new Error(`unsupported thresholds: ${e}`);let{contour:T}=Wc().size([y,g]).smooth(this.smooth),A=[],E=[];for(let N of v)E.push(er(A.length,A.push(...Xt(w,I=>T(N,I)))));for(let{coordinates:N}of A)for(let I of N)for(let R of I)for(let C of R)C[0]=C[0]/x+l,C[1]=C[1]/b+u;return{data:A,facets:E,channels:pS(this.contourChannels,A)}})}function mat(e,t,r,n){if(typeof e?.range=="function")return e.range(e.floor(r),n);if(typeof e=="function"&&(e=e(t,r,n)),typeof e!="number")return xi(e);let i=Qr(...Td(r,n,e),e);for(;i[i.length-1]>=n;)i.pop();for(;i[1]<r;)i.shift();return i}function Vq(){return new D0(...$N("value",...arguments))}function yat(e){return[Ht(e,t=>Ht(t,qq)),Kt(e,t=>Kt(t,qq))]}function qq(e){return isFinite(e)?e:NaN}function Gq(e,t){return jN(gl,e,t)}function Xq(e,t={}){return jN(xl,e,t)}function Hq(e,t={}){return jN(ic,e,t)}function jN(e,t,r={}){let{x:n,y:i,maxRadius:o}=r,s=e({px:n,py:i,maxRadius:o}),a=[];n!=null&&a.push(vi(t,Yq("x",{...s,inset:-6},r))),i!=null&&a.push(Si(t,Yq("y",{...s,inset:-6},r))),n!=null&&a.push(Rs(t,Wq("x",{...s,dy:9,frameAnchor:"bottom",lineAnchor:"top"},r))),i!=null&&a.push(Rs(t,Wq("y",{...s,dx:-9,frameAnchor:"left",textAnchor:"end"},r)));for(let c of a)c.ariaLabel=`crosshair ${c.ariaLabel}`;return yr(...a)}function Qq(e,{channels:t,...r},{facet:n,facetAnchor:i,fx:o,fy:s,[e]:a,channels:c,transform:l,initializer:u}){return{...r,facet:n,facetAnchor:i,fx:o,fy:s,[e]:a,channels:{...t,...c},transform:l,initializer:gat(e,u)}}function gat(e,t){return t==null?t:function(r,n,{x:i,y:o,px:s,py:a,...c},...l){let{channels:{x:u,y:f,...d}={},...h}=t.call(this,r,n,{...c,x:s,y:a},...l);return{channels:{...d,...u&&{px:u,...e==="x"&&{x:u}},...f&&{py:f,...e==="y"&&{y:f}}},...h}}}function Yq(e,t,r){let{color:n="currentColor",opacity:i=.2,ruleStroke:o=n,ruleStrokeOpacity:s=i,ruleStrokeWidth:a}=r;return{...Qq(e,t,r),stroke:o,strokeOpacity:s,strokeWidth:a}}function Wq(e,t,r){let{color:n="currentColor",textFill:i=n,textFillOpacity:o,textStroke:s="var(--plot-background)",textStrokeOpacity:a,textStrokeWidth:c=5}=r;return{...Qq(e,t,xat(e,r)),fill:i,fillOpacity:o,stroke:s,strokeOpacity:a,strokeWidth:c}}function xat(e,t){return Ne(t,(r,n,i)=>({channels:{text:{value:Jg(i,e)?.value}}}))}var bat={ariaLabel:"delaunay link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},_at={ariaLabel:"delaunay mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},wat={ariaLabel:"hull",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:1},vat={ariaLabel:"voronoi",fill:"none",stroke:"currentColor",strokeMiterlimit:1},Sat={ariaLabel:"voronoi mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},qN=class extends vt{constructor(t,r={}){let{x:n,y:i,z:o,curve:s,tension:a}=r;super(t,{x:{value:n,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},z:{value:o,optional:!0}},r,bat),this.curve=g0(s,a),Lo(this,r)}render(t,r,n,i,o){let{x:s,y:a}=r,{x:c,y:l,z:u}=n,{curve:f}=this,[d,h]=Ur(this,i),p=c?x=>c[x]:Ye(d),m=l?x=>l[x]:Ye(h),y=this;function g(x){let b=-1,_=[],v={};for(let S in n)v[S]=[];let w=[],T=[],A=[],E=[];function N(S,M){S=x[S],M=x[M],_.push(++b),w[b]=p(S),A[b]=m(S),T[b]=p(M),E[b]=m(M);for(let O in n)v[O].push(n[O][M])}let{halfedges:I,hull:R,triangles:C}=Vi.from(x,p,m);for(let S=0;S<I.length;++S){let M=I[S];M>S&&N(C[S],C[M])}for(let S=0;S<R.length;++S)N(R[S],R[(S+1)%R.length]);Qt(this).selectAll().data(_).enter().append("path").call(Et,y).attr("d",S=>{let M=Nn(),O=f(M);return O.lineStart(),O.point(w[S],A[S]),O.point(T[S],E[S]),O.lineEnd(),M}).call(Wt,y,v).call(oc,y,v,o)}return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,{x:c&&s,y:l&&a}).call(u?x=>x.selectAll().data(Hr(t,b=>u[b]).values()).enter().append("g").each(g):x=>x.datum(t).each(g)).node()}},L0=class extends vt{constructor(t,r={},n,i=({z:o})=>o){let{x:o,y:s}=r;super(t,{x:{value:o,scale:"x",optional:!0},y:{value:s,scale:"y",optional:!0},z:{value:i(r),optional:!0}},r,n)}render(t,r,n,i,o){let{x:s,y:a}=r,{x:c,y:l,z:u}=n,[f,d]=Ur(this,i),h=c?g=>c[g]:Ye(f),p=l?g=>l[g]:Ye(d),m=this;function y(g){let x=Vi.from(g,h,p);Qt(this).append("path").datum(g[0]).call(Et,m).attr("d",m._render(x,i)).call(Wt,m,n)}return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,{x:c&&s,y:l&&a}).call(u?g=>g.selectAll().data(Hr(t,x=>u[x]).values()).enter().append("g").each(y):g=>g.datum(t).each(y)).node()}},VN=class extends L0{constructor(t,r={}){super(t,r,_at),this.fill="none"}_render(t){return t.render()}},YN=class extends L0{constructor(t,r={}){super(t,r,wat,pn)}_render(t){return t.renderHull()}},WN=class extends vt{constructor(t,r={}){let{x:n,y:i,z:o}=r;super(t,{x:{value:n,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},z:{value:o,optional:!0}},Ne(r,function(s,a,c,l,u,f){let{x:d,y:h,z:p}=c;({x:d,y:h}=Ns(c,l,f)),p=p?.value;let m=new Array((d??h).length).fill(null),[y,g]=Ur(this,u),x=d?_=>d[_]:Ye(y),b=h?_=>h[_]:Ye(g);for(let _ of a){d&&(_=_.filter(v=>Pe(x(v)))),h&&(_=_.filter(v=>Pe(b(v))));for(let[,v]of As(_,p)){let w=Vi.from(v,x,b),T=Zq(w,u);for(let A=0,E=v.length;A<E;++A)m[v[A]]=T.renderCell(A)}}return{data:s,facets:a,channels:{cells:{value:m}}}}),vat)}render(t,r,n,i,o){let{x:s,y:a}=r,{x:c,y:l,cells:u}=n;return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,{x:c&&s,y:l&&a}).call(f=>{f.selectAll().data(t).enter().append("path").call(Et,this).attr("d",d=>u[d]).call(Wt,this,n)}).node()}},GN=class extends L0{constructor(t,r){super(t,r,Sat),this.fill="none"}_render(t,r){return Zq(t,r).render()}};function Zq(e,t){let{width:r,height:n,marginTop:i,marginRight:o,marginBottom:s,marginLeft:a}=t;return e.voronoi([a,i,r-o,n-s])}function F0(e,t,{x:r,y:n,...i}={}){return[r,n]=Ke(r,n),new e(t,{...i,x:r,y:n})}function Kq(e,t){return F0(qN,e,t)}function Jq(e,t){return F0(VN,e,t)}function tV(e,t){return F0(YN,e,t)}function eV(e,{x:t,y:r,initializer:n,...i}={}){return F0(WN,e,{...mr({...i,x:t,y:r},GS),initializer:n})}function rV(e,t){return F0(GN,e,t)}var Iat={ariaLabel:"density",fill:"none",stroke:"currentColor",strokeMiterlimit:1},C0=class extends vt{constructor(t,{x:r,y:n,z:i,weight:o,fill:s,stroke:a,...c}={}){let l=nV(s)&&(s="currentColor",!0),u=nV(a)&&(a="currentColor",!0);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:n,scale:"y",optional:!0},z:{value:pn({z:i,fill:s,stroke:a}),optional:!0},weight:{value:o,optional:!0}},Aat({...c,fill:s,stroke:a},l,u),Iat),l&&(this.fill=void 0),u&&(this.stroke=void 0),this.z=i}filter(t){return t}render(t,r,n,i,o){let{contours:s}=n,a=Dr();return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,{}).call(c=>c.selectAll().data(t).enter().append("path").call(Et,this).call(Wt,this,n).attr("d",l=>a(s[l]))).node()}};function iV(e,{x:t,y:r,...n}={}){return[t,r]=Ke(t,r),new C0(e,{...n,x:t,y:r})}var Tat=new Set(["x","y","z","weight"]);function Aat(e,t,r){let{bandwidth:i,thresholds:o}=e;return i=i===void 0?20:+i,o=o===void 0?20:typeof o?.[Symbol.iterator]=="function"?pr(o):+o,Ne(e,function(s,a,c,l,u,f){let d=c.weight?pr(c.weight.value):null,h=c.z?.value,{z:p}=this,[m,y]=Ur(this,u),{width:g,height:x}=u,{x:b,y:_}=Ns(c,l,f),v=Object.fromEntries(Object.entries(c).filter(([C])=>!Tat.has(C)).map(([C,S])=>[C,{...S,value:[]}])),w=t&&[],T=r&&[],A=HM().x(b?C=>b[C]:m).y(_?C=>_[C]:y).weight(d?C=>d[C]:1).size([g,x]).bandwidth(i),E=[];for(let C of a){let S=[];E.push(S);for(let M of h?i0(C,h,p):[C]){let O=A.contours(M);S.push([M,O])}}let N=o;if(!(N instanceof Yg)){let C=0;for(let S of E)for(let[,M]of S){let O=M.max;O>C&&(C=O)}N=Float64Array.from({length:o-1},(S,M)=>C*100*(M+1)/o)}let I=[],R=[];for(let C of E){let S=[];I.push(S);for(let[M,O]of C)for(let L of N){S.push(R.length),R.push(O(L/100)),w&&w.push(L),T&&T.push(L);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:I,channels:{...v,...w&&{fill:{value:w,scale:"color"}},...T&&{stroke:{value:T,scale:"color"}},contours:{value:R}}}})}function nV(e){return/^density$/i.test(e)}function aV(e,t){return lV("x",e,t)}function cV(e,t){return lV("y",e,t)}function lV(e,t,{x1:r,x2:n,y1:i,y2:o,x:s=r===void 0&&n===void 0?e==="y"?Ee:G:void 0,y:a=i===void 0&&o===void 0?e==="x"?Ee:G:void 0,fill:c,positiveFill:l="#3ca951",negativeFill:u="#4269d0",fillOpacity:f=1,positiveFillOpacity:d=f,negativeFillOpacity:h=f,stroke:p,strokeOpacity:m,z:y=qe(p)[0],clip:g,tip:x,render:b,..._}={}){return[r,n]=oV(s,r,n),[i,o]=oV(a,i,o),r===n&&i===o&&(e==="y"?i=lc(0):r=lc(0)),{tip:x}=Do({tip:x},e==="y"?"x":"y"),yr(fe(l)?null:Object.assign(x0(t,{x1:r,x2:n,y1:i,y2:o,z:y,fill:l,fillOpacity:d,render:nc(b,sV(e,!0)),clip:g,..._}),{ariaLabel:"positive difference"}),fe(u)?null:Object.assign(x0(t,{x1:r,x2:n,y1:i,y2:o,z:y,fill:u,fillOpacity:h,render:nc(b,sV(e,!1)),clip:g,..._}),{ariaLabel:"negative difference"}),bf(t,{x:n,y:o,z:y,stroke:p,strokeOpacity:m,tip:x,clip:!0,..._}))}function oV(e,t,r){return t===void 0&&r===void 0?t=r=lc(e):t===void 0?(r=lc(r),t=e===void 0?r:lc(e)):r===void 0?(t=lc(t),r=e===void 0?t:lc(e)):(t=lc(t),r=lc(r)),[t,r]}function lc(e){let t,{value:r,label:n=en(r)}=Ki(e);return{transform:i=>t||(t=_t(i,r)),label:n}}function sV(e,t){let r=e==="x"?"y":"x",n=`${r}1`,i=`${r}2`,o=`${e}1`,s=`${e}2`;return(a,c,l,u,f,d)=>{let{[n]:h,[i]:p}=l,m=new Float32Array(h.length),y=new Float32Array(p.length),g=u[e==="y"?"height":"width"];(t===xS(c[e])<0?m:y).fill(g);let x=d(a,c,{...l,[i]:h,[s]:y},u,f),b=d(a,c,{...l,[n]:p,[o]:m},u,f),_=x.querySelector("g")??x,v=b.querySelector("g")??b;for(let w=0;_.firstChild;w+=2){let T=cN(),A=lt("svg:clipPath",f).attr("id",T).node();A.appendChild(_.firstChild),v.childNodes[w].setAttribute("clip-path",`url(#${T})`),v.insertBefore(A,v.childNodes[w])}return b}}function pI({geometry:e=G,...t}={}){let r=ml(n=>_t(n,e));return Ne({...t,x:null,y:null,geometry:{transform:r}},(n,i,o,s,a,{projection:c})=>{let l=r(n),u=l.length,f=new Float64Array(u),d=new Float64Array(u),h=Dr(c);for(let p=0;p<u;++p)[f[p],d[p]]=h.centroid(l[p]);return{data:n,facets:i,channels:{x:{value:f,scale:c==null?"x":null,source:null},y:{value:d,scale:c==null?"y":null,source:null}}}})}function uV({geometry:e=G,...t}={}){let r=ml(i=>_t(i,e)),n=ml(i=>_t(r(i),f3));return{...t,x:{transform:i=>Float64Array.from(n(i),([o])=>o)},y:{transform:i=>Float64Array.from(n(i),([,o])=>o)},geometry:{transform:r}}}var Eat={ariaLabel:"geo",fill:"none",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},k0=class extends vt{constructor(t,r={}){let[n,i]=ye(r.r,3);super(t,{x:{value:r.tip?r.x:null,scale:"x",optional:!0},y:{value:r.tip?r.y:null,scale:"y",optional:!0},r:{value:n,scale:"r",filter:Fn,optional:!0},geometry:{value:r.geometry,scale:"projection"}},v0(r),Eat),this.r=i}render(t,r,n,i,o){let{geometry:s,r:a}=n,c=Dr(o.projection??Mat(r)),{r:l}=this;return tl(l)?t=[]:l!==void 0&&c.pointRadius(l),lt("svg:g",o).call(kt,this,i,o).call(Rt,this,r).call(u=>{u.selectAll().data(t).enter().append("path").call(Et,this).attr("d",a?f=>c.pointRadius(a[f])(s[f]):f=>c(s[f])).call(Wt,this,n)}).node()}};function Mat({x:e,y:t}){if(e||t)return e??=r=>r,t??=r=>r,Pu({point(r,n){this.stream.point(e(r),t(n))}})}function mI(e,t={}){return t.tip&&t.x===void 0&&t.y===void 0?t=pI(t):t.geometry===void 0&&(t={...t,geometry:G}),new k0(e,t)}function fV({strokeWidth:e=1.5,...t}={}){return mI({type:"Sphere"},{strokeWidth:e,...t})}function dV({strokeOpacity:e=.1,...t}={}){return mI(g3(),{strokeOpacity:e,...t})}var Kh=.5,Jh=0;function hV(e={fill:"count"},{binWidth:t,...r}={}){let{z:n}=r;return t=t===void 0?20:ie(t),e=C4(e,r),Es(e,"fill")&&(r.channels={...r.channels,fill:{value:[]}}),r.symbol===void 0&&(r.symbol="hexagon"),r.r===void 0&&!Es(e,"r")&&(r.r=t/2),Ne(r,(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}=Ns(s,a,l)),d=d?d.value:_t(i,n),h=h?.value,p=p?.value,m=m?.value;let y=Kg(e,{z:d,fill:h,stroke:p,symbol:m}),g=d&&[],x=h&&[],b=p&&[],_=m&&[],v=[],w=[],T=[],A=-1;for(let R of e)R.initialize(i);for(let R of o){let C=[];for(let S of e)S.scope("facet",R);for(let[S,M]of As(R,y))for(let{index:O,extent:L}of Nat(i,M,u,f,t)){C.push(++A),w.push(L.x),T.push(L.y),d&&g.push(y===d?S:d[O[0]]),h&&x.push(y===h?S:h[O[0]]),p&&b.push(y===p?S:p[O[0]]),m&&_.push(y===m?S:m[O[0]]);for(let B of e)B.reduce(O,L)}v.push(C)}let E=s.x.scale,N=s.y.scale,I={x:{value:w,source:a[E]?{value:Xt(w,a[E].invert),scale:E}:null},y:{value:T,source:a[N]?{value:Xt(T,a[N].invert),scale:N}:null},...d&&{z:{value:g}},...h&&{fill:{value:x,scale:"auto"}},...p&&{stroke:{value:b,scale:"auto"}},...m&&{symbol:{value:_,scale:"auto"}},...Object.fromEntries(e.map(({name:R,output:C})=>[R,{scale:"auto",label:C.label,radius:R==="r"?t/2:void 0,value:C.transform()}]))};return{data:i,facets:v,channels:I}})}function Nat(e,t,r,n,i){let o=i*(1.5/T4),s=new Map;for(let a of t){let c=r[a],l=n[a];if(isNaN(c)||isNaN(l))continue;let u=Math.round(l=(l-Jh)/o),f=Math.round(c=(c-Kh)/i-(u&1)/2),d=l-u;if(Math.abs(d)*3>1){let m=c-f,y=f+(c<f?-1:1)/2,g=u+(l<u?-1:1),x=c-y,b=l-g;m*m+d*d>x*x+b*b&&(f=y+(u&1?1:-1)/2,u=g)}let h=`${f},${u}`,p=s.get(h);p===void 0&&(p={index:[],extent:{data:e,x:(f+(u&1)/2)*i+Kh,y:u*o+Jh}},s.set(h,p)),p.index.push(a)}return s.values()}var Oat={ariaLabel:"hexgrid",fill:"none",stroke:"currentColor",strokeOpacity:.1};function pV(e){return new B0(e)}var B0=class extends vt{constructor({binWidth:t=20,clip:r=!0,...n}={}){super(il,void 0,{clip:r,...n},Oat),this.binWidth=ie(t)}render(t,r,n,i,o){let{binWidth:s}=this,{marginTop:a,marginRight:c,marginBottom:l,marginLeft:u,width:f,height:d}=i,h=u-Kh,p=f-c-Kh,m=a-Jh,y=d-l-Jh,g=s/2,x=g*A4,b=x/2,_=g*2,v=x*1.5,w=Math.floor(h/_),T=Math.ceil(p/_),A=Math.floor((m+b)/v),E=Math.ceil((y-b)/v)+1,N=`m0,${Ol(-x)}l${Ol(g)},${Ol(b)}v${Ol(x)}l${Ol(-g)},${Ol(b)}`,I=N;for(let R=A;R<E;++R)for(let C=w;C<T;++C)I+=`M${Ol(C*_+(R&1)*g)},${Ol(R*v)}${N}`;return lt("svg:g",o).datum(0).call(kt,this,i,o).call(Rt,this,{},We+Kh,We+Jh).call(R=>R.append("path").call(Et,this).call(Wt,this,n).attr("d",I)).node()}};function Ol(e){return Math.round(e*1e3)/1e3}var Rat={ariaLabel:"image",fill:null,stroke:null};function Dat(e){return/^\.*\//.test(e)}function Lat(e){return/^(blob|data|file|http|https):/i.test(e)}function Fat(e){return typeof e=="string"&&(Dat(e)||Lat(e))?[void 0,e]:[e,void 0]}var P0=class extends vt{constructor(t,r={}){let{x:n,y:i,r:o,width:s,height:a,rotate:c,src:l,preserveAspectRatio:u,crossOrigin:f,frameAnchor:d,imageRendering:h}=r;o==null&&(o=void 0),o===void 0&&s===void 0&&a===void 0?s=a=16:s===void 0&&a!==void 0?s=a:a===void 0&&s!==void 0&&(a=s);let[p,m]=Fat(l),[y,g]=ye(o),[x,b]=ye(s,g!==void 0?g*2:void 0),[_,v]=ye(a,g!==void 0?g*2:void 0),[w,T]=ye(c,0);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:y,scale:"r",filter:Fn,optional:!0},width:{value:x,filter:Fn,optional:!0},height:{value:_,filter:Fn,optional:!0},rotate:{value:w,optional:!0},src:{value:p,optional:!0}},v0(r),Rat),this.src=m,this.width=b,this.rotate=T,this.height=v,this.r=g,this.preserveAspectRatio=Oe(u,"xMidYMid"),this.crossOrigin=rr(f),this.frameAnchor=Ts(d),this.imageRendering=Oe(h,"auto")}render(t,r,n,i,o){let{x:s,y:a}=r,{x:c,y:l,width:u,height:f,r:d,rotate:h,src:p}=n,{r:m,width:y,height:g,rotate:x}=this,[b,_]=Ur(this,i);return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,{x:c&&s,y:l&&a}).call(v=>v.selectAll().data(t).enter().append("image").call(Et,this).attr("x",mV(c,u,d,b,y,m)).attr("y",mV(l,f,d,_,g,m)).attr("width",u?w=>u[w]:y!==void 0?y:d?w=>d[w]*2:m*2).attr("height",f?w=>f[w]:g!==void 0?g:d?w=>d[w]*2:m*2).attr("transform",h?w=>`rotate(${h[w]})`:x?`rotate(${x})`:null).attr("transform-origin",h||x?Fo`${c?w=>c[w]:b}px ${l?w=>l[w]:_}px`:null).call(dt,"href",p?w=>p[w]:this.src).call(dt,"preserveAspectRatio",this.preserveAspectRatio).call(dt,"crossorigin",this.crossOrigin).call(dt,"image-rendering",this.imageRendering).call(dt,"clip-path",d?w=>`circle(${d[w]}px)`:m!==void 0?`circle(${m}px)`:null).call(Wt,this,n)).node()}};function mV(e,t,r,n,i,o){return t&&e?s=>e[s]-t[s]/2:t?s=>n-t[s]/2:e&&i!==void 0?s=>e[s]-i/2:i!==void 0?n-i/2:r&&e?s=>e[s]-r[s]:r?s=>n-r[s]:e?s=>e[s]-o:n-o}function yV(e,{x:t,y:r,...n}={}){return n.frameAnchor===void 0&&([t,r]=Ke(t,r)),new P0(e,{...n,x:t,y:r})}function Cat(e,t,r){var n=1e-8,i=t-1,o=r-1,s=0,a,c,l,u,f,d,h,p,m,y,g;if(e<=0)return 0;if(e>=1)return 1;for(t>=1&&r>=1?(l=e<.5?e:1-e,u=Math.sqrt(-2*Math.log(l)),h=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,e<.5&&(h=-h),p=(h*h-3)/6,m=2/(1/(2*t-1)+1/(2*r-1)),y=h*Math.sqrt(p+m)/m-(1/(2*r-1)-1/(2*t-1))*(p+5/6-2/(3*m)),h=t/(t+r*Math.exp(2*y))):(a=Math.log(t/(t+r)),c=Math.log(r/(t+r)),u=Math.exp(t*a)/t,f=Math.exp(r*c)/r,y=u+f,e<u/y?h=Math.pow(t*y*e,1/t):h=1-Math.pow(r*y*(1-e),1/r)),g=-tp(t)-tp(r)+tp(t+r);s<10;s++){if(h===0||h===1)return h;if(d=kat(h,t,r)-e,u=Math.exp(i*Math.log(h)+o*Math.log(1-h)+g),f=d/u,h-=u=f/(1-.5*Math.min(1,f*(i/h-o/(1-h)))),h<=0&&(h=.5*(h+u)),h>=1&&(h=.5*(h+u+1)),Math.abs(u)<n*h&&s>0)break}return h}function kat(e,t,r){var n=e===0||e===1?0:Math.exp(tp(t+r)-tp(t)-tp(r)+t*Math.log(e)+r*Math.log(1-e));return e<0||e>1?!1:e<(t+1)/(t+r+2)?n*gV(e,t,r)/t:1-n*gV(1-e,r,t)/r}function gV(e,t,r){var n=1e-30,i=1,o=t+r,s=t+1,a=t-1,c=1,l=1-o*e/s,u,f,d,h;for(Math.abs(l)<n&&(l=n),l=1/l,h=l;i<=100&&(u=2*i,f=i*(r-i)*e/((a+u)*(t+u)),l=1+f*l,Math.abs(l)<n&&(l=n),c=1+f/c,Math.abs(c)<n&&(c=n),l=1/l,h*=l*c,f=-(t+i)*(o+i)*e/((t+u)*(s+u)),l=1+f*l,Math.abs(l)<n&&(l=n),c=1+f/c,Math.abs(c)<n&&(c=n),l=1/l,d=l*c,h*=d,!(Math.abs(d-1)<3e-7));i++);return h}function tp(e){var t=0,r=[76.18009172947146,-86.5053203294167,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],n=1.000000000190015,i,o,s;for(s=(o=i=e)+5.5,s-=(i+.5)*Math.log(s);t<6;t++)n+=r[t]/++o;return Math.log(2.506628274631*n/i)-s}function xV(e,t){var r=Cat(2*Math.min(e,1-e),.5*t,.5);return r=Math.sqrt(t*(1-r)/r),e>.5?r:-r}var Bat={ariaLabel:"linear-regression",fill:"currentColor",fillOpacity:.1,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},yI=class extends vt{constructor(t,r={}){let{x:n,y:i,z:o,ci:s=.95,precision:a=4}=r;if(super(t,{x:{value:n,scale:"x"},y:{value:i,scale:"y"},z:{value:pn(r),optional:!0}},r,Bat),this.z=o,this.ci=+s,this.precision=+a,!(0<=this.ci&&this.ci<1))throw new Error(`invalid ci; not in [0, 1): ${s}`);if(!(this.precision>0))throw new Error(`invalid precision: ${a}`)}render(t,r,n,i,o){let{x:s,y:a,z:c}=n,{ci:l}=this;return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,r).call(u=>u.selectAll().data(c?i0(t,c,this.z):[t]).enter().call(f=>f.append("path").attr("fill","none").call(Et,this).call(of,this,{...n,fill:null,fillOpacity:null}).attr("d",d=>this._renderLine(d,s,a)).call(l&&!Ka(this.fill)?d=>d.select(Pat).attr("stroke","none").call(Et,this).call(of,this,{...n,stroke:null,strokeOpacity:null,strokeWidth:null}).attr("d",h=>this._renderBand(h,s,a)):()=>{}))).node()}};function Pat(){return this.parentNode.insertBefore(this.ownerDocument.createElementNS(An.svg,"path"),this)}var XN=class extends yI{constructor(t,r){super(t,r)}_renderBand(t,r,n){let{ci:i,precision:o}=this,[s,a]=ce(t,u=>n[u]),c=gI(t,n,r),l=wV(t,n,r,(1-i)/2,c);return ch().y(u=>u).x0(u=>l(u,-1)).x1(u=>l(u,1))(er(s,a-o/2,o).concat(a))}_renderLine(t,r,n){let[i,o]=ce(t,a=>n[a]),s=gI(t,n,r);return`M${s(i)},${i}L${s(o)},${o}`}},HN=class extends yI{constructor(t,r){super(t,r)}_renderBand(t,r,n){let{ci:i,precision:o}=this,[s,a]=ce(t,u=>r[u]),c=gI(t,r,n),l=wV(t,r,n,(1-i)/2,c);return ch().x(u=>u).y0(u=>l(u,-1)).y1(u=>l(u,1))(er(s,a-o/2,o).concat(a))}_renderLine(t,r,n){let[i,o]=ce(t,a=>r[a]),s=gI(t,r,n);return`M${i},${s(i)}L${o},${s(o)}`}};function bV(e,{y:t=Ee,x:r=G,stroke:n,fill:i=fe(n)?"currentColor":n,...o}={}){return new XN(e,Yh({...o,x:r,y:t,fill:i,stroke:n}))}function _V(e,{x:t=Ee,y:r=G,stroke:n,fill:i=fe(n)?"currentColor":n,...o}={}){return new HN(e,Vh({...o,x:t,y:r,fill:i,stroke:n}))}function gI(e,t,r){let n=0,i=0,o=0,s=0;for(let u of e){let f=t[u],d=r[u];n+=f,i+=d,o+=f*d,s+=f*f}let a=e.length,c=(a*o-n*i)/(a*s-n*n),l=(i-c*n)/a;return u=>c*u+l}function wV(e,t,r,n,i){let o=Zr(e,u=>t[u])/e.length,s=0,a=0;for(let u of e)s+=(t[u]-o)**2,a+=(r[u]-i(t[u]))**2;let c=Math.sqrt(a/(e.length-2)),l=xV(n,e.length-2);return(u,f)=>{let d=i(u),h=c*Math.sqrt(1/e.length+(u-o)**2/s);return d+f*l*h}}function U0({path:e=G,delimiter:t,frameAnchor:r,treeLayout:n=Uu,treeSort:i,treeSeparation:o,treeAnchor:s,treeFilter:a,...c}={}){s=wI(s),i=IV(i),a!=null&&(a=ZN(a)),r===void 0&&(r=s.frameAnchor);let l=TV(t),u=DV(c,ZN),[f,d]=Br(),[h,p]=Br();return{x:f,y:h,frameAnchor:r,...mr(c,(m,y)=>{let g=l(_t(m,e)),x=d([]),b=p([]),_=-1,v=[],w=[],T=pv().path(N=>g[N]),A=Qn(m)?N=>N.data=m[N.data]:N=>N.data=m.get(N.data),E=n();E.nodeSize&&E.nodeSize([1,1]),E.separation&&o!==void 0&&E.separation(o??Wg);for(let N of u)N[bI]=N[OV]([]);for(let N of y){let I=[],R=T(N.filter(C=>g[C]!=null)).each(A);i!=null&&R.sort(i),E(R);for(let C of R.descendants())if(!(a!=null&&!a(C))){I.push(++_),v[_]=C.data,s.position(C,_,x,b);for(let S of u)S[bI][_]=S[RV](C)}w.push(I)}return{data:v,facets:w}}),...Object.fromEntries(u)}}function _I({path:e=G,delimiter:t,curve:r="bump-x",stroke:n="#555",strokeWidth:i=1.5,strokeOpacity:o=.5,treeLayout:s=Uu,treeSort:a,treeSeparation:c,treeAnchor:l,treeFilter:u,...f}={}){l=wI(l),a=IV(a),u!=null&&(u=SV(u)),f={curve:r,stroke:n,strokeWidth:i,strokeOpacity:o,...f};let d=TV(t),h=DV(f,SV),[p,m]=Br(),[y,g]=Br(),[x,b]=Br(),[_,v]=Br();return{x1:p,x2:y,y1:x,y2:_,...mr(f,(w,T)=>{let A=d(_t(w,e)),E=m([]),N=g([]),I=b([]),R=v([]),C=-1,S=[],M=[],O=pv().path(B=>A[B]),L=s();L.nodeSize&&L.nodeSize([1,1]),L.separation&&c!==void 0&&L.separation(c??Wg);for(let B of h)B[bI]=B[OV]([]);for(let B of T){let k=[],P=O(B.filter(U=>A[U]!=null)).each(U=>U.data=w[U.data]);a!=null&&P.sort(a),L(P);for(let{source:U,target:$}of P.links())if(!(u!=null&&!u($,U))){k.push(++C),S[C]=$.data,l.position(U,C,E,I),l.position($,C,N,R);for(let X of h)X[bI][C]=X[RV]($,U)}M.push(k)}return{data:S,facets:M}}),...Object.fromEntries(h)}}function wI(e="left"){switch(`${e}`.trim().toLowerCase()){case"left":return Uat;case"right":return $at}throw new Error(`invalid tree anchor: ${e}`)}var Uat={frameAnchor:"left",dx:6,position({x:e,y:t},r,n,i){n[r]=t,i[r]=-e}},$at={frameAnchor:"right",dx:-6,position({x:e,y:t},r,n,i){n[r]=-t,i[r]=-e}};function IV(e){return e==null||typeof e=="function"?e:`${e}`.trim().toLowerCase().startsWith("node:")?vV(ZN(e)):vV(zat(e))}function vV(e){return(t,r)=>Cr(e(t),e(r))}function zat(e){return t=>t.data?.[e]}function TV(e="/"){if(e=`${e}`,e==="/")return r=>r;if(e.length!==1)throw new Error("delimiter must be exactly one character");let t=e.charCodeAt(0);return r=>r.map(n=>jat(n,t))}var QN=92,AV=47;function jat(e,t){if(t===QN)throw new Error("delimiter cannot be backslash");let r=!1;for(let n=0,i=e.length;n<i;++n){switch(e.charCodeAt(n)){case QN:if(!r){r=!0;continue}break;case t:r?(e=e.slice(0,n-1)+e.slice(n),--n,--i):e=e.slice(0,n)+"/"+e.slice(n+1);break;case AV:r?(e=e.slice(0,n)+"\\\\"+e.slice(n),n+=2,i+=2):(e=e.slice(0,n)+"\\"+e.slice(n),++n,++i);break}r=!1}return e}function qat(e){let t=!1;for(let r=0,n=e.length;r<n;++r){switch(e.charCodeAt(r)){case QN:if(!t){t=!0;continue}case AV:t&&(e=e.slice(0,r-1)+e.slice(r),--r,--n);break}t=!1}return e}function EV(e){return kr(e)&&typeof e.node=="function"}function Vat(e){return kr(e)&&typeof e.link=="function"}function ZN(e){if(EV(e))return e.node;if(e=`${e}`.trim().toLowerCase(),!!e.startsWith("node:")){switch(e){case"node:name":return JN;case"node:path":return KN;case"node:internal":return MV;case"node:external":return NV;case"node:depth":return t8;case"node:height":return e8}throw new Error(`invalid node value: ${e}`)}}function SV(e){if(EV(e))return e.node;if(Vat(e))return e.link;if(e=`${e}`.trim().toLowerCase(),!(!e.startsWith("node:")&&!e.startsWith("parent:"))){switch(e){case"parent:name":return xI(JN);case"parent:path":return xI(KN);case"parent:depth":return xI(t8);case"parent:height":return xI(e8);case"node:name":return JN;case"node:path":return KN;case"node:internal":return MV;case"node:external":return NV;case"node:depth":return t8;case"node:height":return e8}throw new Error(`invalid link value: ${e}`)}}function KN(e){return e.id}function JN(e){return Yat(e.id)}function t8(e){return e.depth}function e8(e){return e.height}function MV(e){return!!e.children}function NV(e){return!e.children}function xI(e){return(t,r)=>r==null?void 0:e(r)}function Yat(e){let t=e.length;for(;--t>0&&!Wat(e,t););return qat(e.slice(t+1))}function Wat(e,t){if(e[t]==="/"){let r=0;for(;t>0&&e[--t]==="\\";)++r;if(!(r&1))return!0}return!1}var OV=2,RV=3,bI=4;function DV(e,t){let r=[];for(let n in e){let i=e[n],o=t(i);o!==void 0&&r.push([n,...Br(i),o])}return r}function r8(e,{fill:t,stroke:r,strokeWidth:n,strokeOpacity:i,strokeLinejoin:o,strokeLinecap:s,strokeMiterlimit:a,strokeDasharray:c,strokeDashoffset:l,marker:u,markerStart:f=u,markerEnd:d=u,dot:h=fe(f)&&fe(d),text:p="node:name",textStroke:m="var(--plot-background)",title:y="node:path",dx:g,dy:x,textAnchor:b,treeLayout:_=Uu,textLayout:v=_===Uu||_===dv?"mirrored":"normal",tip:w,...T}={}){if(g===void 0&&(g=wI(T.treeAnchor).dx),b!==void 0)throw new Error("textAnchor is not a configurable tree option");v=Sr(v,"textLayout",["mirrored","normal"]);function A(E){return Rs(e,U0({treeLayout:_,text:p,fill:t===void 0?"currentColor":t,stroke:m,dx:g,dy:x,title:y,...E,...T}))}return yr(iI(e,_I({treeLayout:_,markerStart:f,markerEnd:d,stroke:r!==void 0?r:t===void 0?"node:internal":t,strokeWidth:n,strokeOpacity:i,strokeLinejoin:o,strokeLinecap:s,strokeMiterlimit:a,strokeDasharray:c,strokeDashoffset:l,...T})),h?to(e,U0({treeLayout:_,fill:t===void 0?"node:internal":t,title:y,tip:w,...T})):null,p!=null?v==="mirrored"?[A({textAnchor:"start",treeFilter:"node:external"}),A({textAnchor:"end",treeFilter:"node:internal",dx:-g})]:A():null)}function LV(e,t){return r8(e,{...t,treeLayout:dv})}var CV={ariaLabel:"waffle"},$0=class extends pf{constructor(t,{unit:r=1,gap:n=1,round:i,render:o,multiple:s,...a}={}){super(t,{...a,render:nc(o,kV("x"))},CV),this.unit=Math.max(0,r),this.gap=+n,this.round=BV(i),this.multiple=PV(s)}},z0=class extends mf{constructor(t,{unit:r=1,gap:n=1,round:i,render:o,multiple:s,...a}={}){super(t,{...a,render:nc(o,kV("y"))},CV),this.unit=Math.max(0,r),this.gap=+n,this.round=BV(i),this.multiple=PV(s)}};function kV(e){return function(t,r,n,i,o){let{unit:s,gap:a,rx:c,ry:l,round:u}=this,{document:f}=o,d=n.channels[`${e}1`].value,h=n.channels[`${e}2`].value,p=this[e==="y"?"_width":"_height"](r,n,i),m=this[e==="y"?"_x":"_y"](r,n,i),y=s*Gat(r.scales[e]),{multiple:g=Math.max(1,Math.floor(Math.sqrt(p/y)))}=this,x=Math.min(p/g,y*g),b=y*g,_=e==="y"?([I,R])=>[I*x,-R*b]:([I,R])=>[R*b,I*x],v=(p-g*x)/2,w=typeof m=="function"?I=>m(I)+v:m+v,T=r[e](0),A=qz(),E=f.createElementNS(An.svg,"pattern");E.setAttribute("width",e==="y"?x:b),E.setAttribute("height",e==="y"?b:x),E.setAttribute("patternUnits","userSpaceOnUse");let N=E.appendChild(f.createElementNS(An.svg,"rect"));return N.setAttribute("x",a/2),N.setAttribute("y",a/2),N.setAttribute("width",(e==="y"?x:b)-a),N.setAttribute("height",(e==="y"?b:x)-a),c!=null&&N.setAttribute("rx",c),l!=null&&N.setAttribute("ry",l),lt("svg:g",o).call(kt,this,i,o).call(this._transform,this,r).call(I=>I.selectAll().data(t).enter().append(()=>E.cloneNode(!0)).attr("id",R=>`${A}-${R}`).select("rect").call(Et,this).call(Wt,this,n)).call(I=>I.selectAll().data(t).enter().append("path").attr("transform",e==="y"?Fo`translate(${w},${T})`:Fo`translate(${T},${w})`).attr("d",R=>`M${n8(u(d[R]/s),u(h[R]/s),g).map(_).join("L")}Z`).attr("fill",R=>`url(#${A}-${R})`).attr("stroke",this.stroke==null?null:R=>`url(#${A}-${R})`)).node()}}function n8(e,t,r){if(e<0||t<0){let n=Math.ceil(-Math.min(e,t)/r);return n8(e+n*r,t+n*r,r).map(([i,o])=>[i,o-n])}return t<e?n8(t,e,r):[[0,Math.ceil(e/r)],[Math.floor(e%r),Math.ceil(e/r)],[Math.floor(e%r),Math.floor(e/r)+e%1],[Math.ceil(e%r),Math.floor(e/r)+e%1],...e%r>r-1?[]:[[Math.ceil(e%r),Math.floor(e/r)],[r,Math.floor(e/r)]],[r,Math.floor(t/r)],[Math.ceil(t%r),Math.floor(t/r)],[Math.ceil(t%r),Math.floor(t/r)+t%1],[Math.floor(t%r),Math.floor(t/r)+t%1],...t%r<1?[]:[[Math.floor(t%r),Math.ceil(t/r)],[0,Math.ceil(t/r)]]]}function BV(e){if(e===void 0||e===!1)return Number;if(e===!0)return Math.round;if(typeof e!="function")throw new Error(`invalid round: ${e}`);return e}function PV(e){return e===void 0?void 0:Math.max(1,Math.floor(e))}function Gat({domain:e,range:t}){return FV(t)/FV(e)}function FV(e){let[t,r]=ce(e);return r-t}function UV(e,t={}){return Ha(t)||(t={...t,y:Ee,x2:G}),new $0(e,vl(Fh(_l(t))))}function $V(e,t={}){return Ha(t)||(t={...t,x:Ee,y2:G}),new z0(e,Sl(Ch(wl(t))))}var ZV=CW(QV(),1);var ect=({marginLeft:e})=>[1,e],rct=({width:e,marginRight:t})=>[-1,e-t],nct=({width:e,marginLeft:t,marginRight:r})=>[0,(t+e-r)/2],ict=({marginTop:e})=>[1,e],oct=({height:e,marginBottom:t})=>[-1,e-t],sct=({height:e,marginTop:t,marginBottom:r})=>[0,(t+e-r)/2];function KV(e){return typeof e=="string"?{anchor:e}:e}function JV(e={},t={}){arguments.length===1&&([e,t]=eY(e));let{anchor:r="left",padding:n=1,r:i=t.r}=KV(e);switch(`${r}`.toLowerCase()){case"left":r=ect;break;case"right":r=rct;break;case"middle":r=nct;break;default:throw new Error(`unknown dodge anchor: ${r}`)}return rY("x","y",r,ie(n),i,t)}function tY(e={},t={}){arguments.length===1&&([e,t]=eY(e));let{anchor:r="bottom",padding:n=1,r:i=t.r}=KV(e);switch(`${r}`.toLowerCase()){case"top":r=ict;break;case"bottom":r=oct;break;case"middle":r=sct;break;default:throw new Error(`unknown dodge anchor: ${r}`)}return rY("y","x",r,ie(n),i,t)}function eY(e){let{anchor:t,padding:r,...n}=e,{r:i}=n;return[{anchor:t,padding:r,r:i},n]}function rY(e,t,r,n,i,o){if(i!=null&&typeof i!="number"){let{channels:s,sort:a,reverse:c}=o;s=Xg(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 Ne(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}=Ns(c,l,f));let p=h?void 0:i!==void 0?ie(i):this.r!==void 0?this.r:3;h&&(h=_t(h.value,l[h.scale]||G,Float64Array));let[m,y]=r(u),g=m?cct:act,x=new Float64Array(d.length),b=h?_=>h[_]:()=>p;for(let _ of a){let v=(0,ZV.default)();_=_.filter(h?T=>hh(d[T])&&Fn(h[T]):T=>hh(d[T]));let w=new Float64Array(2*_.length+2);for(let T of _){let A=b(T),E=m?A+n:0,N=d[T]-A,I=d[T]+A,R=2;v.queryInterval(N-n,I+n,([,,S])=>{let M=x[S]-E,O=d[T]-d[S],L=n+(h?h[T]+h[S]:2*p),B=Math.sqrt(L*L-O*O);w[R++]=M-B,w[R++]=M+B});let C=w.slice(0,R);m&&(C=C.filter(S=>S>=0));t:for(let S of C.sort(g)){for(let M=0;M<R;M+=2)if(w[M]+1e-6<S&&S<w[M+1]-1e-6)continue t;x[T]=S+E;break}v.insert([N,I,T])}}m||(m=1);for(let _ of a)for(let v of _)x[v]=x[v]*m+y;return{data:s,facets:a,channels:{[e]:{value:x,source:null},[t]:{value:d,source:c[t]},...h&&{r:{value:h,source:c.r}}}}})}function act(e,t){return Math.abs(e)-Math.abs(t)}function cct(e,t){return e-t}function iY(e,t){return arguments.length===1&&({basis:e,...t}=e),Xh(II(e),t)}function oY(e,t){return arguments.length===1&&({basis:e,...t}=e),Hh(II(e),t)}function II(e){if(e===void 0)return nY;if(typeof e=="function")return TI(bh(e));if(/^p\d{2}$/i.test(e))return ip(xh(e));switch(`${e}`.toLowerCase()){case"deviation":return fct;case"first":return nY;case"last":return uct;case"max":return dct;case"mean":return hct;case"median":return pct;case"min":return mct;case"sum":return yct;case"extent":return lct}throw new Error(`invalid basis: ${e}`)}function TI(e){return{mapIndex(t,r,n){let i=+e(t,r);for(let o of t)n[o]=r[o]===null?NaN:r[o]/i}}}function ip(e){return TI((t,r)=>e(t,n=>r[n]))}var lct={mapIndex(e,t,r){let[n,i]=ce(e,s=>t[s]),o=i-n;for(let s of e)r[s]=t[s]===null?NaN:(t[s]-n)/o}},nY=TI((e,t)=>{for(let r=0;r<e.length;++r){let n=t[e[r]];if(Pe(n))return n}}),uct=TI((e,t)=>{for(let r=e.length-1;r>=0;--r){let n=t[e[r]];if(Pe(n))return n}}),fct={mapIndex(e,t,r){let n=Ea(e,o=>t[o]),i=zi(e,o=>t[o]);for(let o of e)r[o]=t[o]===null?NaN:i?(t[o]-n)/i:0}},dct=ip(Kt),hct=ip(Ea),pct=ip(Eo),mct=ip(Ht),yct=ip(Zr);function sY(e,t){return cY("x",e,t)}function aY(e,t){return cY("y",e,t)}function cY(e,t,r={}){let n,i=1;if(typeof t=="number")i=t,n=(l,u)=>+l+u;else{if(typeof t=="string"){let l=t.startsWith("-")?-1:1;[t,i]=eS(t.replace(/^[+-]/,"")),i*=l}t=wh(t),n=(l,u)=>t.offset(l,u)}let o=`${e}1`,s=`${e}2`,a=Zn({[o]:l=>l.map(u=>n(u,i)),[s]:l=>l},r),c=a[s].transform;return a[s].transform=()=>{let l=c(),[u,f]=ce(l);return l.domain=i<0?[u,n(f,i)]:[n(u,i),f],l},a}function lY(e,t={}){if(typeof e=="string")switch(e.toLowerCase()){case"first":return V0(t);case"last":return Y0(t)}if(typeof e=="function")return Rl(null,e,t);let r,n;for(r in e){if(n!==void 0)throw new Error("ambiguous selector; multiple inputs");n=gct(e[r])}if(n===void 0)throw new Error(`invalid selector: ${e}`);return Rl(r,n,t)}function gct(e){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"min":return l8;case"max":return u8}throw new Error(`unknown selector: ${e}`)}function V0(e){return Rl(null,xct,e)}function Y0(e){return Rl(null,bct,e)}function AI(e){return Rl("x",l8,e)}function EI(e){return Rl("y",l8,e)}function MI(e){return Rl("x",u8,e)}function NI(e){return Rl("y",u8,e)}function*xct(e){yield e[0]}function*bct(e){yield e[e.length-1]}function*l8(e,t){yield Q_(e,r=>t[r])}function*u8(e,t){yield vu(e,r=>t[r])}function Rl(e,t,r){if(e!=null){if(r[e]==null)throw new Error(`missing channel: ${e}`);e=r[e]}let n=pn(r);return mr(r,(i,o)=>{let s=_t(i,n),a=_t(i,e),c=[];for(let l of o){let u=[];for(let f of s?Hr(l,d=>s[d]).values():[l])for(let d of t(f,a))u.push(d);c.push(u)}return{data:i,facets:c}})}vt.prototype.plot=function({marks:e=[],...t}={}){return qh({...t,marks:[...e,this]})};var _ct=new Map([["style","style"],["width","width"],["height","height"],["margin","margin"],["marginLeft","marginLeft"],["marginRight","marginRight"],["marginTop","marginTop"],["marginBottom","marginBottom"],["align","align"],["aspectRatio","aspectRatio"],["axis","axis"],["inset","inset"],["grid","grid"],["label","label"],["padding","padding"],["xScale","x.type"],["xDomain","x.domain"],["xRange","x.range"],["xNice","x.nice"],["xInset","x.inset"],["xInsetLeft","x.insetLeft"],["xInsetRight","x.insetRight"],["xClamp","x.clamp"],["xRound","x.round"],["xAlign","x.align"],["xPadding","x.padding"],["xPaddingInner","x.paddingInner"],["xPaddingOuter","x.paddingOuter"],["xAxis","x.axis"],["xTicks","x.ticks"],["xTickSize","x.tickSize"],["xTickSpacing","x.tickSpacing"],["xTickPadding","x.tickPadding"],["xTickFormat","x.tickFormat"],["xTickRotate","x.tickRotate"],["xGrid","x.grid"],["xLine","x.line"],["xLabel","x.label"],["xLabelAnchor","x.labelAnchor"],["xLabelArrow","x.labelArrow"],["xLabelOffset","x.labelOffset"],["xFontVariant","x.fontVariant"],["xAriaLabel","x.ariaLabel"],["xAriaDescription","x.ariaDescription"],["xPercent","x.percent"],["xReverse","x.reverse"],["xZero","x.zero"],["xBase","x.base"],["xExponent","x.exponent"],["xConstant","x.constant"],["yScale","y.type"],["yDomain","y.domain"],["yRange","y.range"],["yNice","y.nice"],["yInset","y.inset"],["yInsetTop","y.insetTop"],["yInsetBottom","y.insetBottom"],["yClamp","y.clamp"],["yRound","y.round"],["yAlign","y.align"],["yPadding","y.padding"],["yPaddingInner","y.paddingInner"],["yPaddingOuter","y.paddingOuter"],["yAxis","y.axis"],["yTicks","y.ticks"],["yTickSize","y.tickSize"],["yTickSpacing","y.tickSpacing"],["yTickPadding","y.tickPadding"],["yTickFormat","y.tickFormat"],["yTickRotate","y.tickRotate"],["yGrid","y.grid"],["yLine","y.line"],["yLabel","y.label"],["yLabelAnchor","y.labelAnchor"],["yLabelArrow","y.labelArrow"],["yLabelOffset","y.labelOffset"],["yFontVariant","y.fontVariant"],["yAriaLabel","y.ariaLabel"],["yAriaDescription","y.ariaDescription"],["yPercent","y.percent"],["yReverse","y.reverse"],["yZero","y.zero"],["yBase","y.base"],["yExponent","y.exponent"],["yConstant","y.constant"],["facetMargin","facet.margin"],["facetMarginTop","facet.marginTop"],["facetMarginBottom","facet.marginBottom"],["facetMarginLeft","facet.marginLeft"],["facetMarginRight","facet.marginRight"],["facetGrid","facet.grid"],["facetLabel","facet.label"],["fxDomain","fx.domain"],["fxRange","fx.range"],["fxInset","fx.inset"],["fxInsetLeft","fx.insetLeft"],["fxInsetRight","fx.insetRight"],["fxRound","fx.round"],["fxAlign","fx.align"],["fxPadding","fx.padding"],["fxPaddingInner","fx.paddingInner"],["fxPaddingOuter","fx.paddingOuter"],["fxAxis","fx.axis"],["fxTicks","fx.ticks"],["fxTickSize","fx.tickSize"],["fxTickSpacing","fx.tickSpacing"],["fxTickPadding","fx.tickPadding"],["fxTickFormat","fx.tickFormat"],["fxTickRotate","fx.tickRotate"],["fxGrid","fx.grid"],["fxLine","fx.line"],["fxLabel","fx.label"],["fxLabelAnchor","fx.labelAnchor"],["fxLabelOffset","fx.labelOffset"],["fxFontVariant","fx.fontVariant"],["fxAriaLabel","fx.ariaLabel"],["fxAriaDescription","fx.ariaDescription"],["fxReverse","fx.reverse"],["fyDomain","fy.domain"],["fyRange","fy.range"],["fyInset","fy,inset"],["fyInsetTop","fy.insetTop"],["fyInsetBottom","fy.insetBottom"],["fyRound","fy.round"],["fyAlign","fy.align"],["fyPadding","fy.padding"],["fyPaddingInner","fy.paddingInner"],["fyPaddingOuter","fy.paddingOuter"],["fyAxis","fy.axis"],["fyTicks","fy.ticks"],["fyTickSize","fy.tickSize"],["fyTickSpacing","fy.tickSpacing"],["fyTickPadding","fy.tickPadding"],["fyTickFormat","fy.tickFormat"],["fyTickRotate","fy.tickRotate"],["fyGrid","fy.grid"],["fyLine","fy.line"],["fyLabel","fy.label"],["fyLabelAnchor","fy.labelAnchor"],["fyLabelOffset","fy.labelOffset"],["fyFontVariant","fy.fontVariant"],["fyAriaLabel","fy.ariaLabel"],["fyAriaDescription","fy.ariaDescription"],["fyReverse","fy.reverse"],["colorScale","color.type"],["colorDomain","color.domain"],["colorRange","color.range"],["colorClamp","color.clamp"],["colorN","color.n"],["colorNice","color.nice"],["colorScheme","color.scheme"],["colorInterpolate","color.interpolate"],["colorPivot","color.pivot"],["colorSymmetric","color.symmetric"],["colorLabel","color.label"],["colorPercent","color.percent"],["colorReverse","color.reverse"],["colorZero","color.zero"],["colorTickFormat","color.tickFormat"],["colorBase","color.base"],["colorExponent","color.exponent"],["colorConstant","color.constant"],["opacityScale","opacity.type"],["opacityDomain","opacity.domain"],["opacityRange","opacity.range"],["opacityClamp","opacity.clamp"],["opacityNice","opacity.nice"],["opacityLabel","opacity.label"],["opacityPercent","opacity.percent"],["opacityReverse","opacity.reverse"],["opacityZero","opacity.zero"],["opacityTickFormat","opacity.tickFormat"],["opacityBase","opacity.base"],["opacityExponent","opacity.exponent"],["opacityConstant","opacity.constant"],["symbolScale","symbol.type"],["symbolDomain","symbol.domain"],["symbolRange","symbol.range"],["rScale","r.type"],["rDomain","r.domain"],["rRange","r.range"],["rClamp","r.clamp"],["rNice","r.nice"],["rLabel","r.label"],["rPercent","r.percent"],["rZero","r.zero"],["rBase","r.base"],["rExponent","r.exponent"],["rConstant","r.constant"],["lengthScale","length.type"],["lengthDomain","length.domain"],["lengthRange","length.range"],["lengthClamp","length.clamp"],["lengthNice","length.nice"],["lengthPercent","length.percent"],["lengthZero","length.zero"],["lengthBase","length.base"],["lengthExponent","length.exponent"],["lengthConstant","length.constant"],["projectionType","projection.type"],["projectionParallels","projection.parallels"],["projectionPrecision","projection.precision"],["projectionRotate","projection.rotate"],["projectionDomain","projection.domain"],["projectionInset","projection.inset"],["projectionInsetLeft","projection.insetLeft"],["projectionInsetRight","projection.insetRight"],["projectionInsetTop","projection.insetTop"],["projectionInsetBottom","projection.insetBottom"],["projectionClip","projection.clip"]]);function wct(e,t,r){for(let n=0;n<t.length;++n){let i=t[n];n===t.length-1?e[i]=r:e=e[i]||(e[i]={})}}function uY(e,t,r){for(let n in e){let i=_ct.get(n);if(i==null)throw new Error(`Unrecognized plot attribute: ${n}`);let o=e[n];typeof o=="symbol"?r.push(n):o!==void 0&&wct(t,i.split("."),o)}}var vct=new Set(["frame","hexgrid","sphere","graticule"]),Sct=new Map([["first",V0],["last",Y0],["maxX",MI],["maxY",NI],["minX",AI],["minY",EI],["nearest",gl],["nearestX",xl],["nearestXY",ic]]);async function fY(e){let t={marks:[]},r=[],{attributes:n,marks:i}=e;uY(n,t,r);let o=[];for(let a of i)for(let{type:c,data:l,options:u}of a.plotSpecs()){let{select:f,...d}=u,h=Sct.get(f)?.(d)??d,p=vct.has(c)?[h]:[l,h];t.marks.push(f8[c](...p)),o.push(a.index)}Tct(t,e);let s=qh(t);Ect(s,o),Ict(e,s,n,r);for(let a of e.interactors)await a.init(s);return s}function Ict(e,t,r,n){n.forEach(i=>{let o=r[i];if(o===es){if(!i.endsWith("Domain"))throw new Error(`Unsupported fixed attribute: ${i}`);let s=i.slice(0,-6),a=t.scale(s);a?.domain&&e.setAttribute(i,r[`${s}Reverse`]?a.domain.slice().reverse():a.domain)}else throw new Error(`Unrecognized symbol: ${o}`)})}function Tct(e,t){let{marks:r}=t;OI("x",e,r),OI("y",e,r),OI("fx",e,r),OI("fy",e,r)}function OI(e,t,r){let n=t[e]||{};if(n.axis===null||n.label!==void 0)return;let i=r.map(s=>s.channelField(e)?.field);if(i.every(s=>s==null))return;let o;for(let s=0;s<i.length;++s){let a=dY(i[s]);a!==void 0&&(o===void 0?o=a:o!==a&&(o=void 0))}o!==void 0&&(t[e]={...n,label:o})}function dY(e){if(e){switch(e.type){case"COLUMN_REF":return e.column;case"CAST":return dY(e.expr);case"FUNCTION":if(e.name==="make_date")return"date";break}return Act(e)}}function Act(e){let t=`${e}`.replaceAll('"',"").replaceAll("(*)","()");return t.endsWith("()")?t.slice(0,-2):t}function Ect(e,t){let r=-1;for(let n of e.children){let i=n.getAttribute("aria-label")||"";n.nodeName==="style"||i.includes("-axis")||i.includes("-grid")||n.setAttribute("data-index",t[++r])}}var Mct={width:640,marginLeft:40,marginRight:20,marginTop:20,marginBottom:30},W0=class{constructor(t){this.attributes={...Mct},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=sM()}margins(){return{left:this.getAttribute("marginLeft"),top:this.getAttribute("marginTop"),bottom:this.getAttribute("marginBottom"),right:this.getAttribute("marginRight")}}innerWidth(){let{left:t,right:r}=this.margins();return this.getAttribute("width")-t-r}innerHeight(t=400){let{top:r,bottom:n}=this.margins(),i=this.getAttribute("height");return i==null&&(i=Nct(this,r,n)||t,this.setAttribute("height",i,{silent:!0})),i-r-n}pending(t){this.synch.pending(t)}update(t){return this.synch.ready(t)&&!this.pendingRender&&(this.pendingRender=!0,requestAnimationFrame(()=>this.render())),this.synch.promise}async render(){this.pendingRender=!1;let t=await fY(this),r=this.legends.flatMap(({legend:n,include:i})=>{let o=n.init(t);return i?o:[]});this.element.replaceChildren(t,...r),this.synch.resolve()}getAttribute(t){return this.attributes[t]}setAttribute(t,r,n){return om(this.attributes[t],r)?(r===void 0?delete this.attributes[t]:this.attributes[t]=r,n?.silent||this.listeners?.get(t)?.forEach(i=>i(t,r)),!0):!1}addAttributeListener(t,r){let n=this.listeners||(this.listeners=new Map);return n.has(t)||n.set(t,new Set),n.get(t).add(r),this}removeAttributeListener(t,r){return this.listeners?.get(t)?.delete(r)}addParams(t,r){let{params:n}=this;for(let i of r)n.has(i)?n.get(i).push(t):(n.set(i,[t]),i.addEventListener("value",()=>Promise.allSettled(n.get(i).map(o=>o.initialize()))))}addMark(t){return t.setPlot(this,this.marks.length),this.marks.push(t),this.markset=null,this}get markSet(){return this.markset||(this.markset=new Set(this.marks))}addInteractor(t){return this.interactors.push(t),this}addLegend(t,r=!0){t.setPlot(this),this.legends.push({legend:t,include:r})}};function Nct(e,t,r){let n=e.getAttribute("aspectRatio");if(n==null)return;let i=e.getAttribute("xDomain"),o=e.getAttribute("yDomain");if(!i||!o)return;let s=Math.abs(i[1]-i[0]);return Math.abs(o[1]-o[0])*e.innerWidth()/(n*s)+t+r}function RI(e){return typeof e!="string"?!1:(e=e.toLowerCase().trim(),e==="none"||e==="currentcolor"||e.startsWith("url(")&&e.endsWith(")")||e.startsWith("var(")&&e.endsWith(")")||di(e)!==null)}var Oct=new Set(["order","sort","label","anchor","curve","tension","marker","markerStart","markerMid","markerEnd","textAnchor","lineAnchor","lineHeight","textOverflow","monospace","fontFamily","fontSize","fontStyle","fontVariant","fontWeight","frameAnchor","strokeLinejoin","strokeLinecap","strokeMiterlimit","strokeDasharray","strokeDashoffset","mixBlendMode","shapeRendering","imageRendering","preserveAspectRatio","interpolate","crossOrigin","paintOrder","pointerEvents","target","select"]);function hY(e){return Oct.has(e)}var Rct=new Set(["asterisk","circle","cross","diamond","diamond2","hexagon","plus","square","square2","star","times","triangle","triangle2","wye"]);function pY(e){return Rct.has(`${e}`.toLowerCase())}var mY=e=>e==="stroke"||e==="fill",Dct=e=>/opacity$/i.test(e),Lct=e=>e==="symbol",Fct=(e,t)=>e!=="sort"&&e!=="tip"&&t!=null&&!Array.isArray(t),d8=(e,t)=>({channel:e,field:t,as:yc(t)?t.column:e}),h8=(e,t)=>({channel:e,value:t}),DI=e=>Array.isArray(e),Ir=class extends Bn{constructor(t,r,n,i={}){super(r?.options?.filterBy),this.type=t,this.reqs=i,this.source=r;let o=this.channels=[],s=this.detail=new Set,a=this.params=new Set;DI(r)?this.data=Xn(r):or(r?.table)&&a.add(r.table);let 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[oy]){let d=u(this,l);for(let h in d)c(h,d[h])}else if(f==="string")hY(l)||mY(l)&&RI(u)||Lct(l)&&pY(u)?o.push(h8(l,u)):o.push(d8(l,Gs(u)));else if(io(u)){let d=h8(l,u.value);o.push(d),u.addEventListener("value",h=>(d.value=h,this.update()))}else nn(u)?(MA(u).forEach(d=>a.add(d)),o.push(d8(l,u))):f==="object"&&Fct(l,u)?o.push(d8(l,u)):u!==void 0&&o.push(h8(l,u))};for(let l in n)c(l,n[l])}setPlot(t,r){this.plot=t,this.index=r,t.addParams(this,this.params),this.source?.table&&this.queryPending()}sourceTable(){let t=this.source?.table;return t?or(t)?t.value:t:null}hasOwnData(){return this.source==null||DI(this.source)}hasFieldInfo(){return!!this._fieldInfo}channel(t){return this.channels.find(r=>r.channel===t)}channelField(t,{exact:r=!1}={}){let n=r?this.channel(t):this.channels.find(i=>i.channel.startsWith(t));return n?.field?n:null}fields(){if(this.hasOwnData())return null;let{channels:t,reqs:r}=this,n=new Map;for(let{channel:o,field:s}of t){if(!s)continue;let a=s.stats?.stats||[],c=s.stats?.column??s,l=n.get(c)??n.set(c,new Set).get(c);a.forEach(u=>l.add(u)),r[o]?.forEach(u=>l.add(u))}let i=this.sourceTable();return Array.from(n,([o,s])=>({table:i,column:o,stats:s}))}fieldInfo(t){let r=Object.fromEntries(t.map(n=>[n.column,n]));for(let n of this.channels){let{field:i}=n;i&&Object.assign(n,r[i.stats?.column??i])}return this._fieldInfo=!0,this}query(t=[]){return this.hasOwnData()?null:G0(this.channels,this.sourceTable()).where(t)}queryPending(){return this.plot.pending(this),this}queryResult(t){return this.data=Xn(t),this}update(){return this.plot.update(this)}plotSpecs(){let{type:t,data:r,detail:n,channels:i}=this;return p8(t,n,i,r)}};function yn(e,t){let r=t?.[e.as]??e.as;return Object.hasOwn(e,"value")?e.value:mY(e.channel)?{value:r,scale:"color"}:Dct(e.channel)?{value:r,scale:"opacity"}:r}function G0(e,t,r=[]){let n=ft.from({source:t}),i=new Set,o=!1;for(let s of e){let{channel:a,field:c,as:l}=s;if(!r.includes(a)){if(a==="orderby")n.orderby(s.value);else if(c){if(ni(c))o=!0;else{if(i.has(l))continue;i.add(l)}n.select({[l]:c})}}}return o&&n.groupby(Array.from(i)),n}function p8(e,t,r,n,i={}){let{numRows:o,values:s,columns:a}=n??{},c={};for(let f of r){let d=t.has(f.channel)?c:i;d[f.channel]=yn(f,a)}return t.size&&(i.channels=c),[{type:e,data:s??(n?{length:o}:null),options:i}]}function wf(e,t){let{plot:r}=e,n=r.getAttribute(`${t}Scale`);if(!n){let{type:o}=e.channelField(t);n=o==="date"?"time":"linear"}let i={type:n};switch(n){case"log":i.base=r.getAttribute(`${t}Base`)??10;break;case"pow":i.exponent=r.getAttribute(`${t}Exponent`)??1;break;case"symlog":i.constant=r.getAttribute(`${t}Constant`)??1;break}return rm(i)}function Ii(e,t,r,n,i=1,o){let{field:s}=e.channelField(t);o=o??s;let{type:a,apply:c,sqlApply:l}=wf(e,t),u=!!e.plot.getAttribute(`${t}Reverse`),[f,d]=n.map(m=>c(m)),h=l(o),p=a==="time"||a==="utc"?h:o;return[BA(h,f,d,r-i,u),p]}var m8={x:["min","max"]},y8={y:["min","max"]},LI={...m8,...y8};function yY(e,t,r,n,i){let{plot:o}=e,s=o.getAttribute(n),a=o.getAttribute(i);if(Array.isArray(s)&&!s[Gr])return s;{let{column:c,min:l,max:u}=e.channelField(r),f=g8(t,c)||(a?Ba().domain([l,u]).nice().domain():[l,u]);return s!==es&&(f[Gr]=!0),o.setAttribute(n,f,{silent:!0}),f}}function ks(e,t){return yY(e,t,"x","xDomain","xNice")}function Bs(e,t){return yY(e,t,"y","yDomain","yNice")}function g8(e,t){if(!e)return;let r,n;return[e].flat().forEach(i=>zo(i,o=>{if(o instanceof Hl&&`${o.expr}`===t){let s=(o.extent??[]).map(a=>a?.value??a);(r==null||s[0]<r)&&(r=s[0]),(n==null||s[1]>n)&&(n=s[1])}})),r!=null&&n!=null&&r!==n?[r,n]:void 0}var X0=class extends Ir{constructor(t,r,n){let i=t.endsWith("X")?"y":t.endsWith("Y")?"x":null,o=i?{[i]:["count","min","max"]}:void 0;super(t,r,n,o),this.dim=i}query(t=[]){let{plot:r,dim:n,source:i}=this,o=i.options?.optimize,s=super.query(t);if(!n)return s;let a=n==="x"?"y":"x",c=this.channelField(a,{exact:!0})?.as,{field:l,as:u,type:f,count:d,min:h,max:p}=this.channelField(n),m=f==="date"||f==="number",y=n==="x"?r.innerWidth():r.innerHeight();if(o??=d/y>10,o&&m&&c){let[g,x]=g8(t,l)||[h,p],[b]=Ii(this,n,y,[g,x],1,u),_=s._select.map(v=>v.alias).filter(v=>v!==u&&v!==c);return jA(s,b,u,c,_)}else return s.orderby(l)}};function gY(e,t=[]){return new t.constructor(e)}function xY(e,t,r){let n=gY(e,r),i=r.length;for(let o=0;o<i;++o)n[t[o]]=r[o];return n}function bY(e,t,r,n,i,o,s){let a=r.length,c=e*t,l=i.map(h=>n[h]),u={},f=[],d=new Int32Array(a);if(o?.length){let h=o.map(m=>n[m]),p={};for(let m=0;m<a;++m){let y=h.map(g=>g[m]);d[m]=p[y]??=f.push(y)-1}for(let m=0;m<o.length;++m)u[o[m]]=f.map(y=>y[m])}else f.push([]);if(s){let h=r.map(y=>y%e),p=r.map(y=>Math.floor(y/e)),m=f.map(()=>[]);for(let y=0;y<a;++y)m[d[y]].push(y);i.forEach((y,g)=>{let x=l[g];u[y]=f.map((b,_)=>s(m[_],e,t,h,p,x))})}else i.forEach((h,p)=>{let m=l[p],y=u[h]=f.map(()=>gY(c,m));for(let g=0;g<a;++g)y[d[g]][r[g]]=m[g]});return{numRows:f.length,columns:u}}function H0(e){let t=1/0,r=-1/0;return e.forEach(n=>{let i=n.length;for(let o=0;o<i;++o){let s=n[o];s<t&&(t=s),s>r&&(r=s)}}),Number.isFinite(t)&&Number.isFinite(r)?[t,r]:[0,1]}function _Y(e){let t=new In;return e.forEach(r=>{let n=r.length;for(let i=0;i<n;++i)t.add(r[i])}),Array.from(t).sort(Ft)}function nr(e,t){return or(e)?(e.addEventListener("value",t),e.value):e}function Q0(e,t=!1){let r=new Float64Array(5),n=new Float64Array(4);Cct(r,n,e);let i=Float64Array.of(0,n[1]-r[1]*n[0],n[2]-r[2]*n[0],n[3]-r[3]*n[0],-r[4]*n[0]),o=1+r[1]+r[2]+r[3]+r[4],s=(n[0]+n[1]+n[2]+n[3])/o,a=(i[1]+i[2]+i[3]+i[4])/o;return{sigma:e,negative:t,a:r,b_causal:n,b_anticausal:i,sum_causal:s,sum_anticausal:a}}function Cct(e,t,r){let i=Float64Array.of(.84,1.8675,.84,-1.8675,-.34015,-.1299,-.34015,.1299),o=Math.exp(-1.783/r),s=Math.exp(-1.723/r),a=.6318/r,c=1.997/r,l=Float64Array.of(-o*Math.cos(a),o*Math.sin(a),-o*Math.cos(-a),o*Math.sin(-a),-s*Math.cos(c),s*Math.sin(c),-s*Math.cos(-c),s*Math.sin(-c)),u=r*2.5066282746310007,f=Float64Array.of(i[0],i[1],0,0,0,0,0,0),d=Float64Array.of(1,0,l[0],l[1],0,0,0,0,0,0),h,p;for(p=2;p<8;p+=2){for(f[p]=l[p]*f[p-2]-l[p+1]*f[p-1],f[p+1]=l[p]*f[p-1]+l[p+1]*f[p-2],h=p-2;h>0;h-=2)f[h]+=l[p]*f[h-2]-l[p+1]*f[h-1],f[h+1]+=l[p]*f[h-1]+l[p+1]*f[h-2];for(h=0;h<=p;h+=2)f[h]+=i[p]*d[h]-i[p+1]*d[h+1],f[h+1]+=i[p]*d[h+1]+i[p+1]*d[h];for(d[p+2]=l[p]*d[p]-l[p+1]*d[p+1],d[p+3]=l[p]*d[p+1]+l[p+1]*d[p],h=p;h>0;h-=2)d[h]+=l[p]*d[h-2]-l[p+1]*d[h-1],d[h+1]+=l[p]*d[h-1]+l[p+1]*d[h-2]}for(p=0;p<4;++p)h=p<<1,t[p]=f[h]/u,e[p+1]=d[h+2]}function wY(e,t,r,[n,i]){let o=new Float64Array(Math.max(n,i)),s=new Float64Array(Math.max(n,i)),a=new Float64Array(5),c=new Float64Array(r.length);for(let l=0,u=0;l<i;++l,u+=n){let f=c.subarray(u);FI(e,r.subarray(u),n,1,o,s,a,f)}for(let l=0;l<n;++l){let u=c.subarray(l);FI(t,u,i,n,o,s,a,u)}return c}function FI(e,t,r,n=1,i=new Float64Array(r),o=new Float64Array(r),s=new Float64Array(5),a=i,c=kct){let l=n*2,u=n*3,f=n*4,d=n*r,h,p;for(c(i,t,r,n,e.b_causal,3,e.a,4,e.sum_causal,s,e.sigma),p=4,h=f;p<r;++p,h+=n)i[p]=e.b_causal[0]*t[h]+e.b_causal[1]*t[h-n]+e.b_causal[2]*t[h-l]+e.b_causal[3]*t[h-u]-e.a[1]*i[p-1]-e.a[2]*i[p-2]-e.a[3]*i[p-3]-e.a[4]*i[p-4];for(c(o,t,r,-n,e.b_anticausal,4,e.a,4,e.sum_anticausal,s,e.sigma),p=4,h=d-n*5;p<r;++p,h-=n)o[p]=e.b_anticausal[1]*t[h+n]+e.b_anticausal[2]*t[h+l]+e.b_anticausal[3]*t[h+u]+e.b_anticausal[4]*t[h+f]-e.a[1]*o[p-1]-e.a[2]*o[p-2]-e.a[3]*o[p-3]-e.a[4]*o[p-4];if(e.negative)for(p=0,h=0;p<r;++p,h+=n)a[h]=i[p]+o[r-p-1];else for(p=0,h=0;p<r;++p,h+=n)a[h]=Math.max(0,i[p]+o[r-p-1]);return a}function kct(e,t,r,n,i,o,s,a,c,l,u,f=.5){let d=Math.abs(n)*r,h=n<0?d+n:0,p,m,y;for(m=0;m<=a;++m)for(l[m]=m<=o?i[m]:0,y=1;y<=a&&y<=m;++y)l[m]-=s[y]*l[m-y];for(y=0;y<a;++y)for(e[y]=0,m=1;m<=y;++m)p=h+n*m,p>=0&&p<d&&(e[y]+=l[y-m]*t[p]);let g=t[h],x=Math.ceil(u*10);for(m=0;m<x;++m){for(y=0;y<a;++y)e[y]+=l[y]*g;if(c-=Math.abs(l[0]),c<=f)break;for(l[a]=m+a<=o?i[m+a]:0,y=1;y<=a;++y)l[a]-=s[y]*l[a-y];for(y=0;y<a;++y)l[y]=l[y+1]}}var Co="density",ko=class extends Ir{constructor(t,r,n){let{bandwidth:i=0,interpolate:o="none",pixelSize:s=1,pad:a=1,width:c,height:l,...u}=n,f=Bct(u);super(t,r,u,LI),this.densityMap=f,this.bandwidth=nr(i,d=>(this.bandwidth=d,this.grids?this.convolve().update():null)),this.interpolate=nr(o,d=>(this.interpolate=d,this.requestUpdate())),this.pixelSize=nr(s,d=>(this.pixelSize=d,this.requestUpdate())),this.pad=nr(a,d=>(this.pad=d,this.requestUpdate())),this.width=nr(c,d=>(this.width=d,this.requestUpdate())),this.height=nr(l,d=>(this.height=d,this.requestUpdate()))}setPlot(t,r){let n=()=>{this.hasFieldInfo()&&this.requestUpdate()};t.addAttributeListener("xDomain",n),t.addAttributeListener("yDomain",n),super.setPlot(t,r)}get filterStable(){let t=this.plot.getAttribute("xDomain"),r=this.plot.getAttribute("yDomain");return t&&r&&!t[Gr]&&!r[Gr]}query(t=[]){let{interpolate:r,pad:n,channels:i,densityMap:o}=this,[s,a]=this.extentX=ks(this,t),[c,l]=this.extentY=Bs(this,t),[u,f]=this.bins=this.binDimensions(),[d,h]=Ii(this,"x",u,[s,a],n),[p,m]=Ii(this,"y",f,[c,l],n),y=n?[jr(h,[+s,+a]),jr(m,[+c,+l])]:[ri(+s,h),ze(h,+a),ri(+c,m),ze(m,+l)],g=ft.from(this.sourceTable()).where(t.concat(y)),x=this.groupby=[],b={};for(let v of i)if(Object.hasOwn(v,"field")){let{as:w,channel:T,field:A}=v;ni(A)?(b[T]=A,o[T]=!0):T==="weight"?b[Co]=de(A):T!=="x"&&T!=="y"&&(g.select({[w]:A}),x.push(w))}let _=this.aggr=Object.keys(b);if(b.density&&_.length>1)throw new Error("Weight option can not be used with custom aggregates.");if(_.length||(_.push(Co),b[Co]=Mr()),r==="linear"){if(_.length>1)throw new Error("Linear binning not applicable to multiple aggregates.");if(!b[Co])throw new Error("Linear binning not applicable to custom aggregates.");let v=Gf(b[Co])[0];return $A(g,d,p,v,u,x)}else return PA(g,d,p,b,u,x)}binDimensions(){let{plot:t,pixelSize:r,width:n,height:i}=this;return[n??Math.round(t.innerWidth()/r),i??Math.round(t.innerHeight()/r)]}queryResult(t){let[r,n]=this.bins,i=Pct(this.interpolate),{columns:o}=Xn(t);return this.grids0=bY(r,n,o.index,o,this.aggr,this.groupby,i),this.convolve()}convolve(){let{aggr:t,bandwidth:r,bins:n,grids0:i,plot:o}=this;if(this.grids=i,r>0){let s=t.length===1?t[0]:t.includes(Co)?Co:null;if(!s)return console.warn("No compatible grid found for smoothing."),this;let a=i.columns[s],c=o.innerWidth(),l=o.innerHeight(),[u,f]=n,d=a.some(m=>m.some(y=>y<0)),h=Q0(r*(u-1)/c,d),p=Q0(r*(f-1)/l,d);this.grids={numRows:i.numRows,columns:{...i.columns,[s]:a.map(m=>wY(h,p,m,n))}}}return this}};function Bct(e){let t={};for(let r in e)e[r]==="density"&&(delete e[r],t[r]=!0);return t}function Pct(e="none"){if(typeof e=="function")return e;switch(e.toLowerCase()){case"none":case"linear":return;case"nearest":return O0;case"barycentric":return N0();case"random-walk":return R0()}throw new Error(`invalid interpolate: ${e}`)}var Z0=class extends ko{constructor(t,r){let{thresholds:n=10,...i}=r;super("geo",t,{bandwidth:20,interpolate:"linear",pixelSize:2,...i}),this.thresholds=nr(n,o=>(this.thresholds=o,this.grids?this.contours().update():null))}convolve(){return super.convolve().contours()}contours(){let{bins:t,densityMap:r,grids:n,thresholds:i,plot:o}=this,{numRows:s,columns:a}=n,c=i,l;if(Array.isArray(c))l=c;else{let[,I]=H0(a.density);l=Array.from({length:c-1},(R,C)=>I*(C+1)/c)}(r.fill||r.stroke)&&this.plot.getAttribute("colorScale")!=="log"&&this.plot.setAttribute("colorZero",!0);let[u,f]=t,[d,h]=o.getAttribute("xDomain"),[p,m]=o.getAttribute("yDomain"),y=(h-d)/u,g=(m-p)/f,x=+d,b=+p,_=I=>x+I*y,v=I=>b+I*g,w=Wc().size(t),T=this.contourData=Array(s*l.length),{density:A,...E}=a,N=Object.entries(E);for(let I=0,R=0;I<s;++I){let C=A[I],S=N.reduce((M,[O,L])=>(M[O]=L[I],M),{});for(let M=0;M<l.length;++M,++R)T[R]=Object.assign(Uct(w.contour(C,l[M]),_,v),S)}return this}plotSpecs(){let{type:t,channels:r,densityMap:n,contourData:i}=this,o={};for(let s of r){let{channel:a}=s;a!=="x"&&a!=="y"&&(o[a]=yn(s))}for(let s in n)n[s]&&(o[s]=yn({channel:s,as:"value"}));return[{type:t,data:i,options:o}]}};function Uct(e,t,r){function n(s){s.forEach(i)}function i(s){s.forEach(o)}function o(s){s[0]=t(s[0]),s[1]=r(s[1])}return e.coordinates.forEach(n),e}function K0(e){return Array.from({length:e},(t,r)=>r)}function CI(e,t){let r=t.reduce((i,o,s)=>(i[o]=s,i),{}),n=K0(e.length);return n.sort((i,o)=>r[e[i]]-r[e[o]]),n}function kI(e,t){if(typeof document<"u"){let r=document.createElement("canvas");return r.setAttribute("width",e),r.setAttribute("height",t),r}throw new Error("Can not create a canvas instance.")}function vY(e=1){let t=255*e|0;return(r,n,i)=>{for(let o=0,s=0;o<i;++o)for(let a=0;a<n;++a,s+=4)r[s+3]=t}}function SY(e){let{apply:t}=e;return(r,n,i,o)=>{for(let s=0,a=0;s<i;++s)for(let c=0,l=(i-s-1)*n;c<n;++c,a+=4)r[a+3]=255*t(o[c+l])|0}}function IY(e={}){let{r:t=0,g:r=0,b:n=0,opacity:i=1}=typeof e=="string"?wr(e):e,o=new Uint8ClampedArray([t,r,n,255*i|0]);return(s,a,c)=>{for(let l=0,u=0;l<c;++l)for(let f=0;f<a;++f,u+=4)s[u+0]=o[0],s[u+1]=o[1],s[u+2]=o[2],s[u+3]=o[3]}}function TY(e){let{domain:t,range:r}=e,n=Object.create(null),i=new Uint8ClampedArray(4*t.length),o=t.length-1,s=r.length;for(let a=0;a<=o;++a){let c=r[a%s],{r:l,g:u,b:f,opacity:d=1}=typeof c=="string"?wr(c):c,h=a<<2;i[h+0]=l,i[h+1]=u,i[h+2]=f,i[h+3]=255*d|0,n[t[a]]=h}return(a,c,l,u)=>{if(u.map)for(let f=0,d=0;f<l;++f)for(let h=0,p=(l-f-1)*c;h<c;++h,d+=4){let m=n[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=n[u];for(let d=0,h=0;d<l;++d)for(let p=0;p<c;++p,h+=4)a[h+0]=i[f+0],a[h+1]=i[f+1],a[h+2]=i[f+2],a[h+3]=i[f+3]}}}function AY(e,t,r){let{interpolate:n}=t,i=new Uint8ClampedArray(4*e),o=e-1;for(let s=0;s<=o;++s){let a=n(s/o),{r:c,g:l,b:u,opacity:f=1}=typeof a=="string"?wr(a):a,d=s<<2;i[d+0]=c,i[d+1]=l,i[d+2]=u,i[d+3]=255*f|0}return(s,a,c,l)=>{for(let u=0,f=0;u<c;++u)for(let d=0,h=(c-u-1)*a;d<a;++d,f+=4){let p=o*r(l[d+h])<<2;s[f+0]=i[p+0],s[f+1]=i[p+1],s[f+2]=i[p+2],s[f+3]=i[p+3]}}}var Dl=class extends ko{constructor(t,r){super("image",t,r),this.image=null}setPlot(t,r){let n=()=>{this.hasFieldInfo()&&this.rasterize()};t.addAttributeListener("schemeColor",n),super.setPlot(t,r)}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:t,grids:r}=this,[n,i]=t,{numRows:o,columns:s}=r,{canvas:a,ctx:c,img:l}=qct(this,n,i),{alpha:u,alphaProp:f,color:d,colorProp:h}=x8(this),p=s[f]??[],m=s[h]??[],y=o>1&&h&&this.groupby?.includes(h)?CI(m,this.plot.getAttribute("colorDomain")):K0(o);return this.data={numRows:o,columns:{src:Array.from({length:o},(g,x)=>(d?.(l.data,n,i,m[y[x]]),u?.(l.data,n,i,p[y[x]]),c.putImageData(l,0,0),a.toDataURL()))}},this}plotSpecs(){let{type:t,plot:r,data:{numRows:n,columns:i}}=this,o={src:i.src,width:r.innerWidth(),height:r.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:{length:n},options:o}]}},J0=class extends Dl{constructor(t,r){super(t,{bandwidth:20,interpolate:"linear",pixelSize:2,...r})}};function x8(e){let{aggr:t,densityMap:r,groupby:n,plot:i}=e,o=t.includes(Co),s=t.includes("fillOpacity"),a=e.channel("fill"),c=e.channel("fillOpacity");if(t.length>2||o&&s)throw new Error("Invalid raster encodings. Try dropping an aggregate?");if(n.includes(c?.as))throw new Error("Raster fillOpacity must be an aggregate or constant.");let l=r.fill||t.includes("fill")?"grid":n.includes(a?.as)?"group":RI(a?.value)?a.value:o&&i.getAttribute("colorScheme")?"grid":void 0,u=r.fillOpacity||t.includes("fillOpacity")?"grid":typeof c?.value=="number"?c.value:o&&l!=="grid"?"grid":void 0;if(l!=="grid"&&u!=="grid")throw new Error("Raster mark missing density values.");let f=a?.as??(l==="grid"?Co:null),d=c?.as??(u==="grid"?Co:null),h=l!=="grid"&&l!=="group"?IY(l):zct(e,f),p=u!=="grid"?vY(u):$ct(e,d);return{alphaProp:d,colorProp:f,alpha:p,color:h}}function $ct(e,t){let{plot:r,grids:n}=e,i=r.getAttribute("opacityDomain"),o=i===es,s=i?.[Gr],a=!o&&!s&&i||H0(n.columns[t]);(o||s||!i)&&(o||(a[Gr]=!0),r.setAttribute("opacityDomain",a));let c=dl({opacity:{type:r.getAttribute("opacityScale"),domain:a,range:r.getAttribute("opacityRange"),clamp:r.getAttribute("opacityClamp"),nice:r.getAttribute("opacityNice"),reverse:r.getAttribute("opacityReverse"),zero:r.getAttribute("opacityZero"),base:r.getAttribute("opacityBase"),exponent:r.getAttribute("opacityExponent"),constant:r.getAttribute("opacityConstant")}});return SY(c)}function zct(e,t){let{plot:r,grids:n}=e,i=n.columns[t],o=!i[0]?.map,s=o||Array.isArray(i[0]),a=r.getAttribute("colorDomain"),c=a===es,l=a?.[Gr],u=!c&&!l&&a||(o?i.slice().sort(Ft):s?_Y(i):H0(i));(c||l||!a)&&(c||(u[Gr]=!0),r.setAttribute("colorDomain",u));let f=dl({color:{type:r.getAttribute("colorScale"),domain:u,range:r.getAttribute("colorRange"),clamp:r.getAttribute("colorClamp"),n:r.getAttribute("colorN"),nice:r.getAttribute("colorNice"),reverse:r.getAttribute("colorReverse"),scheme:r.getAttribute("colorScheme"),interpolate:r.getAttribute("colorInterpolate"),pivot:r.getAttribute("colorPivot"),symmetric:r.getAttribute("colorSymmetric"),zero:r.getAttribute("colorZero"),base:r.getAttribute("colorBase"),exponent:r.getAttribute("colorExponent"),constant:r.getAttribute("colorConstant")}});if(s)return TY(f);{let d=dl({x:{type:jct(f.type),domain:f.domain,reverse:f.reverse,range:[0,1],clamp:f.clamp,base:f.base,exponent:f.exponent,constant:f.constant}});return AY(1024,f,d.apply)}}function jct(e){return e.endsWith("symlog")?"symlog":e.endsWith("log")?"log":e.endsWith("pow")?"pow":e.endsWith("sqrt")?"sqrt":e==="diverging"?"linear":e}function qct(e,t,r){if(!e.image||e.image.w!==t||e.image.h!==r){let n=kI(t,r),i=n.getContext("2d",{willReadFrequently:!0}),o=i.getImageData(0,0,t,r);e.image={canvas:n,ctx:i,img:o,w:t,h:r}}return e.image}var tx=class extends Dl{constructor(t,r){let{normalize:n=!0,...i}=r;super(t,i),this.normalize=nr(n,o=>(this.normalize=o,this.requestUpdate()))}query(t=[]){let{channels:r,normalize:n,pad:i}=this,[o,s]=this.bins=this.binDimensions(),[a]=Ii(this,"x",o,ks(this,t),i),[c]=Ii(this,"y",s,Bs(this,t),i),l=ft.from(this.sourceTable()).where(Vct(this,t));this.aggr=["density"];let u=this.groupby=[],f=[];for(let d of r)if(Object.hasOwn(d,"field")){let{channel:h,field:p}=d;h==="z"?(l.select({[h]:p}),f.push("z")):h!=="x"&&h!=="y"&&(l.select({[h]:p}),u.push(h))}return zA(l,a,c,f,o,s,u,n)}};function Vct(e,t){if(Array.isArray(t)&&!t.length)return t;let r=e.channelField("x").column,n=e.channelField("y").column,i=s=>{let a=`${s.expr}`;return s.type!=="BETWEEN"||a!==r&&a!==n},o=s=>s.op==="AND"?on(s.clauses.filter(a=>i(a))):s;return Array.isArray(t)?t.filter(s=>i(s)).map(s=>o(s)):o(t)}var op=class extends Ir{constructor(t,r,n){let{bins:i=1024,bandwidth:o=20,...s}=n,a=t.endsWith("X")?"y":"x";super(t,r,s,a==="x"?m8:y8),this.dim=a,this.bins=nr(i,c=>(this.bins=c,this.requestUpdate())),this.bandwidth=nr(o,c=>(this.bandwidth=c,this.grid?this.convolve().update():null))}get filterStable(){let t=this.dim==="x"?"xDomain":"yDomain",r=this.plot.getAttribute(t);return r&&!r[Gr]}query(t=[]){if(this.hasOwnData())throw new Error("Density1DMark requires a data source");let{bins:r,channels:n,dim:i}=this,o=this.extent=(i==="x"?ks:Bs)(this,t),[s,a]=Ii(this,i,r,o),c=G0(n,this.sourceTable(),[i]).where(t.concat(jr(a,o))),l=this.channelField("weight")?"weight":null;return UA(c,s,l)}queryResult(t){let{columns:{index:r,density:n}}=Xn(t);return this.grid=xY(this.bins,r,n),this.convolve()}convolve(){let{bins:t,bandwidth:r,dim:n,grid:i,plot:o,extent:[s,a]}=this,c=i.some(b=>b<0),l=n==="x"?o.innerWidth():o.innerHeight(),u=Q0(r*(t-1)/l,c),f=FI(u,i,t),d=n==="x"?"y":"x",h=this.channelField(n).as,p=+s,m=(a-p)/(t-1),y=1/m,g=new Float64Array(t),x=new Float64Array(t);for(let b=0;b<t;++b)g[b]=p+b*m,x[b]=f[b]*y;return this.data={numRows:t,columns:{[h]:g,[d]:x}},this}plotSpecs(){let{type:t,data:{numRows:r,columns:n},channels:i,dim:o}=this,s=o==="x"?{y:n.y}:{x:n.x};for(let a of i)s[a.channel]=yn(a,n);return[{type:t,data:{length:r},options:s}]}};var ex=class extends ko{constructor(t,r){let{type:n="dot",...i}=r;super(n,t,{bandwidth:20,interpolate:"linear",pad:0,pixelSize:2,...i})}convolve(){super.convolve();let{bins:t,pad:r,extentX:n,extentY:i}=this,[o,s]=t,a=wf(this,"x"),c=wf(this,"y"),[l,u]=n.map(y=>a.apply(y)),[f,d]=i.map(y=>c.apply(y)),h=(u-l)/(o-r),p=(d-f)/(s-r),m=r?0:.5;return this.data=Yct(this.grids,t,l,f,h,p,a.invert,c.invert,m),this}plotSpecs(){let{type:t,channels:r,densityMap:n,data:{numRows:i,columns:o}}=this,s={};for(let a of r){let{channel:c}=a;s[c]=c==="x"||c==="y"?o[c]:yn(a,o)}for(let a in n)n[a]&&(s[a]=o.density);return[{type:t,data:{length:i},options:s}]}};function Yct(e,t,r,n,i,o,s,a,c){let l=1/(i*o),[u,f]=t,d=u*f,h=d*e.numRows,p=new Float64Array(h),m=new Float64Array(h),y=new Float64Array(h),g={x:p,y:m,density:y},{density:x,...b}=e.columns;for(let v in b)g[v]=new b[v].constructor(h);let _=0;for(let v=0;v<e.numRows;++v){for(let T in b)g[T].fill(b[T][v],_,_+d);let w=x[v];for(let T=0,A=0;A<f;++A)for(let E=0;E<u;++E,++_,++T)p[_]=s(r+(E+c)*i),m[_]=a(n+(A+c)*o),y[_]=w[T]*l}return{numRows:h,columns:g}}function Wct(e,t,r){var n=1e-8,i=t-1,o=r-1,s=0,a,c,l,u,f,d,h,p,m,y,g;if(e<=0)return 0;if(e>=1)return 1;for(t>=1&&r>=1?(l=e<.5?e:1-e,u=Math.sqrt(-2*Math.log(l)),h=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,e<.5&&(h=-h),p=(h*h-3)/6,m=2/(1/(2*t-1)+1/(2*r-1)),y=h*Math.sqrt(p+m)/m-(1/(2*r-1)-1/(2*t-1))*(p+5/6-2/(3*m)),h=t/(t+r*Math.exp(2*y))):(a=Math.log(t/(t+r)),c=Math.log(r/(t+r)),u=Math.exp(t*a)/t,f=Math.exp(r*c)/r,y=u+f,e<u/y?h=Math.pow(t*y*e,1/t):h=1-Math.pow(r*y*(1-e),1/r)),g=-sp(t)-sp(r)+sp(t+r);s<10;s++){if(h===0||h===1)return h;if(d=Gct(h,t,r)-e,u=Math.exp(i*Math.log(h)+o*Math.log(1-h)+g),f=d/u,h-=u=f/(1-.5*Math.min(1,f*(i/h-o/(1-h)))),h<=0&&(h=.5*(h+u)),h>=1&&(h=.5*(h+u+1)),Math.abs(u)<n*h&&s>0)break}return h}function Gct(e,t,r){var n=e===0||e===1?0:Math.exp(sp(t+r)-sp(t)-sp(r)+t*Math.log(e)+r*Math.log(1-e));return e<0||e>1?0:e<(t+1)/(t+r+2)?n*EY(e,t,r)/t:1-n*EY(1-e,r,t)/r}function EY(e,t,r){var n=1e-30,i=1,o=t+r,s=t+1,a=t-1,c=1,l=1-o*e/s,u,f,d,h;for(Math.abs(l)<n&&(l=n),l=1/l,h=l;i<=100&&(u=2*i,f=i*(r-i)*e/((a+u)*(t+u)),l=1+f*l,Math.abs(l)<n&&(l=n),c=1+f/c,Math.abs(c)<n&&(c=n),l=1/l,h*=l*c,f=-(t+i)*(o+i)*e/((t+u)*(s+u)),l=1+f*l,Math.abs(l)<n&&(l=n),c=1+f/c,Math.abs(c)<n&&(c=n),l=1/l,d=l*c,h*=d,!(Math.abs(d-1)<3e-7));i++);return h}function sp(e){var t=0,r=[76.18009172947146,-86.5053203294167,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],n=1.000000000190015,i,o,s;for(s=(o=i=e)+5.5,s-=(i+.5)*Math.log(s);t<6;t++)n+=r[t]/++o;return Math.log(2.506628274631*n/i)-s}function MY(e,t){var r=Wct(2*Math.min(e,1-e),.5*t,.5);return r=Math.sqrt(t*(1-r)/r),e>.5?r:-r}function NY(e){let t=-Math.log((1-e)*(1+e)),r;return t<6.25?(t-=3.125,r=-364441206401782e-35,r=-16850591381820166e-35+r*t,r=128584807152564e-32+r*t,r=11157877678025181e-33+r*t,r=-1333171662854621e-31+r*t,r=20972767875968562e-33+r*t,r=6637638134358324e-30+r*t,r=-4054566272975207e-29+r*t,r=-8151934197605472e-29+r*t,r=26335093153082323e-28+r*t,r=-12975133253453532e-27+r*t,r=-5415412054294628e-26+r*t,r=10512122733215323e-25+r*t,r=-4112633980346984e-24+r*t,r=-29070369957882005e-24+r*t,r=42347877827932404e-23+r*t,r=-13654692000834679e-22+r*t,r=-13882523362786469e-21+r*t,r=.00018673420803405714+r*t,r=-.000740702534166267+r*t,r=-.006033670871430149+r*t,r=.24015818242558962+r*t,r=1.6536545626831027+r*t):t<16?(t=Math.sqrt(t)-3.25,r=22137376921775787e-25,r=9075656193888539e-23+r*t,r=-27517406297064545e-23+r*t,r=18239629214389228e-24+r*t,r=15027403968909828e-22+r*t,r=-4013867526981546e-21+r*t,r=29234449089955446e-22+r*t,r=12475304481671779e-21+r*t,r=-47318229009055734e-21+r*t,r=6828485145957318e-20+r*t,r=24031110387097894e-21+r*t,r=-.0003550375203628475+r*t,r=.0009532893797373805+r*t,r=-.0016882755560235047+r*t,r=.002491442096107851+r*t,r=-.003751208507569241+r*t,r=.005370914553590064+r*t,r=1.0052589676941592+r*t,r=3.0838856104922208+r*t):Number.isFinite(t)?(t=Math.sqrt(t)-5,r=-27109920616438573e-27,r=-2555641816996525e-25+r*t,r=15076572693500548e-25+r*t,r=-3789465440126737e-24+r*t,r=761570120807834e-23+r*t,r=-1496002662714924e-23+r*t,r=2914795345090108e-23+r*t,r=-6771199775845234e-23+r*t,r=22900482228026655e-23+r*t,r=-99298272942317e-20+r*t,r=4526062597223154e-21+r*t,r=-1968177810553167e-20+r*t,r=7599527703001776e-20+r*t,r=-.00021503011930044477+r*t,r=-.00013871931833623122+r*t,r=1.0103004648645344+r*t,r=4.849906401408584+r*t):r=1/0,r*e}var ap=class extends Ir{constructor(t,r,n){let i=t.endsWith("X")?"y":"x",{ci:o=.95,...s}=n;super(t,r,s),this.dim=i,this.field=this.channelField(i).field,this.channels=this.channels.filter(a=>a.channel!==i),this.ci=nr(o,a=>(this.ci=a,this.update()))}query(t=[]){let{channels:r,field:n}=this,i=r.concat([{field:Xp(n),as:"__avg__"},{field:se(Zp(n),Hs(Mr(n))),as:"__se__"}]);return G0(i,this.sourceTable()).where(t)}queryResult(t){return this.data=Xn(t),this}plotSpecs(){let{type:t,dim:r,detail:n,data:i,ci:o,channels:s}=this,a=Math.SQRT2*NY(o),{columns:{__avg__:c,__se__:l}}=i,u={[`${r}1`]:c.map((f,d)=>f-a*l[d]),[`${r}2`]:c.map((f,d)=>f+a*l[d])};return p8(t,n,s,i,u)}};var Xct="geom",rx=class extends Ir{constructor(t,r={},n){!DI(t)&&!r?.geometry&&(r.geometry=Jp(Xct)),super("geo",t,r,n)}queryResult(t){super.queryResult(t);let r=this.channelField("geometry")?.as;if(r){let{columns:n}=this.data;typeof n[r][0]=="string"&&(n[r]=n[r].map(i=>JSON.parse(i)))}return this}};var nx=class extends Ir{constructor(t,r){let{type:n="hexagon",binWidth:i=20,...o}=r;super(n,t,{r:i/2,clip:!0,...o},LI),this.binWidth=nr(i,s=>(this.binWidth=s,this.requestUpdate()))}get filterStable(){let t=this.plot.getAttribute("xDomain"),r=this.plot.getAttribute("yDomain");return t&&r&&!t[Gr]&&!r[Gr]}query(t=[]){if(this.hasOwnData())return null;let{plot:r,binWidth:n,channels:i}=this,o,s,a=new Set,c={};for(let N of i)if(N.channel!=="orderby"){if(N.channel==="x")o=N;else if(N.channel==="y")s=N;else if(Object.hasOwn(N,"field")){let{as:I,field:R}=N;c[I]=R,ni(R)||a.add(I)}}let[l,u]=ks(this,t),[f,d]=Bs(this,t),h=.5-r.getAttribute("marginLeft"),p=0-r.getAttribute("marginTop"),m=Ge(n),y=Ge(n*(1.5/Math.sqrt(3))),g=Ge(r.innerWidth()/(u-l)),x=Ge(r.innerHeight()/(d-f)),b="_x",_="_y",v="_px",w="_py",T="_pi",A="_pj",E="_tt";return ft.select({[o.as]:te(Ge(l),se(te(Nt(te(b,Nt(.5,Kp(_,1))),m),h),g)),[s.as]:It(Ge(d),se(te(Nt(_,y),p),x)),...c}).groupby(b,_,...a).from(ft.select({[w]:se(Nt(x,It(It(d,s.field),p)),y),[A]:ve(Qs(w)),[v]:It(se(It(Nt(g,It(o.field,l)),h),m),Nt(.5,Kp(A,1))),[T]:ve(Qs(v)),[E]:on(Di(Nt(Nr(It(w,A)),3),1),Di(te(ir(It(v,T),2),ir(It(w,A),2)),te(ir(It(It(v,T),Nt(.5,Xs(ze(v,T),-1,1))),2),ir(It(It(w,A),Xs(ze(w,A),-1,1)),2)))),[b]:Xs(E,ve(te(te(T,Xs(ze(v,T),-.5,.5)),Xs(so(Kp(A,1),0),.5,-.5))),T),[_]:Xs(E,ve(te(A,Xs(ze(w,A),-1,1))),A)},"*").from(this.sourceTable()).where(Ri(o.field),Ri(s.field),t))}};var ix=class extends ko{constructor(t,r){let{origin:n=[0,0],dim:i="xy",...o}=r;super("image",t,o),this.image=null,this.origin=n,this.tileX=i.toLowerCase().includes("x"),this.tileY=i.toLowerCase().includes("y")}setPlot(t,r){let n=()=>{this.hasFieldInfo()&&this.rasterize()};t.addAttributeListener("schemeColor",n),super.setPlot(t,r)}requestQuery(){return this.requestTiles()}query(t=[]){return this._filter=t,null}tileQuery(t){let{interpolate:r,pad:n,channels:i,densityMap:o}=this,[[s,a],[c,l]]=t,[u,f]=this.bins,[d,h]=Ii(this,"x",u,[s,a],n),[p,m]=Ii(this,"y",f,[c,l],n),y=n?[jr(h,[+s,+a]),jr(m,[+c,+l])]:[ri(+s,h),ze(h,+a),ri(+c,m),ze(m,+l)],g=ft.from(this.sourceTable()).where(y),x=this.groupby=[],b={};for(let v of i)if(Object.hasOwn(v,"field")){let{as:w,channel:T,field:A}=v;A.aggregate?(b[T]=A,o[T]=!0):T==="weight"?b.density=de(A):T!=="x"&&T!=="y"&&(g.select({[w]:A}),x.push(w))}let _=this.aggr=Object.keys(b);if(b.density&&_.length>1)throw new Error("Weight option can not be used with custom aggregates.");if(_.length||(_.push("density"),b.density=Mr()),r==="linear"){if(_.length>1)throw new Error("Linear binning not applicable to multiple aggregates.");if(!b.density)throw new Error("Linear binning not applicable to custom aggregates.");return Jct(g,d,p,b.density,u,x)}else return Kct(g,d,p,b,u,x)}async requestTiles(){let t=Li();this.prefetch&&t.cancel(this.prefetch);let{pad:r,tileX:n,tileY:i,origin:[o,s]}=this,[a,c]=this.bins=this.binDimensions(),[l,u]=ks(this,this._filter),[f,d]=Bs(this,this._filter),h=u-l,p=d-f,m=Math.floor((l-o)*(a-r)/h),y=Math.floor((f-s)*(c-r)/p),g=(I,R)=>[[o+I*h,o+(I+1)*h],[s+R*p,s+(R+1)*p]],x=Math.floor((l-o)/h),b=n?OY((u-o)/h):x,_=Math.floor((f-s)/p),v=i?OY((d-s)/p):_,w=[];for(let I=x;I<=b;++I)for(let R=_;R<=v;++R)w.push([I,R]);let T=w.map(([I,R])=>t.query(this.tileQuery(g(I,R)))),A=[];if(n)for(let I=_;I<=v;++I)A.push([b+1,I]),A.push([x-1,I]);if(i){let I=n?x-1:x,R=n?b+1:b;for(let C=I;C<=R;++C)A.push([C,v+1]),A.push([C,_-1])}this.prefetch=A.map(([I,R])=>t.prefetch(this.tileQuery(g(I,R))));let E=await Promise.all(T),N=Hct(a,c,m,y,w,E);this.grids0={numRows:N.length,columns:{density:[N]}},this.convolve().update()}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:t,grids:r}=this,[n,i]=t,{numRows:o,columns:s}=r,{canvas:a,ctx:c,img:l}=Zct(this,n,i),{alpha:u,alphaProp:f,color:d,colorProp:h}=x8(this),p=s[f]??[],m=s[h]??[],y=o>1&&h&&this.groupby?.includes(h)?CI(m,this.plot.getAttribute("colorDomain")):K0(o);return this.data={numRows:o,columns:{src:Array.from({length:o},(g,x)=>(d?.(l.data,n,i,m[y[x]]),u?.(l.data,n,i,p[y[x]]),c.putImageData(l,0,0),a.toDataURL()))}},this}plotSpecs(){let{type:t,plot:r,data:{numRows:n,columns:i}}=this,o={src:i.src,width:r.innerWidth(),height:r.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:{length:n},options:o}]}};function Hct(e,t,r,n,i,o){let s=new Float64Array(e*t);return o.forEach((a,c)=>{let[l,u]=i[c],f=l*e-r,d=u*t-n;Qct(e,t,s,a,f,d)}),s}function Qct(e,t,r,n,i,o){let s=n.numRows;if(s===0)return;let a=n.getChild("index").toArray(),c=n.getChild("density").toArray();for(let l=0;l<s;++l){let u=a[l],f=i+u%e,d=o+Math.floor(u/e);0<=f&&f<e&&0<=d&&d<t&&(r[f+d*e]=c[l])}}function Zct(e,t,r){if(!e.image||e.image.w!==t||e.image.h!==r){let n=kI(t,r),i=n.getContext("2d",{willReadFrequently:!0}),o=i.getImageData(0,0,t,r);e.image={canvas:n,ctx:i,img:o,w:t,h:r}}return e.image}function Kct(e,t,r,n,i,o){return e.select({index:tr`FLOOR(${t})::INTEGER + FLOOR(${r})::INTEGER * ${i}`,...n}).groupby("index",o)}function Jct(e,t,r,n,i,o){let s=n.column?`* ${n.column}`:"",a=(d,h)=>e.clone().select({xp:t,yp:r,i:d,w:h}),c=a(tr`FLOOR(xp)::INTEGER + FLOOR(yp)::INTEGER * ${i}`,tr`(FLOOR(xp)::INTEGER + 1 - xp) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),l=a(tr`FLOOR(xp)::INTEGER + (FLOOR(yp)::INTEGER + 1) * ${i}`,tr`(FLOOR(xp)::INTEGER + 1 - xp) * (yp - FLOOR(yp)::INTEGER)${s}`),u=a(tr`FLOOR(xp)::INTEGER + 1 + FLOOR(yp)::INTEGER * ${i}`,tr`(xp - FLOOR(xp)::INTEGER) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),f=a(tr`FLOOR(xp)::INTEGER + 1 + (FLOOR(yp)::INTEGER + 1) * ${i}`,tr`(xp - FLOOR(xp)::INTEGER) * (yp - FLOOR(yp)::INTEGER)${s}`);return ft.from(ft.unionAll(c,l,u,f)).select({index:"i",density:de("w")},o).groupby("index",o).having(so("density",0))}function OY(e){let t=Math.floor(e);return t===e?t-1:t}var ox=class extends Ir{constructor(t,r){let{ci:n=.95,precision:i=4,...o}=r;super("line",t,o);let s=()=>this.modelFit?this.confidenceBand().update():null;this.ci=nr(n,a=>(this.ci=a,s())),this.precision=nr(i,a=>(this.precision=a,s()))}query(t=[]){let r=this.channelField("x").as,n=this.channelField("y").as,i=Array.from(new Set(["stroke","z","fx","fy"].flatMap(o=>this.channelField(o)?.as||[])));return ft.from(super.query(t)).select({intercept:UT(n,r),slope:jT(n,r),n:Qp(n,r),ssy:zT(n,r),ssx:$T(n,r),xm:Hp(n,r),x0:Ge(zn(r).where(Ri(n))),x1:Ge(zr(r).where(Ri(n)))}).select(i).groupby(i)}queryResult(t){return this.modelFit=Xn(t),this.lineData=tlt(this.modelFit),this.confidenceBand()}confidenceBand(){let{ci:t,modelFit:r,precision:n,plot:i}=this,o=i.innerWidth();return this.areaData=t?elt(r,t,n,o):null,this}plotSpecs(){let{lineData:t,areaData:r,channels:n,ci:i}=this,o=t.columns,s=i?r.columns:{},a={x:o.x,y:o.y},c={x:s.x,y1:s.y1,y2:s.y2,fillOpacity:.1};for(let l of n)switch(l.channel){case"x":case"y":case"fill":break;case"tip":c.tip=yn(l,s);break;case"stroke":a.stroke=yn(l,o),c.fill=yn(l,s);break;case"strokeOpacity":a.strokeOpacity=yn(l,o);break;case"fillOpacity":c.fillOpacity=yn(l,s);break;default:a[l.channel]=yn(l,o),c[l.channel]=yn(l,s);break}return[...i?[{type:"areaY",data:{length:r.numRows},options:c}]:[],{type:"line",data:{length:t.numRows},options:a}]}};function b8(e,t){if(e.concat)return e.concat(t);let r=new e.constructor(e.length+t.length);return r.set(e,0),r.set(t,e.length),r}function tlt(e){let{x0:t=[],x1:r=[],xm:n,intercept:i,slope:o,n:s,ssx:a,ssy:c,...l}=e.columns,u=(h,p)=>i[p]+h*o[p],f=b8(t,r),d=b8(t.map(u),r.map(u));for(let h in l)l[h]=b8(l[h],l[h]);return{numRows:f.length,columns:{x:f,y:d,...l}}}function elt(e,t,r,n){let i=e.numRows,{x0:o,x1:s,xm:a,intercept:c,slope:l,n:u,ssx:f,ssy:d,...h}=e.columns,p=Object.keys(h),m={x:[],y1:[],y2:[]};p.forEach(y=>m[y]=[]);for(let y=0;y<i;++y){let g=r*(s[y]-o[y])/n,x=MY((1-t)/2,u[y]-2)*Math.sqrt(d[y]/(u[y]-2));er(o[y],s[y]-g/2,g).concat(s[y]).forEach(b=>{let _=c[y]+b*l[y],v=x*Math.sqrt(1/u[y]+(b-a[y])**2/f[y]);m.x.push(b),m.y1.push(_-v),m.y2.push(_+v),p.forEach(w=>m[w].push(h[w][y]))})}return{numRows:m.x.length,columns:m}}function cp(e){e.tagName==="a"&&(e=e.children[0]);let t=e.__data__;return Array.isArray(t)?t[0]:t}function RY(e){let t=e.toLowerCase(),r=e.length,n="";for(let i=0;i<r;++i)n+=(e[i]!==t[i]?"-":"")+t[i];return n}function Ll(e){let t={};for(let r in e)t[RY(r)]=e[r];return t}function rlt(e){let{channels:t}=e,r=new Set,n=!1,i=!1;for(let o of t){let{channel:s,field:a,as:c}=o;if(s==="orderby")n=!0;else if(a)if(ni(a))i=!0;else{if(r.has(c))continue;r.add(c)}}return!n&&i&&r.size&&e.channels.push({channel:"orderby",value:Array.from(r)}),e}var sx=class{constructor(t,{selection:r,channels:n={}}){this.mark=rlt(t),this.selection=r;let i=Object.entries(Ll(n));this.channels=i.length?i:[["opacity",.2]],this.selection.addEventListener("value",fp(()=>this.update()))}init(t){this.svg=t;let r=this.values=[],i=`g[data-index="${this.mark.index}"]`,o=`${i} > *:not(g), ${i} > g > *`,s=this.nodes=t.querySelectorAll(o),{channels:a}=this;for(let c=0;c<s.length;++c){let l=s[c];r.push(a.map(u=>l.getAttribute(u[0])))}return this.update()}async update(){let{svg:t,nodes:r,channels:n,values:i,mark:o,selection:s}=this;if(!t)return;let a=await nlt(o,s);for(let c=0;c<r.length;++c){let l=r[c],u=i[c],f=a(cp(l));for(let d=0;d<n.length;++d){let[h,p]=n[d];l.setAttribute(h,f?u[d]:p)}}}};async function nlt(e,t){let r=t?.predicate(e);if(!r||r.length===0)return()=>!0;let n=e.filterBy?.predicate(e,!0),i={__:on(r)},o=e.query(n);(o.queries||[o]).forEach(c=>{c._groupby.length?c.select(i):c.setSelect(i)});let s=await e.coordinator.query(o),a=s.getChild?.("__");return s.numRows||s.length?a?c=>a.at(c):c=>s[c].__:()=>!1}function BI(){let e=this,t=e.getScreenCTM,r;e.getScreenCTM=()=>e.isConnected?r=t.call(e):r}function _8(e){let t=e.on,r=!0;function n(i){r=!1,i(),r=!0}return e.reset=(...i)=>{n(()=>e.clear(...i))},e.moveSilent=(...i)=>{n(()=>e.move(...i))},e.on=(...i)=>{if(i.length>1&&i[1]){let o=i[1];i[1]=(...s)=>r&&o(...s)}return t(...i)},e}function PI(){return _8(VM())}function DY(){return _8(jM())}function LY(){return _8(qM())}function UI(e,t,r,n,i){let o=Qt(t??e).append("g").attr("class",i),s=e.scale("fx"),a=e.scale("fy");if(s||a){let c=s?.domain.map(u=>s.apply(u)-r),l=a?.domain.map(u=>a.apply(u)-n);if(c&&l)for(let u=0;u<c.length;++u)for(let f=0;f<l.length;++f)o.append("g").attr("transform",`translate(${c[u]}, ${l[f]})`);else if(c)for(let u=0;u<c.length;++u)o.append("g").attr("transform",`translate(${c[u]}, 0})`);else if(l)for(let u=0;u<l.length;++u)o.append("g").attr("transform",`translate(0, ${l[u]})`);o=o.selectAll("g")}return o.each(BI)}function ax(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 FY(e){if(nn(e)){if(e.type==="COLUMN_REF")return e.column;if(e.type==="AGGREGATE")return e.args[0]??e}return e}function Ps(e,t){return FY(e.channelField(t)?.field)}function CY(e,t){let r=[],n=[];return t.forEach(i=>{let o=i==="color"?["color","fill","stroke"]:i==="x"?["x","x1","x2"]:i==="y"?["y","y1","y2"]:[i];for(let s=0;s<o.length;++s){let a=e.channelField(o[s],{exact:!0});if(a){r.push(FY(a.field)),n.push(a.as);return}}throw new Error(`Missing channel: ${i}`)}),{fields:r,as:n}}function cx(e,t,r=1){return t.invert(r*Math.floor(e/r))}var Fl=class{constructor(t,{channel:r,selection:n,field:i=void 0,pixelSize:o=1,peers:s=!0,brush:a}){this.mark=t,this.channel=r,this.pixelSize=o||1,this.selection=n,this.peers=s,this.field=i||Ps(t,r),this.style=a&&Ll(a),this.brush=r==="y"?LY():DY(),this.brush.on("brush end",({selection:c})=>this.publish(c))}reset(){this.value=void 0,this.g&&this.brush.reset(this.g)}activate(){this.selection.activate(this.clause(this.value||[0,1]))}publish(t){let r;t&&(r=t.map(n=>cx(n,this.scale,this.pixelSize)).sort((n,i)=>n-i)),ax(r,this.value)||(this.value=r,this.g.call(this.brush.moveSilent,t),this.selection.update(this.clause(r)))}clause(t){let{mark:r,pixelSize:n,field:i,scale:o}=this;return _u(i,t,{source:this,clients:this.peers?r.plot.markSet:new Set().add(r),scale:o,pixelSize:n})}init(t,r){let{brush:n,channel:i,style:o}=this;this.scale=t.scale(i);let s=this.value?.map(this.scale.apply).sort(Ft),a=t.scale("x").range,c=t.scale("y").range;if(n.extent([[Ht(a),Ht(c)],[Kt(a),Kt(c)]]),this.g=UI(t,r,Ht(a),Ht(c),`interval-${i}`).call(n).call(n.moveSilent,s),o){let l=this.g.selectAll("rect.selection");for(let u in o)l.attr(u,o[u])}t.addEventListener("pointerenter",l=>{l.buttons||this.activate()})}};var lx=class{constructor(t,{selection:r,xfield:n,yfield:i,pixelSize:o=1,peers:s=!0,brush:a}){this.mark=t,this.pixelSize=o||1,this.selection=r,this.peers=s,this.xfield=n||Ps(t,"x"),this.yfield=i||Ps(t,"y"),this.style=a&&Ll(a),this.brush=PI(),this.brush.on("brush end",({selection:c})=>this.publish(c))}reset(){this.value=void 0,this.g&&this.brush.reset(this.g)}activate(){this.selection.activate(this.clause(this.value||[[0,1],[0,1]]))}publish(t){let{value:r,pixelSize:n,xscale:i,yscale:o}=this,s,a;if(t){let[c,l]=t;s=[c[0],l[0]].map(u=>cx(u,i,n)).sort(Ft),a=[c[1],l[1]].map(u=>cx(u,o,n)).sort(Ft)}(!ax(s,r?.[0])||!ax(a,r?.[1]))&&(this.value=t?[s,a]:void 0,this.g.call(this.brush.moveSilent,t),this.selection.update(this.clause(this.value)))}clause(t){let{mark:r,pixelSize:n,xfield:i,yfield:o,xscale:s,yscale:a}=this;return nM([i,o],t,{source:this,clients:this.peers?r.plot.markSet:new Set().add(r),scales:[s,a],pixelSize:n})}init(t){let{brush:r,style:n,value:i}=this,o=this.xscale=t.scale("x"),s=this.yscale=t.scale("y"),a=o.range,c=s.range;if(r.extent([[Ht(a),Ht(c)],[Kt(a),Kt(c)]]),this.g=UI(t,null,Ht(a),Ht(c),"interval-xy").call(r),n){let l=this.g.selectAll("rect.selection");for(let u in n)l.attr(u,n[u])}if(i){let[l,u]=i[0].map(o.apply).sort(Ft),[f,d]=i[1].map(s.apply).sort(Ft);this.g.call(r.moveSilent,[[l,f],[u,d]])}t.addEventListener("pointerenter",l=>{l.buttons||this.activate()})}};var vf=class{constructor(t,{selection:r,pointer:n,channels:i,fields:o,maxRadius:s=40}){this.mark=t,this.selection=r,this.clients=new Set().add(t),this.pointer=n,this.channels=i||(n==="x"?["x"]:n==="y"?["y"]:["x","y"]),this.fields=o||this.channels.map(a=>Ps(t,[a])),this.maxRadius=s,this.valueIndex=-1}clause(t){let{clients:r,fields:n}=this,i={source:this,clients:r};return n.length>1?Sa(n,t&&[t],i):bu(n[0],t?.[0],i)}init(t){let r=this,{mark:n,channels:i,selection:o,maxRadius:s}=this,{data:{columns:a}}=n,c=i.map(m=>n.channelField(m).as),l=!ii(o),[u,f]=ilt(t,n),d=this.pointer==="y"?.01:1,h=this.pointer==="x"?.01:1,p=Qt(t);p.on("pointerenter pointerdown pointermove",function(m){let[y,g]=an(m,this),x=olt(u,f,y,g,d,h,s);if(x!==this.valueIndex){this.valueIndex=x;let b=x<0?void 0:c.map(_=>a[_][x]);o.update(l?!b||b.length>1?b:b[0]:r.clause(b))}}),!l&&(p.on("pointerleave",()=>{o.update(r.clause(void 0))}),t.addEventListener("pointerenter",m=>{if(!m.buttons){let y=this.channels.map(()=>0);o.activate(this.clause(y))}}))}};function ilt(e,t){let{data:{columns:r}}=t,n=f=>r[t.channelField(f)?.as],i=f=>e.scale(f),o=e.scale("x"),s=e.scale("y"),a=i("fx")?.apply,c=i("fy")?.apply,l=Array.from(n("x"),o.apply),u=Array.from(n("y"),s.apply);if(a){let f=Ht(o.range),d=n("fx");for(let h=0;h<d.length;++h)l[h]+=a(d[h])-f}if(c){let f=Ht(s.range),d=n("fy");for(let h=0;h<d.length;++h)u[h]+=c(d[h])-f}return[l,u]}function olt(e,t,r,n,i,o,s){let a=s*s,c=-1;for(let l=0;l<e.length;++l){let u=i*(e[l]-r),f=o*(t[l]-n),d=u*u+f*f;d<=a&&(a=d,c=l)}return c}var kY=(e,t)=>e-t,ux=class{constructor(t,{x:r=new qo,y:n=new qo,xfield:i,yfield:o,zoom:s=!0,panx:a=!0,pany:c=!0}){this.mark=t,this.xsel=r,this.ysel=n,this.xfield=i||Ps(t,"x"),this.yfield=o||Ps(t,"y"),this.zoom=w8(s,[0,1/0],[1,1]),this.panx=this.xsel&&a,this.pany=this.ysel&&c;let{plot:l}=t;a&&this.xsel.addEventListener("value",u=>{l.setAttribute("xDomain",u)&&l.update()}),c&&this.ysel.addEventListener("value",u=>{l.setAttribute("yDomain",u)&&l.update()})}publish(t){if(this.panx){let r=slt(t,this.xscale);this.xsel.update(this.clause(r,this.xfield,this.xscale))}if(this.pany){let r=alt(t,this.yscale);this.ysel.update(this.clause(r,this.yfield,this.yscale))}}clause(t,r,n){return _u(r,t,{source:this,clients:this.mark.plot.markSet,scale:n})}init(t){if(this.svg=t,this.initialized)return;this.initialized=!0;let{panx:r,pany:n,mark:{plot:{element:i}},xsel:o,ysel:s}=this;this.xscale=t.scale("x"),this.yscale=t.scale("y");let a=this.xscale.range.slice().sort(kY),c=this.yscale.range.slice().sort(kY),l=w8(r,[-1/0,1/0],a),u=w8(n,[-1/0,1/0],c),f=a4().extent([[a[0],c[0]],[a[1],c[1]]]).scaleExtent(this.zoom).translateExtent([[l[0],u[0]],[l[1],u[1]]]).on("start",()=>{this.xscale=this.svg.scale("x"),this.yscale=this.svg.scale("y")}).on("end",()=>i.__zoom=new gi(1,0,0)).on("zoom",({transform:d})=>this.publish(d));if(Qt(i).call(f),r||n){let d=!1;i.addEventListener("pointerenter",h=>{if(!d&&(d=!0,!h.buttons)){if(r){let{xscale:p,xfield:m}=this;o.activate(this.clause(p.domain,m,p))}if(n){let{yscale:p,yfield:m}=this;s.activate(this.clause(p.domain,m,p))}}}),i.addEventListener("pointerleave",()=>d=!1)}}};function w8(e,t,r){return e?Array.isArray(e)?e:t:r}function slt(e,t){return t.range.map(e.invertX,e).map(t.invert,t)}function alt(e,t){return t.range.map(e.invertY,e).map(t.invert,t)}var clt={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},llt=/[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi,ult=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,flt=/^((\s+,?\s*)|(,\s*))/,dlt=/^[01]/,BY=e=>`Invalid SVG path, incorrect parameter ${e}`;function PY(e){let t=[];return(e.match(llt)||[]).forEach(n=>{let i=n[0],o=i.toLowerCase(),s=clt[o],a=hlt(o,s,n.slice(1).trim()),c=a.length;if(c<s||c&&c%s!==0)throw new Error(BY("count"));if(t.push([i,...a.slice(0,s)]),c!==s){o==="m"&&(i=i==="M"?"L":"l");for(let l=s;l<c;l+=s)t.push([i,...a.slice(l,l+s)])}}),t}function hlt(e,t,r){let n=[];for(let i=0;t&&i<r.length;)for(let o=0;o<t;++o){let s=e==="a"&&(o===3||o===4)?dlt:ult,a=r.slice(i).match(s);if(a===null)throw new Error(BY("type"));i+=a[0].length,n.push(+a[0]);let c=r.slice(i).match(flt);c!==null&&(i+=c[0].length)}return n}function qY(e,t,r){let{x:n,y:i}=e.getBoundingClientRect(),o=e.createSVGMatrix(),s=[];for(let a of t.children)if(a.tagName==="g"){let c=VY(a)??o;for(let l of a.children)UY(r,n,i,l,c)&&s.push(l)}else UY(r,n,i,a,o)&&s.push(a);return s}function UY(e,t,r,n,i){let[[o,s],[a,c]]=e,{e:l,f:u}=i,f=n.getBoundingClientRect(),d=f.left-t,h=f.right-t,p=f.top-r,m=f.bottom-r;if(d>=o&&h<=a&&p>=s&&m<=c)return!0;if(d<=a&&h>=o&&p<=c&&m>=s){let y=n.tagName;if(y==="a"&&(n=n.children[0],y=n.tagName),y==="rect"||y==="text"||y==="image")return!0;switch(o-=l,s-=u,a-=l,c-=u,y){case"circle":return YY(o,s,a,c,Sf(n.cx),Sf(n.cy),Sf(n.r));case"line":return WY(o,s,a,c,Sf(n.x1),Sf(n.y1),Sf(n.x2),Sf(n.y2));case"path":return plt(o,s,a,c,n)}}return!1}function Sf(e){return e.baseVal.value}function VY(e){let t=e.transform.baseVal,r=t.length,n=t[0]?.matrix;for(let i=1;i<r;++i)n=n.multiply(t[i].matrix);return n}function YY(e,t,r,n,i,o,s){let a=e<=i&&i<=r,c=t<=o&&o<=n;if(a&&c)return!0;let l=Math.min(Math.abs(e-i),Math.abs(r-i));if(c&&l<=s)return!0;let u=Math.min(Math.abs(t-o),Math.abs(n-o));return a&&u<=s||l*l+u*u<=s*s}function WY(e,t,r,n,i,o,s,a){let c=Math.max(Math.min(i,s),e),l=Math.min(Math.max(i,s),r);if(c>l)return!1;let u=o,f=a,d=s-i;if(Math.abs(d)>1e-8){let m=(a-o)/d,y=o-m*i;u=m*c+y,f=m*l+y}let h=Math.max(Math.min(u,f),t),p=Math.min(Math.max(u,f),n);return h<=p}function plt(e,t,r,n,i){let o=i.__path__||(i.__path__=PY(i.getAttribute("d"))),s=0,a=0,c=0,l=0,u=!1,f=[0,0],d=2,h=VY(i),p=(x,b)=>{f.length=d=2,f[0]=c=s=x,f[1]=l=a=b},m=h?(x,b)=>p($Y(h,x,b),zY(h,x,b)):(x,b)=>p(x,b),y=(x,b)=>(f[d]=x,f[d+1]=b,d+=2,WY(e,t,r,n,f[d-4],f[d-3],x,b)),g=h?(x,b)=>{u=y($Y(h,c=x,l=b),zY(h,x,b))}:(x,b)=>{u=y(c=x,l=b)};for(let x=0;x<o.length;++x){let b=o[x];switch(b[0]){case"M":m(b[1],b[2]);break;case"m":m(c+b[1],l+b[2]);break;case"L":case"T":g(b[1],b[2]);break;case"H":g(b[1],l);break;case"V":g(c,b[1]);break;case"l":case"t":g(c+b[1],l+b[2]);break;case"h":g(c+b[1],l);break;case"v":g(c,l+b[1]);break;case"C":g(b[5],b[6]);break;case"c":g(c+b[5],l+b[6]);break;case"S":case"Q":g(b[3],b[4]);break;case"s":case"q":g(c+b[3],l+b[4]);break;case"A":g(b[6],b[7]);break;case"a":if(mlt(o,x))return YY(e,t,r,n,c,l-b[2],b[2]);g(c+b[6],c+b[7]);break;case"z":case"Z":if(g(s,a),ylt(e,t,f)>0)return!0;m(s,a);break;default:return console.warn("SVG path command not supported: ",b[0]),!1}if(u)return!0}return!1}function $Y(e,t,r){return e.a*t+e.c*r+e.e}function zY(e,t,r){return e.b*t+e.d*r+e.f}function mlt(e,t){let r=e[t],n=e[t+1];return n&&n[0]==="a"&&e[t+2]?.[0]==="z"&&r[1]===r[2]&&n[1]===n[2]&&r[1]===n[1]&&r[7]===-n[7]}function ylt(e,t,r){let n=0,i=r.length-2;for(let o=0;o<i;o+=2)r[o+1]<=t?r[o+3]>t&&jY(e,t,r,o)>0&&++n:r[o+3]<=t&&jY(e,t,r[o])<0&&--n;return n}function jY(e,t,r,n){return(r[n+2]-r[n])*(t-r[n+1])-(e-r[n])*(r[n+3]-r[n+1])}function $I(e,t){return e==null||t==null?e!=null||t!=null:e.length!==t.length||e.some((r,n)=>zI(r,t[n]))}function zI(e,t){let r=e.length;if(t.length!==r)return!0;for(let n=0;n<r;++n)if(e[n]!==t[n])return!0;return!1}var fx=class{constructor(t,{channels:r,selection:n,peers:i=!0,brush:o={fill:"none",stroke:"currentColor",strokeDasharray:"1,1"}}){this.mark=t,this.selection=n,this.peers=i,this.style=o&&Ll(o),this.brush=PI(),this.brush.on("brush end",c=>this.publish(c.selection)),this.extent=null,this.groups=null;let{fields:s,as:a}=CY(t,r);this.fields=s,this.as=a}reset(){this.value=void 0,this.extent=null,this.g&&this.brush.reset(this.g)}activate(){this.selection.activate(this.clause([this.fields.map(()=>0)]))}clause(t){let{fields:r,mark:n}=this;return Sa(r,t,{source:this,clients:this.peers?n.plot.markSet:new Set().add(n)})}publish(t){let{as:r,group:n,mark:i,svg:o}=this,s;if(t){let{data:{columns:a={}}={}}=i,c=new Map;qY(o,n,t).forEach(l=>{let u=cp(l),f=r.map(d=>a[d][u]);c.set(f.join("|"),f)}),s=Array.from(c.values())}this.extent=t,$I(s,this.value)&&(this.value=s,this.selection.update(this.clause(s)))}init(t){let{brush:r,extent:n,mark:i,style:o}=this;this.svg=t;let s=t.width.baseVal.value,a=t.height.baseVal.value;if(r.extent([[0,0],[s,a]]),this.group=t.querySelector(`[data-index="${i.index}"]`),this.g=Qt(t).append("g").attr("class","region-xy").each(BI).call(r).call(r.moveSilent,n),o){let c=this.g.selectAll("rect.selection");for(let l in o)c.attr(l,o[l])}t.addEventListener("pointerenter",c=>{c.buttons||this.activate()})}};var If=class{constructor(t,{selection:r,channels:n,peers:i=!0}){this.value=null,this.mark=t,this.selection=r,this.peers=i;let o=this.fields=[],s=this.as=[];n.forEach(a=>{let c=a==="color"?["color","fill","stroke"]:a==="x"?["x","x1","x2"]:a==="y"?["y","y1","y2"]:[a];for(let l=0;l<c.length;++l){let u=t.channelField(c[l],{exact:!0});if(u){o.push(u.field?.basis||u.field),s.push(u.as);return}}throw new Error(`Missing channel: ${a}`)})}clause(t){let{fields:r,mark:n}=this;return Sa(r,t,{source:this,clients:this.peers?n.plot.markSet:new Set().add(n)})}init(t,r,n){let{mark:i,as:o,selection:s}=this,{data:{columns:a={}}={}}=i;n??=l=>o.map(u=>a[u][cp(l)]),r??=`[data-index="${i.index}"]`;let c=Array.from(t.querySelectorAll(r));t.addEventListener("pointerdown",l=>{let u=s.single?s.value:this.value,f=l.target,d=null;if(glt(c,f)){let h=n(f);(l.shiftKey||l.metaKey)&&u?.length?(d=u.filter(p=>zI(p,h)),d.length===u.length&&d.push(h)):u?.length===1&&!zI(u[0],h)?d=null:d=[h]}this.value=d,$I(u,d)&&s.update(this.clause(d))}),t.addEventListener("pointerenter",l=>{l.buttons||this.selection.activate(this.clause([this.fields.map(()=>0)]))})}};function glt(e,t){return e.some(r=>r.contains(t))}var XY=":scope > div, :scope > span",jI="swatch",GY="ramp",lp=class{constructor(t,r){let{as:n,field:i,...o}=r;this.channel=t,this.options=o,this.type=null,this.handler=null,this.selection=n,this.field=i,this.legend=null,this.element=document.createElement("div"),this.element.setAttribute("class","legend"),Object.defineProperty(this.element,"value",{value:this})}setPlot(t){this.plot=t}init(t){let r=xlt(this,t);return this.element.replaceChildren(r),this.element}update(){if(!this.legend)return;let{selection:t,handler:r}=this,{single:n,value:i}=t,o=n?i:t.valueFor(r),s=o&&o.length?new Set(o.map(c=>c[0])):null,a=this.legend.querySelectorAll(XY);for(let c of a){let l=s?s.has(c.__data__):!0;c.style.opacity=l?1:.2}}};function xlt(e,t){let{channel:r,plot:n,selection:i}=e,o=t.scale(r),s=o.type==="ordinal"?jI:GY,a={label:n.getAttribute(`${r}Label`)??null,...e.options},c=s===jI?a:a.label?{tickSize:2,...a}:{tickSize:2,marginTop:1,height:29,...a},l=t.legend(r,c);e.legend=l;let u=!!i;if(u&&s===GY){let f=c.width??240,d=vlt(o,f);d?l.scale=function(h){return h==="x"?{range:[0,f]}:h==="y"?{range:[-10,0]}:h===r?d:void 0}:u=!1}if(u){let f=blt(e,s);s===jI?(f.init(l,XY,d=>[d.__data__]),e.update()):f.init(l,l.querySelector("g:last-of-type"))}return l}function blt(e,t){let{channel:r,handler:n,selection:i}=e;if(n)return n;let o=_lt(e);return t===jI?(e.handler=new If(o,{selection:i,channels:[r],peers:!1}),i.addEventListener("value",()=>e.update())):e.handler=new Fl(o,{selection:i,channel:r,brush:{fill:"none",stroke:"currentColor"},peers:!1}),e.handler}function _lt(e){let{channel:t,plot:r}=e,n=e.field??wlt(r.marks,t)??"value";if(n){let i={field:n};return{plot:r,channelField:o=>t===o?i:void 0}}}function wlt(e,t){let r=t==="color"?["fill","stroke"]:t==="opacity"?["opacity","fillOpacity","strokeOpacity"]:null;if(r==null)return null;for(let n=e.length-1;n>-1;--n)for(let i of r){let o=e[n].channelField(i,{exact:!0});if(o)return o.field}return null}function vlt(e,t){let{apply:r,invert:n,interpolate:i,...o}=e,s=e.type;s.startsWith("diverging-")&&(s=s.slice(11));let a;switch(s){case"log":case"pow":case"sqrt":case"symlog":a=s;break;case"threshold":case"quantize":case"quantile":return console.warn(`Legends do not yet support ${s} scales.`),null;default:a="linear"}return dl({x:{...o,type:a,range:[0,t]}})}function qI(e,t,r=0,n=Math.LN10){let i,o=Math.ceil(Math.log(t)/n),s=Math.max(r,Math.pow(10,Math.round(Math.log(e)/n)-o));for(;Math.ceil(e/s)>t;)s*=10;let a=[5,2];for(let c=0,l=a.length;c<l;++c)i=s/a[c],i>=r&&e/i<=t&&(s=i);return s}function HY(e,t,r){let{step:n,steps:i,minstep:o=0,nice:s=!0}=r;if(s!==!1){let a=t-e,c=Math.LN10;n=n||qI(a,i||25,o,c);let l=Math.log(n),u=l>=0?0:~~(-l/c)+1,f=Math.pow(10,-u-1);l=Math.floor(e/n+f)*n,e=e<l?l-n:l,t=Math.ceil(t/n)*n,i=Math.round((t-e)/n)}return{min:e,max:t,steps:i}}var JY="year",QY="month",ZY="day",VI="hour",YI="minute",WI="second",Slt="millisecond",hx=1e3,px=hx*60,mx=px*60,GI=mx*24,Ilt=GI*7,KY=GI*30,tW=GI*365,dx=[[WI,1,hx],[WI,5,5*hx],[WI,15,15*hx],[WI,30,30*hx],[YI,1,px],[YI,5,5*px],[YI,15,15*px],[YI,30,30*px],[VI,1,mx],[VI,3,3*mx],[VI,6,6*mx],[VI,12,12*mx],[ZY,1,GI],[ZY,7,Ilt],[QY,1,KY],[QY,3,3*KY],[JY,1,tW]];function eW(e,t,r){let n=t-e,i=n/r,o=To(s=>s[2]).right(dx,i);return o===dx.length?{interval:JY,step:qI(n/tW,r)}:o?(o=dx[i/dx[o-1][2]<dx[o][2]/i?o-1:o],{interval:o[0],step:o[1]}):{interval:Slt,step:qI(n,r,1)}}var Tlt=new Set(["rectY-x","rectX-y","rect-x","rect-y","ruleY-x","ruleX-y"]);function Alt(e,t){return Tlt.has(`${e.type}-${t}`)}function I8(e,t={}){let r=(n,i)=>Alt(n,i)?{[`${i}1`]:v8(n,i,e,t),[`${i}2`]:v8(n,i,e,{...t,offset:1})}:{[i]:v8(n,i,e,t)};return r[oy]=!0,r}function v8(e,t,r,n){return new S8(r,e,t,n)}function Elt(e,t){let r=e.plot.getAttribute(`${t}Scale`);return r==="utc"||r==="time"}var S8=class extends Bt{constructor(t,r,n,i){super("COLUMN_REF"),this.column=t,this.mark=r,this.channel=n,this.options=i}get stats(){return{column:this.column,stats:["min","max"]}}toString(){let{mark:t,channel:r,column:n,options:i}=this,{type:o,min:s,max:a}=t.channelField(r),{interval:c,steps:l,offset:u=0}=i,f=c??(o==="date"||Elt(t,r)?"date":"number"),d;if(f==="number"){let{apply:h,sqlApply:p,sqlInvert:m}=wf(t,r),y=HY(h(s),h(a),i),g=p(n),x=Ge((y.max-y.min)/y.steps),b=Or(se(y.min===0?g:It(g,y.min),x)),_=te(y.min,Nt(x,u?te(u,b):b));d=m(_)}else{let{interval:h,step:p=1}=f==="date"?eW(s,a,l||40):i,m=QT(n,h,p);d=u?te(m,Wb(h,u*p)):m}return`${d}`}};var Mlt=e=>e&&typeof e=="object"&&!Array.isArray(e);var yx=class extends Bn{constructor({element:t,filterBy:r,from:n,column:i,label:o=i,format:s=f=>f,options:a,value:c,field:l=i,as:u}={}){super(r),this.from=n,this.column=i,this.format=s,this.field=l;let f=this.selection=u;this.element=t??document.createElement("div"),this.element.setAttribute("class","input"),Object.defineProperty(this.element,"value",{value:this});let d=document.createElement("label");if(d.innerText=o||i,this.element.appendChild(d),this.select=document.createElement("select"),this.element.appendChild(this.select),a&&(this.data=a.map(h=>Mlt(h)?h:{value:h}),this.selectedValue(c??""),this.update()),f){let h=!ii(f);c!=null&&(!h||f.value===void 0)&&this.publish(c),this.select.addEventListener("input",()=>{this.publish(this.selectedValue()??null)}),h&&this.selection.addEventListener("value",p=>{p!==this.select.value&&this.selectedValue(p)})}}selectedValue(t){if(arguments.length===0){let r=this.select.selectedIndex;return this.data[r].value}else{let r=this.data?.findIndex(n=>n.value===t);r>=0?this.select.selectedIndex=r:this.select.value=String(t)}}reset(){this.select.selectedIndex=this.from?0:-1}publish(t){let{selection:r,field:n}=this;if(ii(r)){t===""&&(t=void 0);let i=bu(n,t,{source:this});r.update(i)}else or(r)&&r.update(t)}query(t=[]){let{from:r,column:n}=this;return r?ft.from(r).select({value:n}).distinct().where(t).orderby(n):null}queryResult(t){return this.data=[{value:"",label:"All"},...t],this}update(){let{data:t,format:r,select:n,selection:i}=this;n.replaceChildren();for(let{value:o,label:s}of t){let a=document.createElement("option");a.setAttribute("value",o),a.innerText=s??r(o),this.select.appendChild(a)}if(i){let o=ii(i)?i.valueFor(this):i.value;this.selectedValue(o??"")}return this}};var Nlt=0;var gx=class extends Bn{constructor({element:t,filterBy:r,from:n,column:i,label:o,type:s="contains",field:a=i,as:c}={}){if(super(r),this.id="search_"+ ++Nlt,this.type=s,this.from=n,this.column=i,this.selection=c,this.field=a,this.element=t??document.createElement("div"),this.element.setAttribute("class","input"),Object.defineProperty(this.element,"value",{value:this}),o){let l=document.createElement("label");l.setAttribute("for",this.id),l.innerText=o,this.element.appendChild(l)}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)}),ii(this.selection)||this.selection.addEventListener("value",l=>{l!==this.searchbox.value&&(this.searchbox.value=l)}))}reset(){this.searchbox.value=""}publish(t){let{selection:r,field:n,type:i}=this;if(ii(r)){let o=iM(n,t,{source:this,method:i});r.update(o)}else or(r)&&r.update(t)}query(t=[]){let{from:r,column:n}=this;return r?ft.from(r).select({list:n}).distinct().where(t):null}queryResult(t){return this.data=t,this}update(){let t=document.createElement("datalist"),r=`${this.id}_list`;t.setAttribute("id",r);for(let n of this.data){let i=document.createElement("option");i.setAttribute("value",n.list),t.append(i)}return this.datalist&&this.datalist.remove(),this.element.appendChild(this.datalist=t),this.searchbox.setAttribute("list",r),this}};var Olt=0;var xx=class extends Bn{constructor({element:t,filterBy:r,as:n,min:i,max:o,step:s,from:a,column:c,label:l=c,value:u=n?.value,select:f="point",field:d=c,width:h}={}){if(super(r),this.id="slider_"+ ++Olt,this.from=a,this.column=c||"value",this.selection=n,this.selectionType=f,this.field=d,this.min=i,this.max=o,this.step=s,this.element=t||document.createElement("div"),this.element.setAttribute("class","input"),Object.defineProperty(this.element,"value",{value:this}),l){let p=document.createElement("label");p.setAttribute("for",this.id),p.innerText=l,this.element.appendChild(p)}this.slider=document.createElement("input"),this.slider.setAttribute("id",this.id),this.slider.setAttribute("type","range"),h!=null&&(this.slider.style.width=`${+h}px`),i!=null&&this.slider.setAttribute("min",`${i}`),o!=null&&this.slider.setAttribute("max",`${o}`),s!=null&&this.slider.setAttribute("step",`${s}`),this.element.appendChild(this.slider),this.curval=document.createElement("label"),this.curval.setAttribute("for",this.id),this.curval.setAttribute("class","value"),this.element.appendChild(this.curval),u!=null&&(this.slider.setAttribute("value",`${u}`),this.selection?.value===void 0&&this.publish(u)),this.curval.innerText=this.slider.value,this.slider.addEventListener("input",()=>{let{value:p}=this.slider;this.curval.innerText=p,this.selection&&this.publish(+p)}),this.selection&&!ii(this.selection)&&this.selection.addEventListener("value",p=>{p!==+this.slider.value&&(this.slider.value=p,this.curval.innerText=p)})}query(t=[]){let{from:r,column:n}=this;return!r||this.min!=null&&this.max!=null?null:ft.select({min:zn(n),max:zr(n)}).from(r).where(t)}queryResult(t){let{min:r,max:n}=Array.from(t)[0];return this.min==null&&(this.min=r,this.slider.setAttribute("min",`${r}`)),this.max==null&&(this.max=n,this.slider.setAttribute("max",`${n}`)),this.step==null&&(this.step=(n-r)/500,this.slider.setAttribute("step",`${this.step}`)),this}publish(t){let{field:r,selectionType:n,selection:i}=this;if(ii(i))if(n==="interval"){let o=[this.min??0,t];i.update(_u(r,o,{source:this,bin:"ceil",scale:{type:"identity",domain:o},pixelSize:this.step}))}else i.update(bu(r,t,{source:this}));else or(this.selection)&&i.update(t)}};var A8=rW(e=>{let t=XI(e);return r=>r==null?"":typeof r=="number"?t(r):r instanceof Date?E8(r):`${r}`}),XI=rW(e=>t=>t===0?"0":t.toLocaleString(e)),Vce=A8(),Yce=XI();function E8(e){return ph(e,"Invalid Date")}function rW(e){let t=null,r;return(n="en")=>n===t?r:r=e(t=n)}var Rlt=-1;var bx=class extends Bn{constructor({element:t,filterBy:r,from:n,columns:i=["*"],align:o={},format:s,width:a,maxWidth:c,height:l=500,rowBatch:u=100,as:f}={}){super(r),this.id=`table-${++Rlt}`,this.from=n,this.columns=i,this.format=s,this.align=o,this.widths=typeof a=="object"?a:{},or(n)&&n.addEventListener("value",()=>this.initialize()),this.offset=0,this.limit=+u,this.pending=!1,this.selection=f,this.currentRow=-1,this.sortHeader=null,this.sortColumn=null,this.sortDesc=!1,this.element=t||document.createElement("div"),this.element.setAttribute("id",this.id),Object.defineProperty(this.element,"value",{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 d=-1;this.element.addEventListener("scroll",h=>{let{pending:p,loaded:m}=this,{scrollHeight:y,scrollTop:g,clientHeight:x}=h.target,b=g<d;d=g,!(b||p||m)&&y-g<2*x&&(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.selection&&(this.body.addEventListener("pointerover",h=>{let p=Dlt(h.target);p>-1&&p!==this.currentRow&&(this.currentRow=p,this.selection.update(this.clause([p])))}),this.body.addEventListener("pointerleave",()=>{this.currentRow=-1,this.selection.update(this.clause())})),this.style=document.createElement("style"),this.element.appendChild(this.style)}sourceTable(){return or(this.from)?this.from.value:this.from}clause(t=[]){let{data:r,limit:n,schema:i}=this,o=i.map(a=>a.column),s=t.map(a=>{let{columns:c}=r[~~(a/n)];return o.map(l=>c[l][a%n])});return Sa(o,s,{source:this})}requestData(t=0){this.offset=t;let r=this.query(this.filterBy?.predicate(this));this.requestQuery(r),Li().prefetch(r.clone().offset(t+this.limit))}fields(){let t=this.sourceTable();return this.columns.map(r=>Gs(r,t))}fieldInfo(t){this.schema=t;let r=this.head;r.innerHTML="";let n=document.createElement("tr");for(let{column:i}of t){let o=document.createElement("th");o.addEventListener("click",s=>this.sort(s,i)),o.appendChild(document.createElement("span")),o.appendChild(document.createTextNode(i)),n.appendChild(o)}return r.appendChild(n),this.formats=Llt(this.format,t),this.style.innerText=klt(this.id,Flt(this.align,t),Clt(this.widths,t)),this}query(t=[]){let{limit:r,offset:n,schema:i,sortColumn:o,sortDesc:s}=this;return ft.from(this.sourceTable()).select(i.map(a=>a.column)).where(t).orderby(o?s?uA(o):o:[]).limit(r).offset(n)}queryResult(t){return this.pending||(this.loaded=!1,this.data=[],this.body.replaceChildren(),this.offset=0),this.data.push(Xn(t)),this}update(){let{body:t,formats:r,data:n,schema:i,limit:o}=this,s=i.length,a=n.length-1,c=o*a,{numRows:l,columns:u}=n[a],f=i.map(d=>u[d.column]);for(let d=0;d<l;++d){let h=document.createElement("tr");Object.assign(h,{__row__:c+d});for(let p=0;p<s;++p){let m=f[p][d],y=document.createElement("td");y.innerText=m==null?"":r[p](m),h.appendChild(y)}t.appendChild(h)}return l<o&&(this.loaded=!0),this.pending=!1,this}sort(t,r){r===this.sortColumn?this.sortDesc=!this.sortDesc:(this.sortColumn=r,this.sortDesc=!1);let n=t.currentTarget,i=this.sortHeader;i===n&&t.metaKey?(i.firstChild.textContent="",this.sortHeader=null,this.sortColumn=null):(i&&(i.firstChild.textContent=""),this.sortHeader=n,n.firstChild.textContent=this.sortDesc?"\u25BE":"\u25B4"),this.requestData()}};function Dlt(e){let t=e.parentElement;return Object.hasOwn(t,"__row__")?+t.__row__:-1}function Llt(e={},t,r){return t.map(({column:n,type:i})=>{if(n in e)return e[n];switch(i){case"number":return XI(r);case"date":return E8;default:return A8(r)}})}function Flt(e={},t){return t.map(({column:r,type:n})=>r in e?e[r]:n==="number"?"right":"left")}function Clt(e={},t){return t.map(({column:r})=>e[r])}function klt(e,t,r){let n=[];return t.forEach((i,o)=>{let s=+r[o];if(i!=="left"||s){let a=i!=="left"?`text-align:${i};`:"",c=s?`width:${s}px;max-width:${s}px;`:"";n.push(`#${e} tr>:nth-child(${o+1}) {${a}${c}}`)}}),n.join(" ")}function _x(e,...t){let r=e?.context?.coordinator??Li();for(let n of t)r.connect(n)}function HI(e,t,r){let n=new t(r);return _x(e,n),n.element}function nW(e){return HI(this,yx,e)}function iW(e){return HI(this,gx,e)}function oW(e){return HI(this,xx,e)}function sW(e){return HI(this,bx,e)}function aW({direction:e="vertical",wrap:t=!1},r){let n=document.createElement("div");return n.style.display="flex",n.style.flexDirection=e==="vertical"?"column":"row",n.style.flexWrap=t?t===!0?"wrap":t:"nowrap",n.style.justifyContent="flex-start",n.style.alignItems="flex-start",r.forEach(i=>n.appendChild(i)),Object.assign(n,{value:{element:n}}),n}function cW(...e){return aW({direction:"vertical"},e.flat())}function lW(...e){return aW({direction:"horizontal"},e.flat())}function uW({dim:e="width",size:t=10}){let r=document.createElement("span");return r.style.display="inline-block",r.style[e]=Number.isNaN(+t)?t:`${t}px`,Object.assign(r,{value:{element:r}})}function fW(e){return uW({dim:"height",size:e})}function dW(e){return uW({dim:"width",size:e})}var mW={};Jn(mW,{align:()=>j8,ariaDescription:()=>Q8,ariaLabel:()=>H8,aspectRatio:()=>q8,axis:()=>V8,clip:()=>G8,colorBase:()=>LD,colorClamp:()=>wD,colorConstant:()=>CD,colorDomain:()=>bD,colorExponent:()=>FD,colorInterpolate:()=>TD,colorLabel:()=>MD,colorN:()=>vD,colorNice:()=>SD,colorPercent:()=>ND,colorPivot:()=>AD,colorRange:()=>_D,colorReverse:()=>OD,colorScale:()=>xD,colorScheme:()=>ID,colorSymmetric:()=>ED,colorTickFormat:()=>DD,colorZero:()=>RD,facetGrid:()=>xR,facetLabel:()=>bR,facetMargin:()=>hR,facetMarginBottom:()=>mR,facetMarginLeft:()=>yR,facetMarginRight:()=>gR,facetMarginTop:()=>pR,fxAlign:()=>AR,fxAriaDescription:()=>VR,fxAriaLabel:()=>qR,fxAxis:()=>OR,fxDomain:()=>_R,fxFontVariant:()=>jR,fxGrid:()=>BR,fxInset:()=>vR,fxInsetLeft:()=>SR,fxInsetRight:()=>IR,fxLabel:()=>UR,fxLabelAnchor:()=>$R,fxLabelOffset:()=>zR,fxLine:()=>PR,fxPadding:()=>ER,fxPaddingInner:()=>MR,fxPaddingOuter:()=>NR,fxRange:()=>wR,fxReverse:()=>YR,fxRound:()=>TR,fxTickFormat:()=>CR,fxTickPadding:()=>FR,fxTickRotate:()=>kR,fxTickSize:()=>DR,fxTickSpacing:()=>LR,fxTicks:()=>RR,fyAlign:()=>KR,fyAriaDescription:()=>yD,fyAriaLabel:()=>mD,fyAxis:()=>rD,fyDomain:()=>WR,fyFontVariant:()=>pD,fyGrid:()=>lD,fyInset:()=>XR,fyInsetBottom:()=>QR,fyInsetTop:()=>HR,fyLabel:()=>fD,fyLabelAnchor:()=>dD,fyLabelOffset:()=>hD,fyLine:()=>uD,fyPadding:()=>JR,fyPaddingInner:()=>tD,fyPaddingOuter:()=>eD,fyRange:()=>GR,fyReverse:()=>gD,fyRound:()=>ZR,fyTickFormat:()=>aD,fyTickPadding:()=>sD,fyTickRotate:()=>cD,fyTickSize:()=>iD,fyTickSpacing:()=>oD,fyTicks:()=>nD,grid:()=>W8,height:()=>B8,inset:()=>Y8,lengthBase:()=>yL,lengthClamp:()=>dL,lengthConstant:()=>xL,lengthDomain:()=>uL,lengthExponent:()=>gL,lengthNice:()=>hL,lengthPercent:()=>pL,lengthRange:()=>fL,lengthScale:()=>lL,lengthZero:()=>mL,margin:()=>L8,marginBottom:()=>z8,marginLeft:()=>P8,marginRight:()=>U8,marginTop:()=>$8,margins:()=>D8,name:()=>O8,opacityBase:()=>WD,opacityClamp:()=>UD,opacityConstant:()=>XD,opacityDomain:()=>BD,opacityExponent:()=>GD,opacityLabel:()=>zD,opacityNice:()=>$D,opacityPercent:()=>jD,opacityRange:()=>PD,opacityReverse:()=>qD,opacityScale:()=>kD,opacityTickFormat:()=>YD,opacityZero:()=>VD,padding:()=>X8,projectionClip:()=>NL,projectionDomain:()=>SL,projectionInset:()=>IL,projectionInsetBottom:()=>ML,projectionInsetLeft:()=>TL,projectionInsetRight:()=>AL,projectionInsetTop:()=>EL,projectionParallels:()=>_L,projectionPrecision:()=>wL,projectionRotate:()=>vL,projectionType:()=>bL,rBase:()=>sL,rClamp:()=>eL,rConstant:()=>cL,rDomain:()=>JD,rExponent:()=>aL,rLabel:()=>nL,rNice:()=>rL,rPercent:()=>iL,rRange:()=>tL,rScale:()=>KD,rZero:()=>oL,style:()=>C8,symbolDomain:()=>QD,symbolRange:()=>ZD,symbolScale:()=>HD,width:()=>k8,xAlign:()=>sO,xAriaDescription:()=>TO,xAriaLabel:()=>IO,xAxis:()=>uO,xBase:()=>NO,xClamp:()=>iO,xConstant:()=>RO,xDomain:()=>K8,xExponent:()=>OO,xFontVariant:()=>SO,xGrid:()=>gO,xInset:()=>eO,xInsetLeft:()=>rO,xInsetRight:()=>nO,xLabel:()=>bO,xLabelAnchor:()=>_O,xLabelArrow:()=>wO,xLabelOffset:()=>vO,xLine:()=>xO,xNice:()=>tO,xPadding:()=>aO,xPaddingInner:()=>cO,xPaddingOuter:()=>lO,xPercent:()=>AO,xRange:()=>J8,xReverse:()=>EO,xRound:()=>oO,xScale:()=>Z8,xTickFormat:()=>mO,xTickPadding:()=>pO,xTickRotate:()=>yO,xTickSize:()=>dO,xTickSpacing:()=>hO,xTicks:()=>fO,xZero:()=>MO,xyDomain:()=>F8,yAlign:()=>zO,yAriaDescription:()=>sR,yAriaLabel:()=>oR,yAxis:()=>YO,yBase:()=>uR,yClamp:()=>UO,yConstant:()=>dR,yDomain:()=>LO,yExponent:()=>fR,yFontVariant:()=>iR,yGrid:()=>KO,yInset:()=>kO,yInsetBottom:()=>PO,yInsetTop:()=>BO,yLabel:()=>tR,yLabelAnchor:()=>eR,yLabelArrow:()=>rR,yLabelOffset:()=>nR,yLine:()=>JO,yNice:()=>CO,yPadding:()=>jO,yPaddingInner:()=>qO,yPaddingOuter:()=>VO,yPercent:()=>aR,yRange:()=>FO,yReverse:()=>cR,yRound:()=>$O,yScale:()=>DO,yTickFormat:()=>QO,yTickPadding:()=>HO,yTickRotate:()=>ZO,yTickSize:()=>GO,yTickSpacing:()=>XO,yTicks:()=>WO,yZero:()=>lR});var wx=class extends Map{request(t,r){if(this.has(t))r(this.get(t));else{let n=this.waiting||(this.waiting=new Map),i=n.get(t)||[];n.set(t,i.concat(r))}}set(t,r){this.has(t)&&console.warn(`Overwriting named plot "${t}".`);let{waiting:n}=this;return n?.has(t)&&(n.get(t).forEach(i=>i(r)),n.delete(t)),super.set(t,r)}clear(){return this.waiting?.clear(),super.clear()}},M8=new wx;function N8(e,t,r){(e?.context?.namedPlots??M8).request(t,r)}function hW(e,t,r){(e?.context?.namedPlots??M8).set(t,r)}function O8(e){return t=>hW(this,e,t)}function pW(e,t,r){or(r)?(r.addEventListener("value",n=>{e.setAttribute(t,n),e.update()}),r.value!==void 0&&e.setAttribute(t,r.value)):e.setAttribute(t,r)}function Blt(e,t){return r=>{pW(r,e,t)}}function R8(e){return t=>{for(let[r,n]of Object.entries(e))pW(t,r,n)}}function D8(e){let{top:t,bottom:r,left:n,right:i}=e,o={};return t!==void 0&&(o.marginTop=t),r!==void 0&&(o.marginBottom=r),n!==void 0&&(o.marginLeft=n),i!==void 0&&(o.marginRight=i),R8(o)}function L8(e){return R8({marginTop:e,marginBottom:e,marginLeft:e,marginRight:e})}function F8(e){return R8({xDomain:e,yDomain:e})}var F=e=>t=>Blt(e,t),C8=F("style"),k8=F("width"),B8=F("height"),P8=F("marginLeft"),U8=F("marginRight"),$8=F("marginTop"),z8=F("marginBottom"),j8=F("align"),q8=F("aspectRatio"),V8=F("axis"),Y8=F("inset"),W8=F("grid"),G8=F("clip"),X8=F("padding"),H8=F("ariaLabel"),Q8=F("ariaDescription"),Z8=F("xScale"),K8=F("xDomain"),J8=F("xRange"),tO=F("xNice"),eO=F("xInset"),rO=F("xInsetLeft"),nO=F("xInsetRight"),iO=F("xClamp"),oO=F("xRound"),sO=F("xAlign"),aO=F("xPadding"),cO=F("xPaddingInner"),lO=F("xPaddingOuter"),uO=F("xAxis"),fO=F("xTicks"),dO=F("xTickSize"),hO=F("xTickSpacing"),pO=F("xTickPadding"),mO=F("xTickFormat"),yO=F("xTickRotate"),gO=F("xGrid"),xO=F("xLine"),bO=F("xLabel"),_O=F("xLabelAnchor"),wO=F("xLabelArrow"),vO=F("xLabelOffset"),SO=F("xFontVariant"),IO=F("xAriaLabel"),TO=F("xAriaDescription"),AO=F("xPercent"),EO=F("xReverse"),MO=F("xZero"),NO=F("xBase"),OO=F("xExponent"),RO=F("xConstant"),DO=F("yScale"),LO=F("yDomain"),FO=F("yRange"),CO=F("yNice"),kO=F("yInset"),BO=F("yInsetTop"),PO=F("yInsetBottom"),UO=F("yClamp"),$O=F("yRound"),zO=F("yAlign"),jO=F("yPadding"),qO=F("yPaddingInner"),VO=F("yPaddingOuter"),YO=F("yAxis"),WO=F("yTicks"),GO=F("yTickSize"),XO=F("yTickSpacing"),HO=F("yTickPadding"),QO=F("yTickFormat"),ZO=F("yTickRotate"),KO=F("yGrid"),JO=F("yLine"),tR=F("yLabel"),eR=F("yLabelAnchor"),rR=F("yLabelArrow"),nR=F("yLabelOffset"),iR=F("yFontVariant"),oR=F("yAriaLabel"),sR=F("yAriaDescription"),aR=F("yPercent"),cR=F("yReverse"),lR=F("yZero"),uR=F("yBase"),fR=F("yExponent"),dR=F("yConstant"),hR=F("facetMargin"),pR=F("facetMarginTop"),mR=F("facetMarginBottom"),yR=F("facetMarginLeft"),gR=F("facetMarginRight"),xR=F("facetGrid"),bR=F("facetLabel"),_R=F("fxDomain"),wR=F("fxRange"),vR=F("fxInset"),SR=F("fxInsetLeft"),IR=F("fxInsetRight"),TR=F("fxRound"),AR=F("fxAlign"),ER=F("fxPadding"),MR=F("fxPaddingInner"),NR=F("fxPaddingOuter"),OR=F("fxAxis"),RR=F("fxTicks"),DR=F("fxTickSize"),LR=F("fxTickSpacing"),FR=F("fxTickPadding"),CR=F("fxTickFormat"),kR=F("fxTickRotate"),BR=F("fxGrid"),PR=F("fxLine"),UR=F("fxLabel"),$R=F("fxLabelAnchor"),zR=F("fxLabelOffset"),jR=F("fxFontVariant"),qR=F("fxAriaLabel"),VR=F("fxAriaDescription"),YR=F("fxReverse"),WR=F("fyDomain"),GR=F("fyRange"),XR=F("fyInset"),HR=F("fyInsetTop"),QR=F("fyInsetBottom"),ZR=F("fyRound"),KR=F("fyAlign"),JR=F("fyPadding"),tD=F("fyPaddingInner"),eD=F("fyPaddingOuter"),rD=F("fyAxis"),nD=F("fyTicks"),iD=F("fyTickSize"),oD=F("fyTickSpacing"),sD=F("fyTickPadding"),aD=F("fyTickFormat"),cD=F("fyTickRotate"),lD=F("fyGrid"),uD=F("fyLine"),fD=F("fyLabel"),dD=F("fyLabelAnchor"),hD=F("fyLabelOffset"),pD=F("fyFontVariant"),mD=F("fyAriaLabel"),yD=F("fyAriaDescription"),gD=F("fyReverse"),xD=F("colorScale"),bD=F("colorDomain"),_D=F("colorRange"),wD=F("colorClamp"),vD=F("colorN"),SD=F("colorNice"),ID=F("colorScheme"),TD=F("colorInterpolate"),AD=F("colorPivot"),ED=F("colorSymmetric"),MD=F("colorLabel"),ND=F("colorPercent"),OD=F("colorReverse"),RD=F("colorZero"),DD=F("colorTickFormat"),LD=F("colorBase"),FD=F("colorExponent"),CD=F("colorConstant"),kD=F("opacityScale"),BD=F("opacityDomain"),PD=F("opacityRange"),UD=F("opacityClamp"),$D=F("opacityNice"),zD=F("opacityLabel"),jD=F("opacityPercent"),qD=F("opacityReverse"),VD=F("opacityZero"),YD=F("opacityTickFormat"),WD=F("opacityBase"),GD=F("opacityExponent"),XD=F("opacityConstant"),HD=F("symbolScale"),QD=F("symbolDomain"),ZD=F("symbolRange"),KD=F("rScale"),JD=F("rDomain"),tL=F("rRange"),eL=F("rClamp"),rL=F("rNice"),nL=F("rLabel"),iL=F("rPercent"),oL=F("rZero"),sL=F("rBase"),aL=F("rExponent"),cL=F("rConstant"),lL=F("lengthScale"),uL=F("lengthDomain"),fL=F("lengthRange"),dL=F("lengthClamp"),hL=F("lengthNice"),pL=F("lengthPercent"),mL=F("lengthZero"),yL=F("lengthBase"),gL=F("lengthExponent"),xL=F("lengthConstant"),bL=F("projectionType"),_L=F("projectionParallels"),wL=F("projectionPrecision"),vL=F("projectionRotate"),SL=F("projectionDomain"),IL=F("projectionInset"),TL=F("projectionInsetLeft"),AL=F("projectionInsetRight"),EL=F("projectionInsetTop"),ML=F("projectionInsetBottom"),NL=F("projectionClip");function yW(e,t){return{table:e,options:t}}var gW={};Jn(gW,{area:()=>OL,areaX:()=>RL,areaY:()=>DL,arrow:()=>TF,axisFx:()=>OF,axisFy:()=>RF,axisX:()=>MF,axisY:()=>NF,barX:()=>kL,barY:()=>BL,cell:()=>PL,cellX:()=>UL,cellY:()=>$L,circle:()=>GL,contour:()=>fF,delaunayLink:()=>vF,delaunayMesh:()=>SF,denseLine:()=>uF,density:()=>lF,densityX:()=>aF,densityY:()=>cF,dot:()=>VL,dotX:()=>YL,dotY:()=>WL,errorbarX:()=>xF,errorbarY:()=>bF,frame:()=>EF,geo:()=>kF,graticule:()=>PF,gridFx:()=>FF,gridFy:()=>CF,gridX:()=>DF,gridY:()=>LF,heatmap:()=>dF,hexagon:()=>XL,hexbin:()=>mF,hexgrid:()=>yF,hull:()=>IF,image:()=>sF,line:()=>LL,lineX:()=>FL,lineY:()=>CL,link:()=>AF,raster:()=>hF,rasterTile:()=>pF,rect:()=>zL,rectX:()=>jL,rectY:()=>qL,regressionY:()=>gF,ruleX:()=>KL,ruleY:()=>JL,sphere:()=>BF,spike:()=>oF,text:()=>HL,textX:()=>QL,textY:()=>ZL,tickX:()=>tF,tickY:()=>eF,vector:()=>rF,vectorX:()=>nF,vectorY:()=>iF,voronoi:()=>_F,voronoiMesh:()=>wF});var Plt=new Set(["frame","axisX","axisY","axisFx","axisFy","gridX","gridY","gridFx","gridFy","hexgrid","graticule","sphere"]);function Mt(e,t,r={}){arguments.length===2&&!Array.isArray(t)&&(r=t,t=Plt.has(e)?null:[{}]);let n=e.startsWith("area")||e.startsWith("line")?X0:Ir;return QI(n,e,t,r)}function QI(e,t,r,n){return i=>{i.addMark(new e(t,r,n))}}function Us(e,t,r){return n=>{n.addMark(new e(t,r))}}var OL=(...e)=>Mt("area",...e),RL=(...e)=>Mt("areaX",...e),DL=(...e)=>Mt("areaY",...e),LL=(...e)=>Mt("line",...e),FL=(...e)=>Mt("lineX",...e),CL=(...e)=>Mt("lineY",...e),kL=(...e)=>Mt("barX",...e),BL=(...e)=>Mt("barY",...e),PL=(...e)=>Mt("cell",...e),UL=(...e)=>Mt("cellX",...e),$L=(...e)=>Mt("cellY",...e),zL=(...e)=>Mt("rect",...e),jL=(...e)=>Mt("rectX",...e),qL=(...e)=>Mt("rectY",...e),VL=(...e)=>Mt("dot",...e),YL=(...e)=>Mt("dotX",...e),WL=(...e)=>Mt("dotY",...e),GL=(...e)=>Mt("circle",...e),XL=(...e)=>Mt("hexagon",...e),HL=(...e)=>Mt("text",...e),QL=(...e)=>Mt("textX",...e),ZL=(...e)=>Mt("textY",...e),KL=(...e)=>Mt("ruleX",...e),JL=(...e)=>Mt("ruleY",...e),tF=(...e)=>Mt("tickX",...e),eF=(...e)=>Mt("tickY",...e),rF=(...e)=>Mt("vector",...e),nF=(...e)=>Mt("vectoX",...e),iF=(...e)=>Mt("vectorY",...e),oF=(...e)=>Mt("spike",...e),sF=(...e)=>Mt("image",...e),aF=(...e)=>QI(op,"areaX",...e),cF=(...e)=>QI(op,"areaY",...e),lF=(...e)=>Us(ex,...e),uF=(...e)=>Us(tx,...e),fF=(...e)=>Us(Z0,...e),dF=(...e)=>Us(J0,...e),hF=(...e)=>Us(Dl,...e),pF=(...e)=>Us(ix,...e),mF=(...e)=>Us(nx,...e),yF=(...e)=>Mt("hexgrid",...e),gF=(...e)=>Us(ox,...e),xF=(...e)=>QI(ap,"ruleY",...e),bF=(...e)=>Us(ap,"ruleX",...e),_F=(...e)=>Mt("voronoi",...e),wF=(...e)=>Mt("voronoiMesh",...e),vF=(...e)=>Mt("delaunayLink",...e),SF=(...e)=>Mt("delaunayMesh",...e),IF=(...e)=>Mt("hull",...e),TF=(...e)=>Mt("arrow",...e),AF=(...e)=>Mt("link",...e),EF=(...e)=>Mt("frame",...e),MF=(...e)=>Mt("axisX",...e),NF=(...e)=>Mt("axisY",...e),OF=(...e)=>Mt("axisFx",...e),RF=(...e)=>Mt("axisFy",...e),DF=(...e)=>Mt("gridX",...e),LF=(...e)=>Mt("gridY",...e),FF=(...e)=>Mt("gridFx",...e),CF=(...e)=>Mt("gridFy",...e),kF=(...e)=>Us(rx,...e),BF=(...e)=>Mt("sphere",...e),PF=(...e)=>Mt("graticule",...e);var xW={};Jn(xW,{highlight:()=>UF,intervalX:()=>$F,intervalXY:()=>jF,intervalY:()=>zF,nearest:()=>qF,nearestX:()=>VF,nearestY:()=>YF,pan:()=>ZF,panX:()=>KF,panY:()=>JF,panZoom:()=>tC,panZoomX:()=>eC,panZoomY:()=>rC,region:()=>WF,toggle:()=>Tf,toggleColor:()=>QF,toggleX:()=>GF,toggleY:()=>XF,toggleZ:()=>HF});function $s(e,t){return r=>{let n=r.marks[r.marks.length-1];r.addInteractor(new e(n,t))}}function UF({by:e,...t}){return $s(sx,{selection:e,channels:t})}function $F({as:e,...t}){return $s(Fl,{...t,selection:e,channel:"x"})}function zF({as:e,...t}){return $s(Fl,{...t,selection:e,channel:"y"})}function jF({as:e,...t}){return $s(lx,{...t,selection:e})}function qF({as:e,...t}){return $s(vf,{...t,selection:e,pointer:"xy"})}function VF({as:e,...t}){return $s(vf,{...t,selection:e,pointer:"x"})}function YF({as:e,...t}){return $s(vf,{...t,selection:e,pointer:"y"})}function WF({as:e,...t}){return $s(fx,{...t,selection:e})}function Tf({as:e,...t}){return $s(If,{...t,selection:e})}function GF(e){return Tf({...e,channels:["x"]})}function XF(e){return Tf({...e,channels:["y"]})}function HF(e){return Tf({...e,channels:["z"]})}function QF(e){return Tf({...e,channels:["color"]})}function up(e){return $s(ux,e)}function ZF(e={}){return up({...e,zoom:!1})}function KF(e={}){return up({...e,zoom:!1,pany:!1})}function JF(e={}){return up({...e,zoom:!1,panx:!1})}function tC(e={}){return up(e)}function eC(e={}){return up({...e,pany:!1})}function rC(e={}){return up({...e,panx:!1})}var bW={};Jn(bW,{colorLegend:()=>iC,opacityLegend:()=>oC,symbolLegend:()=>sC});function nC(e,t={}){if(t.for){let{for:r,...n}=t,i=new lp(e,n),o=typeof r,s=a=>a.addLegend(i,!1);return o==="string"?N8(this,r,s):r.value&&s(r.value),i.element}else return r=>r.addLegend(new lp(e,t))}function iC(e){return nC.call(this,"color",e)}function oC(e){return nC.call(this,"opacity",e)}function sC(e){return nC.call(this,"symbol",e)}function _W(...e){let t=new W0;return e.flat().forEach(r=>r(t)),_x(this,...t.marks),t.update(),t.element}function Ult({coordinator:e=Li(),namedPlots:t=new wx,extensions:r=null,...n}={}){return{...aC,...r,context:{coordinator:e,namedPlots:t,...n}}}export{im as Coordinator,es as Fixed,Bn as MosaicClient,vc as Param,ft as Query,qo as Selection,j8 as align,on as and,OL as area,RL as areaX,DL as areaY,xc as argmax,bc as argmin,Q8 as ariaDescription,H8 as ariaLabel,TT as arrayAgg,TF as arrow,q8 as aspectRatio,mW as attributeDirectives,Xp as avg,V8 as axis,OF as axisFx,RF as axisFy,MF as axisX,NF as axisY,kL as barX,BL as barY,I8 as bin,qf as cast,PL as cell,UL as cellX,$L as cellY,tm as centroid,fA as centroidX,dA as centroidY,GL as circle,G8 as clip,LD as colorBase,wD as colorClamp,CD as colorConstant,bD as colorDomain,FD as colorExponent,TD as colorInterpolate,MD as colorLabel,iC as colorLegend,vD as colorN,SD as colorNice,ND as colorPercent,AD as colorPivot,_D as colorRange,OD as colorReverse,xD as colorScale,ID as colorScheme,ED as colorSymmetric,DD as colorTickFormat,RD as colorZero,Gs as column,_x as connect,fF as contour,Li as coordinator,AT as corr,Mr as count,MT as covarPop,ET as covariance,Ult as createAPIContext,NA as createSchema,_c as createTable,wA as cume_dist,JT as dateDay,ZT as dateMonth,KT as dateMonthDay,vF as delaunayLink,SF as delaunayMesh,uF as denseLine,bA as dense_rank,lF as density,aF as densityX,cF as densityY,VL as dot,YL as dotX,WL as dotY,NT as entropy,iA as eq,xF as errorbarX,bF as errorbarY,xR as facetGrid,bR as facetLabel,hR as facetMargin,mR as facetMarginBottom,yR as facetMarginLeft,gR as facetMarginRight,pR as facetMarginTop,OT as first,IA as first_value,XT as float32,Ge as float64,EF as frame,yW as from,AR as fxAlign,VR as fxAriaDescription,qR as fxAriaLabel,OR as fxAxis,_R as fxDomain,jR as fxFontVariant,BR as fxGrid,vR as fxInset,SR as fxInsetLeft,IR as fxInsetRight,UR as fxLabel,$R as fxLabelAnchor,zR as fxLabelOffset,PR as fxLine,ER as fxPadding,MR as fxPaddingInner,NR as fxPaddingOuter,wR as fxRange,YR as fxReverse,TR as fxRound,CR as fxTickFormat,FR as fxTickPadding,kR as fxTickRotate,DR as fxTickSize,LR as fxTickSpacing,RR as fxTicks,KR as fyAlign,yD as fyAriaDescription,mD as fyAriaLabel,rD as fyAxis,WR as fyDomain,pD as fyFontVariant,lD as fyGrid,XR as fyInset,QR as fyInsetBottom,HR as fyInsetTop,fD as fyLabel,dD as fyLabelAnchor,hD as fyLabelOffset,uD as fyLine,JR as fyPadding,tD as fyPaddingInner,eD as fyPaddingOuter,GR as fyRange,gD as fyReverse,ZR as fyRound,aD as fyTickFormat,sD as fyTickPadding,cD as fyTickRotate,iD as fyTickSize,oD as fyTickSpacing,nD as fyTicks,kF as geo,Jp as geojson,PF as graticule,W8 as grid,FF as gridFx,CF as gridFy,DF as gridX,LF as gridY,Di as gt,oA as gte,lW as hconcat,dF as heatmap,B8 as height,XL as hexagon,mF as hexbin,yF as hexgrid,UF as highlight,dW as hspace,IF as hull,sF as image,Y8 as inset,ve as int32,xW as interactorDirectives,$F as intervalX,jF as intervalXY,zF as intervalY,jr as isBetween,sA as isDistinct,aA as isNotBetween,Yf as isNotDistinct,Ri as isNotNull,Kl as isNull,RT as kurtosis,SA as lag,CT as last,TA as last_value,Wf as lead,bW as legendDirectives,yL as lengthBase,dL as lengthClamp,xL as lengthConstant,uL as lengthDomain,gL as lengthExponent,hL as lengthNice,pL as lengthPercent,fL as lengthRange,lL as lengthScale,mL as lengthZero,LL as line,FL as lineX,CL as lineY,AF as link,Er as literal,DA as loadCSV,OA as loadExtension,LA as loadJSON,kA as loadObjects,FA as loadParquet,CA as loadSpatial,ze as lt,ri as lte,DT as mad,L8 as margin,z8 as marginBottom,P8 as marginLeft,U8 as marginRight,$8 as marginTop,D8 as margins,gW as markDirectives,zr as max,LT as median,nW as menu,zn as min,FT as mode,O8 as name,M8 as namedPlots,qF as nearest,VF as nearestX,YF as nearestY,so as neq,nA as not,AA as nth_value,vA as ntile,WD as opacityBase,UD as opacityClamp,XD as opacityConstant,BD as opacityDomain,GD as opacityExponent,zD as opacityLabel,oC as opacityLegend,$D as opacityNice,jD as opacityPercent,PD as opacityRange,qD as opacityReverse,kD as opacityScale,YD as opacityTickFormat,VD as opacityZero,Oi as or,X8 as padding,ZF as pan,KF as panX,JF as panY,tC as panZoom,eC as panZoomX,rC as panZoomY,_A as percent_rank,_W as plot,kT as product,NL as projectionClip,SL as projectionDomain,IL as projectionInset,ML as projectionInsetBottom,TL as projectionInsetLeft,AL as projectionInsetRight,EL as projectionInsetTop,_L as projectionParallels,wL as projectionPrecision,vL as projectionRotate,bL as projectionType,BT as quantile,sL as rBase,eL as rClamp,cL as rConstant,JD as rDomain,aL as rExponent,nL as rLabel,rL as rNice,iL as rPercent,tL as rRange,KD as rScale,oL as rZero,xA as rank,hF as raster,pF as rasterTile,zL as rect,jL as rectX,qL as rectY,WF as region,gF as regressionY,N8 as requestNamedPlot,yk as restConnector,gA as row_number,KL as ruleX,JL as ruleY,iW as search,qT as skewness,oW as slider,xb as socketConnector,BF as sphere,oF as spike,tr as sql,Zp as stddev,VT as stddevPop,YT as stringAgg,C8 as style,de as sum,QD as symbolDomain,sC as symbolLegend,ZD as symbolRange,HD as symbolScale,sW as table,HL as text,QL as textX,ZL as textY,tF as tickX,eF as tickY,Tf as toggle,QF as toggleColor,GF as toggleX,XF as toggleY,HF as toggleZ,GT as varPop,WT as variance,cW as vconcat,rF as vector,nF as vectorX,iF as vectorY,_F as voronoi,wF as voronoiMesh,fW as vspace,g5 as wasmConnector,k8 as width,sO as xAlign,TO as xAriaDescription,IO as xAriaLabel,uO as xAxis,NO as xBase,iO as xClamp,RO as xConstant,K8 as xDomain,OO as xExponent,SO as xFontVariant,gO as xGrid,eO as xInset,rO as xInsetLeft,nO as xInsetRight,bO as xLabel,_O as xLabelAnchor,wO as xLabelArrow,vO as xLabelOffset,xO as xLine,tO as xNice,aO as xPadding,cO as xPaddingInner,lO as xPaddingOuter,AO as xPercent,J8 as xRange,EO as xReverse,oO as xRound,Z8 as xScale,mO as xTickFormat,pO as xTickPadding,yO as xTickRotate,dO as xTickSize,hO as xTickSpacing,fO as xTicks,MO as xZero,F8 as xyDomain,zO as yAlign,sR as yAriaDescription,oR as yAriaLabel,YO as yAxis,uR as yBase,UO as yClamp,dR as yConstant,LO as yDomain,fR as yExponent,iR as yFontVariant,KO as yGrid,kO as yInset,PO as yInsetBottom,BO as yInsetTop,tR as yLabel,eR as yLabelAnchor,rR as yLabelArrow,nR as yLabelOffset,JO as yLine,CO as yNice,jO as yPadding,qO as yPaddingInner,VO as yPaddingOuter,aR as yPercent,FO as yRange,cR as yReverse,$O as yRound,DO as yScale,QO as yTickFormat,HO as yTickPadding,ZO as yTickRotate,GO as yTickSize,XO as yTickSpacing,WO as yTicks,lR as yZero};
69
+ }`)).call(Rh,r);for(let k of l){let{channels:P,values:U,facets:$}=m.get(k);if(p===void 0||k.facet==="super"){let X=null;if($&&(X=$[0],X=k.filter(X,P,U),X.length===0))continue;let rt=k.render(X,x,U,w,T);if(rt==null)continue;E.appendChild(rt)}else{let X;for(let rt of p){if(!(k.facetAnchor?.(p,R,rt)??!rt.empty))continue;let ot=null;if($){let Y=f.has(k);if(ot=$[Y?rt.i:0],ot=k.filter(ot,P,U),ot.length===0)continue;!Y&&ot===$[0]&&(ot=Qa(ot)),ot.fx=rt.x,ot.fy=rt.y,ot.fi=rt.i}let at=k.render(ot,x,U,v,T);if(at!=null){(X??=Qt(E).append("g")).append(()=>at).datum(rt);for(let Y of["aria-label","aria-description","aria-hidden","transform"])at.hasAttribute(Y)&&(X.attr(Y,at.getAttribute(Y)),at.removeAttribute(Y))}}X?.selectChildren().attr("transform",C)}}let O=jj(y,T,e),{figure:L=n!=null||i!=null||o!=null||O.length>0}=e;L&&(N=A.createElement("figure"),N.className=`${c}-figure`,N.style.maxWidth="initial",n!=null&&N.append(nq(A,n,"h2")),i!=null&&N.append(nq(A,i,"h3")),N.append(...O,E),o!=null&&N.append(ist(A,o)),"value"in E&&(N.value=E.value,delete E.value)),N.scale=Nz(x.scales),N.legend=$j(y,T,e);let B=sz();return B>0&&Qt(E).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.`),N}function nq(e,t,r){if(t.ownerDocument)return t;let n=e.createElement(r);return n.append(t),n}function ist(e,t){let r=e.createElement("figcaption");return r.append(t),r}function iq(e){return e.flat(1/0).filter(t=>t!=null).map(ost)}function ost(e){return typeof e.render=="function"?e:new NN(e)}var NN=class extends vt{constructor(t){if(typeof t!="function")throw new TypeError("invalid mark; missing render function");super(),this.render=t}render(){}};function ON(e,t){for(let r in e)cq(e[r],t);return e}function cq(e,t){let{scale:r,transform:n=!0}=e;if(r==null||!n)return;let{type:i,percent:o,interval:s,transform:a=o?c=>c==null?NaN:c*100:S4(s,i)}=t[r]??{};a!=null&&(e.value=Xt(e.value,a),e.transform=!1)}function sst(e){for(let t in e)U4(t,e[t])}function y0(e,t,r,n=f$){for(let{channels:i}of t.values())for(let o in i){let s=i[o],{scale:a}=s;if(a!=null&&n(a))if(a==="projection"){if(!$z(r)){let c=r.x?.domain===void 0,l=r.y?.domain===void 0;if(c||l){let[u,f]=jz(s);c&&MN(e,"x",u),l&&MN(e,"y",f)}}}else MN(e,a,s)}return e}function MN(e,t,r){let n=e.get(t);n!==void 0?n.push(r):e.set(t,[r])}function ast(e,t){if(e==null)return;let{x:r,y:n}=e;if(r==null&&n==null)return;let i=Xa(e.data);if(i==null)throw new Error("missing facet data");let o={};r!=null&&(o.fx=Ih(i,{value:r,scale:"fx"})),n!=null&&(o.fy=Ih(i,{value:n,scale:"fy"})),ON(o,t);let s=SS(i,o);return{channels:o,groups:s,data:e.data}}function oq(e,t,r){if(e.facet===null||e.facet==="super")return;let{fx:n,fy:i}=e;if(n!=null||i!=null){let c=Xa(e.data??n??i);if(c===void 0)throw new Error(`missing facet data in ${e.ariaLabel}`);if(c===null)return;let l={};return n!=null&&(l.fx=Ih(c,{value:n,scale:"fx"})),i!=null&&(l.fy=Ih(c,{value:i,scale:"fy"})),ON(l,r),{channels:l,groups:SS(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)&&cl(Xa(e.data))===cl(a)&&mn(`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 cst(e,t={}){return Ne({...t,x:null,y:null},(r,n,i,o,s,a)=>a.getMarkState(e))}function lst(e){let t=[];for(let r of e){let n=r.tip;if(n){n===!0?n={}:typeof n=="string"&&(n={pointer:n});let{pointer:i,preferredAnchor:o}=n;i=/^x$/i.test(i)?bl:/^y$/i.test(i)?ic:xl,n=i(cst(r,n)),n.title=null,o===void 0&&(n.preferredAnchor=i===ic?"left":"bottom");let s=JS(r.data,n);s.facet=r.facet,s.facetAnchor=r.facetAnchor,t.push(s)}}return t}function ust(e,t,r){let{projection:n,x:i={},y:o={},fx:s={},fy:a={},axis:c,grid:l,facet:u={},facet:{axis:f=c,grid:d}=u,x:{axis:h=c,grid:p=h===null?null:l}=i,y:{axis:m=c,grid:y=m===null?null:l}=o,fx:{axis:g=f,grid:x=g===null?null:d}=s,fy:{axis:b=f,grid:_=b===null?null:d}=a}=r;(n||!vs(i)&&!sq("x",e))&&(h=p=null),(n||!vs(o)&&!sq("y",e))&&(m=y=null),t.has("fx")||(g=x=null),t.has("fy")||(b=_=null),h===void 0&&(h=!rI(e,"x")),m===void 0&&(m=!rI(e,"y")),g===void 0&&(g=!rI(e,"fx")),b===void 0&&(b=!rI(e,"fy")),h===!0&&(h="bottom"),m===!0&&(m="left"),g===!0&&(g=h==="top"||h===null?"bottom":"top"),b===!0&&(b=m==="right"||m===null?"left":"right");let v=[];return eI(v,_,VS,a),tI(v,b,zS,"right","left",u,a),eI(v,x,WS,s),tI(v,g,jS,"top","bottom",u,s),eI(v,y,qS,o),tI(v,m,a0,"left","right",r,o),eI(v,p,YS,i),tI(v,h,c0,"bottom","top",r,i),v}function tI(e,t,r,n,i,o,s){if(!t)return;let a=fst(t);s=dst(a?n:t,o,s);let{line:c}=s;(r===a0||r===c0)&&c&&!Ka(c)&&e.push(zh(hst(s))),e.push(r(s)),a&&e.push(r({...s,anchor:i,label:null}))}function eI(e,t,r,n){!t||Ka(t)||e.push(r(pst(t,n)))}function fst(e){return/^\s*both\s*$/i.test(e)}function dst(e,t,{line:r=t.line,ticks:n,tickSize:i,tickSpacing:o,tickPadding:s,tickFormat:a,tickRotate:c,fontVariant:l,ariaLabel:u,ariaDescription:f,label:d=t.label,labelAnchor:h,labelArrow:p=t.labelArrow,labelOffset:m}){return{anchor:e,line:r,ticks:n,tickSize:i,tickSpacing:o,tickPadding:s,tickFormat:a,tickRotate:c,fontVariant:l,ariaLabel:u,ariaDescription:f,label:d,labelAnchor:h,labelArrow:p,labelOffset:m}}function hst(e){let{anchor:t,line:r}=e;return{anchor:t,facetAnchor:t+"-empty",stroke:r===!0?void 0:r}}function pst(e,{stroke:t=ul(e)?e:void 0,ticks:r=mst(e)?e:void 0,tickSpacing:n,ariaLabel:i,ariaDescription:o}){return{stroke:t,ticks:r,tickSpacing:n,ariaLabel:i,ariaDescription:o}}function mst(e){switch(typeof e){case"number":return!0;case"string":return!ul(e)}return kn(e)||typeof e?.range=="function"}function rI(e,t){let r=`${t}-axis `;return e.some(n=>n.ariaLabel?.startsWith(r))}function sq(e,t){for(let r of t)for(let n in r.channels){let{scale:i}=r.channels[n];if(i===e||i==="projection")return!0}return!1}function yst(e,t){for(let r in e){let n=e[r],i=t[r];n.label===void 0&&i&&(n.label=i.label)}return e}function gst({fx:e,fy:t},r){let{marginTop:n,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=_S(r),l=e&&aq(e),u=t&&aq(t);return{marginTop:t?u[0]:n,marginRight:e?a-l[1]:i,marginBottom:t?c-u[1]:o,marginLeft:e?l[0]:s,inset:{marginTop:r.marginTop,marginRight:r.marginRight,marginBottom:r.marginBottom,marginLeft:r.marginLeft},width:a,height:c}}function aq(e){let t=e.domain();if(t.length===0)return[0,e.bandwidth()];let r=e(t[0]),n=e(t[t.length-1]);return n<r&&([r,n]=[n,r]),[r,n+e.bandwidth()]}var xst=new Map([["basis",z6],["basis-closed",j6],["basis-open",q6],["bundle",V6],["bump-x",k6],["bump-y",B6],["cardinal",Y6],["cardinal-closed",W6],["cardinal-open",G6],["catmull-rom",X6],["catmull-rom-closed",H6],["catmull-rom-open",Q6],["linear",Va],["linear-closed",Z6],["monotone-x",J6],["monotone-y",t4],["natural",e4],["step",r4],["step-after",i4],["step-before",n4]]);function g0(e=Va,t){if(typeof e=="function")return e;let r=xst.get(`${e}`.toLowerCase());if(!r)throw new Error(`unknown curve: ${e}`);if(t!==void 0){if("beta"in r)return r.beta(t);if("tension"in r)return r.tension(t);if("alpha"in r)return r.alpha(t)}return r}function nI(e=Tl,t){return typeof e!="function"&&`${e}`.toLowerCase()==="auto"?Tl:g0(e,t)}function Tl(e){return Va(e)}function Ds(e={y:"count"},t={}){[e,t]=DN(e,t);let{x:r,y:n}=t;return RN(iI(r,t,G),null,null,n,e,sf(t))}function Ls(e={x:"count"},t={}){[e,t]=DN(e,t);let{x:r,y:n}=t;return RN(null,iI(n,t,G),r,null,e,af(t))}function sc(e={fill:"count"},t={}){[e,t]=DN(e,t);let{x:r,y:n}=bst(t);return RN(r,n,null,null,e,sf(af(t)))}function fq(e,t,r={}){if(r?.interval==null)return r;let{reduce:n=pS}=r,i={filter:null};return r[t]!=null&&(i[t]=n),r[`${t}1`]!=null&&(i[`${t}1`]=n),r[`${t}2`]!=null&&(i[`${t}2`]=n),e(i,r)}function qh(e={}){return fq(Ds,"y",Do(e,"x"))}function Vh(e={}){return fq(Ls,"x",Do(e,"y"))}function RN(e,t,r,n,{data:i=hS,filter:o=Hg,sort:s,reverse:a,...c}={},l={}){e=lq(e),t=lq(t),c=_st(c,l),i=pq(i,G),s=s==null?void 0:dq("sort",s,l),o=o==null?void 0:hq("filter",o,l),r!=null&&Es(c,"x","x1","x2")&&(r=null),n!=null&&Es(c,"y","y1","y2")&&(n=null);let[u,f]=tn(e),[d,h]=tn(e),[p,m]=tn(t),[y,g]=tn(t),[x,b]=r!=null?[r,"x"]:n!=null?[n,"y"]:[],[_,v]=tn(x),{x:w,y:T,z:A,fill:E,stroke:N,x1:I,x2:R,y1:C,y2:S,domain:M,cumulative:O,thresholds:L,interval:B,...k}=l,[P,U]=tn(A),[$]=qe(E),[X]=qe(N),[rt,ot]=tn($),[at,Y]=tn(X);return{..."z"in l&&{z:P||A},..."fill"in l&&{fill:rt||E},..."stroke"in l&&{stroke:at||N},...mr(k,(st,q,H)=>{let nt=tf(_t(st,x),H?.[b]),z=_t(st,A),Pt=_t(st,$),ht=_t(st,X),Zt=Kg(c,{z,fill:Pt,stroke:ht}),Jt=[],tt=[],ge=nt&&v([]),Kn=z&&U([]),Bo=Pt&&ot([]),SW=ht&&Y([]),uC=e&&f([]),IW=e&&h([]),fC=t&&m([]),TW=t&&g([]),AW=Sst(e,t,st),EW=0;for(let Af of c)Af.initialize(st);s&&s.initialize(st),o&&o.initialize(st);for(let Af of q){let dC=[];for(let Ef of c)Ef.scope("facet",Af);s&&s.scope("facet",Af),o&&o.scope("facet",Af);for(let[Ef,MW]of As(Af,Zt))for(let[NW,vx]of As(MW,nt))for(let[Po,zs]of AW(vx))if(Zt&&(zs.z=Ef),!(o&&!o.reduce(Po,zs))){dC.push(EW++),tt.push(i.reduceIndex(Po,st,zs)),nt&&ge.push(NW),z&&Kn.push(Zt===z?Ef:z[(Po.length>0?Po:vx)[0]]),Pt&&Bo.push(Zt===Pt?Ef:Pt[(Po.length>0?Po:vx)[0]]),ht&&SW.push(Zt===ht?Ef:ht[(Po.length>0?Po:vx)[0]]),uC&&(uC.push(zs.x1),IW.push(zs.x2)),fC&&(fC.push(zs.y1),TW.push(zs.y2));for(let OW of c)OW.reduce(Po,zs);s&&s.reduce(Po,zs)}Jt.push(dC)}return k4(Jt,s,a),{data:tt,facets:Jt}}),...!Es(c,"x")&&(u?{x1:u,x2:d,x:bh(u,d)}:{x:w,x1:I,x2:R}),...!Es(c,"y")&&(p?{y1:p,y2:y,y:bh(p,y)}:{y:T,y1:C,y2:S}),..._&&{[b]:_},...Object.fromEntries(c.map(({name:st,output:q})=>[st,q]))}}function DN({cumulative:e,domain:t,thresholds:r,interval:n,...i},o){return[i,{cumulative:e,domain:t,thresholds:r,interval:n,...o}]}function iI(e,{cumulative:t,domain:r,thresholds:n,interval:i},o){return e={...Ki(e)},e.domain===void 0&&(e.domain=r),e.cumulative===void 0&&(e.cumulative=t),e.thresholds===void 0&&(e.thresholds=n),e.interval===void 0&&(e.interval=i),e.value===void 0&&(e.value=o),e.thresholds=LN(e.thresholds,e.interval),e}function bst(e){let{x:t,y:r}=e;return t=iI(t,e),r=iI(r,e),[t.value,r.value]=Ke(t.value,r.value),{x:t,y:r}}function lq(e){if(e==null)return;let{value:t,cumulative:r,domain:n=ce,thresholds:i}=e,o=s=>{let a=_t(s,t),c;if(Ve(a)||vst(i)){a=Xt(a,x4,Float64Array);let[u,f]=typeof n=="function"?n(a):n,d=typeof i=="function"&&!ll(i)?i(a,u,f):i;typeof d=="number"&&(d=yg(u,f,d)),ll(d)&&(n===ce&&(u=d.floor(u),f=d.offset(d.floor(f))),d=d.range(u,d.offset(f))),c=d}else{a=pr(a);let[u,f]=typeof n=="function"?n(a):n,d=typeof i=="function"&&!ll(i)?i(a,u,f):i;if(typeof d=="number")if(n===ce){let h=Aa(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 y=m-p+1;d=new Float64Array(y);for(let g=0;g<y;++g)d[g]=(p+g)*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 y=m-p+1;d=new Float64Array(y);for(let g=0;g<y;++g)d[g]=(p+g)/h}else d=[u];else d=[u]}else d=Qr(u,f,d);else ll(d)&&(n===ce&&(u=d.floor(u),f=d.offset(d.floor(f))),d=d.range(u,d.offset(f)));c=d}let l=[];if(c.length===1)l.push([c[0],c[0]]);else for(let u=1;u<c.length;++u)l.push([c[u-1],c[u]]);return l.bin=(r<0?Tst:r>0?Ist:FN)(l,c,a),l};return o.label=en(t),o}function LN(e,t,r=uq){if(e===void 0)return t===void 0?r:Is(t);if(typeof e=="string"){switch(e.toLowerCase()){case"freedman-diaconis":return H_;case"scott":return fy;case"sturges":return $c;case"auto":return uq}return Ku(e)}return e}function _st(e,t){return F4(e,t,dq)}function dq(e,t,r){return fS(e,t,r,hq)}function hq(e,t,r){return dS(e,t,r,pq)}function pq(e,t){return Sh(e,t,wst)}function wst(e){switch(`${e}`.toLowerCase()){case"x":return Ast;case"x1":return Mst;case"x2":return Nst;case"y":return Est;case"y1":return Ost;case"y2":return Rst;case"z":return B4}throw new Error(`invalid bin reduce: ${e}`)}function uq(e,t,r){return Math.min(200,fy(e,t,r))}function vst(e){return p$(e)||kn(e)&&Ve(e)}function Sst(e,t,r){let n=e?.(r),i=t?.(r);return n&&i?function*(o){let s=n.bin(o);for(let[a,[c,l]]of n.entries()){let u=i.bin(s[a]);for(let[f,[d,h]]of i.entries())yield[u[f],{data:r,x1:c,y1:d,x2:l,y2:h}]}}:n?function*(o){let s=n.bin(o);for(let[a,[c,l]]of n.entries())yield[s[a],{data:r,x1:c,x2:l}]}:function*(o){let s=i.bin(o);for(let[a,[c,l]]of i.entries())yield[s[a],{data:r,y1:c,y2:l}]}}function FN(e,t,r){return t=pr(t),n=>{let i=e.map(()=>[]);for(let o of n)i[Ia(t,r[o])-1]?.push(o);return i}}function Ist(e,t,r){let n=FN(e,t,r);return i=>{let o=n(i);for(let s=1,a=o.length;s<a;++s){let c=o[s-1],l=o[s];for(let u of c)l.push(u)}return o}}function Tst(e,t,r){let n=FN(e,t,r);return i=>{let o=n(i);for(let s=o.length-2;s>=0;--s){let a=o[s+1],c=o[s];for(let l of a)c.push(l)}return o}}function mq(e,t){let r=(+e+ +t)/2;return e instanceof Date?new Date(r):r}var Ast={reduceIndex(e,t,{x1:r,x2:n}){return mq(r,n)}},Est={reduceIndex(e,t,{y1:r,y2:n}){return mq(r,n)}},Mst={reduceIndex(e,t,{x1:r}){return r}},Nst={reduceIndex(e,t,{x2:r}){return r}},Ost={reduceIndex(e,t,{y1:r}){return r}},Rst={reduceIndex(e,t,{y2:r}){return r}};var Dst={ariaLabel:"area",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},hf=class extends vt{constructor(t,r={}){let{x1:n,y1:i,x2:o,y2:s,z:a,curve:c,tension:l}=r;super(t,{x1:{value:n,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0},z:{value:pn(r),optional:!0}},r,Dst),this.z=a,this.curve=g0(c,l)}filter(t){return t}render(t,r,n,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a}=n;return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,r,0,0).call(u=>u.selectAll().data(NS(t,[s,a,c,l],this,n)).enter().append("path").call(Mt,this).call(of,this,n).attr("d",ah().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 x0(e,t){return t===void 0?ac(e,{x:Ju,y:sl}):new hf(e,t)}function Al(e,t){let{y:r=Ee,...n}=Vh(t);return new hf(e,Sl(wl({...n,y1:r,y2:void 0})))}function ac(e,t){let{x:r=Ee,...n}=qh(t);return new hf(e,Il(vl({...n,x1:r,x2:void 0})))}var Lst={ariaLabel:"link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},b0=class extends vt{constructor(t,r={}){let{x1:n,y1:i,x2:o,y2:s,curve:a,tension:c}=r;super(t,{x1:{value:n,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},r,Lst),this.curve=nI(a,c),Lo(this,r)}project(t,r,n){this.curve!==Tl&&super.project(t,r,n)}render(t,r,n,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a}=n,{curve:u}=this;return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,r).call(f=>f.selectAll().data(t).enter().append("path").call(Mt,this).attr("d",u===Tl&&o.projection?Fst(o.projection,s,a,c,l):d=>{let h=Nn(),p=u(h);return p.lineStart(),p.point(s[d],a[d]),p.point(c[d],l[d]),p.lineEnd(),h}).call(Wt,this,n).call(oc,this,n,o)).node()}};function Fst(e,t,r,n,i){let o=Dr(e);return t=pr(t),r=pr(r),n=pr(n),i=pr(i),s=>o({type:"LineString",coordinates:[[t[s],r[s]],[n[s],i[s]]]})}function oI(e,{x:t,x1:r,x2:n,y:i,y1:o,y2:s,...a}={}){return[r,n]=_0(t,r,n),[o,s]=_0(i,o,s),new b0(e,{...a,x1:r,x2:n,y1:o,y2:s})}function _0(e,t,r){if(e===void 0){if(t===void 0){if(r!==void 0)return[r]}else if(r===void 0)return[t]}else{if(t===void 0)return r===void 0?[e]:[e,r];if(r===void 0)return[e,t]}return[t,r]}var Cst={ariaLabel:"arrow",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:1,strokeWidth:1.5},w0=class extends vt{constructor(t,r={}){let{x1:n,y1:i,x2:o,y2:s,bend:a=0,headAngle:c=60,headLength:l=8,inset:u=0,insetStart:f=u,insetEnd:d=u,sweep:h}=r;super(t,{x1:{value:n,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},r,Cst),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=kst(h)}render(t,r,n,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a,SW:u}=n,{strokeWidth:f,bend:d,headAngle:h,headLength:p,insetStart:m,insetEnd:y}=this,g=u?_=>u[_]:Ye(f===void 0?1:f),x=h*Dh/2,b=p/1.5;return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,r).call(_=>_.selectAll().data(t).enter().append("path").call(Mt,this).attr("d",v=>{let w=s[v],T=a[v],A=c[v],E=l[v],N=Math.hypot(A-w,E-T);if(N<=m+y)return null;let I=Math.atan2(E-T,A-w),R=Math.min(b*g(v),N/3),C=this.sweep(w,T,A,E)*d*Dh,S=Math.hypot(N/Math.tan(C),N)/2;if(m||y)if(S<1e5){let rt=Math.sign(C),[ot,at]=Bst([w,T],[A,E],S,rt);if(m&&([w,T]=yq([ot,at,S],[w,T,m],-rt*Math.sign(m))),y){let[Y,st]=yq([ot,at,S],[A,E,y],rt*Math.sign(y));I+=Math.atan2(st-at,Y-ot)-Math.atan2(E-at,A-ot),A=Y,E=st}}else{let rt=A-w,ot=E-T,at=Math.hypot(rt,ot);m&&(w+=rt/at*m,T+=ot/at*m),y&&(A-=rt/at*y,E-=ot/at*y)}let M=I+C,O=M+x,L=M-x,B=A-R*Math.cos(O),k=E-R*Math.sin(O),P=A-R*Math.cos(L),U=E-R*Math.sin(L),$=S<1e5?`A${S},${S} 0,0,${C>0?1:0} `:"L",X=R?`M${B},${k}L${A},${E}L${P},${U}`:"";return`M${w},${T}${$}${A},${E}${X}`}).call(Wt,this,n)).node()}};function kst(e=1){if(typeof e=="number")return Ye(Math.sign(e));if(typeof e=="function")return(t,r,n,i)=>Math.sign(e(t,r,n,i));switch(Sr(e,"sweep",["+x","-x","+y","-y"])){case"+x":return(t,r,n)=>Ft(t,n);case"-x":return(t,r,n)=>vn(t,n);case"+y":return(t,r,n,i)=>Ft(r,i);case"-y":return(t,r,n,i)=>vn(r,i)}}function Bst([e,t],[r,n],i,o){let s=r-e,a=n-t,c=Math.hypot(s,a),l=o*Math.sqrt(i*i-c*c/4)/c;return[(e+r)/2-a*l,(t+n)/2+s*l]}function yq([e,t,r],[n,i,o],s){let a=n-e,c=i-t,l=Math.hypot(a,c),u=(a*a+c*c-o*o+r*r)/(2*l),f=s*Math.sqrt(r*r-u*u);return[e+(a*u+c*f)/l,t+(c*u-a*f)/l]}function gq(e,{x:t,x1:r,x2:n,y:i,y1:o,y2:s,...a}={}){return[r,n]=_0(t,r,n),[o,s]=_0(i,o,s),new w0(e,{...a,x1:r,x2:n,y1:o,y2:s})}var Pst={ariaLabel:"bar"},Yh=class extends vt{constructor(t,r,n={},i=Pst){super(t,r,n,i),u0(this,n),f0(this,n)}render(t,r,n,i,o){let{rx:s,ry:a,rx1y1:c,rx1y2:l,rx2y1:u,rx2y2:f}=this,d=this._x(r,n,i),h=this._y(r,n,i),p=this._width(r,n,i),m=this._height(r,n,i);return lt("svg:g",o).call(kt,this,i,o).call(this._transform,this,r).call(y=>y.selectAll().data(t).enter().call(c||l||u||f?g=>g.append("path").call(Mt,this).call(d0,d,h,xq(d,p),xq(h,m),this).call(Wt,this,n):g=>g.append("rect").call(Mt,this).attr("x",d).attr("width",p).attr("y",h).attr("height",m).call(dt,"rx",s).call(dt,"ry",a).call(Wt,this,n))).node()}_x(t,{x:r},{marginLeft:n}){let{insetLeft:i}=this;return r?o=>r[o]+i:n+i}_y(t,{y:r},{marginTop:n}){let{insetTop:i}=this;return r?o=>r[o]+i:n+i}_width({x:t},{x:r},{marginRight:n,marginLeft:i,width:o}){let{insetLeft:s,insetRight:a}=this,c=r&&t?t.bandwidth():o-n-i;return Math.max(0,c-s-a)}_height({y:t},{y:r},{marginTop:n,marginBottom:i,height:o}){let{insetTop:s,insetBottom:a}=this,c=r&&t?t.bandwidth():o-n-i;return Math.max(0,c-s-a)}};function xq(e,t){return typeof e=="function"&&typeof t=="function"?r=>e(r)+t(r):typeof e=="function"?r=>e(r)+t:typeof t=="function"?r=>e+t(r):e+t}var pf=class extends Yh{constructor(t,r={},n){let{x1:i,x2:o,y:s}=r;super(t,{x1:{value:i,scale:"x"},x2:{value:o,scale:"x"},y:{value:s,scale:"y",type:"band",optional:!0}},r,n)}_transform(t,r,{x:n}){t.call(Rt,r,{x:n},0,0)}_x({x:t},{x1:r,x2:n},{marginLeft:i}){let{insetLeft:o}=this;return wi(t)?i+o:s=>Math.min(r[s],n[s])+o}_width({x:t},{x1:r,x2:n},{marginRight:i,marginLeft:o,width:s}){let{insetLeft:a,insetRight:c}=this;return wi(t)?s-i-o-a-c:l=>Math.max(0,Math.abs(n[l]-r[l])-a-c)}},mf=class extends Yh{constructor(t,r={},n){let{x:i,y1:o,y2:s}=r;super(t,{y1:{value:o,scale:"y"},y2:{value:s,scale:"y"},x:{value:i,scale:"x",type:"band",optional:!0}},r,n)}_transform(t,r,{y:n}){t.call(Rt,r,{y:n},0,0)}_y({y:t},{y1:r,y2:n},{marginTop:i}){let{insetTop:o}=this;return wi(t)?i+o:s=>Math.min(r[s],n[s])+o}_height({y:t},{y1:r,y2:n},{marginTop:i,marginBottom:o,height:s}){let{insetTop:a,insetBottom:c}=this;return wi(t)?s-i-o-a-c:l=>Math.max(0,Math.abs(n[l]-r[l])-a-c)}};function Fs(e,t={}){return Ha(t)||(t={...t,y:Ee,x2:G}),new pf(e,Sl(Lh(wl(t))))}function Cs(e,t={}){return Ha(t)||(t={...t,x:Ee,y2:G}),new mf(e,Il(Fh(vl(t))))}var Ust={ariaLabel:"cell"},yf=class extends Yh{constructor(t,{x:r,y:n,...i}={}){super(t,{x:{value:r,scale:"x",type:"band",optional:!0},y:{value:n,scale:"y",type:"band",optional:!0}},i,Ust)}_transform(t,r){t.call(Rt,r,{},0,0)}};function El(e,{x:t,y:r,...n}={}){return[t,r]=Ke(t,r),new yf(e,{...n,x:t,y:r})}function bq(e,{x:t=Ee,fill:r,stroke:n,...i}={}){return r===void 0&&qe(n)[0]===void 0&&(r=G),new yf(e,{...i,x:t,fill:r,stroke:n})}function _q(e,{y:t=Ee,fill:r,stroke:n,...i}={}){return r===void 0&&qe(n)[0]===void 0&&(r=G),new yf(e,{...i,y:t,fill:r,stroke:n})}var $st={ariaLabel:"dot",fill:"none",stroke:"currentColor",strokeWidth:1.5};function v0(e){return e.sort===void 0&&e.reverse===void 0?lS({channel:"-r"},e):e}var gf=class extends vt{constructor(t,r={}){let{x:n,y:i,r:o,rotate:s,symbol:a=Ya,frameAnchor:c}=r,[l,u]=ye(s,0),[f,d]=M$(a),[h,p]=ye(o,f==null?3:4.5);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:h,scale:"r",filter:Fn,optional:!0},rotate:{value:l,optional:!0},symbol:{value:f,scale:"auto",optional:!0}},v0(r),$st),this.r=p,this.rotate=u,this.symbol=d,this.frameAnchor=Ts(c);let{channels:m}=this,{symbol:y}=m;if(y){let{fill:g,stroke:x}=m;y.hint={fill:g?g.value===y.value?"color":"currentColor":this.fill??"currentColor",stroke:x?x.value===y.value?"color":"currentColor":this.stroke??"none"}}}render(t,r,n,i,o){let{x:s,y:a}=r,{x:c,y:l,r:u,rotate:f,symbol:d}=n,{r:h,rotate:p,symbol:m}=this,[y,g]=Ur(this,i),x=m===Ya,b=u?void 0:h*h*Math.PI;return el(h)&&(t=[]),lt("svg:g",o).call(kt,this,i,o).call(Rt,this,{x:c&&s,y:l&&a}).call(_=>_.selectAll().data(t).enter().append(x?"circle":"path").call(Mt,this).call(x?v=>{v.attr("cx",c?w=>c[w]:y).attr("cy",l?w=>l[w]:g).attr("r",u?w=>u[w]:h)}:v=>{v.attr("transform",Fo`translate(${c?w=>c[w]:y},${l?w=>l[w]:g})${f?w=>` rotate(${f[w]})`:p?` rotate(${p})`:""}`).attr("d",u&&d?w=>{let T=Nn();return d[w].draw(T,u[w]*u[w]*Math.PI),T}:u?w=>{let T=Nn();return m.draw(T,u[w]*u[w]*Math.PI),T}:d?w=>{let T=Nn();return d[w].draw(T,b),T}:(()=>{let w=Nn();return m.draw(w,b),w})())}).call(Wt,this,n)).node()}};function to(e,{x:t,y:r,...n}={}){return n.frameAnchor===void 0&&([t,r]=Ke(t,r)),new gf(e,{...n,x:t,y:r})}function wq(e,{x:t=G,...r}={}){return new gf(e,LS({...r,x:t}))}function vq(e,{y:t=G,...r}={}){return new gf(e,DS({...r,y:t}))}function Sq(e,t){return to(e,{...t,symbol:"circle"})}function Iq(e,t){return to(e,{...t,symbol:"hexagon"})}var zst={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},xf=class extends vt{constructor(t,r={}){let{x:n,y:i,z:o,curve:s,tension:a}=r;super(t,{x:{value:n,scale:"x"},y:{value:i,scale:"y"},z:{value:pn(r),optional:!0}},r,zst),this.z=o,this.curve=nI(s,a),Lo(this,r)}filter(t){return t}project(t,r,n){this.curve!==Tl&&super.project(t,r,n)}render(t,r,n,i,o){let{x:s,y:a}=n,{curve:c}=this;return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,r).call(l=>l.selectAll().data(NS(t,[s,a],this,n)).enter().append("path").call(Mt,this).call(of,this,n).call(tj,this,n,o).attr("d",c===Tl&&o.projection?jst(o.projection,s,a):Tg().curve(c).defined(u=>u>=0).x(u=>s[u]).y(u=>a[u]))).node()}};function jst(e,t,r){let n=Dr(e);return t=pr(t),r=pr(r),i=>{let o=[],s=[o];for(let a of i)a===-1?(o=[],s.push(o)):o.push([t[a],r[a]]);return n({type:"MultiLineString",coordinates:s})}}function bf(e,{x:t,y:r,...n}={}){return[t,r]=Ke(t,r),new xf(e,{...n,x:t,y:r})}function Ml(e,{x:t=G,y:r=Ee,...n}={}){return new xf(e,Vh({...n,x:t,y:r}))}function Nl(e,{x:t=Ee,y:r=G,...n}={}){return new xf(e,qh({...n,x:t,y:r}))}function kN(e,t){t=qst(t);let{x:r,y:n,color:i,size:o}=t,s=sI(e,r),a=sI(e,n),c=sI(e,i),l=sI(e,o),{fx:u,fy:f,x:{value:d,reduce:h,zero:p,...m},y:{value:y,reduce:g,zero:x,...b},color:{value:_,color:v,reduce:w},size:{value:T,reduce:A},mark:E}=t;if(h===void 0&&(h=g==null&&d==null&&T==null&&y!=null?"count":null),g===void 0&&(g=h==null&&y==null&&T==null&&d!=null?"count":null),A===void 0&&T==null&&w==null&&h==null&&g==null&&(d==null||Ue(s))&&(y==null||Ue(a))&&(A="count"),p===void 0&&(p=aI(h)?!0:void 0),x===void 0&&(x=aI(g)?!0:void 0),d==null&&y==null)throw new Error("must specify x or y");if(h!=null&&y==null)throw new Error("reducing x requires y");if(g!=null&&d==null)throw new Error("reducing y requires x");E===void 0&&(E=T!=null||A!=null?"dot":aI(h)||aI(g)||w!=null?"bar":d!=null&&y!=null?Ue(s)||Ue(a)||h==null&&g==null&&!S0(s)&&!S0(a)?"dot":"line":d!=null||y!=null?"rule":null);let N,I,R;switch(E){case"dot":R=to,I="stroke";break;case"line":R=s&&a||h!=null||g!=null?x||g!=null||s&&S0(s)?Nl:p||h!=null||a&&S0(a)?Ml:bf:s?Ml:Nl,I="stroke",Aq(c)&&(N=null);break;case"area":R=!(x||g!=null)&&(p||h!=null||a&&S0(a))?Al:ac,I="fill",Aq(c)&&(N=null);break;case"rule":R=s?vi:Si,I="stroke";break;case"bar":R=h!=null?Ue(a)?Tq(h)&&s&&Ue(s)?El:Fs:Uh:g!=null?Ue(s)?Tq(g)&&a&&Ue(a)?El:Cs:$h:w!=null||A!=null?s&&Ue(s)&&a&&Ue(a)?El:s&&Ue(s)?Cs:a&&Ue(a)?Fs:h0:s&&Za(s)&&!(a&&Za(a))?Fs:a&&Za(a)&&!(s&&Za(s))?Cs:El,I="fill";break;default:throw new Error(`invalid mark: ${E}`)}let C={fx:u,fy:f,x:s??void 0,y:a??void 0,[I]:c??v,z:N,r:l??void 0,tip:!0},S,M={[I]:w??void 0,r:A??void 0};if(h!=null&&g!=null)throw new Error("cannot reduce both x and y");return g!=null?(M.y=g,S=Ue(s)?fl:Ds):h!=null?(M.x=h,S=Ue(a)?dl:Ls):(w!=null||A!=null)&&(s&&a?S=Ue(s)&&Ue(a)?Zg:Ue(s)?Ls:Ue(a)?Ds:sc:s?S=Ue(s)?fl:Ds:a&&(S=Ue(a)?dl:Ls)),(S===sc||S===Ds)&&(C.x={value:s,...m}),(S===sc||S===Ls)&&(C.y={value:a,...b}),p===void 0&&(p=s&&!(S===sc||S===Ds)&&(R===Fs||R===Al||R===Uh||R===Si)),x===void 0&&(x=a&&!(S===sc||S===Ls)&&(R===Cs||R===ac||R===$h||R===vi)),{fx:u??null,fy:f??null,x:{value:d??null,reduce:h??null,zero:!!p,...m},y:{value:y??null,reduce:g??null,zero:!!x,...b},color:{value:_??null,reduce:w??null,...v!==void 0&&{color:v}},size:{value:T??null,reduce:A??null},mark:E,markImpl:Eq[R],markOptions:C,transformImpl:Eq[S],transformOptions:M,colorMode:I}}function Mq(e,t){let r=kN(e,t),{fx:n,fy:i,x:{zero:o},y:{zero:s},markOptions:a,transformOptions:c,colorMode:l}=r,u=CN[r.markImpl],f=CN[r.transformImpl],d=n!=null||i!=null?zh({strokeOpacity:.1}):null,h=[o?vi([0]):null,s?Si([0]):null],p=u(e,f?f(c,a):a);return l==="stroke"?yr(d,h,p):yr(d,p,h)}function S0(e){let t,r;for(let n of e){if(n==null)continue;if(t===void 0){t=n;continue}let i=Math.sign(Ft(t,n));if(i){if(r!==void 0&&i!==r)return!1;t=n,r=i}}return!0}function qst({x:e,y:t,color:r,size:n,fx:i,fy:o,mark:s}={}){return bi(e)||(e=Wh(e)),bi(t)||(t=Wh(t)),bi(r)||(r=ul(r)?{color:r}:Wh(r)),bi(n)||(n=Wh(n)),bi(i)&&({value:i}=Wh(i)),bi(o)&&({value:o}=Wh(o)),s!=null&&(s=`${s}`.toLowerCase()),{x:e,y:t,color:r,size:n,fx:i,fy:o,mark:s}}function sI(e,t){let r=_t(e,t.value);return r&&(r.label=en(t.value)),r}function Wh(e){return Vst(e)?{reduce:e}:{value:e}}function aI(e){return/^(?:distinct|count|sum|proportion)$/i.test(e)}function Tq(e){return/^(?:first|last|mode)$/i.test(e)}function Vst(e){if(e==null)return!1;if(typeof e.reduceIndex=="function"||typeof e.reduce=="function"&&kr(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 Aq(e){return e?new In(e).size>e.length>>1:!1}var CN={dot:to,line:bf,lineX:Ml,lineY:Nl,areaX:Al,areaY:ac,ruleX:vi,ruleY:Si,barX:Fs,barY:Cs,rect:h0,rectX:Uh,rectY:$h,cell:El,bin:sc,binX:Ds,binY:Ls,group:Zg,groupX:fl,groupY:dl},Eq=Object.fromEntries(Object.entries(CN).map(([e,t])=>[t,e]));function Gh(e,t={}){let{x:r,x1:n,x2:i}=t;r===void 0&&n===void 0&&i===void 0&&(t={...t,x:r=G});let o={};return r!=null&&(o.x=e),n!=null&&(o.x1=e),i!=null&&(o.x2=e),Zn(o,t)}function Xh(e,t={}){let{y:r,y1:n,y2:i}=t;r===void 0&&n===void 0&&i===void 0&&(t={...t,y:r=G});let o={};return r!=null&&(o.y=e),n!=null&&(o.y1=e),i!=null&&(o.y2=e),Zn(o,t)}function Zn(e={},t={}){let r=pn(t),n=Object.entries(e).map(([i,o])=>{let s=nS(i,t);if(s==null)throw new Error(`missing channel: ${i}`);let[a,c]=Br(s);return{key:i,input:s,output:a,setOutput:c,map:Yst(o)}});return{...mr(t,(i,o)=>{let s=_t(i,r),a=n.map(({input:l})=>_t(i,l)),c=n.map(({setOutput:l})=>l(new Array(i.length)));for(let l of o)for(let u of s?Hr(l,f=>s[f]).values():[l])n.forEach(({map:f},d)=>f.mapIndex(u,a[d],c[d]));return{data:i,facets:o}}),...Object.fromEntries(n.map(({key:i,output:o})=>[i,o]))}}function Yst(e){if(e==null)throw new Error("missing map");if(typeof e.mapIndex=="function")return e;if(typeof e.map=="function"&&kr(e))return Wst(e);if(typeof e=="function")return BN(xh(e));switch(`${e}`.toLowerCase()){case"cumsum":return Xst;case"rank":return BN((t,r)=>dy(t,n=>r[n]));case"quantile":return BN((t,r)=>Gst(t,n=>r[n]))}throw new Error(`invalid map: ${e}`)}function Wst(e){return console.warn("deprecated map interface; implement mapIndex instead."),{mapIndex:e.map.bind(e)}}function Gst(e,t){let r=rs(e,t)-1;return dy(e,t).map(n=>n/r)}function BN(e){return{mapIndex(t,r,n){let i=e(t,r);if(i.length!==t.length)throw new Error("map function returned a mismatched length");for(let o=0,s=t.length;o<s;++o)n[t[o]]=i[o]}}}var Xst={mapIndex(e,t,r){let n=0;for(let i of e)r[i]=n+=t[i]}};function Nq(e={},t){return arguments.length===1&&(t=e),Gh(Hh(e),t)}function Oq(e={},t){return arguments.length===1&&(t=e),Xh(Hh(e),t)}function Hh(e={}){typeof e=="number"&&(e={k:e});let{k:t,reduce:r,shift:n,anchor:i,strict:o}=e;if(i===void 0&&n!==void 0&&(i=Qst(n),mn(`Warning: the shift option is deprecated; please use anchor "${i}" instead.`)),!((t=Math.floor(t))>0))throw new Error(`invalid k: ${t}`);return Zst(r)(t,Hst(i,t),o)}function Hst(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 Qst(e){switch(`${e}`.toLowerCase()){case"centered":return"middle";case"leading":return"start";case"trailing":return"end"}throw new Error(`invalid shift: ${e}`)}function Zst(e="mean"){if(typeof e=="string"){if(/^p\d{2}$/i.test(e))return cI(gh(e));switch(e.toLowerCase()){case"deviation":return cI(zi);case"max":return lI((t,r)=>Kt(t,n=>r[n]));case"mean":return Kst;case"median":return cI(Eo);case"min":return lI((t,r)=>Ht(t,n=>r[n]));case"mode":return lI((t,r)=>Ad(t,n=>r[n]));case"sum":return Rq;case"variance":return cI(Uc);case"difference":return eat;case"ratio":return rat;case"first":return nat;case"last":return iat}}if(typeof e!="function")throw new Error(`invalid reduce: ${e}`);return lI(xh(e))}function cI(e){return(t,r,n)=>n?{mapIndex(i,o,s){let a=l=>o[l]==null?NaN:+o[l],c=0;for(let l=0;l<t-1;++l)isNaN(a(l))&&++c;for(let l=0,u=i.length-t+1;l<u;++l)isNaN(a(l+t-1))&&++c,s[i[l+r]]=c===0?e(Qa(i,l,l+t),a):NaN,isNaN(a(l))&&--c}}:{mapIndex(i,o,s){let a=c=>o[c]==null?NaN:+o[c];for(let c=-r;c<0;++c)s[i[c+r]]=e(Qa(i,0,c+t),a);for(let c=0,l=i.length-r;c<l;++c)s[i[c+r]]=e(Qa(i,c,c+t),a)}}}function lI(e){return(t,r,n)=>n?{mapIndex(i,o,s){let a=0;for(let c=0;c<t-1;++c)a+=Pe(o[i[c]]);for(let c=0,l=i.length-t+1;c<l;++c)a+=Pe(o[i[c+t-1]]),a===t&&(s[i[c+r]]=e(Qa(i,c,c+t),o)),a-=Pe(o[i[c]])}}:{mapIndex(i,o,s){for(let a=-r;a<0;++a)s[i[a+r]]=e(Qa(i,0,a+t),o);for(let a=0,c=i.length-r;a<c;++a)s[i[a+r]]=e(Qa(i,a,a+t),o)}}}function Rq(e,t,r){return r?{mapIndex(n,i,o){let s=0,a=0;for(let c=0;c<e-1;++c){let l=i[n[c]];l===null||isNaN(l)?++s:a+=+l}for(let c=0,l=n.length-e+1;c<l;++c){let u=i[n[c]],f=i[n[c+e-1]];f===null||isNaN(f)?++s:a+=+f,o[n[c+t]]=s===0?a:NaN,u===null||isNaN(u)?--s:a-=+u}}}:{mapIndex(n,i,o){let s=0,a=n.length;for(let c=0,l=Math.min(a,e-t-1);c<l;++c)s+=+i[n[c]]||0;for(let c=-t,l=a-t;c<l;++c)s+=+i[n[c+e-1]]||0,o[n[c+t]]=s,s-=+i[n[c]]||0}}}function Kst(e,t,r){if(r){let n=Rq(e,t,r);return{mapIndex(i,o,s){n.mapIndex(i,o,s);for(let a=0,c=i.length-e+1;a<c;++a)s[i[a+t]]/=e}}}else return{mapIndex(n,i,o){let s=0,a=0,c=n.length;for(let l=0,u=Math.min(c,e-t-1);l<u;++l){let f=i[n[l]];f!==null&&!isNaN(f=+f)&&(s+=f,++a)}for(let l=-t,u=c-t;l<u;++l){let f=i[n[l+e-1]],d=i[n[l]];f!==null&&!isNaN(f=+f)&&(s+=f,++a),o[n[l+t]]=s/a,d!==null&&!isNaN(d=+d)&&(s-=d,--a)}}}}function Jst(e,t,r,n){for(let i=r+n;r<i;++r){let o=e[t[r]];if(Pe(o))return o}}function tat(e,t,r,n){for(let i=r+n-1;i>=r;--i){let o=e[t[i]];if(Pe(o))return o}}function Dq(e,t,r,n){for(let i=r+n;r<i;++r){let o=e[t[r]];if(o!==null&&!isNaN(o=+o))return o}}function Lq(e,t,r,n){for(let i=r+n-1;i>=r;--i){let o=e[t[i]];if(o!==null&&!isNaN(o=+o))return o}}function eat(e,t,r){return r?{mapIndex(n,i,o){for(let s=0,a=n.length-e;s<a;++s){let c=i[n[s]],l=i[n[s+e-1]];o[n[s+t]]=c===null||l===null?NaN:l-c}}}:{mapIndex(n,i,o){for(let s=-t,a=n.length-e+t+1;s<a;++s)o[n[s+t]]=Lq(i,n,s,e)-Dq(i,n,s,e)}}}function rat(e,t,r){return r?{mapIndex(n,i,o){for(let s=0,a=n.length-e;s<a;++s){let c=i[n[s]],l=i[n[s+e-1]];o[n[s+t]]=c===null||l===null?NaN:l/c}}}:{mapIndex(n,i,o){for(let s=-t,a=n.length-e+t+1;s<a;++s)o[n[s+t]]=Lq(i,n,s,e)/Dq(i,n,s,e)}}}function nat(e,t,r){return r?{mapIndex(n,i,o){for(let s=0,a=n.length-e;s<a;++s)o[n[s+t]]=i[n[s]]}}:{mapIndex(n,i,o){for(let s=-t,a=n.length-e+t+1;s<a;++s)o[n[s+t]]=Jst(i,n,s,e)}}}function iat(e,t,r){return r?{mapIndex(n,i,o){for(let s=0,a=n.length-e;s<a;++s)o[n[s+t]]=i[n[s+e-1]]}}:{mapIndex(n,i,o){for(let s=-t,a=n.length-e+t+1;s<a;++s)o[n[s+t]]=tat(i,n,s,e)}}}var cc={n:20,k:2,color:"currentColor",opacity:.2,strict:!0,anchor:"end"};function Fq(e,{x:t=G,y:r,k:n=cc.k,color:i=cc.color,opacity:o=cc.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return yr(fe(s)?null:Al(e,Zn({x1:Ol({k:-n,...f}),x2:Ol({k:n,...f})},{x1:t,x2:t,y:r,fill:s,fillOpacity:a,...f})),fe(c)?null:Ml(e,Zn({x:Ol(f)},{x:t,y:r,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function Cq(e,{x:t,y:r=G,k:n=cc.k,color:i=cc.color,opacity:o=cc.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return yr(fe(s)?null:ac(e,Zn({y1:Ol({k:-n,...f}),y2:Ol({k:n,...f})},{x:t,y1:r,y2:r,fill:s,fillOpacity:a,...f})),fe(c)?null:Nl(e,Zn({y:Ol(f)},{x:t,y:r,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function Ol({n:e=cc.n,k:t=0,strict:r=cc.strict,anchor:n=cc.anchor}={}){return Hh({k:e,reduce:i=>Ea(i)+t*(zi(i)||0),strict:r,anchor:n})}var oat={ariaLabel:"tick",fill:null,stroke:"currentColor"},uI=class extends vt{constructor(t,r,n){super(t,r,n,oat),Lo(this,n)}render(t,r,n,i,o){return lt("svg:g",o).call(kt,this,i,o).call(this._transform,this,r).call(s=>s.selectAll().data(t).enter().append("line").call(Mt,this).attr("x1",this._x1(r,n,i)).attr("x2",this._x2(r,n,i)).attr("y1",this._y1(r,n,i)).attr("y2",this._y2(r,n,i)).call(Wt,this,n).call(oc,this,n,o)).node()}},I0=class extends uI{constructor(t,r={}){let{x:n,y:i,inset:o=0,insetTop:s=o,insetBottom:a=o}=r;super(t,{x:{value:n,scale:"x"},y:{value:i,scale:"y",type:"band",optional:!0}},r),this.insetTop=ie(s),this.insetBottom=ie(a)}_transform(t,r,{x:n}){t.call(Rt,r,{x:n},We,0)}_x1(t,{x:r}){return n=>r[n]}_x2(t,{x:r}){return n=>r[n]}_y1({y:t},{y:r},{marginTop:n}){let{insetTop:i}=this;return r&&t?o=>r[o]+i:n+i}_y2({y:t},{y:r},{height:n,marginBottom:i}){let{insetBottom:o}=this;return r&&t?s=>r[s]+t.bandwidth()-o:n-i-o}},T0=class extends uI{constructor(t,r={}){let{x:n,y:i,inset:o=0,insetRight:s=o,insetLeft:a=o}=r;super(t,{y:{value:i,scale:"y"},x:{value:n,scale:"x",type:"band",optional:!0}},r),this.insetRight=ie(s),this.insetLeft=ie(a)}_transform(t,r,{y:n}){t.call(Rt,r,{y:n},0,We)}_x1({x:t},{x:r},{marginLeft:n}){let{insetLeft:i}=this;return r&&t?o=>r[o]+i:n+i}_x2({x:t},{x:r},{width:n,marginRight:i}){let{insetRight:o}=this;return r&&t?s=>r[s]+t.bandwidth()-o:n-i-o}_y1(t,{y:r}){return n=>r[n]}_y2(t,{y:r}){return n=>r[n]}};function fI(e,{x:t=G,...r}={}){return new I0(e,{...r,x:t})}function dI(e,{y:t=G,...r}={}){return new T0(e,{...r,y:t})}function kq(e,{x:t=G,y:r=null,r:n,fill:i="#ccc",fillOpacity:o,stroke:s="currentColor",strokeOpacity:a,strokeWidth:c=2,sort:l,...u}={}){let f=r!=null?dl:Qg;return yr(Si(e,f({x1:PN,x2:UN},{x:t,y:r,stroke:s,strokeOpacity:a,...u})),Fs(e,f({x1:"p25",x2:"p75"},{x:t,y:r,fill:i,fillOpacity:o,...u})),fI(e,f({x:"p50"},{x:t,y:r,stroke:s,strokeOpacity:a,strokeWidth:c,sort:l,...u})),to(e,Zn({x:Pq},{x:t,y:r,z:r,r:n,stroke:s,strokeOpacity:a,...u})))}function Bq(e,{y:t=G,x:r=null,r:n,fill:i="#ccc",fillOpacity:o,stroke:s="currentColor",strokeOpacity:a,strokeWidth:c=2,sort:l,...u}={}){let f=r!=null?fl:Qg;return yr(vi(e,f({y1:PN,y2:UN},{x:r,y:t,stroke:s,strokeOpacity:a,...u})),Cs(e,f({y1:"p25",y2:"p75"},{x:r,y:t,fill:i,fillOpacity:o,...u})),dI(e,f({y:"p50"},{x:r,y:t,stroke:s,strokeOpacity:a,strokeWidth:c,sort:l,...u})),to(e,Zn({y:Pq},{x:r,y:t,z:r,r:n,stroke:s,strokeOpacity:a,...u})))}function Pq(e){let t=PN(e),r=UN(e);return e.map(n=>n<t||n>r?n:NaN)}function PN(e){let t=Uq(e)*2.5-$q(e)*1.5;return Ht(e,r=>r>=t?r:NaN)}function UN(e){let t=$q(e)*2.5-Uq(e)*1.5;return Kt(e,r=>r<=t?r:NaN)}function Uq(e){return Tn(e,.25)}function $q(e){return Tn(e,.75)}var sat={ariaLabel:"raster",stroke:null,pixelSize:1};function Qh(e,t){let r=+e;if(isNaN(r))throw new Error(`invalid ${t}: ${e}`);return r}function zq(e,t){let r=Math.floor(e);if(isNaN(r))throw new Error(`invalid ${t}: ${e}`);return r}var E0=class extends vt{constructor(t,r,n={},i){let{width:o,height:s,x:a,y:c,x1:l=a==null?0:void 0,y1:u=c==null?0:void 0,x2:f=a==null?o:void 0,y2:d=c==null?s:void 0,pixelSize:h=i.pixelSize,blur:p=0,interpolate:m}=n;if(o!=null&&(o=zq(o,"width")),s!=null&&(s=zq(s,"height")),l!=null&&(l=Qh(l,"x1")),u!=null&&(u=Qh(u,"y1")),f!=null&&(f=Qh(f,"x2")),d!=null&&(d=Qh(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=pat(l,f,o,s)),c===void 0&&u!=null&&d!=null&&(c=mat(u,d,o,s))),super(t,{x:{value:a,scale:"x",optional:!0},y:{value:c,scale:"y",optional:!0},x1:{value:l==null?null:[l],scale:"x",optional:!0,filter:null},y1:{value:u==null?null:[u],scale:"y",optional:!0,filter:null},x2:{value:f==null?null:[f],scale:"x",optional:!0,filter:null},y2:{value:d==null?null:[d],scale:"y",optional:!0,filter:null},...r},n,i),this.width=o,this.height=s,this.pixelSize=Qh(h,"pixelSize"),this.blur=Qh(p,"blur"),this.interpolate=a==null||c==null?null:aat(m)}},M0=class extends E0{constructor(t,r={}){let{imageRendering:n}=r;if(t==null){let{fill:i,fillOpacity:o}=r;ye(o)[0]!==void 0&&(r=hI("fillOpacity",r)),qe(i)[0]!==void 0&&(r=hI("fill",r))}super(t,void 0,r,sat),this.imageRendering=Oe(n,"auto")}scale(t,{color:r,...n},i){return super.scale(t,n,i)}render(t,r,n,i,o){let s=r[n.channels.fill?.scale]??(M=>M),{x:a,y:c}=n,{document:l}=o,[u,f,d,h]=qq(n,i,o),p=d-u,m=h-f,{pixelSize:y,width:g=Math.round(Math.abs(p)/y),height:x=Math.round(Math.abs(m)/y)}=this,b=g*x,{fill:_,fillOpacity:v}=n,w=0;if(this.interpolate){let M=g/p,O=x/m,L=Xt(a,k=>(k-u)*M,Float64Array),B=Xt(c,k=>(k-f)*O,Float64Array);_&&(_=this.interpolate(t,g,x,L,B,_)),v&&(v=this.interpolate(t,g,x,L,B,v))}else this.data==null&&t&&(w=t.fi*b);let T=l.createElement("canvas");T.width=g,T.height=x;let A=T.getContext("2d"),E=A.createImageData(g,x),N=E.data,{r:I,g:R,b:C}=wr(this.fill)??{r:0,g:0,b:0},S=(this.fillOpacity??1)*255;for(let M=0;M<b;++M){let O=M<<2;if(_){let L=s(_[M+w]);if(L==null){N[O+3]=0;continue}({r:I,g:R,b:C}=wr(L))}v&&(S=v[M+w]*255),N[O+0]=I,N[O+1]=R,N[O+2]=C,N[O+3]=S}return this.blur>0&&aM(E,this.blur),A.putImageData(E,0,0),lt("svg:g",o).call(kt,this,i,o).call(Rt,this,r).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(m)).attr("preserveAspectRatio","none").call(dt,"image-rendering",this.imageRendering).call(Mt,this).attr("xlink:href",T.toDataURL())).node()}};function $N(e,t,r){arguments.length<3&&(r=t,t=null);let{x:n,y:i,[e]:o,...s}=r;return n===void 0&&i===void 0&&y$(t)&&(n=Ju,i=sl,o===void 0&&(o=d$)),[t,{...s,x:n,y:i,[e]:o}]}function jq(){let[e,t]=$N("fill",...arguments);return new M0(e,e==null||t.fill!==void 0||t.fillOpacity!==void 0?t:{...t,fill:G})}function qq({x1:e,y1:t,x2:r,y2:n},i,{projection:o}){let{width:s,height:a,marginTop:c,marginRight:l,marginBottom:u,marginLeft:f}=i;return[e&&o==null?e[0]:f,t&&o==null?t[0]:c,r&&o==null?r[0]:s-l,n&&o==null?n[0]:a-u]}function zN({x1:e,y1:t,x2:r,y2:n},i,o,s){let a={};return e&&(a.x1=e),t&&(a.y1=t),r&&(a.x2=r),n&&(a.y2=n),qq(Th(a,i),o,s)}function hI(e,t={}){let{[e]:r}=t;if(typeof r!="function")throw new Error(`invalid ${e}: not a function`);return Ne({...t,[e]:void 0},function(n,i,o,s,a,c){let{x:l,y:u}=s;if(!l)throw new Error("missing scale: x");if(!u)throw new Error("missing scale: y");let[f,d,h,p]=zN(o,s,a,c),m=h-f,y=p-d,{pixelSize:g}=this,{width:x=Math.round(Math.abs(m)/g),height:b=Math.round(Math.abs(y)/g)}=t,_=new Array(x*b*(i?i.length:1)),v=m/x,w=y/b,T=0;for(let A of i??[void 0])for(let E=.5;E<b;++E)for(let N=.5;N<x;++N,++T)_[T]=r(l.invert(f+N*v),u.invert(d+E*w),A);return{data:_,facets:i,channels:{[e]:{value:_,scale:"auto"}}}})}function aat(e){if(typeof e=="function")return e;if(e==null)return pI;switch(`${e}`.toLowerCase()){case"none":return pI;case"nearest":return O0;case"barycentric":return N0();case"random-walk":return R0()}throw new Error(`invalid interpolate: ${e}`)}function pI(e,t,r,n,i,o){let s=new Array(t*r);for(let a of e)n[a]<0||n[a]>=t||i[a]<0||i[a]>=r||(s[Math.floor(i[a])*t+Math.floor(n[a])]=o[a]);return s}function N0({random:e=$u(42)}={}){return(t,r,n,i,o,s)=>{let{points:a,triangles:c,hull:l}=Vi.from(t,h=>i[h],h=>o[h]),u=new s.constructor(r*n).fill(NaN),f=new Uint8Array(r*n),d=hat(s,e);for(let h=0;h<c.length;h+=3){let p=c[h],m=c[h+1],y=c[h+2],g=a[2*p],x=a[2*m],b=a[2*y],_=a[2*p+1],v=a[2*m+1],w=a[2*y+1],T=Math.min(g,x,b),A=Math.max(g,x,b),E=Math.min(_,v,w),N=Math.max(_,v,w),I=(v-w)*(g-b)+(_-w)*(b-x);if(!I)continue;let R=s[t[p]],C=s[t[m]],S=s[t[y]];for(let M=Math.floor(T);M<A;++M)for(let O=Math.floor(E);O<N;++O){if(M<0||M>=r||O<0||O>=n)continue;let L=M+.5,B=O+.5,k=Math.sign(I),P=(v-w)*(L-b)+(B-w)*(b-x);if(P*k<0)continue;let U=(w-_)*(L-b)+(B-w)*(g-b);if(U*k<0)continue;let $=I-(P+U);if($*k<0)continue;let X=M+r*O;u[X]=d(R,P/I,C,U/I,S,$/I,M,O),f[X]=1}}return cat(u,f,i,o,s,r,n,l,t,d),u}}function cat(e,t,r,n,i,o,s,a,c,l){r=Float64Array.from(a,h=>r[c[h]]),n=Float64Array.from(a,h=>n[c[h]]),i=Array.from(a,h=>i[c[h]]);let u=r.length,f=Array.from({length:u},(h,p)=>uat(p,r,n)),d=0;for(let h=0;h<s;++h){let p=h+.5;for(let m=0;m<o;++m){let y=m+o*h;if(!t[y]){let g=m+.5;for(let x=0;x<u;++x){let b=(u+d+(x%2?(x+1)/2:-x/2))%u;if(f[b](g,p)){let _=lat(r.at(b-1),n.at(b-1),r[b],n[b],g,p);e[y]=l(i.at(b-1),_,i[b],1-_,i[b],0,m,h),d=b;break}}}}}}function lat(e,t,r,n,i,o){let s=r-e,a=n-t,c=s*(r-i)+a*(n-o),l=s*(i-e)+a*(o-t);return c>0&&l>0?c/(c+l):+(c>l)}function A0(e,t,r,n){return e*n-r*t}function uat(e,t,r){let n=t.length,i=t.at(e-2),o=r.at(e-2),s=t.at(e-1),a=r.at(e-1),c=t[e],l=r[e],u=t.at(e+1-n),f=r.at(e+1-n),d=s-c,h=a-l,p=i-s,m=o-a,y=c-u,g=l-f,x=Math.hypot(d,h),b=Math.hypot(p,m),_=Math.hypot(y,g);return(v,w)=>{let T=v-s,A=w-a,E=v-c,N=w-l;return A0(T,A,E,N)>-1e-6&&A0(T,A,d,h)*b-A0(T,A,p,m)*x>-1e-6&&A0(E,N,y,g)*x-A0(E,N,d,h)*_<=0}}function O0(e,t,r,n,i,o){let s=new o.constructor(t*r),a=Vi.from(e,u=>n[u],u=>i[u]),c,l;for(let u=.5,f=0;u<r;++u){l=c;for(let d=.5;d<t;++d,++f)l=a.find(d,u,l),d===.5&&(c=l),s[f]=o[e[l]]}return s}function R0({random:e=$u(42),minDistance:t=.5,maxSteps:r=2}={}){return(n,i,o,s,a,c)=>{let l=new c.constructor(i*o),u=Vi.from(n,p=>s[p],p=>a[p]),f,d,h;for(let p=.5,m=0;p<o;++p){d=f;for(let y=.5;y<i;++y,++m){let g=y,x=p;h=d=u.find(g,x,d),y===.5&&(f=d);let b,_=0;for(;(b=Math.hypot(s[n[h]]-g,a[n[h]]-x))>t&&_<r;){let v=e(y,p,_)*2*Math.PI;g+=Math.cos(v)*b,x+=Math.sin(v)*b,h=u.find(g,x,h),++_}l[m]=c[n[h]]}}return l}}function fat(e,t,r,n,i,o){return t*e+n*r+o*i}function dat(e){return(t,r,n,i,o,s,a,c)=>{let l=e(a,c);return l<r?t:l<r+i?n:o}}function hat(e,t){return Za(e)||Ve(e)?fat:dat(t)}function pat(e,t,r){return{transform(n){let i=n.length,o=new Float64Array(i),s=(t-e)/r,a=e+s/2;for(let c=0;c<i;++c)o[c]=c%r*s+a;return o}}}function mat(e,t,r,n){return{transform(i){let o=i.length,s=new Float64Array(o),a=(t-e)/n,c=e+a/2;for(let l=0;l<o;++l)s[l]=Math.floor(l/r)%n*a+c;return s}}}var Vq={ariaLabel:"contour",fill:"none",stroke:"currentColor",strokeMiterlimit:1,pixelSize:2},D0=class extends E0{constructor(t,{smooth:r=!0,value:n,...i}={}){let o=MS({},i,Vq);if(n===void 0){for(let a in o)if(o[a].value!=null){if(n!==void 0)throw new Error("ambiguous contour value");n=i[a],i[a]="value"}}if(n!=null){let a={transform:c=>c.map(l=>l.value),label:en(n)};for(let c in o)i[c]==="value"&&(i[c]=a)}if(t==null){if(n==null)throw new Error("missing contour value");i=hI("value",{value:n,...i}),n=null}else{let{interpolate:a}=i;n===void 0&&(n=G),a===void 0&&(i.interpolate="nearest")}super(t,{value:{value:n,optional:!0}},yat(i),Vq);let s={geometry:{value:G}};for(let a in this.channels){let c=this.channels[a],{scale:l}=c;l==="x"||l==="y"||a==="value"||(s[a]=c,delete this.channels[a])}this.contourChannels=s,this.smooth=!!r}filter(t,{x:r,y:n,value:i,...o},s){return super.filter(t,o,s)}render(t,r,n,i,o){let{geometry:s}=n,a=Dr();return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,r).call(c=>{c.selectAll().data(t).enter().append("path").call(Mt,this).attr("d",l=>a(s[l])).call(Wt,this,n)}).node()}};function yat({thresholds:e,interval:t,...r}){return e=LN(e,t,$c),Ne(r,function(n,i,o,s,a,c){let[l,u,f,d]=zN(o,s,a,c),h=f-l,p=d-u,{pixelSize:m,width:y=Math.round(Math.abs(h)/m),height:g=Math.round(Math.abs(p)/m)}=this,x=y/h,b=g/p,_=o.value.value,v=[];if(this.interpolate){let{x:N,y:I}=Ns(o,s,c),R=Xt(N,O=>(O-l)*x,Float64Array),C=Xt(I,O=>(O-u)*b,Float64Array),S=[o.x,o.y,o.value],M=[R,C,_];for(let O of i){let L=this.filter(O,S,M);v.push(this.interpolate(L,y,g,R,C,_))}}else if(i){let N=y*g,I=i.length;for(let R=0;R<I;++R)v.push(_.slice(R*N,R*N+N))}else v.push(_);if(this.blur>0)for(let N of v)ay({data:N,width:y,height:g},this.blur);let w=gat(e,_,...xat(v));if(w===null)throw new Error(`unsupported thresholds: ${e}`);let{contour:T}=Gc().size([y,g]).smooth(this.smooth),A=[],E=[];for(let N of v)E.push(er(A.length,A.push(...Xt(w,I=>T(N,I)))));for(let{coordinates:N}of A)for(let I of N)for(let R of I)for(let C of R)C[0]=C[0]/x+l,C[1]=C[1]/b+u;return{data:A,facets:E,channels:mS(this.contourChannels,A)}})}function gat(e,t,r,n){if(typeof e?.range=="function")return e.range(e.floor(r),n);if(typeof e=="function"&&(e=e(t,r,n)),typeof e!="number")return xi(e);let i=Qr(...Id(r,n,e),e);for(;i[i.length-1]>=n;)i.pop();for(;i[1]<r;)i.shift();return i}function Wq(){return new D0(...$N("value",...arguments))}function xat(e){return[Ht(e,t=>Ht(t,Yq)),Kt(e,t=>Kt(t,Yq))]}function Yq(e){return isFinite(e)?e:NaN}function Hq(e,t){return jN(xl,e,t)}function Qq(e,t={}){return jN(bl,e,t)}function Zq(e,t={}){return jN(ic,e,t)}function jN(e,t,r={}){let{x:n,y:i,maxRadius:o}=r,s=e({px:n,py:i,maxRadius:o}),a=[];n!=null&&a.push(vi(t,Gq("x",{...s,inset:-6},r))),i!=null&&a.push(Si(t,Gq("y",{...s,inset:-6},r))),n!=null&&a.push(Rs(t,Xq("x",{...s,dy:9,frameAnchor:"bottom",lineAnchor:"top"},r))),i!=null&&a.push(Rs(t,Xq("y",{...s,dx:-9,frameAnchor:"left",textAnchor:"end"},r)));for(let c of a)c.ariaLabel=`crosshair ${c.ariaLabel}`;return yr(...a)}function Kq(e,{channels:t,...r},{facet:n,facetAnchor:i,fx:o,fy:s,[e]:a,channels:c,transform:l,initializer:u}){return{...r,facet:n,facetAnchor:i,fx:o,fy:s,[e]:a,channels:{...t,...c},transform:l,initializer:bat(e,u)}}function bat(e,t){return t==null?t:function(r,n,{x:i,y:o,px:s,py:a,...c},...l){let{channels:{x:u,y:f,...d}={},...h}=t.call(this,r,n,{...c,x:s,y:a},...l);return{channels:{...d,...u&&{px:u,...e==="x"&&{x:u}},...f&&{py:f,...e==="y"&&{y:f}}},...h}}}function Gq(e,t,r){let{color:n="currentColor",opacity:i=.2,ruleStroke:o=n,ruleStrokeOpacity:s=i,ruleStrokeWidth:a}=r;return{...Kq(e,t,r),stroke:o,strokeOpacity:s,strokeWidth:a}}function Xq(e,t,r){let{color:n="currentColor",textFill:i=n,textFillOpacity:o,textStroke:s="var(--plot-background)",textStrokeOpacity:a,textStrokeWidth:c=5}=r;return{...Kq(e,t,_at(e,r)),fill:i,fillOpacity:o,stroke:s,strokeOpacity:a,strokeWidth:c}}function _at(e,t){return Ne(t,(r,n,i)=>({channels:{text:{value:Jg(i,e)?.value}}}))}var wat={ariaLabel:"delaunay link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},vat={ariaLabel:"delaunay mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},Sat={ariaLabel:"hull",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:1},Iat={ariaLabel:"voronoi",fill:"none",stroke:"currentColor",strokeMiterlimit:1},Tat={ariaLabel:"voronoi mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},qN=class extends vt{constructor(t,r={}){let{x:n,y:i,z:o,curve:s,tension:a}=r;super(t,{x:{value:n,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},z:{value:o,optional:!0}},r,wat),this.curve=g0(s,a),Lo(this,r)}render(t,r,n,i,o){let{x:s,y:a}=r,{x:c,y:l,z:u}=n,{curve:f}=this,[d,h]=Ur(this,i),p=c?x=>c[x]:Ye(d),m=l?x=>l[x]:Ye(h),y=this;function g(x){let b=-1,_=[],v={};for(let S in n)v[S]=[];let w=[],T=[],A=[],E=[];function N(S,M){S=x[S],M=x[M],_.push(++b),w[b]=p(S),A[b]=m(S),T[b]=p(M),E[b]=m(M);for(let O in n)v[O].push(n[O][M])}let{halfedges:I,hull:R,triangles:C}=Vi.from(x,p,m);for(let S=0;S<I.length;++S){let M=I[S];M>S&&N(C[S],C[M])}for(let S=0;S<R.length;++S)N(R[S],R[(S+1)%R.length]);Qt(this).selectAll().data(_).enter().append("path").call(Mt,y).attr("d",S=>{let M=Nn(),O=f(M);return O.lineStart(),O.point(w[S],A[S]),O.point(T[S],E[S]),O.lineEnd(),M}).call(Wt,y,v).call(oc,y,v,o)}return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,{x:c&&s,y:l&&a}).call(u?x=>x.selectAll().data(Hr(t,b=>u[b]).values()).enter().append("g").each(g):x=>x.datum(t).each(g)).node()}},L0=class extends vt{constructor(t,r={},n,i=({z:o})=>o){let{x:o,y:s}=r;super(t,{x:{value:o,scale:"x",optional:!0},y:{value:s,scale:"y",optional:!0},z:{value:i(r),optional:!0}},r,n)}render(t,r,n,i,o){let{x:s,y:a}=r,{x:c,y:l,z:u}=n,[f,d]=Ur(this,i),h=c?g=>c[g]:Ye(f),p=l?g=>l[g]:Ye(d),m=this;function y(g){let x=Vi.from(g,h,p);Qt(this).append("path").datum(g[0]).call(Mt,m).attr("d",m._render(x,i)).call(Wt,m,n)}return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,{x:c&&s,y:l&&a}).call(u?g=>g.selectAll().data(Hr(t,x=>u[x]).values()).enter().append("g").each(y):g=>g.datum(t).each(y)).node()}},VN=class extends L0{constructor(t,r={}){super(t,r,vat),this.fill="none"}_render(t){return t.render()}},YN=class extends L0{constructor(t,r={}){super(t,r,Sat,pn)}_render(t){return t.renderHull()}},WN=class extends vt{constructor(t,r={}){let{x:n,y:i,z:o}=r;super(t,{x:{value:n,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},z:{value:o,optional:!0}},Ne(r,function(s,a,c,l,u,f){let{x:d,y:h,z:p}=c;({x:d,y:h}=Ns(c,l,f)),p=p?.value;let m=new Array((d??h).length).fill(null),[y,g]=Ur(this,u),x=d?_=>d[_]:Ye(y),b=h?_=>h[_]:Ye(g);for(let _ of a){d&&(_=_.filter(v=>Pe(x(v)))),h&&(_=_.filter(v=>Pe(b(v))));for(let[,v]of As(_,p)){let w=Vi.from(v,x,b),T=Jq(w,u);for(let A=0,E=v.length;A<E;++A)m[v[A]]=T.renderCell(A)}}return{data:s,facets:a,channels:{cells:{value:m}}}}),Iat)}render(t,r,n,i,o){let{x:s,y:a}=r,{x:c,y:l,cells:u}=n;return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,{x:c&&s,y:l&&a}).call(f=>{f.selectAll().data(t).enter().append("path").call(Mt,this).attr("d",d=>u[d]).call(Wt,this,n)}).node()}},GN=class extends L0{constructor(t,r){super(t,r,Tat),this.fill="none"}_render(t,r){return Jq(t,r).render()}};function Jq(e,t){let{width:r,height:n,marginTop:i,marginRight:o,marginBottom:s,marginLeft:a}=t;return e.voronoi([a,i,r-o,n-s])}function F0(e,t,{x:r,y:n,...i}={}){return[r,n]=Ke(r,n),new e(t,{...i,x:r,y:n})}function tV(e,t){return F0(qN,e,t)}function eV(e,t){return F0(VN,e,t)}function rV(e,t){return F0(YN,e,t)}function nV(e,{x:t,y:r,initializer:n,...i}={}){return F0(WN,e,{...mr({...i,x:t,y:r},XS),initializer:n})}function iV(e,t){return F0(GN,e,t)}var Aat={ariaLabel:"density",fill:"none",stroke:"currentColor",strokeMiterlimit:1},C0=class extends vt{constructor(t,{x:r,y:n,z:i,weight:o,fill:s,stroke:a,...c}={}){let l=oV(s)&&(s="currentColor",!0),u=oV(a)&&(a="currentColor",!0);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:n,scale:"y",optional:!0},z:{value:pn({z:i,fill:s,stroke:a}),optional:!0},weight:{value:o,optional:!0}},Mat({...c,fill:s,stroke:a},l,u),Aat),l&&(this.fill=void 0),u&&(this.stroke=void 0),this.z=i}filter(t){return t}render(t,r,n,i,o){let{contours:s}=n,a=Dr();return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,{}).call(c=>c.selectAll().data(t).enter().append("path").call(Mt,this).call(Wt,this,n).attr("d",l=>a(s[l]))).node()}};function sV(e,{x:t,y:r,...n}={}){return[t,r]=Ke(t,r),new C0(e,{...n,x:t,y:r})}var Eat=new Set(["x","y","z","weight"]);function Mat(e,t,r){let{bandwidth:i,thresholds:o}=e;return i=i===void 0?20:+i,o=o===void 0?20:typeof o?.[Symbol.iterator]=="function"?pr(o):+o,Ne(e,function(s,a,c,l,u,f){let d=c.weight?pr(c.weight.value):null,h=c.z?.value,{z:p}=this,[m,y]=Ur(this,u),{width:g,height:x}=u,{x:b,y:_}=Ns(c,l,f),v=Object.fromEntries(Object.entries(c).filter(([C])=>!Eat.has(C)).map(([C,S])=>[C,{...S,value:[]}])),w=t&&[],T=r&&[],A=HM().x(b?C=>b[C]:m).y(_?C=>_[C]:y).weight(d?C=>d[C]:1).size([g,x]).bandwidth(i),E=[];for(let C of a){let S=[];E.push(S);for(let M of h?i0(C,h,p):[C]){let O=A.contours(M);S.push([M,O])}}let N=o;if(!(N instanceof Yg)){let C=0;for(let S of E)for(let[,M]of S){let O=M.max;O>C&&(C=O)}N=Float64Array.from({length:o-1},(S,M)=>C*100*(M+1)/o)}let I=[],R=[];for(let C of E){let S=[];I.push(S);for(let[M,O]of C)for(let L of N){S.push(R.length),R.push(O(L/100)),w&&w.push(L),T&&T.push(L);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:I,channels:{...v,...w&&{fill:{value:w,scale:"color"}},...T&&{stroke:{value:T,scale:"color"}},contours:{value:R}}}})}function oV(e){return/^density$/i.test(e)}function lV(e,t){return fV("x",e,t)}function uV(e,t){return fV("y",e,t)}function fV(e,t,{x1:r,x2:n,y1:i,y2:o,x:s=r===void 0&&n===void 0?e==="y"?Ee:G:void 0,y:a=i===void 0&&o===void 0?e==="x"?Ee:G:void 0,fill:c,positiveFill:l="#3ca951",negativeFill:u="#4269d0",fillOpacity:f=1,positiveFillOpacity:d=f,negativeFillOpacity:h=f,stroke:p,strokeOpacity:m,z:y=qe(p)[0],clip:g,tip:x,render:b,..._}={}){return[r,n]=aV(s,r,n),[i,o]=aV(a,i,o),r===n&&i===o&&(e==="y"?i=lc(0):r=lc(0)),{tip:x}=Do({tip:x},e==="y"?"x":"y"),yr(fe(l)?null:Object.assign(x0(t,{x1:r,x2:n,y1:i,y2:o,z:y,fill:l,fillOpacity:d,render:nc(b,cV(e,!0)),clip:g,..._}),{ariaLabel:"positive difference"}),fe(u)?null:Object.assign(x0(t,{x1:r,x2:n,y1:i,y2:o,z:y,fill:u,fillOpacity:h,render:nc(b,cV(e,!1)),clip:g,..._}),{ariaLabel:"negative difference"}),bf(t,{x:n,y:o,z:y,stroke:p,strokeOpacity:m,tip:x,clip:!0,..._}))}function aV(e,t,r){return t===void 0&&r===void 0?t=r=lc(e):t===void 0?(r=lc(r),t=e===void 0?r:lc(e)):r===void 0?(t=lc(t),r=e===void 0?t:lc(e)):(t=lc(t),r=lc(r)),[t,r]}function lc(e){let t,{value:r,label:n=en(r)}=Ki(e);return{transform:i=>t||(t=_t(i,r)),label:n}}function cV(e,t){let r=e==="x"?"y":"x",n=`${r}1`,i=`${r}2`,o=`${e}1`,s=`${e}2`;return(a,c,l,u,f,d)=>{let{[n]:h,[i]:p}=l,m=new Float32Array(h.length),y=new Float32Array(p.length),g=u[e==="y"?"height":"width"];(t===bS(c[e])<0?m:y).fill(g);let x=d(a,c,{...l,[i]:h,[s]:y},u,f),b=d(a,c,{...l,[n]:p,[o]:m},u,f),_=x.querySelector("g")??x,v=b.querySelector("g")??b;for(let w=0;_.firstChild;w+=2){let T=cN(),A=lt("svg:clipPath",f).attr("id",T).node();A.appendChild(_.firstChild),v.childNodes[w].setAttribute("clip-path",`url(#${T})`),v.insertBefore(A,v.childNodes[w])}return b}}function mI({geometry:e=G,...t}={}){let r=yl(n=>_t(n,e));return Ne({...t,x:null,y:null,geometry:{transform:r}},(n,i,o,s,a,{projection:c})=>{let l=r(n),u=l.length,f=new Float64Array(u),d=new Float64Array(u),h=Dr(c);for(let p=0;p<u;++p)[f[p],d[p]]=h.centroid(l[p]);return{data:n,facets:i,channels:{x:{value:f,scale:c==null?"x":null,source:null},y:{value:d,scale:c==null?"y":null,source:null}}}})}function dV({geometry:e=G,...t}={}){let r=yl(i=>_t(i,e)),n=yl(i=>_t(r(i),f3));return{...t,x:{transform:i=>Float64Array.from(n(i),([o])=>o)},y:{transform:i=>Float64Array.from(n(i),([,o])=>o)},geometry:{transform:r}}}var Nat={ariaLabel:"geo",fill:"none",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},k0=class extends vt{constructor(t,r={}){let[n,i]=ye(r.r,3);super(t,{x:{value:r.tip?r.x:null,scale:"x",optional:!0},y:{value:r.tip?r.y:null,scale:"y",optional:!0},r:{value:n,scale:"r",filter:Fn,optional:!0},geometry:{value:r.geometry,scale:"projection"}},v0(r),Nat),this.r=i}render(t,r,n,i,o){let{geometry:s,r:a}=n,c=Dr(o.projection??Oat(r)),{r:l}=this;return el(l)?t=[]:l!==void 0&&c.pointRadius(l),lt("svg:g",o).call(kt,this,i,o).call(Rt,this,r).call(u=>{u.selectAll().data(t).enter().append("path").call(Mt,this).attr("d",a?f=>c.pointRadius(a[f])(s[f]):f=>c(s[f])).call(Wt,this,n)}).node()}};function Oat({x:e,y:t}){if(e||t)return e??=r=>r,t??=r=>r,Pu({point(r,n){this.stream.point(e(r),t(n))}})}function yI(e,t={}){return t.tip&&t.x===void 0&&t.y===void 0?t=mI(t):t.geometry===void 0&&(t={...t,geometry:G}),new k0(e,t)}function hV({strokeWidth:e=1.5,...t}={}){return yI({type:"Sphere"},{strokeWidth:e,...t})}function pV({strokeOpacity:e=.1,...t}={}){return yI(g3(),{strokeOpacity:e,...t})}var Zh=.5,Kh=0;function mV(e={fill:"count"},{binWidth:t,...r}={}){let{z:n}=r;return t=t===void 0?20:ie(t),e=C4(e,r),Es(e,"fill")&&(r.channels={...r.channels,fill:{value:[]}}),r.symbol===void 0&&(r.symbol="hexagon"),r.r===void 0&&!Es(e,"r")&&(r.r=t/2),Ne(r,(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}=Ns(s,a,l)),d=d?d.value:_t(i,n),h=h?.value,p=p?.value,m=m?.value;let y=Kg(e,{z:d,fill:h,stroke:p,symbol:m}),g=d&&[],x=h&&[],b=p&&[],_=m&&[],v=[],w=[],T=[],A=-1;for(let R of e)R.initialize(i);for(let R of o){let C=[];for(let S of e)S.scope("facet",R);for(let[S,M]of As(R,y))for(let{index:O,extent:L}of Rat(i,M,u,f,t)){C.push(++A),w.push(L.x),T.push(L.y),d&&g.push(y===d?S:d[O[0]]),h&&x.push(y===h?S:h[O[0]]),p&&b.push(y===p?S:p[O[0]]),m&&_.push(y===m?S:m[O[0]]);for(let B of e)B.reduce(O,L)}v.push(C)}let E=s.x.scale,N=s.y.scale,I={x:{value:w,source:a[E]?{value:Xt(w,a[E].invert),scale:E}:null},y:{value:T,source:a[N]?{value:Xt(T,a[N].invert),scale:N}:null},...d&&{z:{value:g}},...h&&{fill:{value:x,scale:"auto"}},...p&&{stroke:{value:b,scale:"auto"}},...m&&{symbol:{value:_,scale:"auto"}},...Object.fromEntries(e.map(({name:R,output:C})=>[R,{scale:"auto",label:C.label,radius:R==="r"?t/2:void 0,value:C.transform()}]))};return{data:i,facets:v,channels:I}})}function Rat(e,t,r,n,i){let o=i*(1.5/T4),s=new Map;for(let a of t){let c=r[a],l=n[a];if(isNaN(c)||isNaN(l))continue;let u=Math.round(l=(l-Kh)/o),f=Math.round(c=(c-Zh)/i-(u&1)/2),d=l-u;if(Math.abs(d)*3>1){let m=c-f,y=f+(c<f?-1:1)/2,g=u+(l<u?-1:1),x=c-y,b=l-g;m*m+d*d>x*x+b*b&&(f=y+(u&1?1:-1)/2,u=g)}let h=`${f},${u}`,p=s.get(h);p===void 0&&(p={index:[],extent:{data:e,x:(f+(u&1)/2)*i+Zh,y:u*o+Kh}},s.set(h,p)),p.index.push(a)}return s.values()}var Dat={ariaLabel:"hexgrid",fill:"none",stroke:"currentColor",strokeOpacity:.1};function yV(e){return new B0(e)}var B0=class extends vt{constructor({binWidth:t=20,clip:r=!0,...n}={}){super(ol,void 0,{clip:r,...n},Dat),this.binWidth=ie(t)}render(t,r,n,i,o){let{binWidth:s}=this,{marginTop:a,marginRight:c,marginBottom:l,marginLeft:u,width:f,height:d}=i,h=u-Zh,p=f-c-Zh,m=a-Kh,y=d-l-Kh,g=s/2,x=g*A4,b=x/2,_=g*2,v=x*1.5,w=Math.floor(h/_),T=Math.ceil(p/_),A=Math.floor((m+b)/v),E=Math.ceil((y-b)/v)+1,N=`m0,${Rl(-x)}l${Rl(g)},${Rl(b)}v${Rl(x)}l${Rl(-g)},${Rl(b)}`,I=N;for(let R=A;R<E;++R)for(let C=w;C<T;++C)I+=`M${Rl(C*_+(R&1)*g)},${Rl(R*v)}${N}`;return lt("svg:g",o).datum(0).call(kt,this,i,o).call(Rt,this,{},We+Zh,We+Kh).call(R=>R.append("path").call(Mt,this).call(Wt,this,n).attr("d",I)).node()}};function Rl(e){return Math.round(e*1e3)/1e3}var Lat={ariaLabel:"image",fill:null,stroke:null};function Fat(e){return/^\.*\//.test(e)}function Cat(e){return/^(blob|data|file|http|https):/i.test(e)}function kat(e){return typeof e=="string"&&(Fat(e)||Cat(e))?[void 0,e]:[e,void 0]}var P0=class extends vt{constructor(t,r={}){let{x:n,y:i,r:o,width:s,height:a,rotate:c,src:l,preserveAspectRatio:u,crossOrigin:f,frameAnchor:d,imageRendering:h}=r;o==null&&(o=void 0),o===void 0&&s===void 0&&a===void 0?s=a=16:s===void 0&&a!==void 0?s=a:a===void 0&&s!==void 0&&(a=s);let[p,m]=kat(l),[y,g]=ye(o),[x,b]=ye(s,g!==void 0?g*2:void 0),[_,v]=ye(a,g!==void 0?g*2:void 0),[w,T]=ye(c,0);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:y,scale:"r",filter:Fn,optional:!0},width:{value:x,filter:Fn,optional:!0},height:{value:_,filter:Fn,optional:!0},rotate:{value:w,optional:!0},src:{value:p,optional:!0}},v0(r),Lat),this.src=m,this.width=b,this.rotate=T,this.height=v,this.r=g,this.preserveAspectRatio=Oe(u,"xMidYMid"),this.crossOrigin=rr(f),this.frameAnchor=Ts(d),this.imageRendering=Oe(h,"auto")}render(t,r,n,i,o){let{x:s,y:a}=r,{x:c,y:l,width:u,height:f,r:d,rotate:h,src:p}=n,{r:m,width:y,height:g,rotate:x}=this,[b,_]=Ur(this,i);return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,{x:c&&s,y:l&&a}).call(v=>v.selectAll().data(t).enter().append("image").call(Mt,this).attr("x",gV(c,u,d,b,y,m)).attr("y",gV(l,f,d,_,g,m)).attr("width",u?w=>u[w]:y!==void 0?y:d?w=>d[w]*2:m*2).attr("height",f?w=>f[w]:g!==void 0?g:d?w=>d[w]*2:m*2).attr("transform",h?w=>`rotate(${h[w]})`:x?`rotate(${x})`:null).attr("transform-origin",h||x?Fo`${c?w=>c[w]:b}px ${l?w=>l[w]:_}px`:null).call(dt,"href",p?w=>p[w]:this.src).call(dt,"preserveAspectRatio",this.preserveAspectRatio).call(dt,"crossorigin",this.crossOrigin).call(dt,"image-rendering",this.imageRendering).call(dt,"clip-path",d?w=>`circle(${d[w]}px)`:m!==void 0?`circle(${m}px)`:null).call(Wt,this,n)).node()}};function gV(e,t,r,n,i,o){return t&&e?s=>e[s]-t[s]/2:t?s=>n-t[s]/2:e&&i!==void 0?s=>e[s]-i/2:i!==void 0?n-i/2:r&&e?s=>e[s]-r[s]:r?s=>n-r[s]:e?s=>e[s]-o:n-o}function xV(e,{x:t,y:r,...n}={}){return n.frameAnchor===void 0&&([t,r]=Ke(t,r)),new P0(e,{...n,x:t,y:r})}function Bat(e,t,r){var n=1e-8,i=t-1,o=r-1,s=0,a,c,l,u,f,d,h,p,m,y,g;if(e<=0)return 0;if(e>=1)return 1;for(t>=1&&r>=1?(l=e<.5?e:1-e,u=Math.sqrt(-2*Math.log(l)),h=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,e<.5&&(h=-h),p=(h*h-3)/6,m=2/(1/(2*t-1)+1/(2*r-1)),y=h*Math.sqrt(p+m)/m-(1/(2*r-1)-1/(2*t-1))*(p+5/6-2/(3*m)),h=t/(t+r*Math.exp(2*y))):(a=Math.log(t/(t+r)),c=Math.log(r/(t+r)),u=Math.exp(t*a)/t,f=Math.exp(r*c)/r,y=u+f,e<u/y?h=Math.pow(t*y*e,1/t):h=1-Math.pow(r*y*(1-e),1/r)),g=-Jh(t)-Jh(r)+Jh(t+r);s<10;s++){if(h===0||h===1)return h;if(d=Pat(h,t,r)-e,u=Math.exp(i*Math.log(h)+o*Math.log(1-h)+g),f=d/u,h-=u=f/(1-.5*Math.min(1,f*(i/h-o/(1-h)))),h<=0&&(h=.5*(h+u)),h>=1&&(h=.5*(h+u+1)),Math.abs(u)<n*h&&s>0)break}return h}function Pat(e,t,r){var n=e===0||e===1?0:Math.exp(Jh(t+r)-Jh(t)-Jh(r)+t*Math.log(e)+r*Math.log(1-e));return e<0||e>1?!1:e<(t+1)/(t+r+2)?n*bV(e,t,r)/t:1-n*bV(1-e,r,t)/r}function bV(e,t,r){var n=1e-30,i=1,o=t+r,s=t+1,a=t-1,c=1,l=1-o*e/s,u,f,d,h;for(Math.abs(l)<n&&(l=n),l=1/l,h=l;i<=100&&(u=2*i,f=i*(r-i)*e/((a+u)*(t+u)),l=1+f*l,Math.abs(l)<n&&(l=n),c=1+f/c,Math.abs(c)<n&&(c=n),l=1/l,h*=l*c,f=-(t+i)*(o+i)*e/((t+u)*(s+u)),l=1+f*l,Math.abs(l)<n&&(l=n),c=1+f/c,Math.abs(c)<n&&(c=n),l=1/l,d=l*c,h*=d,!(Math.abs(d-1)<3e-7));i++);return h}function Jh(e){var t=0,r=[76.18009172947146,-86.5053203294167,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],n=1.000000000190015,i,o,s;for(s=(o=i=e)+5.5,s-=(i+.5)*Math.log(s);t<6;t++)n+=r[t]/++o;return Math.log(2.506628274631*n/i)-s}function _V(e,t){var r=Bat(2*Math.min(e,1-e),.5*t,.5);return r=Math.sqrt(t*(1-r)/r),e>.5?r:-r}var Uat={ariaLabel:"linear-regression",fill:"currentColor",fillOpacity:.1,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},gI=class extends vt{constructor(t,r={}){let{x:n,y:i,z:o,ci:s=.95,precision:a=4}=r;if(super(t,{x:{value:n,scale:"x"},y:{value:i,scale:"y"},z:{value:pn(r),optional:!0}},r,Uat),this.z=o,this.ci=+s,this.precision=+a,!(0<=this.ci&&this.ci<1))throw new Error(`invalid ci; not in [0, 1): ${s}`);if(!(this.precision>0))throw new Error(`invalid precision: ${a}`)}render(t,r,n,i,o){let{x:s,y:a,z:c}=n,{ci:l}=this;return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,r).call(u=>u.selectAll().data(c?i0(t,c,this.z):[t]).enter().call(f=>f.append("path").attr("fill","none").call(Mt,this).call(of,this,{...n,fill:null,fillOpacity:null}).attr("d",d=>this._renderLine(d,s,a)).call(l&&!Ka(this.fill)?d=>d.select($at).attr("stroke","none").call(Mt,this).call(of,this,{...n,stroke:null,strokeOpacity:null,strokeWidth:null}).attr("d",h=>this._renderBand(h,s,a)):()=>{}))).node()}};function $at(){return this.parentNode.insertBefore(this.ownerDocument.createElementNS(An.svg,"path"),this)}var XN=class extends gI{constructor(t,r){super(t,r)}_renderBand(t,r,n){let{ci:i,precision:o}=this,[s,a]=ce(t,u=>n[u]),c=xI(t,n,r),l=SV(t,n,r,(1-i)/2,c);return ah().y(u=>u).x0(u=>l(u,-1)).x1(u=>l(u,1))(er(s,a-o/2,o).concat(a))}_renderLine(t,r,n){let[i,o]=ce(t,a=>n[a]),s=xI(t,n,r);return`M${s(i)},${i}L${s(o)},${o}`}},HN=class extends gI{constructor(t,r){super(t,r)}_renderBand(t,r,n){let{ci:i,precision:o}=this,[s,a]=ce(t,u=>r[u]),c=xI(t,r,n),l=SV(t,r,n,(1-i)/2,c);return ah().x(u=>u).y0(u=>l(u,-1)).y1(u=>l(u,1))(er(s,a-o/2,o).concat(a))}_renderLine(t,r,n){let[i,o]=ce(t,a=>r[a]),s=xI(t,r,n);return`M${i},${s(i)}L${o},${s(o)}`}};function wV(e,{y:t=Ee,x:r=G,stroke:n,fill:i=fe(n)?"currentColor":n,...o}={}){return new XN(e,Vh({...o,x:r,y:t,fill:i,stroke:n}))}function vV(e,{x:t=Ee,y:r=G,stroke:n,fill:i=fe(n)?"currentColor":n,...o}={}){return new HN(e,qh({...o,x:t,y:r,fill:i,stroke:n}))}function xI(e,t,r){let n=0,i=0,o=0,s=0;for(let u of e){let f=t[u],d=r[u];n+=f,i+=d,o+=f*d,s+=f*f}let a=e.length,c=(a*o-n*i)/(a*s-n*n),l=(i-c*n)/a;return u=>c*u+l}function SV(e,t,r,n,i){let o=Zr(e,u=>t[u])/e.length,s=0,a=0;for(let u of e)s+=(t[u]-o)**2,a+=(r[u]-i(t[u]))**2;let c=Math.sqrt(a/(e.length-2)),l=_V(n,e.length-2);return(u,f)=>{let d=i(u),h=c*Math.sqrt(1/e.length+(u-o)**2/s);return d+f*l*h}}function U0({path:e=G,delimiter:t,frameAnchor:r,treeLayout:n=Uu,treeSort:i,treeSeparation:o,treeAnchor:s,treeFilter:a,...c}={}){s=vI(s),i=AV(i),a!=null&&(a=ZN(a)),r===void 0&&(r=s.frameAnchor);let l=EV(t),u=FV(c,ZN),[f,d]=Br(),[h,p]=Br();return{x:f,y:h,frameAnchor:r,...mr(c,(m,y)=>{let g=l(_t(m,e)),x=d([]),b=p([]),_=-1,v=[],w=[],T=mv().path(N=>g[N]),A=Qn(m)?N=>N.data=m[N.data]:N=>N.data=m.get(N.data),E=n();E.nodeSize&&E.nodeSize([1,1]),E.separation&&o!==void 0&&E.separation(o??Wg);for(let N of u)N[_I]=N[DV]([]);for(let N of y){let I=[],R=T(N.filter(C=>g[C]!=null)).each(A);i!=null&&R.sort(i),E(R);for(let C of R.descendants())if(!(a!=null&&!a(C))){I.push(++_),v[_]=C.data,s.position(C,_,x,b);for(let S of u)S[_I][_]=S[LV](C)}w.push(I)}return{data:v,facets:w}}),...Object.fromEntries(u)}}function wI({path:e=G,delimiter:t,curve:r="bump-x",stroke:n="#555",strokeWidth:i=1.5,strokeOpacity:o=.5,treeLayout:s=Uu,treeSort:a,treeSeparation:c,treeAnchor:l,treeFilter:u,...f}={}){l=vI(l),a=AV(a),u!=null&&(u=TV(u)),f={curve:r,stroke:n,strokeWidth:i,strokeOpacity:o,...f};let d=EV(t),h=FV(f,TV),[p,m]=Br(),[y,g]=Br(),[x,b]=Br(),[_,v]=Br();return{x1:p,x2:y,y1:x,y2:_,...mr(f,(w,T)=>{let A=d(_t(w,e)),E=m([]),N=g([]),I=b([]),R=v([]),C=-1,S=[],M=[],O=mv().path(B=>A[B]),L=s();L.nodeSize&&L.nodeSize([1,1]),L.separation&&c!==void 0&&L.separation(c??Wg);for(let B of h)B[_I]=B[DV]([]);for(let B of T){let k=[],P=O(B.filter(U=>A[U]!=null)).each(U=>U.data=w[U.data]);a!=null&&P.sort(a),L(P);for(let{source:U,target:$}of P.links())if(!(u!=null&&!u($,U))){k.push(++C),S[C]=$.data,l.position(U,C,E,I),l.position($,C,N,R);for(let X of h)X[_I][C]=X[LV]($,U)}M.push(k)}return{data:S,facets:M}}),...Object.fromEntries(h)}}function vI(e="left"){switch(`${e}`.trim().toLowerCase()){case"left":return zat;case"right":return jat}throw new Error(`invalid tree anchor: ${e}`)}var zat={frameAnchor:"left",dx:6,position({x:e,y:t},r,n,i){n[r]=t,i[r]=-e}},jat={frameAnchor:"right",dx:-6,position({x:e,y:t},r,n,i){n[r]=-t,i[r]=-e}};function AV(e){return e==null||typeof e=="function"?e:`${e}`.trim().toLowerCase().startsWith("node:")?IV(ZN(e)):IV(qat(e))}function IV(e){return(t,r)=>Cr(e(t),e(r))}function qat(e){return t=>t.data?.[e]}function EV(e="/"){if(e=`${e}`,e==="/")return r=>r;if(e.length!==1)throw new Error("delimiter must be exactly one character");let t=e.charCodeAt(0);return r=>r.map(n=>Vat(n,t))}var QN=92,MV=47;function Vat(e,t){if(t===QN)throw new Error("delimiter cannot be backslash");let r=!1;for(let n=0,i=e.length;n<i;++n){switch(e.charCodeAt(n)){case QN:if(!r){r=!0;continue}break;case t:r?(e=e.slice(0,n-1)+e.slice(n),--n,--i):e=e.slice(0,n)+"/"+e.slice(n+1);break;case MV:r?(e=e.slice(0,n)+"\\\\"+e.slice(n),n+=2,i+=2):(e=e.slice(0,n)+"\\"+e.slice(n),++n,++i);break}r=!1}return e}function Yat(e){let t=!1;for(let r=0,n=e.length;r<n;++r){switch(e.charCodeAt(r)){case QN:if(!t){t=!0;continue}case MV:t&&(e=e.slice(0,r-1)+e.slice(r),--r,--n);break}t=!1}return e}function NV(e){return kr(e)&&typeof e.node=="function"}function Wat(e){return kr(e)&&typeof e.link=="function"}function ZN(e){if(NV(e))return e.node;if(e=`${e}`.trim().toLowerCase(),!!e.startsWith("node:")){switch(e){case"node:name":return JN;case"node:path":return KN;case"node:internal":return OV;case"node:external":return RV;case"node:depth":return t8;case"node:height":return e8}throw new Error(`invalid node value: ${e}`)}}function TV(e){if(NV(e))return e.node;if(Wat(e))return e.link;if(e=`${e}`.trim().toLowerCase(),!(!e.startsWith("node:")&&!e.startsWith("parent:"))){switch(e){case"parent:name":return bI(JN);case"parent:path":return bI(KN);case"parent:depth":return bI(t8);case"parent:height":return bI(e8);case"node:name":return JN;case"node:path":return KN;case"node:internal":return OV;case"node:external":return RV;case"node:depth":return t8;case"node:height":return e8}throw new Error(`invalid link value: ${e}`)}}function KN(e){return e.id}function JN(e){return Gat(e.id)}function t8(e){return e.depth}function e8(e){return e.height}function OV(e){return!!e.children}function RV(e){return!e.children}function bI(e){return(t,r)=>r==null?void 0:e(r)}function Gat(e){let t=e.length;for(;--t>0&&!Xat(e,t););return Yat(e.slice(t+1))}function Xat(e,t){if(e[t]==="/"){let r=0;for(;t>0&&e[--t]==="\\";)++r;if(!(r&1))return!0}return!1}var DV=2,LV=3,_I=4;function FV(e,t){let r=[];for(let n in e){let i=e[n],o=t(i);o!==void 0&&r.push([n,...Br(i),o])}return r}function r8(e,{fill:t,stroke:r,strokeWidth:n,strokeOpacity:i,strokeLinejoin:o,strokeLinecap:s,strokeMiterlimit:a,strokeDasharray:c,strokeDashoffset:l,marker:u,markerStart:f=u,markerEnd:d=u,dot:h=fe(f)&&fe(d),text:p="node:name",textStroke:m="var(--plot-background)",title:y="node:path",dx:g,dy:x,textAnchor:b,treeLayout:_=Uu,textLayout:v=_===Uu||_===hv?"mirrored":"normal",tip:w,...T}={}){if(g===void 0&&(g=vI(T.treeAnchor).dx),b!==void 0)throw new Error("textAnchor is not a configurable tree option");v=Sr(v,"textLayout",["mirrored","normal"]);function A(E){return Rs(e,U0({treeLayout:_,text:p,fill:t===void 0?"currentColor":t,stroke:m,dx:g,dy:x,title:y,...E,...T}))}return yr(oI(e,wI({treeLayout:_,markerStart:f,markerEnd:d,stroke:r!==void 0?r:t===void 0?"node:internal":t,strokeWidth:n,strokeOpacity:i,strokeLinejoin:o,strokeLinecap:s,strokeMiterlimit:a,strokeDasharray:c,strokeDashoffset:l,...T})),h?to(e,U0({treeLayout:_,fill:t===void 0?"node:internal":t,title:y,tip:w,...T})):null,p!=null?v==="mirrored"?[A({textAnchor:"start",treeFilter:"node:external"}),A({textAnchor:"end",treeFilter:"node:internal",dx:-g})]:A():null)}function CV(e,t){return r8(e,{...t,treeLayout:hv})}var BV={ariaLabel:"waffle"},$0=class extends pf{constructor(t,{unit:r=1,gap:n=1,round:i,render:o,multiple:s,...a}={}){super(t,{...a,render:nc(o,PV("x"))},BV),this.unit=Math.max(0,r),this.gap=+n,this.round=UV(i),this.multiple=$V(s)}},z0=class extends mf{constructor(t,{unit:r=1,gap:n=1,round:i,render:o,multiple:s,...a}={}){super(t,{...a,render:nc(o,PV("y"))},BV),this.unit=Math.max(0,r),this.gap=+n,this.round=UV(i),this.multiple=$V(s)}};function PV(e){return function(t,r,n,i,o){let{unit:s,gap:a,rx:c,ry:l,round:u}=this,{document:f}=o,d=n.channels[`${e}1`].value,h=n.channels[`${e}2`].value,p=this[e==="y"?"_width":"_height"](r,n,i),m=this[e==="y"?"_x":"_y"](r,n,i),y=s*Hat(r.scales[e]),{multiple:g=Math.max(1,Math.floor(Math.sqrt(p/y)))}=this,x=Math.min(p/g,y*g),b=y*g,_=e==="y"?([I,R])=>[I*x,-R*b]:([I,R])=>[R*b,I*x],v=(p-g*x)/2,w=typeof m=="function"?I=>m(I)+v:m+v,T=r[e](0),A=Yz(),E=f.createElementNS(An.svg,"pattern");E.setAttribute("width",e==="y"?x:b),E.setAttribute("height",e==="y"?b:x),E.setAttribute("patternUnits","userSpaceOnUse");let N=E.appendChild(f.createElementNS(An.svg,"rect"));return N.setAttribute("x",a/2),N.setAttribute("y",a/2),N.setAttribute("width",(e==="y"?x:b)-a),N.setAttribute("height",(e==="y"?b:x)-a),c!=null&&N.setAttribute("rx",c),l!=null&&N.setAttribute("ry",l),lt("svg:g",o).call(kt,this,i,o).call(this._transform,this,r).call(I=>I.selectAll().data(t).enter().append(()=>E.cloneNode(!0)).attr("id",R=>`${A}-${R}`).select("rect").call(Mt,this).call(Wt,this,n)).call(I=>I.selectAll().data(t).enter().append("path").attr("transform",e==="y"?Fo`translate(${w},${T})`:Fo`translate(${T},${w})`).attr("d",R=>`M${n8(u(d[R]/s),u(h[R]/s),g).map(_).join("L")}Z`).attr("fill",R=>`url(#${A}-${R})`).attr("stroke",this.stroke==null?null:R=>`url(#${A}-${R})`)).node()}}function n8(e,t,r){if(e<0||t<0){let n=Math.ceil(-Math.min(e,t)/r);return n8(e+n*r,t+n*r,r).map(([i,o])=>[i,o-n])}return t<e?n8(t,e,r):[[0,Math.ceil(e/r)],[Math.floor(e%r),Math.ceil(e/r)],[Math.floor(e%r),Math.floor(e/r)+e%1],[Math.ceil(e%r),Math.floor(e/r)+e%1],...e%r>r-1?[]:[[Math.ceil(e%r),Math.floor(e/r)],[r,Math.floor(e/r)]],[r,Math.floor(t/r)],[Math.ceil(t%r),Math.floor(t/r)],[Math.ceil(t%r),Math.floor(t/r)+t%1],[Math.floor(t%r),Math.floor(t/r)+t%1],...t%r<1?[]:[[Math.floor(t%r),Math.ceil(t/r)],[0,Math.ceil(t/r)]]]}function UV(e){if(e===void 0||e===!1)return Number;if(e===!0)return Math.round;if(typeof e!="function")throw new Error(`invalid round: ${e}`);return e}function $V(e){return e===void 0?void 0:Math.max(1,Math.floor(e))}function Hat({domain:e,range:t}){return kV(t)/kV(e)}function kV(e){let[t,r]=ce(e);return r-t}function zV(e,t={}){return Ha(t)||(t={...t,y:Ee,x2:G}),new $0(e,Sl(Lh(wl(t))))}function jV(e,t={}){return Ha(t)||(t={...t,x:Ee,y2:G}),new z0(e,Il(Fh(vl(t))))}var JV=BW(KV(),1);var nct=({marginLeft:e})=>[1,e],ict=({width:e,marginRight:t})=>[-1,e-t],oct=({width:e,marginLeft:t,marginRight:r})=>[0,(t+e-r)/2],sct=({marginTop:e})=>[1,e],act=({height:e,marginBottom:t})=>[-1,e-t],cct=({height:e,marginTop:t,marginBottom:r})=>[0,(t+e-r)/2];function tY(e){return typeof e=="string"?{anchor:e}:e}function eY(e={},t={}){arguments.length===1&&([e,t]=nY(e));let{anchor:r="left",padding:n=1,r:i=t.r}=tY(e);switch(`${r}`.toLowerCase()){case"left":r=nct;break;case"right":r=ict;break;case"middle":r=oct;break;default:throw new Error(`unknown dodge anchor: ${r}`)}return iY("x","y",r,ie(n),i,t)}function rY(e={},t={}){arguments.length===1&&([e,t]=nY(e));let{anchor:r="bottom",padding:n=1,r:i=t.r}=tY(e);switch(`${r}`.toLowerCase()){case"top":r=sct;break;case"bottom":r=act;break;case"middle":r=cct;break;default:throw new Error(`unknown dodge anchor: ${r}`)}return iY("y","x",r,ie(n),i,t)}function nY(e){let{anchor:t,padding:r,...n}=e,{r:i}=n;return[{anchor:t,padding:r,r:i},n]}function iY(e,t,r,n,i,o){if(i!=null&&typeof i!="number"){let{channels:s,sort:a,reverse:c}=o;s=Xg(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 Ne(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}=Ns(c,l,f));let p=h?void 0:i!==void 0?ie(i):this.r!==void 0?this.r:3;h&&(h=_t(h.value,l[h.scale]||G,Float64Array));let[m,y]=r(u),g=m?uct:lct,x=new Float64Array(d.length),b=h?_=>h[_]:()=>p;for(let _ of a){let v=(0,JV.default)();_=_.filter(h?T=>dh(d[T])&&Fn(h[T]):T=>dh(d[T]));let w=new Float64Array(2*_.length+2);for(let T of _){let A=b(T),E=m?A+n:0,N=d[T]-A,I=d[T]+A,R=2;v.queryInterval(N-n,I+n,([,,S])=>{let M=x[S]-E,O=d[T]-d[S],L=n+(h?h[T]+h[S]:2*p),B=Math.sqrt(L*L-O*O);w[R++]=M-B,w[R++]=M+B});let C=w.slice(0,R);m&&(C=C.filter(S=>S>=0));t:for(let S of C.sort(g)){for(let M=0;M<R;M+=2)if(w[M]+1e-6<S&&S<w[M+1]-1e-6)continue t;x[T]=S+E;break}v.insert([N,I,T])}}m||(m=1);for(let _ of a)for(let v of _)x[v]=x[v]*m+y;return{data:s,facets:a,channels:{[e]:{value:x,source:null},[t]:{value:d,source:c[t]},...h&&{r:{value:h,source:c.r}}}}})}function lct(e,t){return Math.abs(e)-Math.abs(t)}function uct(e,t){return e-t}function sY(e,t){return arguments.length===1&&({basis:e,...t}=e),Gh(TI(e),t)}function aY(e,t){return arguments.length===1&&({basis:e,...t}=e),Xh(TI(e),t)}function TI(e){if(e===void 0)return oY;if(typeof e=="function")return AI(xh(e));if(/^p\d{2}$/i.test(e))return np(gh(e));switch(`${e}`.toLowerCase()){case"deviation":return hct;case"first":return oY;case"last":return dct;case"max":return pct;case"mean":return mct;case"median":return yct;case"min":return gct;case"sum":return xct;case"extent":return fct}throw new Error(`invalid basis: ${e}`)}function AI(e){return{mapIndex(t,r,n){let i=+e(t,r);for(let o of t)n[o]=r[o]===null?NaN:r[o]/i}}}function np(e){return AI((t,r)=>e(t,n=>r[n]))}var fct={mapIndex(e,t,r){let[n,i]=ce(e,s=>t[s]),o=i-n;for(let s of e)r[s]=t[s]===null?NaN:(t[s]-n)/o}},oY=AI((e,t)=>{for(let r=0;r<e.length;++r){let n=t[e[r]];if(Pe(n))return n}}),dct=AI((e,t)=>{for(let r=e.length-1;r>=0;--r){let n=t[e[r]];if(Pe(n))return n}}),hct={mapIndex(e,t,r){let n=Ea(e,o=>t[o]),i=zi(e,o=>t[o]);for(let o of e)r[o]=t[o]===null?NaN:i?(t[o]-n)/i:0}},pct=np(Kt),mct=np(Ea),yct=np(Eo),gct=np(Ht),xct=np(Zr);function cY(e,t){return uY("x",e,t)}function lY(e,t){return uY("y",e,t)}function uY(e,t,r={}){let n,i=1;if(typeof t=="number")i=t,n=(l,u)=>+l+u;else{if(typeof t=="string"){let l=t.startsWith("-")?-1:1;[t,i]=rS(t.replace(/^[+-]/,"")),i*=l}t=_h(t),n=(l,u)=>t.offset(l,u)}let o=`${e}1`,s=`${e}2`,a=Zn({[o]:l=>l.map(u=>n(u,i)),[s]:l=>l},r),c=a[s].transform;return a[s].transform=()=>{let l=c(),[u,f]=ce(l);return l.domain=i<0?[u,n(f,i)]:[n(u,i),f],l},a}function fY(e,t={}){if(typeof e=="string")switch(e.toLowerCase()){case"first":return V0(t);case"last":return Y0(t)}if(typeof e=="function")return Dl(null,e,t);let r,n;for(r in e){if(n!==void 0)throw new Error("ambiguous selector; multiple inputs");n=bct(e[r])}if(n===void 0)throw new Error(`invalid selector: ${e}`);return Dl(r,n,t)}function bct(e){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"min":return l8;case"max":return u8}throw new Error(`unknown selector: ${e}`)}function V0(e){return Dl(null,_ct,e)}function Y0(e){return Dl(null,wct,e)}function EI(e){return Dl("x",l8,e)}function MI(e){return Dl("y",l8,e)}function NI(e){return Dl("x",u8,e)}function OI(e){return Dl("y",u8,e)}function*_ct(e){yield e[0]}function*wct(e){yield e[e.length-1]}function*l8(e,t){yield Z_(e,r=>t[r])}function*u8(e,t){yield vu(e,r=>t[r])}function Dl(e,t,r){if(e!=null){if(r[e]==null)throw new Error(`missing channel: ${e}`);e=r[e]}let n=pn(r);return mr(r,(i,o)=>{let s=_t(i,n),a=_t(i,e),c=[];for(let l of o){let u=[];for(let f of s?Hr(l,d=>s[d]).values():[l])for(let d of t(f,a))u.push(d);c.push(u)}return{data:i,facets:c}})}vt.prototype.plot=function({marks:e=[],...t}={}){return jh({...t,marks:[...e,this]})};var vct=new Map([["style","style"],["width","width"],["height","height"],["margin","margin"],["marginLeft","marginLeft"],["marginRight","marginRight"],["marginTop","marginTop"],["marginBottom","marginBottom"],["align","align"],["aspectRatio","aspectRatio"],["axis","axis"],["inset","inset"],["grid","grid"],["label","label"],["padding","padding"],["xScale","x.type"],["xDomain","x.domain"],["xRange","x.range"],["xNice","x.nice"],["xInset","x.inset"],["xInsetLeft","x.insetLeft"],["xInsetRight","x.insetRight"],["xClamp","x.clamp"],["xRound","x.round"],["xAlign","x.align"],["xPadding","x.padding"],["xPaddingInner","x.paddingInner"],["xPaddingOuter","x.paddingOuter"],["xAxis","x.axis"],["xTicks","x.ticks"],["xTickSize","x.tickSize"],["xTickSpacing","x.tickSpacing"],["xTickPadding","x.tickPadding"],["xTickFormat","x.tickFormat"],["xTickRotate","x.tickRotate"],["xGrid","x.grid"],["xLine","x.line"],["xLabel","x.label"],["xLabelAnchor","x.labelAnchor"],["xLabelArrow","x.labelArrow"],["xLabelOffset","x.labelOffset"],["xFontVariant","x.fontVariant"],["xAriaLabel","x.ariaLabel"],["xAriaDescription","x.ariaDescription"],["xPercent","x.percent"],["xReverse","x.reverse"],["xZero","x.zero"],["xBase","x.base"],["xExponent","x.exponent"],["xConstant","x.constant"],["yScale","y.type"],["yDomain","y.domain"],["yRange","y.range"],["yNice","y.nice"],["yInset","y.inset"],["yInsetTop","y.insetTop"],["yInsetBottom","y.insetBottom"],["yClamp","y.clamp"],["yRound","y.round"],["yAlign","y.align"],["yPadding","y.padding"],["yPaddingInner","y.paddingInner"],["yPaddingOuter","y.paddingOuter"],["yAxis","y.axis"],["yTicks","y.ticks"],["yTickSize","y.tickSize"],["yTickSpacing","y.tickSpacing"],["yTickPadding","y.tickPadding"],["yTickFormat","y.tickFormat"],["yTickRotate","y.tickRotate"],["yGrid","y.grid"],["yLine","y.line"],["yLabel","y.label"],["yLabelAnchor","y.labelAnchor"],["yLabelArrow","y.labelArrow"],["yLabelOffset","y.labelOffset"],["yFontVariant","y.fontVariant"],["yAriaLabel","y.ariaLabel"],["yAriaDescription","y.ariaDescription"],["yPercent","y.percent"],["yReverse","y.reverse"],["yZero","y.zero"],["yBase","y.base"],["yExponent","y.exponent"],["yConstant","y.constant"],["facetMargin","facet.margin"],["facetMarginTop","facet.marginTop"],["facetMarginBottom","facet.marginBottom"],["facetMarginLeft","facet.marginLeft"],["facetMarginRight","facet.marginRight"],["facetGrid","facet.grid"],["facetLabel","facet.label"],["fxDomain","fx.domain"],["fxRange","fx.range"],["fxInset","fx.inset"],["fxInsetLeft","fx.insetLeft"],["fxInsetRight","fx.insetRight"],["fxRound","fx.round"],["fxAlign","fx.align"],["fxPadding","fx.padding"],["fxPaddingInner","fx.paddingInner"],["fxPaddingOuter","fx.paddingOuter"],["fxAxis","fx.axis"],["fxTicks","fx.ticks"],["fxTickSize","fx.tickSize"],["fxTickSpacing","fx.tickSpacing"],["fxTickPadding","fx.tickPadding"],["fxTickFormat","fx.tickFormat"],["fxTickRotate","fx.tickRotate"],["fxGrid","fx.grid"],["fxLine","fx.line"],["fxLabel","fx.label"],["fxLabelAnchor","fx.labelAnchor"],["fxLabelOffset","fx.labelOffset"],["fxFontVariant","fx.fontVariant"],["fxAriaLabel","fx.ariaLabel"],["fxAriaDescription","fx.ariaDescription"],["fxReverse","fx.reverse"],["fyDomain","fy.domain"],["fyRange","fy.range"],["fyInset","fy,inset"],["fyInsetTop","fy.insetTop"],["fyInsetBottom","fy.insetBottom"],["fyRound","fy.round"],["fyAlign","fy.align"],["fyPadding","fy.padding"],["fyPaddingInner","fy.paddingInner"],["fyPaddingOuter","fy.paddingOuter"],["fyAxis","fy.axis"],["fyTicks","fy.ticks"],["fyTickSize","fy.tickSize"],["fyTickSpacing","fy.tickSpacing"],["fyTickPadding","fy.tickPadding"],["fyTickFormat","fy.tickFormat"],["fyTickRotate","fy.tickRotate"],["fyGrid","fy.grid"],["fyLine","fy.line"],["fyLabel","fy.label"],["fyLabelAnchor","fy.labelAnchor"],["fyLabelOffset","fy.labelOffset"],["fyFontVariant","fy.fontVariant"],["fyAriaLabel","fy.ariaLabel"],["fyAriaDescription","fy.ariaDescription"],["fyReverse","fy.reverse"],["colorScale","color.type"],["colorDomain","color.domain"],["colorRange","color.range"],["colorClamp","color.clamp"],["colorN","color.n"],["colorNice","color.nice"],["colorScheme","color.scheme"],["colorInterpolate","color.interpolate"],["colorPivot","color.pivot"],["colorSymmetric","color.symmetric"],["colorLabel","color.label"],["colorPercent","color.percent"],["colorReverse","color.reverse"],["colorZero","color.zero"],["colorTickFormat","color.tickFormat"],["colorBase","color.base"],["colorExponent","color.exponent"],["colorConstant","color.constant"],["opacityScale","opacity.type"],["opacityDomain","opacity.domain"],["opacityRange","opacity.range"],["opacityClamp","opacity.clamp"],["opacityNice","opacity.nice"],["opacityLabel","opacity.label"],["opacityPercent","opacity.percent"],["opacityReverse","opacity.reverse"],["opacityZero","opacity.zero"],["opacityTickFormat","opacity.tickFormat"],["opacityBase","opacity.base"],["opacityExponent","opacity.exponent"],["opacityConstant","opacity.constant"],["symbolScale","symbol.type"],["symbolDomain","symbol.domain"],["symbolRange","symbol.range"],["rScale","r.type"],["rDomain","r.domain"],["rRange","r.range"],["rClamp","r.clamp"],["rNice","r.nice"],["rLabel","r.label"],["rPercent","r.percent"],["rZero","r.zero"],["rBase","r.base"],["rExponent","r.exponent"],["rConstant","r.constant"],["lengthScale","length.type"],["lengthDomain","length.domain"],["lengthRange","length.range"],["lengthClamp","length.clamp"],["lengthNice","length.nice"],["lengthPercent","length.percent"],["lengthZero","length.zero"],["lengthBase","length.base"],["lengthExponent","length.exponent"],["lengthConstant","length.constant"],["projectionType","projection.type"],["projectionParallels","projection.parallels"],["projectionPrecision","projection.precision"],["projectionRotate","projection.rotate"],["projectionDomain","projection.domain"],["projectionInset","projection.inset"],["projectionInsetLeft","projection.insetLeft"],["projectionInsetRight","projection.insetRight"],["projectionInsetTop","projection.insetTop"],["projectionInsetBottom","projection.insetBottom"],["projectionClip","projection.clip"]]);function Sct(e,t,r){for(let n=0;n<t.length;++n){let i=t[n];n===t.length-1?e[i]=r:e=e[i]||(e[i]={})}}function dY(e,t,r){for(let n in e){let i=vct.get(n);if(i==null)throw new Error(`Unrecognized plot attribute: ${n}`);let o=e[n];typeof o=="symbol"?r.push(n):o!==void 0&&Sct(t,i.split("."),o)}}var Ict=new Set(["frame","hexgrid","sphere","graticule"]),Tct=new Map([["first",V0],["last",Y0],["maxX",NI],["maxY",OI],["minX",EI],["minY",MI],["nearest",xl],["nearestX",bl],["nearestXY",ic]]);async function hY(e){let t={marks:[]},r=[],{attributes:n,marks:i}=e;dY(n,t,r);let o=[];for(let a of i)for(let{type:c,data:l,options:u}of a.plotSpecs()){let{select:f,...d}=u,h=Tct.get(f)?.(d)??d,p=Ict.has(c)?[h]:[l,h];t.marks.push(f8[c](...p)),o.push(a.index)}Ect(t,e);let s=jh(t);Nct(s,o),Act(e,s,n,r);for(let a of e.interactors)await a.init(s);return s}function Act(e,t,r,n){n.forEach(i=>{let o=r[i];if(o===es){if(!i.endsWith("Domain"))throw new Error(`Unsupported fixed attribute: ${i}`);let s=i.slice(0,-6),a=t.scale(s);a?.domain&&e.setAttribute(i,r[`${s}Reverse`]?a.domain.slice().reverse():a.domain)}else throw new Error(`Unrecognized symbol: ${o}`)})}function Ect(e,t){let{marks:r}=t;RI("x",e,r),RI("y",e,r),RI("fx",e,r),RI("fy",e,r)}function RI(e,t,r){let n=t[e]||{};if(n.axis===null||n.label!==void 0)return;let i=r.map(s=>s.channelField(e)?.field);if(i.every(s=>s==null))return;let o;for(let s=0;s<i.length;++s){let a=pY(i[s]);a!==void 0&&(o===void 0?o=a:o!==a&&(o=void 0))}o!==void 0&&(t[e]={...n,label:o})}function pY(e){if(e){switch(e.type){case"COLUMN_REF":return e.column;case"CAST":return pY(e.expr);case"FUNCTION":if(e.name==="make_date")return"date";break}return Mct(e)}}function Mct(e){let t=`${e}`.replaceAll('"',"").replaceAll("(*)","()");return t.endsWith("()")?t.slice(0,-2):t}function Nct(e,t){let r=-1;for(let n of e.children){let i=n.getAttribute("aria-label")||"";n.nodeName==="style"||i.includes("-axis")||i.includes("-grid")||n.setAttribute("data-index",t[++r])}}var Oct={width:640,marginLeft:40,marginRight:20,marginTop:20,marginBottom:30},W0=class{constructor(t){this.attributes={...Oct},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=sM()}margins(){return{left:this.getAttribute("marginLeft"),top:this.getAttribute("marginTop"),bottom:this.getAttribute("marginBottom"),right:this.getAttribute("marginRight")}}innerWidth(){let{left:t,right:r}=this.margins();return this.getAttribute("width")-t-r}innerHeight(t=400){let{top:r,bottom:n}=this.margins(),i=this.getAttribute("height");return i==null&&(i=Rct(this,r,n)||t,this.setAttribute("height",i,{silent:!0})),i-r-n}pending(t){this.synch.pending(t)}update(t){return this.synch.ready(t)&&!this.pendingRender&&(this.pendingRender=!0,requestAnimationFrame(()=>this.render())),this.synch.promise}async render(){this.pendingRender=!1;let t=await hY(this),r=this.legends.flatMap(({legend:n,include:i})=>{let o=n.init(t);return i?o:[]});this.element.replaceChildren(t,...r),this.synch.resolve()}getAttribute(t){return this.attributes[t]}setAttribute(t,r,n){return om(this.attributes[t],r)?(r===void 0?delete this.attributes[t]:this.attributes[t]=r,n?.silent||this.listeners?.get(t)?.forEach(i=>i(t,r)),!0):!1}addAttributeListener(t,r){let n=this.listeners||(this.listeners=new Map);return n.has(t)||n.set(t,new Set),n.get(t).add(r),this}removeAttributeListener(t,r){return this.listeners?.get(t)?.delete(r)}addParams(t,r){let{params:n}=this;for(let i of r)n.has(i)?n.get(i).push(t):(n.set(i,[t]),i.addEventListener("value",()=>Promise.allSettled(n.get(i).map(o=>o.initialize()))))}addMark(t){return t.setPlot(this,this.marks.length),this.marks.push(t),this.markset=null,this}get markSet(){return this.markset||(this.markset=new Set(this.marks))}addInteractor(t){return this.interactors.push(t),this}addLegend(t,r=!0){t.setPlot(this),this.legends.push({legend:t,include:r})}};function Rct(e,t,r){let n=e.getAttribute("aspectRatio");if(n==null)return;let i=e.getAttribute("xDomain"),o=e.getAttribute("yDomain");if(!i||!o)return;let s=Math.abs(i[1]-i[0]);return Math.abs(o[1]-o[0])*e.innerWidth()/(n*s)+t+r}function DI(e){return typeof e!="string"?!1:(e=e.toLowerCase().trim(),e==="none"||e==="currentcolor"||e.startsWith("url(")&&e.endsWith(")")||e.startsWith("var(")&&e.endsWith(")")||di(e)!==null)}var Dct=new Set(["order","sort","label","anchor","curve","tension","marker","markerStart","markerMid","markerEnd","textAnchor","lineAnchor","lineHeight","textOverflow","monospace","fontFamily","fontSize","fontStyle","fontVariant","fontWeight","frameAnchor","strokeLinejoin","strokeLinecap","strokeMiterlimit","strokeDasharray","strokeDashoffset","mixBlendMode","shapeRendering","imageRendering","preserveAspectRatio","interpolate","crossOrigin","paintOrder","pointerEvents","target","select"]);function mY(e){return Dct.has(e)}var Lct=new Set(["asterisk","circle","cross","diamond","diamond2","hexagon","plus","square","square2","star","times","triangle","triangle2","wye"]);function yY(e){return Lct.has(`${e}`.toLowerCase())}var gY=e=>e==="stroke"||e==="fill",Fct=e=>/opacity$/i.test(e),Cct=e=>e==="symbol",kct=(e,t)=>e!=="sort"&&e!=="tip"&&t!=null&&!Array.isArray(t),d8=(e,t)=>({channel:e,field:t,as:yc(t)?t.column:e}),h8=(e,t)=>({channel:e,value:t}),LI=e=>Array.isArray(e),Ir=class extends Bn{constructor(t,r,n,i={}){super(r?.options?.filterBy),this.type=t,this.reqs=i,this.source=r;let o=this.channels=[],s=this.detail=new Set,a=this.params=new Set;LI(r)?this.data=Xn(r):or(r?.table)&&a.add(r.table);let 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[oy]){let d=u(this,l);for(let h in d)c(h,d[h])}else if(f==="string")mY(l)||gY(l)&&DI(u)||Cct(l)&&yY(u)?o.push(h8(l,u)):o.push(d8(l,Gs(u)));else if(io(u)){let d=h8(l,u.value);o.push(d),u.addEventListener("value",h=>(d.value=h,this.update()))}else nn(u)?(MA(u).forEach(d=>a.add(d)),o.push(d8(l,u))):f==="object"&&kct(l,u)?o.push(d8(l,u)):u!==void 0&&o.push(h8(l,u))};for(let l in n)c(l,n[l])}setPlot(t,r){this.plot=t,this.index=r,t.addParams(this,this.params),this.source?.table&&this.queryPending()}sourceTable(){let t=this.source?.table;return t?or(t)?t.value:t:null}hasOwnData(){return this.source==null||LI(this.source)}hasFieldInfo(){return!!this._fieldInfo}channel(t){return this.channels.find(r=>r.channel===t)}channelField(t,{exact:r=!1}={}){let n=r?this.channel(t):this.channels.find(i=>i.channel.startsWith(t));return n?.field?n:null}fields(){if(this.hasOwnData())return null;let{channels:t,reqs:r}=this,n=new Map;for(let{channel:o,field:s}of t){if(!s)continue;let a=s.stats?.stats||[],c=s.stats?.column??s,l=n.get(c)??n.set(c,new Set).get(c);a.forEach(u=>l.add(u)),r[o]?.forEach(u=>l.add(u))}let i=this.sourceTable();return Array.from(n,([o,s])=>({table:i,column:o,stats:s}))}fieldInfo(t){let r=Object.fromEntries(t.map(n=>[n.column,n]));for(let n of this.channels){let{field:i}=n;i&&Object.assign(n,r[i.stats?.column??i])}return this._fieldInfo=!0,this}query(t=[]){return this.hasOwnData()?null:G0(this.channels,this.sourceTable()).where(t)}queryPending(){return this.plot.pending(this),this}queryResult(t){return this.data=Xn(t),this}update(){return this.plot.update(this)}plotSpecs(){let{type:t,data:r,detail:n,channels:i}=this;return p8(t,n,i,r)}};function yn(e,t){let r=t?.[e.as]??e.as;return Object.hasOwn(e,"value")?e.value:gY(e.channel)?{value:r,scale:"color"}:Fct(e.channel)?{value:r,scale:"opacity"}:r}function G0(e,t,r=[]){let n=ft.from({source:t}),i=new Set,o=!1;for(let s of e){let{channel:a,field:c,as:l}=s;if(!r.includes(a)){if(a==="orderby")n.orderby(s.value);else if(c){if(ni(c))o=!0;else{if(i.has(l))continue;i.add(l)}n.select({[l]:c})}}}return o&&n.groupby(Array.from(i)),n}function p8(e,t,r,n,i={}){let{numRows:o,values:s,columns:a}=n??{},c={};for(let f of r){let d=t.has(f.channel)?c:i;d[f.channel]=yn(f,a)}return t.size&&(i.channels=c),[{type:e,data:s??(n?{length:o}:null),options:i}]}function wf(e,t){let{plot:r}=e,n=r.getAttribute(`${t}Scale`);if(!n){let{type:o}=e.channelField(t);n=o==="date"?"time":"linear"}let i={type:n};switch(n){case"log":i.base=r.getAttribute(`${t}Base`)??10;break;case"pow":i.exponent=r.getAttribute(`${t}Exponent`)??1;break;case"symlog":i.constant=r.getAttribute(`${t}Constant`)??1;break}return rm(i)}function Ii(e,t,r,n,i=1,o){let{field:s}=e.channelField(t);o=o??s;let{type:a,apply:c,sqlApply:l}=wf(e,t),u=!!e.plot.getAttribute(`${t}Reverse`),[f,d]=n.map(m=>c(m)),h=l(o),p=a==="time"||a==="utc"?h:o;return[BA(h,f,d,r-i,u),p]}var m8={x:["min","max"]},y8={y:["min","max"]},FI={...m8,...y8};function xY(e,t,r,n,i){let{plot:o}=e,s=o.getAttribute(n),a=o.getAttribute(i);if(Array.isArray(s)&&!s[Gr])return s;{let{column:c,min:l,max:u}=e.channelField(r),f=g8(t,c)||(a?Ba().domain([l,u]).nice().domain():[l,u]);return s!==es&&(f[Gr]=!0),o.setAttribute(n,f,{silent:!0}),f}}function ks(e,t){return xY(e,t,"x","xDomain","xNice")}function Bs(e,t){return xY(e,t,"y","yDomain","yNice")}function g8(e,t){if(!e)return;let r,n;return[e].flat().forEach(i=>zo(i,o=>{if(o instanceof Ql&&`${o.expr}`===t){let s=(o.extent??[]).map(a=>a?.value??a);(r==null||s[0]<r)&&(r=s[0]),(n==null||s[1]>n)&&(n=s[1])}})),r!=null&&n!=null&&r!==n?[r,n]:void 0}var X0=class extends Ir{constructor(t,r,n){let i=t.endsWith("X")?"y":t.endsWith("Y")?"x":null,o=i?{[i]:["count","min","max"]}:void 0;super(t,r,n,o),this.dim=i}query(t=[]){let{plot:r,dim:n,source:i}=this,o=i.options?.optimize,s=super.query(t);if(!n)return s;let a=n==="x"?"y":"x",c=this.channelField(a,{exact:!0})?.as,{field:l,as:u,type:f,count:d,min:h,max:p}=this.channelField(n),m=f==="date"||f==="number",y=n==="x"?r.innerWidth():r.innerHeight();if(o??=d/y>10,o&&m&&c){let[g,x]=g8(t,l)||[h,p],[b]=Ii(this,n,y,[g,x],1,u),_=s._select.map(v=>v.alias).filter(v=>v!==u&&v!==c);return jA(s,b,u,c,_)}else return s.orderby(l)}};function bY(e,t=[]){return new t.constructor(e)}function _Y(e,t,r){let n=bY(e,r),i=r.length;for(let o=0;o<i;++o)n[t[o]]=r[o];return n}function wY(e,t,r,n,i,o,s){let a=r.length,c=e*t,l=i.map(h=>n[h]),u={},f=[],d=new Int32Array(a);if(o?.length){let h=o.map(m=>n[m]),p={};for(let m=0;m<a;++m){let y=h.map(g=>g[m]);d[m]=p[y]??=f.push(y)-1}for(let m=0;m<o.length;++m)u[o[m]]=f.map(y=>y[m])}else f.push([]);if(s){let h=r.map(y=>y%e),p=r.map(y=>Math.floor(y/e)),m=f.map(()=>[]);for(let y=0;y<a;++y)m[d[y]].push(y);i.forEach((y,g)=>{let x=l[g];u[y]=f.map((b,_)=>s(m[_],e,t,h,p,x))})}else i.forEach((h,p)=>{let m=l[p],y=u[h]=f.map(()=>bY(c,m));for(let g=0;g<a;++g)y[d[g]][r[g]]=m[g]});return{numRows:f.length,columns:u}}function H0(e){let t=1/0,r=-1/0;return e.forEach(n=>{let i=n.length;for(let o=0;o<i;++o){let s=n[o];s<t&&(t=s),s>r&&(r=s)}}),Number.isFinite(t)&&Number.isFinite(r)?[t,r]:[0,1]}function vY(e){let t=new In;return e.forEach(r=>{let n=r.length;for(let i=0;i<n;++i)t.add(r[i])}),Array.from(t).sort(Ft)}function nr(e,t){return or(e)?(e.addEventListener("value",t),e.value):e}function Q0(e,t=!1){let r=new Float64Array(5),n=new Float64Array(4);Bct(r,n,e);let i=Float64Array.of(0,n[1]-r[1]*n[0],n[2]-r[2]*n[0],n[3]-r[3]*n[0],-r[4]*n[0]),o=1+r[1]+r[2]+r[3]+r[4],s=(n[0]+n[1]+n[2]+n[3])/o,a=(i[1]+i[2]+i[3]+i[4])/o;return{sigma:e,negative:t,a:r,b_causal:n,b_anticausal:i,sum_causal:s,sum_anticausal:a}}function Bct(e,t,r){let i=Float64Array.of(.84,1.8675,.84,-1.8675,-.34015,-.1299,-.34015,.1299),o=Math.exp(-1.783/r),s=Math.exp(-1.723/r),a=.6318/r,c=1.997/r,l=Float64Array.of(-o*Math.cos(a),o*Math.sin(a),-o*Math.cos(-a),o*Math.sin(-a),-s*Math.cos(c),s*Math.sin(c),-s*Math.cos(-c),s*Math.sin(-c)),u=r*2.5066282746310007,f=Float64Array.of(i[0],i[1],0,0,0,0,0,0),d=Float64Array.of(1,0,l[0],l[1],0,0,0,0,0,0),h,p;for(p=2;p<8;p+=2){for(f[p]=l[p]*f[p-2]-l[p+1]*f[p-1],f[p+1]=l[p]*f[p-1]+l[p+1]*f[p-2],h=p-2;h>0;h-=2)f[h]+=l[p]*f[h-2]-l[p+1]*f[h-1],f[h+1]+=l[p]*f[h-1]+l[p+1]*f[h-2];for(h=0;h<=p;h+=2)f[h]+=i[p]*d[h]-i[p+1]*d[h+1],f[h+1]+=i[p]*d[h+1]+i[p+1]*d[h];for(d[p+2]=l[p]*d[p]-l[p+1]*d[p+1],d[p+3]=l[p]*d[p+1]+l[p+1]*d[p],h=p;h>0;h-=2)d[h]+=l[p]*d[h-2]-l[p+1]*d[h-1],d[h+1]+=l[p]*d[h-1]+l[p+1]*d[h-2]}for(p=0;p<4;++p)h=p<<1,t[p]=f[h]/u,e[p+1]=d[h+2]}function SY(e,t,r,[n,i]){let o=new Float64Array(Math.max(n,i)),s=new Float64Array(Math.max(n,i)),a=new Float64Array(5),c=new Float64Array(r.length);for(let l=0,u=0;l<i;++l,u+=n){let f=c.subarray(u);CI(e,r.subarray(u),n,1,o,s,a,f)}for(let l=0;l<n;++l){let u=c.subarray(l);CI(t,u,i,n,o,s,a,u)}return c}function CI(e,t,r,n=1,i=new Float64Array(r),o=new Float64Array(r),s=new Float64Array(5),a=i,c=Pct){let l=n*2,u=n*3,f=n*4,d=n*r,h,p;for(c(i,t,r,n,e.b_causal,3,e.a,4,e.sum_causal,s,e.sigma),p=4,h=f;p<r;++p,h+=n)i[p]=e.b_causal[0]*t[h]+e.b_causal[1]*t[h-n]+e.b_causal[2]*t[h-l]+e.b_causal[3]*t[h-u]-e.a[1]*i[p-1]-e.a[2]*i[p-2]-e.a[3]*i[p-3]-e.a[4]*i[p-4];for(c(o,t,r,-n,e.b_anticausal,4,e.a,4,e.sum_anticausal,s,e.sigma),p=4,h=d-n*5;p<r;++p,h-=n)o[p]=e.b_anticausal[1]*t[h+n]+e.b_anticausal[2]*t[h+l]+e.b_anticausal[3]*t[h+u]+e.b_anticausal[4]*t[h+f]-e.a[1]*o[p-1]-e.a[2]*o[p-2]-e.a[3]*o[p-3]-e.a[4]*o[p-4];if(e.negative)for(p=0,h=0;p<r;++p,h+=n)a[h]=i[p]+o[r-p-1];else for(p=0,h=0;p<r;++p,h+=n)a[h]=Math.max(0,i[p]+o[r-p-1]);return a}function Pct(e,t,r,n,i,o,s,a,c,l,u,f=.5){let d=Math.abs(n)*r,h=n<0?d+n:0,p,m,y;for(m=0;m<=a;++m)for(l[m]=m<=o?i[m]:0,y=1;y<=a&&y<=m;++y)l[m]-=s[y]*l[m-y];for(y=0;y<a;++y)for(e[y]=0,m=1;m<=y;++m)p=h+n*m,p>=0&&p<d&&(e[y]+=l[y-m]*t[p]);let g=t[h],x=Math.ceil(u*10);for(m=0;m<x;++m){for(y=0;y<a;++y)e[y]+=l[y]*g;if(c-=Math.abs(l[0]),c<=f)break;for(l[a]=m+a<=o?i[m+a]:0,y=1;y<=a;++y)l[a]-=s[y]*l[a-y];for(y=0;y<a;++y)l[y]=l[y+1]}}var Co="density",ko=class extends Ir{constructor(t,r,n){let{bandwidth:i=0,interpolate:o="none",pixelSize:s=1,pad:a=1,width:c,height:l,...u}=n,f=Uct(u);super(t,r,u,FI),this.densityMap=f,this.bandwidth=nr(i,d=>(this.bandwidth=d,this.grids?this.convolve().update():null)),this.interpolate=nr(o,d=>(this.interpolate=d,this.requestUpdate())),this.pixelSize=nr(s,d=>(this.pixelSize=d,this.requestUpdate())),this.pad=nr(a,d=>(this.pad=d,this.requestUpdate())),this.width=nr(c,d=>(this.width=d,this.requestUpdate())),this.height=nr(l,d=>(this.height=d,this.requestUpdate()))}setPlot(t,r){let n=()=>{this.hasFieldInfo()&&this.requestUpdate()};t.addAttributeListener("xDomain",n),t.addAttributeListener("yDomain",n),super.setPlot(t,r)}get filterStable(){let t=this.plot.getAttribute("xDomain"),r=this.plot.getAttribute("yDomain");return t&&r&&!t[Gr]&&!r[Gr]}query(t=[]){let{interpolate:r,pad:n,channels:i,densityMap:o}=this,[s,a]=this.extentX=ks(this,t),[c,l]=this.extentY=Bs(this,t),[u,f]=this.bins=this.binDimensions(),[d,h]=Ii(this,"x",u,[s,a],n),[p,m]=Ii(this,"y",f,[c,l],n),y=n?[jr(h,[+s,+a]),jr(m,[+c,+l])]:[ri(+s,h),ze(h,+a),ri(+c,m),ze(m,+l)],g=ft.from(this.sourceTable()).where(t.concat(y)),x=this.groupby=[],b={};for(let v of i)if(Object.hasOwn(v,"field")){let{as:w,channel:T,field:A}=v;ni(A)?(b[T]=A,o[T]=!0):T==="weight"?b[Co]=de(A):T!=="x"&&T!=="y"&&(g.select({[w]:A}),x.push(w))}let _=this.aggr=Object.keys(b);if(b.density&&_.length>1)throw new Error("Weight option can not be used with custom aggregates.");if(_.length||(_.push(Co),b[Co]=Mr()),r==="linear"){if(_.length>1)throw new Error("Linear binning not applicable to multiple aggregates.");if(!b[Co])throw new Error("Linear binning not applicable to custom aggregates.");let v=Wf(b[Co])[0];return $A(g,d,p,v,u,x)}else return PA(g,d,p,b,u,x)}binDimensions(){let{plot:t,pixelSize:r,width:n,height:i}=this;return[n??Math.round(t.innerWidth()/r),i??Math.round(t.innerHeight()/r)]}queryResult(t){let[r,n]=this.bins,i=$ct(this.interpolate),{columns:o}=Xn(t);return this.grids0=wY(r,n,o.index,o,this.aggr,this.groupby,i),this.convolve()}convolve(){let{aggr:t,bandwidth:r,bins:n,grids0:i,plot:o}=this;if(this.grids=i,r>0){let s=t.length===1?t[0]:t.includes(Co)?Co:null;if(!s)return console.warn("No compatible grid found for smoothing."),this;let a=i.columns[s],c=o.innerWidth(),l=o.innerHeight(),[u,f]=n,d=a.some(m=>m.some(y=>y<0)),h=Q0(r*(u-1)/c,d),p=Q0(r*(f-1)/l,d);this.grids={numRows:i.numRows,columns:{...i.columns,[s]:a.map(m=>SY(h,p,m,n))}}}return this}};function Uct(e){let t={};for(let r in e)e[r]==="density"&&(delete e[r],t[r]=!0);return t}function $ct(e="none"){if(typeof e=="function")return e;switch(e.toLowerCase()){case"none":case"linear":return;case"nearest":return O0;case"barycentric":return N0();case"random-walk":return R0()}throw new Error(`invalid interpolate: ${e}`)}var Z0=class extends ko{constructor(t,r){let{thresholds:n=10,...i}=r;super("geo",t,{bandwidth:20,interpolate:"linear",pixelSize:2,...i}),this.thresholds=nr(n,o=>(this.thresholds=o,this.grids?this.contours().update():null))}convolve(){return super.convolve().contours()}contours(){let{bins:t,densityMap:r,grids:n,thresholds:i,plot:o}=this,{numRows:s,columns:a}=n,c=i,l;if(Array.isArray(c))l=c;else{let[,I]=H0(a.density);l=Array.from({length:c-1},(R,C)=>I*(C+1)/c)}(r.fill||r.stroke)&&this.plot.getAttribute("colorScale")!=="log"&&this.plot.setAttribute("colorZero",!0);let[u,f]=t,[d,h]=o.getAttribute("xDomain"),[p,m]=o.getAttribute("yDomain"),y=(h-d)/u,g=(m-p)/f,x=+d,b=+p,_=I=>x+I*y,v=I=>b+I*g,w=Gc().size(t),T=this.contourData=Array(s*l.length),{density:A,...E}=a,N=Object.entries(E);for(let I=0,R=0;I<s;++I){let C=A[I],S=N.reduce((M,[O,L])=>(M[O]=L[I],M),{});for(let M=0;M<l.length;++M,++R)T[R]=Object.assign(zct(w.contour(C,l[M]),_,v),S)}return this}plotSpecs(){let{type:t,channels:r,densityMap:n,contourData:i}=this,o={};for(let s of r){let{channel:a}=s;a!=="x"&&a!=="y"&&(o[a]=yn(s))}for(let s in n)n[s]&&(o[s]=yn({channel:s,as:"value"}));return[{type:t,data:i,options:o}]}};function zct(e,t,r){function n(s){s.forEach(i)}function i(s){s.forEach(o)}function o(s){s[0]=t(s[0]),s[1]=r(s[1])}return e.coordinates.forEach(n),e}function K0(e){return Array.from({length:e},(t,r)=>r)}function kI(e,t){let r=t.reduce((i,o,s)=>(i[o]=s,i),{}),n=K0(e.length);return n.sort((i,o)=>r[e[i]]-r[e[o]]),n}function BI(e,t){if(typeof document<"u"){let r=document.createElement("canvas");return r.setAttribute("width",e),r.setAttribute("height",t),r}throw new Error("Can not create a canvas instance.")}function IY(e=1){let t=255*e|0;return(r,n,i)=>{for(let o=0,s=0;o<i;++o)for(let a=0;a<n;++a,s+=4)r[s+3]=t}}function TY(e){let{apply:t}=e;return(r,n,i,o)=>{for(let s=0,a=0;s<i;++s)for(let c=0,l=(i-s-1)*n;c<n;++c,a+=4)r[a+3]=255*t(o[c+l])|0}}function AY(e={}){let{r:t=0,g:r=0,b:n=0,opacity:i=1}=typeof e=="string"?wr(e):e,o=new Uint8ClampedArray([t,r,n,255*i|0]);return(s,a,c)=>{for(let l=0,u=0;l<c;++l)for(let f=0;f<a;++f,u+=4)s[u+0]=o[0],s[u+1]=o[1],s[u+2]=o[2],s[u+3]=o[3]}}function EY(e){let{domain:t,range:r}=e,n=Object.create(null),i=new Uint8ClampedArray(4*t.length),o=t.length-1,s=r.length;for(let a=0;a<=o;++a){let c=r[a%s],{r:l,g:u,b:f,opacity:d=1}=typeof c=="string"?wr(c):c,h=a<<2;i[h+0]=l,i[h+1]=u,i[h+2]=f,i[h+3]=255*d|0,n[t[a]]=h}return(a,c,l,u)=>{if(u.map)for(let f=0,d=0;f<l;++f)for(let h=0,p=(l-f-1)*c;h<c;++h,d+=4){let m=n[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=n[u];for(let d=0,h=0;d<l;++d)for(let p=0;p<c;++p,h+=4)a[h+0]=i[f+0],a[h+1]=i[f+1],a[h+2]=i[f+2],a[h+3]=i[f+3]}}}function MY(e,t,r){let{interpolate:n}=t,i=new Uint8ClampedArray(4*e),o=e-1;for(let s=0;s<=o;++s){let a=n(s/o),{r:c,g:l,b:u,opacity:f=1}=typeof a=="string"?wr(a):a,d=s<<2;i[d+0]=c,i[d+1]=l,i[d+2]=u,i[d+3]=255*f|0}return(s,a,c,l)=>{for(let u=0,f=0;u<c;++u)for(let d=0,h=(c-u-1)*a;d<a;++d,f+=4){let p=o*r(l[d+h])<<2;s[f+0]=i[p+0],s[f+1]=i[p+1],s[f+2]=i[p+2],s[f+3]=i[p+3]}}}var Ll=class extends ko{constructor(t,r){super("image",t,r),this.image=null}setPlot(t,r){let n=()=>{this.hasFieldInfo()&&this.rasterize()};t.addAttributeListener("schemeColor",n),super.setPlot(t,r)}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:t,grids:r}=this,[n,i]=t,{numRows:o,columns:s}=r,{canvas:a,ctx:c,img:l}=Yct(this,n,i),{alpha:u,alphaProp:f,color:d,colorProp:h}=x8(this),p=s[f]??[],m=s[h]??[],y=o>1&&h&&this.groupby?.includes(h)?kI(m,this.plot.getAttribute("colorDomain")):K0(o);return this.data={numRows:o,columns:{src:Array.from({length:o},(g,x)=>(d?.(l.data,n,i,m[y[x]]),u?.(l.data,n,i,p[y[x]]),c.putImageData(l,0,0),a.toDataURL()))}},this}plotSpecs(){let{type:t,plot:r,data:{numRows:n,columns:i}}=this,o={src:i.src,width:r.innerWidth(),height:r.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:{length:n},options:o}]}},J0=class extends Ll{constructor(t,r){super(t,{bandwidth:20,interpolate:"linear",pixelSize:2,...r})}};function x8(e){let{aggr:t,densityMap:r,groupby:n,plot:i}=e,o=t.includes(Co),s=t.includes("fillOpacity"),a=e.channel("fill"),c=e.channel("fillOpacity");if(t.length>2||o&&s)throw new Error("Invalid raster encodings. Try dropping an aggregate?");if(n.includes(c?.as))throw new Error("Raster fillOpacity must be an aggregate or constant.");let l=r.fill||t.includes("fill")?"grid":n.includes(a?.as)?"group":DI(a?.value)?a.value:o&&i.getAttribute("colorScheme")?"grid":void 0,u=r.fillOpacity||t.includes("fillOpacity")?"grid":typeof c?.value=="number"?c.value:o&&l!=="grid"?"grid":void 0;if(l!=="grid"&&u!=="grid")throw new Error("Raster mark missing density values.");let f=a?.as??(l==="grid"?Co:null),d=c?.as??(u==="grid"?Co:null),h=l!=="grid"&&l!=="group"?AY(l):qct(e,f),p=u!=="grid"?IY(u):jct(e,d);return{alphaProp:d,colorProp:f,alpha:p,color:h}}function jct(e,t){let{plot:r,grids:n}=e,i=r.getAttribute("opacityDomain"),o=i===es,s=i?.[Gr],a=!o&&!s&&i||H0(n.columns[t]);(o||s||!i)&&(o||(a[Gr]=!0),r.setAttribute("opacityDomain",a));let c=hl({opacity:{type:r.getAttribute("opacityScale"),domain:a,range:r.getAttribute("opacityRange"),clamp:r.getAttribute("opacityClamp"),nice:r.getAttribute("opacityNice"),reverse:r.getAttribute("opacityReverse"),zero:r.getAttribute("opacityZero"),base:r.getAttribute("opacityBase"),exponent:r.getAttribute("opacityExponent"),constant:r.getAttribute("opacityConstant")}});return TY(c)}function qct(e,t){let{plot:r,grids:n}=e,i=n.columns[t],o=!i[0]?.map,s=o||Array.isArray(i[0]),a=r.getAttribute("colorDomain"),c=a===es,l=a?.[Gr],u=!c&&!l&&a||(o?i.slice().sort(Ft):s?vY(i):H0(i));(c||l||!a)&&(c||(u[Gr]=!0),r.setAttribute("colorDomain",u));let f=hl({color:{type:r.getAttribute("colorScale"),domain:u,range:r.getAttribute("colorRange"),clamp:r.getAttribute("colorClamp"),n:r.getAttribute("colorN"),nice:r.getAttribute("colorNice"),reverse:r.getAttribute("colorReverse"),scheme:r.getAttribute("colorScheme"),interpolate:r.getAttribute("colorInterpolate"),pivot:r.getAttribute("colorPivot"),symmetric:r.getAttribute("colorSymmetric"),zero:r.getAttribute("colorZero"),base:r.getAttribute("colorBase"),exponent:r.getAttribute("colorExponent"),constant:r.getAttribute("colorConstant")}});if(s)return EY(f);{let d=hl({x:{type:Vct(f.type),domain:f.domain,reverse:f.reverse,range:[0,1],clamp:f.clamp,base:f.base,exponent:f.exponent,constant:f.constant}});return MY(1024,f,d.apply)}}function Vct(e){return e.endsWith("symlog")?"symlog":e.endsWith("log")?"log":e.endsWith("pow")?"pow":e.endsWith("sqrt")?"sqrt":e==="diverging"?"linear":e}function Yct(e,t,r){if(!e.image||e.image.w!==t||e.image.h!==r){let n=BI(t,r),i=n.getContext("2d",{willReadFrequently:!0}),o=i.getImageData(0,0,t,r);e.image={canvas:n,ctx:i,img:o,w:t,h:r}}return e.image}var tx=class extends Ll{constructor(t,r){let{normalize:n=!0,...i}=r;super(t,i),this.normalize=nr(n,o=>(this.normalize=o,this.requestUpdate()))}query(t=[]){let{channels:r,normalize:n,pad:i}=this,[o,s]=this.bins=this.binDimensions(),[a]=Ii(this,"x",o,ks(this,t),i),[c]=Ii(this,"y",s,Bs(this,t),i),l=ft.from(this.sourceTable()).where(Wct(this,t));this.aggr=["density"];let u=this.groupby=[],f=[];for(let d of r)if(Object.hasOwn(d,"field")){let{channel:h,field:p}=d;h==="z"?(l.select({[h]:p}),f.push("z")):h!=="x"&&h!=="y"&&(l.select({[h]:p}),u.push(h))}return zA(l,a,c,f,o,s,u,n)}};function Wct(e,t){if(Array.isArray(t)&&!t.length)return t;let r=e.channelField("x").column,n=e.channelField("y").column,i=s=>{let a=`${s.expr}`;return s.type!=="BETWEEN"||a!==r&&a!==n},o=s=>s.op==="AND"?on(s.clauses.filter(a=>i(a))):s;return Array.isArray(t)?t.filter(s=>i(s)).map(s=>o(s)):o(t)}var ip=class extends Ir{constructor(t,r,n){let{bins:i=1024,bandwidth:o=20,...s}=n,a=t.endsWith("X")?"y":"x";super(t,r,s,a==="x"?m8:y8),this.dim=a,this.bins=nr(i,c=>(this.bins=c,this.requestUpdate())),this.bandwidth=nr(o,c=>(this.bandwidth=c,this.grid?this.convolve().update():null))}get filterStable(){let t=this.dim==="x"?"xDomain":"yDomain",r=this.plot.getAttribute(t);return r&&!r[Gr]}query(t=[]){if(this.hasOwnData())throw new Error("Density1DMark requires a data source");let{bins:r,channels:n,dim:i}=this,o=this.extent=(i==="x"?ks:Bs)(this,t),[s,a]=Ii(this,i,r,o),c=G0(n,this.sourceTable(),[i]).where(t.concat(jr(a,o))),l=this.channelField("weight")?"weight":null;return UA(c,s,l)}queryResult(t){let{columns:{index:r,density:n}}=Xn(t);return this.grid=_Y(this.bins,r,n),this.convolve()}convolve(){let{bins:t,bandwidth:r,dim:n,grid:i,plot:o,extent:[s,a]}=this,c=i.some(b=>b<0),l=n==="x"?o.innerWidth():o.innerHeight(),u=Q0(r*(t-1)/l,c),f=CI(u,i,t),d=n==="x"?"y":"x",h=this.channelField(n).as,p=+s,m=(a-p)/(t-1),y=1/m,g=new Float64Array(t),x=new Float64Array(t);for(let b=0;b<t;++b)g[b]=p+b*m,x[b]=f[b]*y;return this.data={numRows:t,columns:{[h]:g,[d]:x}},this}plotSpecs(){let{type:t,data:{numRows:r,columns:n},channels:i,dim:o}=this,s=o==="x"?{y:n.y}:{x:n.x};for(let a of i)s[a.channel]=yn(a,n);return[{type:t,data:{length:r},options:s}]}};var ex=class extends ko{constructor(t,r){let{type:n="dot",...i}=r;super(n,t,{bandwidth:20,interpolate:"linear",pad:0,pixelSize:2,...i})}convolve(){super.convolve();let{bins:t,pad:r,extentX:n,extentY:i}=this,[o,s]=t,a=wf(this,"x"),c=wf(this,"y"),[l,u]=n.map(y=>a.apply(y)),[f,d]=i.map(y=>c.apply(y)),h=(u-l)/(o-r),p=(d-f)/(s-r),m=r?0:.5;return this.data=Gct(this.grids,t,l,f,h,p,a.invert,c.invert,m),this}plotSpecs(){let{type:t,channels:r,densityMap:n,data:{numRows:i,columns:o}}=this,s={};for(let a of r){let{channel:c}=a;s[c]=c==="x"||c==="y"?o[c]:yn(a,o)}for(let a in n)n[a]&&(s[a]=o.density);return[{type:t,data:{length:i},options:s}]}};function Gct(e,t,r,n,i,o,s,a,c){let l=1/(i*o),[u,f]=t,d=u*f,h=d*e.numRows,p=new Float64Array(h),m=new Float64Array(h),y=new Float64Array(h),g={x:p,y:m,density:y},{density:x,...b}=e.columns;for(let v in b)g[v]=new b[v].constructor(h);let _=0;for(let v=0;v<e.numRows;++v){for(let T in b)g[T].fill(b[T][v],_,_+d);let w=x[v];for(let T=0,A=0;A<f;++A)for(let E=0;E<u;++E,++_,++T)p[_]=s(r+(E+c)*i),m[_]=a(n+(A+c)*o),y[_]=w[T]*l}return{numRows:h,columns:g}}function Xct(e,t,r){var n=1e-8,i=t-1,o=r-1,s=0,a,c,l,u,f,d,h,p,m,y,g;if(e<=0)return 0;if(e>=1)return 1;for(t>=1&&r>=1?(l=e<.5?e:1-e,u=Math.sqrt(-2*Math.log(l)),h=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,e<.5&&(h=-h),p=(h*h-3)/6,m=2/(1/(2*t-1)+1/(2*r-1)),y=h*Math.sqrt(p+m)/m-(1/(2*r-1)-1/(2*t-1))*(p+5/6-2/(3*m)),h=t/(t+r*Math.exp(2*y))):(a=Math.log(t/(t+r)),c=Math.log(r/(t+r)),u=Math.exp(t*a)/t,f=Math.exp(r*c)/r,y=u+f,e<u/y?h=Math.pow(t*y*e,1/t):h=1-Math.pow(r*y*(1-e),1/r)),g=-op(t)-op(r)+op(t+r);s<10;s++){if(h===0||h===1)return h;if(d=Hct(h,t,r)-e,u=Math.exp(i*Math.log(h)+o*Math.log(1-h)+g),f=d/u,h-=u=f/(1-.5*Math.min(1,f*(i/h-o/(1-h)))),h<=0&&(h=.5*(h+u)),h>=1&&(h=.5*(h+u+1)),Math.abs(u)<n*h&&s>0)break}return h}function Hct(e,t,r){var n=e===0||e===1?0:Math.exp(op(t+r)-op(t)-op(r)+t*Math.log(e)+r*Math.log(1-e));return e<0||e>1?0:e<(t+1)/(t+r+2)?n*NY(e,t,r)/t:1-n*NY(1-e,r,t)/r}function NY(e,t,r){var n=1e-30,i=1,o=t+r,s=t+1,a=t-1,c=1,l=1-o*e/s,u,f,d,h;for(Math.abs(l)<n&&(l=n),l=1/l,h=l;i<=100&&(u=2*i,f=i*(r-i)*e/((a+u)*(t+u)),l=1+f*l,Math.abs(l)<n&&(l=n),c=1+f/c,Math.abs(c)<n&&(c=n),l=1/l,h*=l*c,f=-(t+i)*(o+i)*e/((t+u)*(s+u)),l=1+f*l,Math.abs(l)<n&&(l=n),c=1+f/c,Math.abs(c)<n&&(c=n),l=1/l,d=l*c,h*=d,!(Math.abs(d-1)<3e-7));i++);return h}function op(e){var t=0,r=[76.18009172947146,-86.5053203294167,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],n=1.000000000190015,i,o,s;for(s=(o=i=e)+5.5,s-=(i+.5)*Math.log(s);t<6;t++)n+=r[t]/++o;return Math.log(2.506628274631*n/i)-s}function OY(e,t){var r=Xct(2*Math.min(e,1-e),.5*t,.5);return r=Math.sqrt(t*(1-r)/r),e>.5?r:-r}function RY(e){let t=-Math.log((1-e)*(1+e)),r;return t<6.25?(t-=3.125,r=-364441206401782e-35,r=-16850591381820166e-35+r*t,r=128584807152564e-32+r*t,r=11157877678025181e-33+r*t,r=-1333171662854621e-31+r*t,r=20972767875968562e-33+r*t,r=6637638134358324e-30+r*t,r=-4054566272975207e-29+r*t,r=-8151934197605472e-29+r*t,r=26335093153082323e-28+r*t,r=-12975133253453532e-27+r*t,r=-5415412054294628e-26+r*t,r=10512122733215323e-25+r*t,r=-4112633980346984e-24+r*t,r=-29070369957882005e-24+r*t,r=42347877827932404e-23+r*t,r=-13654692000834679e-22+r*t,r=-13882523362786469e-21+r*t,r=.00018673420803405714+r*t,r=-.000740702534166267+r*t,r=-.006033670871430149+r*t,r=.24015818242558962+r*t,r=1.6536545626831027+r*t):t<16?(t=Math.sqrt(t)-3.25,r=22137376921775787e-25,r=9075656193888539e-23+r*t,r=-27517406297064545e-23+r*t,r=18239629214389228e-24+r*t,r=15027403968909828e-22+r*t,r=-4013867526981546e-21+r*t,r=29234449089955446e-22+r*t,r=12475304481671779e-21+r*t,r=-47318229009055734e-21+r*t,r=6828485145957318e-20+r*t,r=24031110387097894e-21+r*t,r=-.0003550375203628475+r*t,r=.0009532893797373805+r*t,r=-.0016882755560235047+r*t,r=.002491442096107851+r*t,r=-.003751208507569241+r*t,r=.005370914553590064+r*t,r=1.0052589676941592+r*t,r=3.0838856104922208+r*t):Number.isFinite(t)?(t=Math.sqrt(t)-5,r=-27109920616438573e-27,r=-2555641816996525e-25+r*t,r=15076572693500548e-25+r*t,r=-3789465440126737e-24+r*t,r=761570120807834e-23+r*t,r=-1496002662714924e-23+r*t,r=2914795345090108e-23+r*t,r=-6771199775845234e-23+r*t,r=22900482228026655e-23+r*t,r=-99298272942317e-20+r*t,r=4526062597223154e-21+r*t,r=-1968177810553167e-20+r*t,r=7599527703001776e-20+r*t,r=-.00021503011930044477+r*t,r=-.00013871931833623122+r*t,r=1.0103004648645344+r*t,r=4.849906401408584+r*t):r=1/0,r*e}var sp=class extends Ir{constructor(t,r,n){let i=t.endsWith("X")?"y":"x",{ci:o=.95,...s}=n;super(t,r,s),this.dim=i,this.field=this.channelField(i).field,this.channels=this.channels.filter(a=>a.channel!==i),this.ci=nr(o,a=>(this.ci=a,this.update()))}query(t=[]){let{channels:r,field:n}=this,i=r.concat([{field:Gp(n),as:"__avg__"},{field:se(Qp(n),Hs(Mr(n))),as:"__se__"}]);return G0(i,this.sourceTable()).where(t)}queryResult(t){return this.data=Xn(t),this}plotSpecs(){let{type:t,dim:r,detail:n,data:i,ci:o,channels:s}=this,a=Math.SQRT2*RY(o),{columns:{__avg__:c,__se__:l}}=i,u={[`${r}1`]:c.map((f,d)=>f-a*l[d]),[`${r}2`]:c.map((f,d)=>f+a*l[d])};return p8(t,n,s,i,u)}};var Qct="geom",rx=class extends Ir{constructor(t,r={},n){!LI(t)&&!r?.geometry&&(r.geometry=Jp(Qct)),super("geo",t,r,n)}queryResult(t){super.queryResult(t);let r=this.channelField("geometry")?.as;if(r){let{columns:n}=this.data;typeof n[r][0]=="string"&&(n[r]=n[r].map(i=>JSON.parse(i)))}return this}};var nx=class extends Ir{constructor(t,r){let{type:n="hexagon",binWidth:i=20,...o}=r;super(n,t,{r:i/2,clip:!0,...o},FI),this.binWidth=nr(i,s=>(this.binWidth=s,this.requestUpdate()))}get filterStable(){let t=this.plot.getAttribute("xDomain"),r=this.plot.getAttribute("yDomain");return t&&r&&!t[Gr]&&!r[Gr]}query(t=[]){if(this.hasOwnData())return null;let{plot:r,binWidth:n,channels:i}=this,o,s,a=new Set,c={};for(let N of i)if(N.channel!=="orderby"){if(N.channel==="x")o=N;else if(N.channel==="y")s=N;else if(Object.hasOwn(N,"field")){let{as:I,field:R}=N;c[I]=R,ni(R)||a.add(I)}}let[l,u]=ks(this,t),[f,d]=Bs(this,t),h=.5-r.getAttribute("marginLeft"),p=0-r.getAttribute("marginTop"),m=Ge(n),y=Ge(n*(1.5/Math.sqrt(3))),g=Ge(r.innerWidth()/(u-l)),x=Ge(r.innerHeight()/(d-f)),b="_x",_="_y",v="_px",w="_py",T="_pi",A="_pj",E="_tt";return ft.select({[o.as]:te(Ge(l),se(te(Nt(te(b,Nt(.5,Zp(_,1))),m),h),g)),[s.as]:Tt(Ge(d),se(te(Nt(_,y),p),x)),...c}).groupby(b,_,...a).from(ft.select({[w]:se(Tt(Nt(x,Tt(d,s.field)),p),y),[A]:ve(Qs(w)),[v]:Tt(se(Tt(Nt(g,Tt(o.field,l)),h),m),Nt(.5,Zp(A,1))),[T]:ve(Qs(v)),[E]:on(Di(Nt(Nr(Tt(w,A)),3),1),Di(te(ir(Tt(v,T),2),ir(Tt(w,A),2)),te(ir(Tt(Tt(v,T),Nt(.5,Xs(ze(v,T),-1,1))),2),ir(Tt(Tt(w,A),Xs(ze(w,A),-1,1)),2)))),[b]:Xs(E,ve(te(te(T,Xs(ze(v,T),-.5,.5)),Xs(so(Zp(A,1),0),.5,-.5))),T),[_]:Xs(E,ve(te(A,Xs(ze(w,A),-1,1))),A)},"*").from(this.sourceTable()).where(Ri(o.field),Ri(s.field),t))}};var ix=class extends ko{constructor(t,r){let{origin:n=[0,0],dim:i="xy",...o}=r;super("image",t,o),this.image=null,this.origin=n,this.tileX=i.toLowerCase().includes("x"),this.tileY=i.toLowerCase().includes("y")}setPlot(t,r){let n=()=>{this.hasFieldInfo()&&this.rasterize()};t.addAttributeListener("schemeColor",n),super.setPlot(t,r)}requestQuery(){return this.requestTiles()}query(t=[]){return this._filter=t,null}tileQuery(t){let{interpolate:r,pad:n,channels:i,densityMap:o}=this,[[s,a],[c,l]]=t,[u,f]=this.bins,[d,h]=Ii(this,"x",u,[s,a],n),[p,m]=Ii(this,"y",f,[c,l],n),y=n?[jr(h,[+s,+a]),jr(m,[+c,+l])]:[ri(+s,h),ze(h,+a),ri(+c,m),ze(m,+l)],g=ft.from(this.sourceTable()).where(y),x=this.groupby=[],b={};for(let v of i)if(Object.hasOwn(v,"field")){let{as:w,channel:T,field:A}=v;A.aggregate?(b[T]=A,o[T]=!0):T==="weight"?b.density=de(A):T!=="x"&&T!=="y"&&(g.select({[w]:A}),x.push(w))}let _=this.aggr=Object.keys(b);if(b.density&&_.length>1)throw new Error("Weight option can not be used with custom aggregates.");if(_.length||(_.push("density"),b.density=Mr()),r==="linear"){if(_.length>1)throw new Error("Linear binning not applicable to multiple aggregates.");if(!b.density)throw new Error("Linear binning not applicable to custom aggregates.");return elt(g,d,p,b.density,u,x)}else return tlt(g,d,p,b,u,x)}async requestTiles(){let t=Li();this.prefetch&&t.cancel(this.prefetch);let{pad:r,tileX:n,tileY:i,origin:[o,s]}=this,[a,c]=this.bins=this.binDimensions(),[l,u]=ks(this,this._filter),[f,d]=Bs(this,this._filter),h=u-l,p=d-f,m=Math.floor((l-o)*(a-r)/h),y=Math.floor((f-s)*(c-r)/p),g=(I,R)=>[[o+I*h,o+(I+1)*h],[s+R*p,s+(R+1)*p]],x=Math.floor((l-o)/h),b=n?DY((u-o)/h):x,_=Math.floor((f-s)/p),v=i?DY((d-s)/p):_,w=[];for(let I=x;I<=b;++I)for(let R=_;R<=v;++R)w.push([I,R]);let T=w.map(([I,R])=>t.query(this.tileQuery(g(I,R)))),A=[];if(n)for(let I=_;I<=v;++I)A.push([b+1,I]),A.push([x-1,I]);if(i){let I=n?x-1:x,R=n?b+1:b;for(let C=I;C<=R;++C)A.push([C,v+1]),A.push([C,_-1])}this.prefetch=A.map(([I,R])=>t.prefetch(this.tileQuery(g(I,R))));let E=await Promise.all(T),N=Zct(a,c,m,y,w,E);this.grids0={numRows:N.length,columns:{density:[N]}},this.convolve().update()}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:t,grids:r}=this,[n,i]=t,{numRows:o,columns:s}=r,{canvas:a,ctx:c,img:l}=Jct(this,n,i),{alpha:u,alphaProp:f,color:d,colorProp:h}=x8(this),p=s[f]??[],m=s[h]??[],y=o>1&&h&&this.groupby?.includes(h)?kI(m,this.plot.getAttribute("colorDomain")):K0(o);return this.data={numRows:o,columns:{src:Array.from({length:o},(g,x)=>(d?.(l.data,n,i,m[y[x]]),u?.(l.data,n,i,p[y[x]]),c.putImageData(l,0,0),a.toDataURL()))}},this}plotSpecs(){let{type:t,plot:r,data:{numRows:n,columns:i}}=this,o={src:i.src,width:r.innerWidth(),height:r.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:{length:n},options:o}]}};function Zct(e,t,r,n,i,o){let s=new Float64Array(e*t);return o.forEach((a,c)=>{let[l,u]=i[c],f=l*e-r,d=u*t-n;Kct(e,t,s,a,f,d)}),s}function Kct(e,t,r,n,i,o){let s=n.numRows;if(s===0)return;let a=n.getChild("index").toArray(),c=n.getChild("density").toArray();for(let l=0;l<s;++l){let u=a[l],f=i+u%e,d=o+Math.floor(u/e);0<=f&&f<e&&0<=d&&d<t&&(r[f+d*e]=c[l])}}function Jct(e,t,r){if(!e.image||e.image.w!==t||e.image.h!==r){let n=BI(t,r),i=n.getContext("2d",{willReadFrequently:!0}),o=i.getImageData(0,0,t,r);e.image={canvas:n,ctx:i,img:o,w:t,h:r}}return e.image}function tlt(e,t,r,n,i,o){return e.select({index:tr`FLOOR(${t})::INTEGER + FLOOR(${r})::INTEGER * ${i}`,...n}).groupby("index",o)}function elt(e,t,r,n,i,o){let s=n.column?`* ${n.column}`:"",a=(d,h)=>e.clone().select({xp:t,yp:r,i:d,w:h}),c=a(tr`FLOOR(xp)::INTEGER + FLOOR(yp)::INTEGER * ${i}`,tr`(FLOOR(xp)::INTEGER + 1 - xp) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),l=a(tr`FLOOR(xp)::INTEGER + (FLOOR(yp)::INTEGER + 1) * ${i}`,tr`(FLOOR(xp)::INTEGER + 1 - xp) * (yp - FLOOR(yp)::INTEGER)${s}`),u=a(tr`FLOOR(xp)::INTEGER + 1 + FLOOR(yp)::INTEGER * ${i}`,tr`(xp - FLOOR(xp)::INTEGER) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),f=a(tr`FLOOR(xp)::INTEGER + 1 + (FLOOR(yp)::INTEGER + 1) * ${i}`,tr`(xp - FLOOR(xp)::INTEGER) * (yp - FLOOR(yp)::INTEGER)${s}`);return ft.from(ft.unionAll(c,l,u,f)).select({index:"i",density:de("w")},o).groupby("index",o).having(so("density",0))}function DY(e){let t=Math.floor(e);return t===e?t-1:t}var ox=class extends Ir{constructor(t,r){let{ci:n=.95,precision:i=4,...o}=r;super("line",t,o);let s=()=>this.modelFit?this.confidenceBand().update():null;this.ci=nr(n,a=>(this.ci=a,s())),this.precision=nr(i,a=>(this.precision=a,s()))}query(t=[]){let r=this.channelField("x").as,n=this.channelField("y").as,i=Array.from(new Set(["stroke","z","fx","fy"].flatMap(o=>this.channelField(o)?.as||[])));return ft.from(super.query(t)).select({intercept:$T(n,r),slope:qT(n,r),n:Hp(n,r),ssy:jT(n,r),ssx:zT(n,r),xm:Xp(n,r),x0:Ge(zn(r).where(Ri(n))),x1:Ge(zr(r).where(Ri(n)))}).select(i).groupby(i)}queryResult(t){return this.modelFit=Xn(t),this.lineData=rlt(this.modelFit),this.confidenceBand()}confidenceBand(){let{ci:t,modelFit:r,precision:n,plot:i}=this,o=i.innerWidth();return this.areaData=t?nlt(r,t,n,o):null,this}plotSpecs(){let{lineData:t,areaData:r,channels:n,ci:i}=this,o=t.columns,s=i?r.columns:{},a={x:o.x,y:o.y},c={x:s.x,y1:s.y1,y2:s.y2,fillOpacity:.1};for(let l of n)switch(l.channel){case"x":case"y":case"fill":break;case"tip":c.tip=yn(l,s);break;case"stroke":a.stroke=yn(l,o),c.fill=yn(l,s);break;case"strokeOpacity":a.strokeOpacity=yn(l,o);break;case"fillOpacity":c.fillOpacity=yn(l,s);break;default:a[l.channel]=yn(l,o),c[l.channel]=yn(l,s);break}return[...i?[{type:"areaY",data:{length:r.numRows},options:c}]:[],{type:"line",data:{length:t.numRows},options:a}]}};function b8(e,t){if(e.concat)return e.concat(t);let r=new e.constructor(e.length+t.length);return r.set(e,0),r.set(t,e.length),r}function rlt(e){let{x0:t=[],x1:r=[],xm:n,intercept:i,slope:o,n:s,ssx:a,ssy:c,...l}=e.columns,u=(h,p)=>i[p]+h*o[p],f=b8(t,r),d=b8(t.map(u),r.map(u));for(let h in l)l[h]=b8(l[h],l[h]);return{numRows:f.length,columns:{x:f,y:d,...l}}}function nlt(e,t,r,n){let i=e.numRows,{x0:o,x1:s,xm:a,intercept:c,slope:l,n:u,ssx:f,ssy:d,...h}=e.columns,p=Object.keys(h),m={x:[],y1:[],y2:[]};p.forEach(y=>m[y]=[]);for(let y=0;y<i;++y){let g=r*(s[y]-o[y])/n,x=OY((1-t)/2,u[y]-2)*Math.sqrt(d[y]/(u[y]-2));er(o[y],s[y]-g/2,g).concat(s[y]).forEach(b=>{let _=c[y]+b*l[y],v=x*Math.sqrt(1/u[y]+(b-a[y])**2/f[y]);m.x.push(b),m.y1.push(_-v),m.y2.push(_+v),p.forEach(w=>m[w].push(h[w][y]))})}return{numRows:m.x.length,columns:m}}function ap(e){e.tagName==="a"&&(e=e.children[0]);let t=e.__data__;return Array.isArray(t)?t[0]:t}function LY(e){let t=e.toLowerCase(),r=e.length,n="";for(let i=0;i<r;++i)n+=(e[i]!==t[i]?"-":"")+t[i];return n}function Fl(e){let t={};for(let r in e)t[LY(r)]=e[r];return t}function ilt(e){let{channels:t}=e,r=new Set,n=!1,i=!1;for(let o of t){let{channel:s,field:a,as:c}=o;if(s==="orderby")n=!0;else if(a)if(ni(a))i=!0;else{if(r.has(c))continue;r.add(c)}}return!n&&i&&r.size&&e.channels.push({channel:"orderby",value:Array.from(r)}),e}var sx=class{constructor(t,{selection:r,channels:n={}}){this.mark=ilt(t),this.selection=r;let i=Object.entries(Fl(n));this.channels=i.length?i:[["opacity",.2]],this.selection.addEventListener("value",up(()=>this.update()))}init(t){this.svg=t;let r=this.values=[],i=`g[data-index="${this.mark.index}"]`,o=`${i} > *:not(g), ${i} > g > *`,s=this.nodes=t.querySelectorAll(o),{channels:a}=this;for(let c=0;c<s.length;++c){let l=s[c];r.push(a.map(u=>l.getAttribute(u[0])))}return this.update()}async update(){let{svg:t,nodes:r,channels:n,values:i,mark:o,selection:s}=this;if(!t)return;let a=await olt(o,s);for(let c=0;c<r.length;++c){let l=r[c],u=i[c],f=a(ap(l));for(let d=0;d<n.length;++d){let[h,p]=n[d];l.setAttribute(h,f?u[d]:p)}}}};async function olt(e,t){let r=t?.predicate(e);if(!r||r.length===0)return()=>!0;let n=e.filterBy?.predicate(e,!0),i={__:on(r)},o=e.query(n);(o.queries||[o]).forEach(c=>{c._groupby.length?c.select(i):c.setSelect(i)});let s=await e.coordinator.query(o),a=s.getChild?.("__");return s.numRows||s.length?a?c=>a.at(c):c=>s[c].__:()=>!1}function PI(){let e=this,t=e.getScreenCTM,r;e.getScreenCTM=()=>e.isConnected?r=t.call(e):r}function _8(e){let t=e.on,r=!0;function n(i){r=!1,i(),r=!0}return e.reset=(...i)=>{n(()=>e.clear(...i))},e.moveSilent=(...i)=>{n(()=>e.move(...i))},e.on=(...i)=>{if(i.length>1&&i[1]){let o=i[1];i[1]=(...s)=>r&&o(...s)}return t(...i)},e}function UI(){return _8(VM())}function FY(){return _8(jM())}function CY(){return _8(qM())}function $I(e,t,r,n,i){let o=Qt(t??e).append("g").attr("class",i),s=e.scale("fx"),a=e.scale("fy");if(s||a){let c=s?.domain.map(u=>s.apply(u)-r),l=a?.domain.map(u=>a.apply(u)-n);if(c&&l)for(let u=0;u<c.length;++u)for(let f=0;f<l.length;++f)o.append("g").attr("transform",`translate(${c[u]}, ${l[f]})`);else if(c)for(let u=0;u<c.length;++u)o.append("g").attr("transform",`translate(${c[u]}, 0})`);else if(l)for(let u=0;u<l.length;++u)o.append("g").attr("transform",`translate(0, ${l[u]})`);o=o.selectAll("g")}return o.each(PI)}function ax(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 kY(e){if(nn(e)){if(e.type==="COLUMN_REF")return e.column;if(e.type==="AGGREGATE")return e.args[0]??e}return e}function Ps(e,t){return kY(e.channelField(t)?.field)}function BY(e,t){let r=[],n=[];return t.forEach(i=>{let o=i==="color"?["color","fill","stroke"]:i==="x"?["x","x1","x2"]:i==="y"?["y","y1","y2"]:[i];for(let s=0;s<o.length;++s){let a=e.channelField(o[s],{exact:!0});if(a){r.push(kY(a.field)),n.push(a.as);return}}throw new Error(`Missing channel: ${i}`)}),{fields:r,as:n}}function cx(e,t,r=1){return t.invert(r*Math.floor(e/r))}var Cl=class{constructor(t,{channel:r,selection:n,field:i=void 0,pixelSize:o=1,peers:s=!0,brush:a}){this.mark=t,this.channel=r,this.pixelSize=o||1,this.selection=n,this.peers=s,this.field=i||Ps(t,r),this.style=a&&Fl(a),this.brush=r==="y"?CY():FY(),this.brush.on("brush end",({selection:c})=>this.publish(c))}reset(){this.value=void 0,this.g&&this.brush.reset(this.g)}activate(){this.selection.activate(this.clause(this.value||[0,1]))}publish(t){let r;t&&(r=t.map(n=>cx(n,this.scale,this.pixelSize)).sort((n,i)=>n-i)),ax(r,this.value)||(this.value=r,this.g.call(this.brush.moveSilent,t),this.selection.update(this.clause(r)))}clause(t){let{mark:r,pixelSize:n,field:i,scale:o}=this;return _u(i,t,{source:this,clients:this.peers?r.plot.markSet:new Set().add(r),scale:o,pixelSize:n})}init(t,r){let{brush:n,channel:i,style:o}=this;this.scale=t.scale(i);let s=this.value?.map(this.scale.apply).sort(Ft),a=t.scale("x").range,c=t.scale("y").range;if(n.extent([[Ht(a),Ht(c)],[Kt(a),Kt(c)]]),this.g=$I(t,r,Ht(a),Ht(c),`interval-${i}`).call(n).call(n.moveSilent,s),o){let l=this.g.selectAll("rect.selection");for(let u in o)l.attr(u,o[u])}t.addEventListener("pointerenter",l=>{l.buttons||this.activate()})}};var lx=class{constructor(t,{selection:r,xfield:n,yfield:i,pixelSize:o=1,peers:s=!0,brush:a}){this.mark=t,this.pixelSize=o||1,this.selection=r,this.peers=s,this.xfield=n||Ps(t,"x"),this.yfield=i||Ps(t,"y"),this.style=a&&Fl(a),this.brush=UI(),this.brush.on("brush end",({selection:c})=>this.publish(c))}reset(){this.value=void 0,this.g&&this.brush.reset(this.g)}activate(){this.selection.activate(this.clause(this.value||[[0,1],[0,1]]))}publish(t){let{value:r,pixelSize:n,xscale:i,yscale:o}=this,s,a;if(t){let[c,l]=t;s=[c[0],l[0]].map(u=>cx(u,i,n)).sort(Ft),a=[c[1],l[1]].map(u=>cx(u,o,n)).sort(Ft)}(!ax(s,r?.[0])||!ax(a,r?.[1]))&&(this.value=t?[s,a]:void 0,this.g.call(this.brush.moveSilent,t),this.selection.update(this.clause(this.value)))}clause(t){let{mark:r,pixelSize:n,xfield:i,yfield:o,xscale:s,yscale:a}=this;return nM([i,o],t,{source:this,clients:this.peers?r.plot.markSet:new Set().add(r),scales:[s,a],pixelSize:n})}init(t){let{brush:r,style:n,value:i}=this,o=this.xscale=t.scale("x"),s=this.yscale=t.scale("y"),a=o.range,c=s.range;if(r.extent([[Ht(a),Ht(c)],[Kt(a),Kt(c)]]),this.g=$I(t,null,Ht(a),Ht(c),"interval-xy").call(r),n){let l=this.g.selectAll("rect.selection");for(let u in n)l.attr(u,n[u])}if(i){let[l,u]=i[0].map(o.apply).sort(Ft),[f,d]=i[1].map(s.apply).sort(Ft);this.g.call(r.moveSilent,[[l,f],[u,d]])}t.addEventListener("pointerenter",l=>{l.buttons||this.activate()})}};var vf=class{constructor(t,{selection:r,pointer:n,channels:i,fields:o,maxRadius:s=40}){this.mark=t,this.selection=r,this.clients=new Set().add(t),this.pointer=n,this.channels=i||(n==="x"?["x"]:n==="y"?["y"]:["x","y"]),this.fields=o||this.channels.map(a=>Ps(t,[a])),this.maxRadius=s,this.valueIndex=-1}clause(t){let{clients:r,fields:n}=this,i={source:this,clients:r};return n.length>1?Sa(n,t&&[t],i):Pc(n[0],t?.[0],i)}init(t){let r=this,{mark:n,channels:i,selection:o,maxRadius:s}=this,{data:{columns:a}}=n,c=i.map(m=>n.channelField(m).as),l=!ii(o),[u,f]=slt(t,n),d=this.pointer==="y"?.01:1,h=this.pointer==="x"?.01:1,p=Qt(t);p.on("pointerenter pointerdown pointermove",function(m){let[y,g]=an(m,this),x=alt(u,f,y,g,d,h,s);if(x!==this.valueIndex){this.valueIndex=x;let b=x<0?void 0:c.map(_=>a[_][x]);o.update(l?!b||b.length>1?b:b[0]:r.clause(b))}}),!l&&(p.on("pointerleave",()=>{o.update(r.clause(void 0))}),t.addEventListener("pointerenter",m=>{if(!m.buttons){let y=this.channels.map(()=>0);o.activate(this.clause(y))}}))}};function slt(e,t){let{data:{columns:r}}=t,n=f=>r[t.channelField(f)?.as],i=f=>e.scale(f),o=e.scale("x"),s=e.scale("y"),a=i("fx")?.apply,c=i("fy")?.apply,l=Array.from(n("x"),o.apply),u=Array.from(n("y"),s.apply);if(a){let f=Ht(o.range),d=n("fx");for(let h=0;h<d.length;++h)l[h]+=a(d[h])-f}if(c){let f=Ht(s.range),d=n("fy");for(let h=0;h<d.length;++h)u[h]+=c(d[h])-f}return[l,u]}function alt(e,t,r,n,i,o,s){let a=s*s,c=-1;for(let l=0;l<e.length;++l){let u=i*(e[l]-r),f=o*(t[l]-n),d=u*u+f*f;d<=a&&(a=d,c=l)}return c}var PY=(e,t)=>e-t,ux=class{constructor(t,{x:r=new qo,y:n=new qo,xfield:i,yfield:o,zoom:s=!0,panx:a=!0,pany:c=!0}){this.mark=t,this.xsel=r,this.ysel=n,this.xfield=i||Ps(t,"x"),this.yfield=o||Ps(t,"y"),this.zoom=w8(s,[0,1/0],[1,1]),this.panx=this.xsel&&a,this.pany=this.ysel&&c;let{plot:l}=t;a&&this.xsel.addEventListener("value",u=>{l.setAttribute("xDomain",u)&&l.update()}),c&&this.ysel.addEventListener("value",u=>{l.setAttribute("yDomain",u)&&l.update()})}publish(t){if(this.panx){let r=clt(t,this.xscale);this.xsel.update(this.clause(r,this.xfield,this.xscale))}if(this.pany){let r=llt(t,this.yscale);this.ysel.update(this.clause(r,this.yfield,this.yscale))}}clause(t,r,n){return _u(r,t,{source:this,clients:this.mark.plot.markSet,scale:n})}init(t){if(this.svg=t,this.initialized)return;this.initialized=!0;let{panx:r,pany:n,mark:{plot:{element:i}},xsel:o,ysel:s}=this;this.xscale=t.scale("x"),this.yscale=t.scale("y");let a=this.xscale.range.slice().sort(PY),c=this.yscale.range.slice().sort(PY),l=w8(r,[-1/0,1/0],a),u=w8(n,[-1/0,1/0],c),f=a4().extent([[a[0],c[0]],[a[1],c[1]]]).scaleExtent(this.zoom).translateExtent([[l[0],u[0]],[l[1],u[1]]]).on("start",()=>{this.xscale=this.svg.scale("x"),this.yscale=this.svg.scale("y")}).on("end",()=>i.__zoom=new gi(1,0,0)).on("zoom",({transform:d})=>this.publish(d));if(Qt(i).call(f),r||n){let d=!1;i.addEventListener("pointerenter",h=>{if(!d&&(d=!0,!h.buttons)){if(r){let{xscale:p,xfield:m}=this;o.activate(this.clause(p.domain,m,p))}if(n){let{yscale:p,yfield:m}=this;s.activate(this.clause(p.domain,m,p))}}}),i.addEventListener("pointerleave",()=>d=!1)}}};function w8(e,t,r){return e?Array.isArray(e)?e:t:r}function clt(e,t){return t.range.map(e.invertX,e).map(t.invert,t)}function llt(e,t){return t.range.map(e.invertY,e).map(t.invert,t)}var ult={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},flt=/[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi,dlt=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,hlt=/^((\s+,?\s*)|(,\s*))/,plt=/^[01]/,UY=e=>`Invalid SVG path, incorrect parameter ${e}`;function $Y(e){let t=[];return(e.match(flt)||[]).forEach(n=>{let i=n[0],o=i.toLowerCase(),s=ult[o],a=mlt(o,s,n.slice(1).trim()),c=a.length;if(c<s||c&&c%s!==0)throw new Error(UY("count"));if(t.push([i,...a.slice(0,s)]),c!==s){o==="m"&&(i=i==="M"?"L":"l");for(let l=s;l<c;l+=s)t.push([i,...a.slice(l,l+s)])}}),t}function mlt(e,t,r){let n=[];for(let i=0;t&&i<r.length;)for(let o=0;o<t;++o){let s=e==="a"&&(o===3||o===4)?plt:dlt,a=r.slice(i).match(s);if(a===null)throw new Error(UY("type"));i+=a[0].length,n.push(+a[0]);let c=r.slice(i).match(hlt);c!==null&&(i+=c[0].length)}return n}function YY(e,t,r){let{x:n,y:i}=e.getBoundingClientRect(),o=e.createSVGMatrix(),s=[];for(let a of t.children)if(a.tagName==="g"){let c=WY(a)??o;for(let l of a.children)zY(r,n,i,l,c)&&s.push(l)}else zY(r,n,i,a,o)&&s.push(a);return s}function zY(e,t,r,n,i){let[[o,s],[a,c]]=e,{e:l,f:u}=i,f=n.getBoundingClientRect(),d=f.left-t,h=f.right-t,p=f.top-r,m=f.bottom-r;if(d>=o&&h<=a&&p>=s&&m<=c)return!0;if(d<=a&&h>=o&&p<=c&&m>=s){let y=n.tagName;if(y==="a"&&(n=n.children[0],y=n.tagName),y==="rect"||y==="text"||y==="image")return!0;switch(o-=l,s-=u,a-=l,c-=u,y){case"circle":return GY(o,s,a,c,Sf(n.cx),Sf(n.cy),Sf(n.r));case"line":return XY(o,s,a,c,Sf(n.x1),Sf(n.y1),Sf(n.x2),Sf(n.y2));case"path":return ylt(o,s,a,c,n)}}return!1}function Sf(e){return e.baseVal.value}function WY(e){let t=e.transform.baseVal,r=t.length,n=t[0]?.matrix;for(let i=1;i<r;++i)n=n.multiply(t[i].matrix);return n}function GY(e,t,r,n,i,o,s){let a=e<=i&&i<=r,c=t<=o&&o<=n;if(a&&c)return!0;let l=Math.min(Math.abs(e-i),Math.abs(r-i));if(c&&l<=s)return!0;let u=Math.min(Math.abs(t-o),Math.abs(n-o));return a&&u<=s||l*l+u*u<=s*s}function XY(e,t,r,n,i,o,s,a){let c=Math.max(Math.min(i,s),e),l=Math.min(Math.max(i,s),r);if(c>l)return!1;let u=o,f=a,d=s-i;if(Math.abs(d)>1e-8){let m=(a-o)/d,y=o-m*i;u=m*c+y,f=m*l+y}let h=Math.max(Math.min(u,f),t),p=Math.min(Math.max(u,f),n);return h<=p}function ylt(e,t,r,n,i){let o=i.__path__||(i.__path__=$Y(i.getAttribute("d"))),s=0,a=0,c=0,l=0,u=!1,f=[0,0],d=2,h=WY(i),p=(x,b)=>{f.length=d=2,f[0]=c=s=x,f[1]=l=a=b},m=h?(x,b)=>p(jY(h,x,b),qY(h,x,b)):(x,b)=>p(x,b),y=(x,b)=>(f[d]=x,f[d+1]=b,d+=2,XY(e,t,r,n,f[d-4],f[d-3],x,b)),g=h?(x,b)=>{u=y(jY(h,c=x,l=b),qY(h,x,b))}:(x,b)=>{u=y(c=x,l=b)};for(let x=0;x<o.length;++x){let b=o[x];switch(b[0]){case"M":m(b[1],b[2]);break;case"m":m(c+b[1],l+b[2]);break;case"L":case"T":g(b[1],b[2]);break;case"H":g(b[1],l);break;case"V":g(c,b[1]);break;case"l":case"t":g(c+b[1],l+b[2]);break;case"h":g(c+b[1],l);break;case"v":g(c,l+b[1]);break;case"C":g(b[5],b[6]);break;case"c":g(c+b[5],l+b[6]);break;case"S":case"Q":g(b[3],b[4]);break;case"s":case"q":g(c+b[3],l+b[4]);break;case"A":g(b[6],b[7]);break;case"a":if(glt(o,x))return GY(e,t,r,n,c,l-b[2],b[2]);g(c+b[6],c+b[7]);break;case"z":case"Z":if(g(s,a),xlt(e,t,f)>0)return!0;m(s,a);break;default:return console.warn("SVG path command not supported: ",b[0]),!1}if(u)return!0}return!1}function jY(e,t,r){return e.a*t+e.c*r+e.e}function qY(e,t,r){return e.b*t+e.d*r+e.f}function glt(e,t){let r=e[t],n=e[t+1];return n&&n[0]==="a"&&e[t+2]?.[0]==="z"&&r[1]===r[2]&&n[1]===n[2]&&r[1]===n[1]&&r[7]===-n[7]}function xlt(e,t,r){let n=0,i=r.length-2;for(let o=0;o<i;o+=2)r[o+1]<=t?r[o+3]>t&&VY(e,t,r,o)>0&&++n:r[o+3]<=t&&VY(e,t,r[o])<0&&--n;return n}function VY(e,t,r,n){return(r[n+2]-r[n])*(t-r[n+1])-(e-r[n])*(r[n+3]-r[n+1])}function zI(e,t){return e==null||t==null?e!=null||t!=null:e.length!==t.length||e.some((r,n)=>jI(r,t[n]))}function jI(e,t){let r=e.length;if(t.length!==r)return!0;for(let n=0;n<r;++n)if(e[n]!==t[n])return!0;return!1}var fx=class{constructor(t,{channels:r,selection:n,peers:i=!0,brush:o={fill:"none",stroke:"currentColor",strokeDasharray:"1,1"}}){this.mark=t,this.selection=n,this.peers=i,this.style=o&&Fl(o),this.brush=UI(),this.brush.on("brush end",c=>this.publish(c.selection)),this.extent=null,this.groups=null;let{fields:s,as:a}=BY(t,r);this.fields=s,this.as=a}reset(){this.value=void 0,this.extent=null,this.g&&this.brush.reset(this.g)}activate(){this.selection.activate(this.clause([this.fields.map(()=>0)]))}clause(t){let{fields:r,mark:n}=this;return Sa(r,t,{source:this,clients:this.peers?n.plot.markSet:new Set().add(n)})}publish(t){let{as:r,group:n,mark:i,svg:o}=this,s;if(t){let{data:{columns:a={}}={}}=i,c=new Map;YY(o,n,t).forEach(l=>{let u=ap(l),f=r.map(d=>a[d][u]);c.set(f.join("|"),f)}),s=Array.from(c.values())}this.extent=t,zI(s,this.value)&&(this.value=s,this.selection.update(this.clause(s)))}init(t){let{brush:r,extent:n,mark:i,style:o}=this;this.svg=t;let s=t.width.baseVal.value,a=t.height.baseVal.value;if(r.extent([[0,0],[s,a]]),this.group=t.querySelector(`[data-index="${i.index}"]`),this.g=Qt(t).append("g").attr("class","region-xy").each(PI).call(r).call(r.moveSilent,n),o){let c=this.g.selectAll("rect.selection");for(let l in o)c.attr(l,o[l])}t.addEventListener("pointerenter",c=>{c.buttons||this.activate()})}};var If=class{constructor(t,{selection:r,channels:n,peers:i=!0}){this.value=null,this.mark=t,this.selection=r,this.peers=i;let o=this.fields=[],s=this.as=[];n.forEach(a=>{let c=a==="color"?["color","fill","stroke"]:a==="x"?["x","x1","x2"]:a==="y"?["y","y1","y2"]:[a];for(let l=0;l<c.length;++l){let u=t.channelField(c[l],{exact:!0});if(u){o.push(u.field?.basis||u.field),s.push(u.as);return}}throw new Error(`Missing channel: ${a}`)})}clause(t){let{fields:r,mark:n}=this;return Sa(r,t,{source:this,clients:this.peers?n.plot.markSet:new Set().add(n)})}init(t,r,n){let{mark:i,as:o,selection:s}=this,{data:{columns:a={}}={}}=i;n??=l=>o.map(u=>a[u][ap(l)]),r??=`[data-index="${i.index}"]`;let c=Array.from(t.querySelectorAll(r));t.addEventListener("pointerdown",l=>{let u=s.single?s.value:this.value,f=l.target,d=null;if(blt(c,f)){let h=n(f);(l.shiftKey||l.metaKey)&&u?.length?(d=u.filter(p=>jI(p,h)),d.length===u.length&&d.push(h)):u?.length===1&&!jI(u[0],h)?d=null:d=[h]}this.value=d,zI(u,d)&&s.update(this.clause(d))}),t.addEventListener("pointerenter",l=>{l.buttons||this.selection.activate(this.clause([this.fields.map(()=>0)]))})}};function blt(e,t){return e.some(r=>r.contains(t))}var QY=":scope > div, :scope > span",qI="swatch",HY="ramp",cp=class{constructor(t,r){let{as:n,field:i,...o}=r;this.channel=t,this.options=o,this.type=null,this.handler=null,this.selection=n,this.field=i,this.legend=null,this.element=document.createElement("div"),this.element.setAttribute("class","legend"),Object.defineProperty(this.element,"value",{value:this})}setPlot(t){this.plot=t}init(t){let r=_lt(this,t);return this.element.replaceChildren(r),this.element}update(){if(!this.legend)return;let{selection:t,handler:r}=this,{single:n,value:i}=t,o=n?i:t.valueFor(r),s=o&&o.length?new Set(o.map(c=>c[0])):null,a=this.legend.querySelectorAll(QY);for(let c of a){let l=s?s.has(c.__data__):!0;c.style.opacity=l?1:.2}}};function _lt(e,t){let{channel:r,plot:n,selection:i}=e,o=t.scale(r),s=o.type==="ordinal"?qI:HY,a={label:n.getAttribute(`${r}Label`)??null,...e.options},c=s===qI?a:a.label?{tickSize:2,...a}:{tickSize:2,marginTop:1,height:29,...a},l=t.legend(r,c);e.legend=l;let u=!!i;if(u&&s===HY){let f=c.width??240,d=Ilt(o,f);d?l.scale=function(h){return h==="x"?{range:[0,f]}:h==="y"?{range:[-10,0]}:h===r?d:void 0}:u=!1}if(u){let f=wlt(e,s);s===qI?(f.init(l,QY,d=>[d.__data__]),e.update()):f.init(l,l.querySelector("g:last-of-type"))}return l}function wlt(e,t){let{channel:r,handler:n,selection:i}=e;if(n)return n;let o=vlt(e);return t===qI?(e.handler=new If(o,{selection:i,channels:[r],peers:!1}),i.addEventListener("value",()=>e.update())):e.handler=new Cl(o,{selection:i,channel:r,brush:{fill:"none",stroke:"currentColor"},peers:!1}),e.handler}function vlt(e){let{channel:t,plot:r}=e,n=e.field??Slt(r.marks,t)??"value";if(n){let i={field:n};return{plot:r,channelField:o=>t===o?i:void 0}}}function Slt(e,t){let r=t==="color"?["fill","stroke"]:t==="opacity"?["opacity","fillOpacity","strokeOpacity"]:null;if(r==null)return null;for(let n=e.length-1;n>-1;--n)for(let i of r){let o=e[n].channelField(i,{exact:!0});if(o)return o.field}return null}function Ilt(e,t){let{apply:r,invert:n,interpolate:i,...o}=e,s=e.type;s.startsWith("diverging-")&&(s=s.slice(11));let a;switch(s){case"log":case"pow":case"sqrt":case"symlog":a=s;break;case"threshold":case"quantize":case"quantile":return console.warn(`Legends do not yet support ${s} scales.`),null;default:a="linear"}return hl({x:{...o,type:a,range:[0,t]}})}function VI(e,t,r=0,n=Math.LN10){let i,o=Math.ceil(Math.log(t)/n),s=Math.max(r,Math.pow(10,Math.round(Math.log(e)/n)-o));for(;Math.ceil(e/s)>t;)s*=10;let a=[5,2];for(let c=0,l=a.length;c<l;++c)i=s/a[c],i>=r&&e/i<=t&&(s=i);return s}function ZY(e,t,r){let{step:n,steps:i,minstep:o=0,nice:s=!0}=r;if(s!==!1){let a=t-e,c=Math.LN10;n=n||VI(a,i||25,o,c);let l=Math.log(n),u=l>=0?0:~~(-l/c)+1,f=Math.pow(10,-u-1);l=Math.floor(e/n+f)*n,e=e<l?l-n:l,t=Math.ceil(t/n)*n,i=Math.round((t-e)/n)}return{min:e,max:t,steps:i}}var eW="year",KY="month",JY="day",YI="hour",WI="minute",GI="second",Tlt="millisecond",hx=1e3,px=hx*60,mx=px*60,XI=mx*24,Alt=XI*7,tW=XI*30,rW=XI*365,dx=[[GI,1,hx],[GI,5,5*hx],[GI,15,15*hx],[GI,30,30*hx],[WI,1,px],[WI,5,5*px],[WI,15,15*px],[WI,30,30*px],[YI,1,mx],[YI,3,3*mx],[YI,6,6*mx],[YI,12,12*mx],[JY,1,XI],[JY,7,Alt],[KY,1,tW],[KY,3,3*tW],[eW,1,rW]];function nW(e,t,r){let n=t-e,i=n/r,o=To(s=>s[2]).right(dx,i);return o===dx.length?{interval:eW,step:VI(n/rW,r)}:o?(o=dx[i/dx[o-1][2]<dx[o][2]/i?o-1:o],{interval:o[0],step:o[1]}):{interval:Tlt,step:VI(n,r,1)}}var Elt=new Set(["rectY-x","rectX-y","rect-x","rect-y","ruleY-x","ruleX-y"]);function Mlt(e,t){return Elt.has(`${e.type}-${t}`)}function I8(e,t={}){let r=(n,i)=>Mlt(n,i)?{[`${i}1`]:v8(n,i,e,t),[`${i}2`]:v8(n,i,e,{...t,offset:1})}:{[i]:v8(n,i,e,t)};return r[oy]=!0,r}function v8(e,t,r,n){return new S8(r,e,t,n)}function Nlt(e,t){let r=e.plot.getAttribute(`${t}Scale`);return r==="utc"||r==="time"}var S8=class extends Bt{constructor(t,r,n,i){super("COLUMN_REF"),this.column=t,this.mark=r,this.channel=n,this.options=i}get stats(){return{column:this.column,stats:["min","max"]}}toString(){let{mark:t,channel:r,column:n,options:i}=this,{type:o,min:s,max:a}=t.channelField(r),{interval:c,steps:l,offset:u=0}=i,f=c??(o==="date"||Nlt(t,r)?"date":"number"),d;if(f==="number"){let{apply:h,sqlApply:p,sqlInvert:m}=wf(t,r),y=ZY(h(s),h(a),i),g=p(n),x=Ge((y.max-y.min)/y.steps),b=Or(se(y.min===0?g:Tt(g,y.min),x)),_=te(y.min,Nt(x,u?te(u,b):b));d=m(_)}else{let{interval:h,step:p=1}=f==="date"?nW(s,a,l||40):i,m=ZT(n,h,p);d=u?te(m,Wb(h,u*p)):m}return`${d}`}};var Olt=e=>e&&typeof e=="object"&&!Array.isArray(e);var yx=class extends Bn{constructor({element:t,filterBy:r,from:n,column:i,label:o=i,format:s=f=>f,options:a,value:c,field:l=i,as:u}={}){super(r),this.from=n,this.column=i,this.format=s,this.field=l;let f=this.selection=u;this.element=t??document.createElement("div"),this.element.setAttribute("class","input"),Object.defineProperty(this.element,"value",{value:this});let d=document.createElement("label");if(d.innerText=o||i,this.element.appendChild(d),this.select=document.createElement("select"),this.element.appendChild(this.select),a&&(this.data=a.map(h=>Olt(h)?h:{value:h}),this.selectedValue(c??""),this.update()),f){let h=!ii(f);c!=null&&(!h||f.value===void 0)&&this.publish(c),this.select.addEventListener("input",()=>{this.publish(this.selectedValue()??null)}),h?this.selection.addEventListener("value",p=>{p!==this.select.value&&this.selectedValue(p)}):(this.select.addEventListener("pointerenter",p=>{p.buttons||this.activate()}),this.select.addEventListener("focus",()=>this.activate()))}}selectedValue(t){if(arguments.length===0){let r=this.select.selectedIndex;return this.data[r].value}else{let r=this.data?.findIndex(n=>n.value===t);r>=0?this.select.selectedIndex=r:this.select.value=String(t)}}reset(){this.select.selectedIndex=this.from?0:-1}activate(){this.selection.activate(Pc(this.field,0,{source:this}))}publish(t){let{selection:r,field:n}=this;if(ii(r)){t===""&&(t=void 0);let i=Pc(n,t,{source:this});r.update(i)}else or(r)&&r.update(t)}query(t=[]){let{from:r,column:n}=this;return r?ft.from(r).select({value:n}).distinct().where(t).orderby(n):null}queryResult(t){return this.data=[{value:"",label:"All"},...t],this}update(){let{data:t,format:r,select:n,selection:i}=this;n.replaceChildren();for(let{value:o,label:s}of t){let a=document.createElement("option");a.setAttribute("value",o),a.innerText=s??r(o),this.select.appendChild(a)}if(i){let o=ii(i)?i.valueFor(this):i.value;this.selectedValue(o??"")}return this}};var Rlt=0;var gx=class extends Bn{constructor({element:t,filterBy:r,from:n,column:i,label:o,type:s="contains",field:a=i,as:c}={}){if(super(r),this.id="search_"+ ++Rlt,this.type=s,this.from=n,this.column=i,this.selection=c,this.field=a,this.element=t??document.createElement("div"),this.element.setAttribute("class","input"),Object.defineProperty(this.element,"value",{value:this}),o){let l=document.createElement("label");l.setAttribute("for",this.id),l.innerText=o,this.element.appendChild(l)}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)}),ii(this.selection)?(this.searchbox.addEventListener("pointerenter",l=>{l.buttons||this.activate()}),this.searchbox.addEventListener("focus",()=>this.activate())):this.selection.addEventListener("value",l=>{l!==this.searchbox.value&&(this.searchbox.value=l)}))}reset(){this.searchbox.value=""}clause(t){let{field:r,type:n}=this;return iM(r,t,{source:this,method:n})}activate(){this.selection.activate(this.clause(""))}publish(t){let{selection:r}=this;ii(r)?r.update(this.clause(t)):or(r)&&r.update(t)}query(t=[]){let{from:r,column:n}=this;return r?ft.from(r).select({list:n}).distinct().where(t):null}queryResult(t){return this.data=t,this}update(){let t=document.createElement("datalist"),r=`${this.id}_list`;t.setAttribute("id",r);for(let n of this.data){let i=document.createElement("option");i.setAttribute("value",n.list),t.append(i)}return this.datalist&&this.datalist.remove(),this.element.appendChild(this.datalist=t),this.searchbox.setAttribute("list",r),this}};var Dlt=0;var xx=class extends Bn{constructor({element:t,filterBy:r,as:n,min:i,max:o,step:s,from:a,column:c,label:l=c,value:u=n?.value,select:f="point",field:d=c,width:h}={}){if(super(r),this.id="slider_"+ ++Dlt,this.from=a,this.column=c||"value",this.selection=n,this.selectionType=f,this.field=d,this.min=i,this.max=o,this.step=s,this.element=t||document.createElement("div"),this.element.setAttribute("class","input"),Object.defineProperty(this.element,"value",{value:this}),l){let p=document.createElement("label");p.setAttribute("for",this.id),p.innerText=l,this.element.appendChild(p)}this.slider=document.createElement("input"),this.slider.setAttribute("id",this.id),this.slider.setAttribute("type","range"),h!=null&&(this.slider.style.width=`${+h}px`),i!=null&&this.slider.setAttribute("min",`${i}`),o!=null&&this.slider.setAttribute("max",`${o}`),s!=null&&this.slider.setAttribute("step",`${s}`),this.element.appendChild(this.slider),this.curval=document.createElement("label"),this.curval.setAttribute("for",this.id),this.curval.setAttribute("class","value"),this.element.appendChild(this.curval),u!=null&&(this.slider.setAttribute("value",`${u}`),this.selection?.value===void 0&&this.publish(u)),this.curval.innerText=this.slider.value,this.slider.addEventListener("input",()=>{let{value:p}=this.slider;this.curval.innerText=p,this.selection&&this.publish(+p)}),this.selection&&(ii(this.selection)?(this.slider.addEventListener("pointerenter",p=>{p.buttons||this.activate()}),this.slider.addEventListener("focus",()=>this.activate())):this.selection.addEventListener("value",p=>{p!==+this.slider.value&&(this.slider.value=p,this.curval.innerText=p)}))}query(t=[]){let{from:r,column:n}=this;return!r||this.min!=null&&this.max!=null?null:ft.select({min:zn(n),max:zr(n)}).from(r).where(t)}queryResult(t){let{min:r,max:n}=Array.from(t)[0];return this.min==null&&(this.min=r,this.slider.setAttribute("min",`${r}`)),this.max==null&&(this.max=n,this.slider.setAttribute("max",`${n}`)),this.step==null&&(this.step=(n-r)/500,this.slider.setAttribute("step",`${this.step}`)),this}clause(t){let{field:r,selectionType:n}=this;if(n==="interval"){let i=[this.min??0,t];return _u(r,i,{source:this,bin:"ceil",scale:{type:"identity",domain:i},pixelSize:this.step})}else return Pc(r,t,{source:this})}activate(){this.selection.activate(this.clause(0))}publish(t){let{selection:r}=this;ii(r)?r.update(this.clause(t)):or(this.selection)&&r.update(t)}};var A8=iW(e=>{let t=HI(e);return r=>r==null?"":typeof r=="number"?t(r):r instanceof Date?E8(r):`${r}`}),HI=iW(e=>t=>t===0?"0":t.toLocaleString(e)),Wce=A8(),Gce=HI();function E8(e){return hh(e,"Invalid Date")}function iW(e){let t=null,r;return(n="en")=>n===t?r:r=e(t=n)}var Llt=-1;var bx=class extends Bn{constructor({element:t,filterBy:r,from:n,columns:i=["*"],align:o={},format:s,width:a,maxWidth:c,height:l=500,rowBatch:u=100,as:f}={}){super(r),this.id=`table-${++Llt}`,this.from=n,this.columns=i,this.format=s,this.align=o,this.widths=typeof a=="object"?a:{},or(n)&&n.addEventListener("value",()=>this.initialize()),this.offset=0,this.limit=+u,this.pending=!1,this.selection=f,this.currentRow=-1,this.sortHeader=null,this.sortColumn=null,this.sortDesc=!1,this.element=t||document.createElement("div"),this.element.setAttribute("id",this.id),Object.defineProperty(this.element,"value",{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 d=-1;this.element.addEventListener("scroll",h=>{let{pending:p,loaded:m}=this,{scrollHeight:y,scrollTop:g,clientHeight:x}=h.target,b=g<d;d=g,!(b||p||m)&&y-g<2*x&&(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.selection&&(this.body.addEventListener("pointerover",h=>{let p=Flt(h.target);p>-1&&p!==this.currentRow&&(this.currentRow=p,this.selection.update(this.clause([p])))}),this.body.addEventListener("pointerleave",()=>{this.currentRow=-1,this.selection.update(this.clause())})),this.style=document.createElement("style"),this.element.appendChild(this.style)}sourceTable(){return or(this.from)?this.from.value:this.from}clause(t=[]){let{data:r,limit:n,schema:i}=this,o=i.map(a=>a.column),s=t.map(a=>{let{columns:c}=r[~~(a/n)];return o.map(l=>c[l][a%n])});return Sa(o,s,{source:this})}requestData(t=0){this.offset=t;let r=this.query(this.filterBy?.predicate(this));this.requestQuery(r),Li().prefetch(r.clone().offset(t+this.limit))}fields(){let t=this.sourceTable();return this.columns.map(r=>Gs(r,t))}fieldInfo(t){this.schema=t;let r=this.head;r.innerHTML="";let n=document.createElement("tr");for(let{column:i}of t){let o=document.createElement("th");o.addEventListener("click",s=>this.sort(s,i)),o.appendChild(document.createElement("span")),o.appendChild(document.createTextNode(i)),n.appendChild(o)}return r.appendChild(n),this.formats=Clt(this.format,t),this.style.innerText=Plt(this.id,klt(this.align,t),Blt(this.widths,t)),this}query(t=[]){let{limit:r,offset:n,schema:i,sortColumn:o,sortDesc:s}=this;return ft.from(this.sourceTable()).select(i.map(a=>a.column)).where(t).orderby(o?s?uA(o):o:[]).limit(r).offset(n)}queryResult(t){return this.pending||(this.loaded=!1,this.data=[],this.body.replaceChildren(),this.offset=0),this.data.push(Xn(t)),this}update(){let{body:t,formats:r,data:n,schema:i,limit:o}=this,s=i.length,a=n.length-1,c=o*a,{numRows:l,columns:u}=n[a],f=i.map(d=>u[d.column]);for(let d=0;d<l;++d){let h=document.createElement("tr");Object.assign(h,{__row__:c+d});for(let p=0;p<s;++p){let m=f[p][d],y=document.createElement("td");y.innerText=m==null?"":r[p](m),h.appendChild(y)}t.appendChild(h)}return l<o&&(this.loaded=!0),this.pending=!1,this}sort(t,r){r===this.sortColumn?this.sortDesc=!this.sortDesc:(this.sortColumn=r,this.sortDesc=!1);let n=t.currentTarget,i=this.sortHeader;i===n&&t.metaKey?(i.firstChild.textContent="",this.sortHeader=null,this.sortColumn=null):(i&&(i.firstChild.textContent=""),this.sortHeader=n,n.firstChild.textContent=this.sortDesc?"\u25BE":"\u25B4"),this.requestData()}};function Flt(e){let t=e.parentElement;return Object.hasOwn(t,"__row__")?+t.__row__:-1}function Clt(e={},t,r){return t.map(({column:n,type:i})=>{if(n in e)return e[n];switch(i){case"number":return HI(r);case"date":return E8;default:return A8(r)}})}function klt(e={},t){return t.map(({column:r,type:n})=>r in e?e[r]:n==="number"?"right":"left")}function Blt(e={},t){return t.map(({column:r})=>e[r])}function Plt(e,t,r){let n=[];return t.forEach((i,o)=>{let s=+r[o];if(i!=="left"||s){let a=i!=="left"?`text-align:${i};`:"",c=s?`width:${s}px;max-width:${s}px;`:"";n.push(`#${e} tr>:nth-child(${o+1}) {${a}${c}}`)}}),n.join(" ")}function _x(e,...t){let r=e?.context?.coordinator??Li();for(let n of t)r.connect(n)}function QI(e,t,r){let n=new t(r);return _x(e,n),n.element}function oW(e){return QI(this,yx,e)}function sW(e){return QI(this,gx,e)}function aW(e){return QI(this,xx,e)}function cW(e){return QI(this,bx,e)}function lW({direction:e="vertical",wrap:t=!1},r){let n=document.createElement("div");return n.style.display="flex",n.style.flexDirection=e==="vertical"?"column":"row",n.style.flexWrap=t?t===!0?"wrap":t:"nowrap",n.style.justifyContent="flex-start",n.style.alignItems="flex-start",r.forEach(i=>n.appendChild(i)),Object.assign(n,{value:{element:n}}),n}function uW(...e){return lW({direction:"vertical"},e.flat())}function fW(...e){return lW({direction:"horizontal"},e.flat())}function dW({dim:e="width",size:t=10}){let r=document.createElement("span");return r.style.display="inline-block",r.style[e]=Number.isNaN(+t)?t:`${t}px`,Object.assign(r,{value:{element:r}})}function hW(e){return dW({dim:"height",size:e})}function pW(e){return dW({dim:"width",size:e})}var gW={};Jn(gW,{align:()=>j8,ariaDescription:()=>Q8,ariaLabel:()=>H8,aspectRatio:()=>q8,axis:()=>V8,clip:()=>G8,colorBase:()=>LD,colorClamp:()=>wD,colorConstant:()=>CD,colorDomain:()=>bD,colorExponent:()=>FD,colorInterpolate:()=>TD,colorLabel:()=>MD,colorN:()=>vD,colorNice:()=>SD,colorPercent:()=>ND,colorPivot:()=>AD,colorRange:()=>_D,colorReverse:()=>OD,colorScale:()=>xD,colorScheme:()=>ID,colorSymmetric:()=>ED,colorTickFormat:()=>DD,colorZero:()=>RD,facetGrid:()=>xR,facetLabel:()=>bR,facetMargin:()=>hR,facetMarginBottom:()=>mR,facetMarginLeft:()=>yR,facetMarginRight:()=>gR,facetMarginTop:()=>pR,fxAlign:()=>AR,fxAriaDescription:()=>VR,fxAriaLabel:()=>qR,fxAxis:()=>OR,fxDomain:()=>_R,fxFontVariant:()=>jR,fxGrid:()=>BR,fxInset:()=>vR,fxInsetLeft:()=>SR,fxInsetRight:()=>IR,fxLabel:()=>UR,fxLabelAnchor:()=>$R,fxLabelOffset:()=>zR,fxLine:()=>PR,fxPadding:()=>ER,fxPaddingInner:()=>MR,fxPaddingOuter:()=>NR,fxRange:()=>wR,fxReverse:()=>YR,fxRound:()=>TR,fxTickFormat:()=>CR,fxTickPadding:()=>FR,fxTickRotate:()=>kR,fxTickSize:()=>DR,fxTickSpacing:()=>LR,fxTicks:()=>RR,fyAlign:()=>KR,fyAriaDescription:()=>yD,fyAriaLabel:()=>mD,fyAxis:()=>rD,fyDomain:()=>WR,fyFontVariant:()=>pD,fyGrid:()=>lD,fyInset:()=>XR,fyInsetBottom:()=>QR,fyInsetTop:()=>HR,fyLabel:()=>fD,fyLabelAnchor:()=>dD,fyLabelOffset:()=>hD,fyLine:()=>uD,fyPadding:()=>JR,fyPaddingInner:()=>tD,fyPaddingOuter:()=>eD,fyRange:()=>GR,fyReverse:()=>gD,fyRound:()=>ZR,fyTickFormat:()=>aD,fyTickPadding:()=>sD,fyTickRotate:()=>cD,fyTickSize:()=>iD,fyTickSpacing:()=>oD,fyTicks:()=>nD,grid:()=>W8,height:()=>B8,inset:()=>Y8,lengthBase:()=>yL,lengthClamp:()=>dL,lengthConstant:()=>xL,lengthDomain:()=>uL,lengthExponent:()=>gL,lengthNice:()=>hL,lengthPercent:()=>pL,lengthRange:()=>fL,lengthScale:()=>lL,lengthZero:()=>mL,margin:()=>L8,marginBottom:()=>z8,marginLeft:()=>P8,marginRight:()=>U8,marginTop:()=>$8,margins:()=>D8,name:()=>O8,opacityBase:()=>WD,opacityClamp:()=>UD,opacityConstant:()=>XD,opacityDomain:()=>BD,opacityExponent:()=>GD,opacityLabel:()=>zD,opacityNice:()=>$D,opacityPercent:()=>jD,opacityRange:()=>PD,opacityReverse:()=>qD,opacityScale:()=>kD,opacityTickFormat:()=>YD,opacityZero:()=>VD,padding:()=>X8,projectionClip:()=>NL,projectionDomain:()=>SL,projectionInset:()=>IL,projectionInsetBottom:()=>ML,projectionInsetLeft:()=>TL,projectionInsetRight:()=>AL,projectionInsetTop:()=>EL,projectionParallels:()=>_L,projectionPrecision:()=>wL,projectionRotate:()=>vL,projectionType:()=>bL,rBase:()=>sL,rClamp:()=>eL,rConstant:()=>cL,rDomain:()=>JD,rExponent:()=>aL,rLabel:()=>nL,rNice:()=>rL,rPercent:()=>iL,rRange:()=>tL,rScale:()=>KD,rZero:()=>oL,style:()=>C8,symbolDomain:()=>QD,symbolRange:()=>ZD,symbolScale:()=>HD,width:()=>k8,xAlign:()=>sO,xAriaDescription:()=>TO,xAriaLabel:()=>IO,xAxis:()=>uO,xBase:()=>NO,xClamp:()=>iO,xConstant:()=>RO,xDomain:()=>K8,xExponent:()=>OO,xFontVariant:()=>SO,xGrid:()=>gO,xInset:()=>eO,xInsetLeft:()=>rO,xInsetRight:()=>nO,xLabel:()=>bO,xLabelAnchor:()=>_O,xLabelArrow:()=>wO,xLabelOffset:()=>vO,xLine:()=>xO,xNice:()=>tO,xPadding:()=>aO,xPaddingInner:()=>cO,xPaddingOuter:()=>lO,xPercent:()=>AO,xRange:()=>J8,xReverse:()=>EO,xRound:()=>oO,xScale:()=>Z8,xTickFormat:()=>mO,xTickPadding:()=>pO,xTickRotate:()=>yO,xTickSize:()=>dO,xTickSpacing:()=>hO,xTicks:()=>fO,xZero:()=>MO,xyDomain:()=>F8,yAlign:()=>zO,yAriaDescription:()=>sR,yAriaLabel:()=>oR,yAxis:()=>YO,yBase:()=>uR,yClamp:()=>UO,yConstant:()=>dR,yDomain:()=>LO,yExponent:()=>fR,yFontVariant:()=>iR,yGrid:()=>KO,yInset:()=>kO,yInsetBottom:()=>PO,yInsetTop:()=>BO,yLabel:()=>tR,yLabelAnchor:()=>eR,yLabelArrow:()=>rR,yLabelOffset:()=>nR,yLine:()=>JO,yNice:()=>CO,yPadding:()=>jO,yPaddingInner:()=>qO,yPaddingOuter:()=>VO,yPercent:()=>aR,yRange:()=>FO,yReverse:()=>cR,yRound:()=>$O,yScale:()=>DO,yTickFormat:()=>QO,yTickPadding:()=>HO,yTickRotate:()=>ZO,yTickSize:()=>GO,yTickSpacing:()=>XO,yTicks:()=>WO,yZero:()=>lR});var wx=class extends Map{request(t,r){if(this.has(t))r(this.get(t));else{let n=this.waiting||(this.waiting=new Map),i=n.get(t)||[];n.set(t,i.concat(r))}}set(t,r){this.has(t)&&console.warn(`Overwriting named plot "${t}".`);let{waiting:n}=this;return n?.has(t)&&(n.get(t).forEach(i=>i(r)),n.delete(t)),super.set(t,r)}clear(){return this.waiting?.clear(),super.clear()}},M8=new wx;function N8(e,t,r){(e?.context?.namedPlots??M8).request(t,r)}function mW(e,t,r){(e?.context?.namedPlots??M8).set(t,r)}function O8(e){return t=>mW(this,e,t)}function yW(e,t,r){or(r)?(r.addEventListener("value",n=>{e.setAttribute(t,n),e.update()}),r.value!==void 0&&e.setAttribute(t,r.value)):e.setAttribute(t,r)}function Ult(e,t){return r=>{yW(r,e,t)}}function R8(e){return t=>{for(let[r,n]of Object.entries(e))yW(t,r,n)}}function D8(e){let{top:t,bottom:r,left:n,right:i}=e,o={};return t!==void 0&&(o.marginTop=t),r!==void 0&&(o.marginBottom=r),n!==void 0&&(o.marginLeft=n),i!==void 0&&(o.marginRight=i),R8(o)}function L8(e){return R8({marginTop:e,marginBottom:e,marginLeft:e,marginRight:e})}function F8(e){return R8({xDomain:e,yDomain:e})}var F=e=>t=>Ult(e,t),C8=F("style"),k8=F("width"),B8=F("height"),P8=F("marginLeft"),U8=F("marginRight"),$8=F("marginTop"),z8=F("marginBottom"),j8=F("align"),q8=F("aspectRatio"),V8=F("axis"),Y8=F("inset"),W8=F("grid"),G8=F("clip"),X8=F("padding"),H8=F("ariaLabel"),Q8=F("ariaDescription"),Z8=F("xScale"),K8=F("xDomain"),J8=F("xRange"),tO=F("xNice"),eO=F("xInset"),rO=F("xInsetLeft"),nO=F("xInsetRight"),iO=F("xClamp"),oO=F("xRound"),sO=F("xAlign"),aO=F("xPadding"),cO=F("xPaddingInner"),lO=F("xPaddingOuter"),uO=F("xAxis"),fO=F("xTicks"),dO=F("xTickSize"),hO=F("xTickSpacing"),pO=F("xTickPadding"),mO=F("xTickFormat"),yO=F("xTickRotate"),gO=F("xGrid"),xO=F("xLine"),bO=F("xLabel"),_O=F("xLabelAnchor"),wO=F("xLabelArrow"),vO=F("xLabelOffset"),SO=F("xFontVariant"),IO=F("xAriaLabel"),TO=F("xAriaDescription"),AO=F("xPercent"),EO=F("xReverse"),MO=F("xZero"),NO=F("xBase"),OO=F("xExponent"),RO=F("xConstant"),DO=F("yScale"),LO=F("yDomain"),FO=F("yRange"),CO=F("yNice"),kO=F("yInset"),BO=F("yInsetTop"),PO=F("yInsetBottom"),UO=F("yClamp"),$O=F("yRound"),zO=F("yAlign"),jO=F("yPadding"),qO=F("yPaddingInner"),VO=F("yPaddingOuter"),YO=F("yAxis"),WO=F("yTicks"),GO=F("yTickSize"),XO=F("yTickSpacing"),HO=F("yTickPadding"),QO=F("yTickFormat"),ZO=F("yTickRotate"),KO=F("yGrid"),JO=F("yLine"),tR=F("yLabel"),eR=F("yLabelAnchor"),rR=F("yLabelArrow"),nR=F("yLabelOffset"),iR=F("yFontVariant"),oR=F("yAriaLabel"),sR=F("yAriaDescription"),aR=F("yPercent"),cR=F("yReverse"),lR=F("yZero"),uR=F("yBase"),fR=F("yExponent"),dR=F("yConstant"),hR=F("facetMargin"),pR=F("facetMarginTop"),mR=F("facetMarginBottom"),yR=F("facetMarginLeft"),gR=F("facetMarginRight"),xR=F("facetGrid"),bR=F("facetLabel"),_R=F("fxDomain"),wR=F("fxRange"),vR=F("fxInset"),SR=F("fxInsetLeft"),IR=F("fxInsetRight"),TR=F("fxRound"),AR=F("fxAlign"),ER=F("fxPadding"),MR=F("fxPaddingInner"),NR=F("fxPaddingOuter"),OR=F("fxAxis"),RR=F("fxTicks"),DR=F("fxTickSize"),LR=F("fxTickSpacing"),FR=F("fxTickPadding"),CR=F("fxTickFormat"),kR=F("fxTickRotate"),BR=F("fxGrid"),PR=F("fxLine"),UR=F("fxLabel"),$R=F("fxLabelAnchor"),zR=F("fxLabelOffset"),jR=F("fxFontVariant"),qR=F("fxAriaLabel"),VR=F("fxAriaDescription"),YR=F("fxReverse"),WR=F("fyDomain"),GR=F("fyRange"),XR=F("fyInset"),HR=F("fyInsetTop"),QR=F("fyInsetBottom"),ZR=F("fyRound"),KR=F("fyAlign"),JR=F("fyPadding"),tD=F("fyPaddingInner"),eD=F("fyPaddingOuter"),rD=F("fyAxis"),nD=F("fyTicks"),iD=F("fyTickSize"),oD=F("fyTickSpacing"),sD=F("fyTickPadding"),aD=F("fyTickFormat"),cD=F("fyTickRotate"),lD=F("fyGrid"),uD=F("fyLine"),fD=F("fyLabel"),dD=F("fyLabelAnchor"),hD=F("fyLabelOffset"),pD=F("fyFontVariant"),mD=F("fyAriaLabel"),yD=F("fyAriaDescription"),gD=F("fyReverse"),xD=F("colorScale"),bD=F("colorDomain"),_D=F("colorRange"),wD=F("colorClamp"),vD=F("colorN"),SD=F("colorNice"),ID=F("colorScheme"),TD=F("colorInterpolate"),AD=F("colorPivot"),ED=F("colorSymmetric"),MD=F("colorLabel"),ND=F("colorPercent"),OD=F("colorReverse"),RD=F("colorZero"),DD=F("colorTickFormat"),LD=F("colorBase"),FD=F("colorExponent"),CD=F("colorConstant"),kD=F("opacityScale"),BD=F("opacityDomain"),PD=F("opacityRange"),UD=F("opacityClamp"),$D=F("opacityNice"),zD=F("opacityLabel"),jD=F("opacityPercent"),qD=F("opacityReverse"),VD=F("opacityZero"),YD=F("opacityTickFormat"),WD=F("opacityBase"),GD=F("opacityExponent"),XD=F("opacityConstant"),HD=F("symbolScale"),QD=F("symbolDomain"),ZD=F("symbolRange"),KD=F("rScale"),JD=F("rDomain"),tL=F("rRange"),eL=F("rClamp"),rL=F("rNice"),nL=F("rLabel"),iL=F("rPercent"),oL=F("rZero"),sL=F("rBase"),aL=F("rExponent"),cL=F("rConstant"),lL=F("lengthScale"),uL=F("lengthDomain"),fL=F("lengthRange"),dL=F("lengthClamp"),hL=F("lengthNice"),pL=F("lengthPercent"),mL=F("lengthZero"),yL=F("lengthBase"),gL=F("lengthExponent"),xL=F("lengthConstant"),bL=F("projectionType"),_L=F("projectionParallels"),wL=F("projectionPrecision"),vL=F("projectionRotate"),SL=F("projectionDomain"),IL=F("projectionInset"),TL=F("projectionInsetLeft"),AL=F("projectionInsetRight"),EL=F("projectionInsetTop"),ML=F("projectionInsetBottom"),NL=F("projectionClip");function xW(e,t){return{table:e,options:t}}var bW={};Jn(bW,{area:()=>OL,areaX:()=>RL,areaY:()=>DL,arrow:()=>TF,axisFx:()=>OF,axisFy:()=>RF,axisX:()=>MF,axisY:()=>NF,barX:()=>kL,barY:()=>BL,cell:()=>PL,cellX:()=>UL,cellY:()=>$L,circle:()=>GL,contour:()=>fF,delaunayLink:()=>vF,delaunayMesh:()=>SF,denseLine:()=>uF,density:()=>lF,densityX:()=>aF,densityY:()=>cF,dot:()=>VL,dotX:()=>YL,dotY:()=>WL,errorbarX:()=>xF,errorbarY:()=>bF,frame:()=>EF,geo:()=>kF,graticule:()=>PF,gridFx:()=>FF,gridFy:()=>CF,gridX:()=>DF,gridY:()=>LF,heatmap:()=>dF,hexagon:()=>XL,hexbin:()=>mF,hexgrid:()=>yF,hull:()=>IF,image:()=>sF,line:()=>LL,lineX:()=>FL,lineY:()=>CL,link:()=>AF,raster:()=>hF,rasterTile:()=>pF,rect:()=>zL,rectX:()=>jL,rectY:()=>qL,regressionY:()=>gF,ruleX:()=>KL,ruleY:()=>JL,sphere:()=>BF,spike:()=>oF,text:()=>HL,textX:()=>QL,textY:()=>ZL,tickX:()=>tF,tickY:()=>eF,vector:()=>rF,vectorX:()=>nF,vectorY:()=>iF,voronoi:()=>_F,voronoiMesh:()=>wF,waffleX:()=>UF,waffleY:()=>$F});var $lt=new Set(["frame","axisX","axisY","axisFx","axisFy","gridX","gridY","gridFx","gridFy","hexgrid","graticule","sphere"]);function St(e,t,r={}){arguments.length===2&&!Array.isArray(t)&&(r=t,t=$lt.has(e)?null:[{}]);let n=e.startsWith("area")||e.startsWith("line")?X0:Ir;return ZI(n,e,t,r)}function ZI(e,t,r,n){return i=>{i.addMark(new e(t,r,n))}}function Us(e,t,r){return n=>{n.addMark(new e(t,r))}}var OL=(...e)=>St("area",...e),RL=(...e)=>St("areaX",...e),DL=(...e)=>St("areaY",...e),LL=(...e)=>St("line",...e),FL=(...e)=>St("lineX",...e),CL=(...e)=>St("lineY",...e),kL=(...e)=>St("barX",...e),BL=(...e)=>St("barY",...e),PL=(...e)=>St("cell",...e),UL=(...e)=>St("cellX",...e),$L=(...e)=>St("cellY",...e),zL=(...e)=>St("rect",...e),jL=(...e)=>St("rectX",...e),qL=(...e)=>St("rectY",...e),VL=(...e)=>St("dot",...e),YL=(...e)=>St("dotX",...e),WL=(...e)=>St("dotY",...e),GL=(...e)=>St("circle",...e),XL=(...e)=>St("hexagon",...e),HL=(...e)=>St("text",...e),QL=(...e)=>St("textX",...e),ZL=(...e)=>St("textY",...e),KL=(...e)=>St("ruleX",...e),JL=(...e)=>St("ruleY",...e),tF=(...e)=>St("tickX",...e),eF=(...e)=>St("tickY",...e),rF=(...e)=>St("vector",...e),nF=(...e)=>St("vectoX",...e),iF=(...e)=>St("vectorY",...e),oF=(...e)=>St("spike",...e),sF=(...e)=>St("image",...e),aF=(...e)=>ZI(ip,"areaX",...e),cF=(...e)=>ZI(ip,"areaY",...e),lF=(...e)=>Us(ex,...e),uF=(...e)=>Us(tx,...e),fF=(...e)=>Us(Z0,...e),dF=(...e)=>Us(J0,...e),hF=(...e)=>Us(Ll,...e),pF=(...e)=>Us(ix,...e),mF=(...e)=>Us(nx,...e),yF=(...e)=>St("hexgrid",...e),gF=(...e)=>Us(ox,...e),xF=(...e)=>ZI(sp,"ruleY",...e),bF=(...e)=>Us(sp,"ruleX",...e),_F=(...e)=>St("voronoi",...e),wF=(...e)=>St("voronoiMesh",...e),vF=(...e)=>St("delaunayLink",...e),SF=(...e)=>St("delaunayMesh",...e),IF=(...e)=>St("hull",...e),TF=(...e)=>St("arrow",...e),AF=(...e)=>St("link",...e),EF=(...e)=>St("frame",...e),MF=(...e)=>St("axisX",...e),NF=(...e)=>St("axisY",...e),OF=(...e)=>St("axisFx",...e),RF=(...e)=>St("axisFy",...e),DF=(...e)=>St("gridX",...e),LF=(...e)=>St("gridY",...e),FF=(...e)=>St("gridFx",...e),CF=(...e)=>St("gridFy",...e),kF=(...e)=>Us(rx,...e),BF=(...e)=>St("sphere",...e),PF=(...e)=>St("graticule",...e),UF=(...e)=>St("waffleX",...e),$F=(...e)=>St("waffleY",...e);var _W={};Jn(_W,{highlight:()=>zF,intervalX:()=>jF,intervalXY:()=>VF,intervalY:()=>qF,nearest:()=>YF,nearestX:()=>WF,nearestY:()=>GF,pan:()=>JF,panX:()=>tC,panY:()=>eC,panZoom:()=>rC,panZoomX:()=>nC,panZoomY:()=>iC,region:()=>XF,toggle:()=>Tf,toggleColor:()=>KF,toggleX:()=>HF,toggleY:()=>QF,toggleZ:()=>ZF});function $s(e,t){return r=>{let n=r.marks[r.marks.length-1];r.addInteractor(new e(n,t))}}function zF({by:e,...t}){return $s(sx,{selection:e,channels:t})}function jF({as:e,...t}){return $s(Cl,{...t,selection:e,channel:"x"})}function qF({as:e,...t}){return $s(Cl,{...t,selection:e,channel:"y"})}function VF({as:e,...t}){return $s(lx,{...t,selection:e})}function YF({as:e,...t}){return $s(vf,{...t,selection:e,pointer:"xy"})}function WF({as:e,...t}){return $s(vf,{...t,selection:e,pointer:"x"})}function GF({as:e,...t}){return $s(vf,{...t,selection:e,pointer:"y"})}function XF({as:e,...t}){return $s(fx,{...t,selection:e})}function Tf({as:e,...t}){return $s(If,{...t,selection:e})}function HF(e){return Tf({...e,channels:["x"]})}function QF(e){return Tf({...e,channels:["y"]})}function ZF(e){return Tf({...e,channels:["z"]})}function KF(e){return Tf({...e,channels:["color"]})}function lp(e){return $s(ux,e)}function JF(e={}){return lp({...e,zoom:!1})}function tC(e={}){return lp({...e,zoom:!1,pany:!1})}function eC(e={}){return lp({...e,zoom:!1,panx:!1})}function rC(e={}){return lp(e)}function nC(e={}){return lp({...e,pany:!1})}function iC(e={}){return lp({...e,panx:!1})}var wW={};Jn(wW,{colorLegend:()=>sC,opacityLegend:()=>aC,symbolLegend:()=>cC});function oC(e,t={}){if(t.for){let{for:r,...n}=t,i=new cp(e,n),o=typeof r,s=a=>a.addLegend(i,!1);return o==="string"?N8(this,r,s):r.value&&s(r.value),i.element}else return r=>r.addLegend(new cp(e,t))}function sC(e){return oC.call(this,"color",e)}function aC(e){return oC.call(this,"opacity",e)}function cC(e){return oC.call(this,"symbol",e)}function vW(...e){let t=new W0;return e.flat().forEach(r=>r(t)),_x(this,...t.marks),t.update(),t.element}function zlt({coordinator:e=Li(),namedPlots:t=new wx,extensions:r=null,...n}={}){return{...lC,...r,context:{coordinator:e,namedPlots:t,...n}}}export{im as Coordinator,es as Fixed,Bn as MosaicClient,vc as Param,ft as Query,qo as Selection,j8 as align,on as and,OL as area,RL as areaX,DL as areaY,xc as argmax,bc as argmin,Q8 as ariaDescription,H8 as ariaLabel,AT as arrayAgg,TF as arrow,q8 as aspectRatio,gW as attributeDirectives,Gp as avg,V8 as axis,OF as axisFx,RF as axisFy,MF as axisX,NF as axisY,kL as barX,BL as barY,I8 as bin,qf as cast,PL as cell,UL as cellX,$L as cellY,tm as centroid,fA as centroidX,dA as centroidY,GL as circle,G8 as clip,LD as colorBase,wD as colorClamp,CD as colorConstant,bD as colorDomain,FD as colorExponent,TD as colorInterpolate,MD as colorLabel,sC as colorLegend,vD as colorN,SD as colorNice,ND as colorPercent,AD as colorPivot,_D as colorRange,OD as colorReverse,xD as colorScale,ID as colorScheme,ED as colorSymmetric,DD as colorTickFormat,RD as colorZero,Gs as column,_x as connect,fF as contour,Li as coordinator,ET as corr,Mr as count,NT as covarPop,MT as covariance,zlt as createAPIContext,NA as createSchema,_c as createTable,wA as cume_dist,tA as dateDay,KT as dateMonth,JT as dateMonthDay,vF as delaunayLink,SF as delaunayMesh,uF as denseLine,bA as dense_rank,lF as density,aF as densityX,cF as densityY,VL as dot,YL as dotX,WL as dotY,OT as entropy,oA as eq,xF as errorbarX,bF as errorbarY,xR as facetGrid,bR as facetLabel,hR as facetMargin,mR as facetMarginBottom,yR as facetMarginLeft,gR as facetMarginRight,pR as facetMarginTop,RT as first,IA as first_value,HT as float32,Ge as float64,EF as frame,xW as from,AR as fxAlign,VR as fxAriaDescription,qR as fxAriaLabel,OR as fxAxis,_R as fxDomain,jR as fxFontVariant,BR as fxGrid,vR as fxInset,SR as fxInsetLeft,IR as fxInsetRight,UR as fxLabel,$R as fxLabelAnchor,zR as fxLabelOffset,PR as fxLine,ER as fxPadding,MR as fxPaddingInner,NR as fxPaddingOuter,wR as fxRange,YR as fxReverse,TR as fxRound,CR as fxTickFormat,FR as fxTickPadding,kR as fxTickRotate,DR as fxTickSize,LR as fxTickSpacing,RR as fxTicks,KR as fyAlign,yD as fyAriaDescription,mD as fyAriaLabel,rD as fyAxis,WR as fyDomain,pD as fyFontVariant,lD as fyGrid,XR as fyInset,QR as fyInsetBottom,HR as fyInsetTop,fD as fyLabel,dD as fyLabelAnchor,hD as fyLabelOffset,uD as fyLine,JR as fyPadding,tD as fyPaddingInner,eD as fyPaddingOuter,GR as fyRange,gD as fyReverse,ZR as fyRound,aD as fyTickFormat,sD as fyTickPadding,cD as fyTickRotate,iD as fyTickSize,oD as fyTickSpacing,nD as fyTicks,kF as geo,Jp as geojson,PF as graticule,W8 as grid,FF as gridFx,CF as gridFy,DF as gridX,LF as gridY,Di as gt,sA as gte,fW as hconcat,dF as heatmap,B8 as height,XL as hexagon,mF as hexbin,yF as hexgrid,zF as highlight,pW as hspace,IF as hull,sF as image,Y8 as inset,ve as int32,_W as interactorDirectives,jF as intervalX,VF as intervalXY,qF as intervalY,jr as isBetween,aA as isDistinct,cA as isNotBetween,Kp as isNotDistinct,Ri as isNotNull,Jl as isNull,DT as kurtosis,SA as lag,kT as last,TA as last_value,Yf as lead,wW as legendDirectives,yL as lengthBase,dL as lengthClamp,xL as lengthConstant,uL as lengthDomain,gL as lengthExponent,hL as lengthNice,pL as lengthPercent,fL as lengthRange,lL as lengthScale,mL as lengthZero,LL as line,FL as lineX,CL as lineY,AF as link,Er as literal,DA as loadCSV,OA as loadExtension,LA as loadJSON,kA as loadObjects,FA as loadParquet,CA as loadSpatial,ze as lt,ri as lte,LT as mad,L8 as margin,z8 as marginBottom,P8 as marginLeft,U8 as marginRight,$8 as marginTop,D8 as margins,bW as markDirectives,zr as max,FT as median,oW as menu,zn as min,CT as mode,O8 as name,M8 as namedPlots,YF as nearest,WF as nearestX,GF as nearestY,so as neq,iA as not,AA as nth_value,vA as ntile,WD as opacityBase,UD as opacityClamp,XD as opacityConstant,BD as opacityDomain,GD as opacityExponent,zD as opacityLabel,aC as opacityLegend,$D as opacityNice,jD as opacityPercent,PD as opacityRange,qD as opacityReverse,kD as opacityScale,YD as opacityTickFormat,VD as opacityZero,Oi as or,X8 as padding,JF as pan,tC as panX,eC as panY,rC as panZoom,nC as panZoomX,iC as panZoomY,_A as percent_rank,vW as plot,BT as product,NL as projectionClip,SL as projectionDomain,IL as projectionInset,ML as projectionInsetBottom,TL as projectionInsetLeft,AL as projectionInsetRight,EL as projectionInsetTop,_L as projectionParallels,wL as projectionPrecision,vL as projectionRotate,bL as projectionType,PT as quantile,sL as rBase,eL as rClamp,cL as rConstant,JD as rDomain,aL as rExponent,nL as rLabel,rL as rNice,iL as rPercent,tL as rRange,KD as rScale,oL as rZero,xA as rank,hF as raster,pF as rasterTile,zL as rect,jL as rectX,qL as rectY,XF as region,gF as regressionY,N8 as requestNamedPlot,xk as restConnector,gA as row_number,KL as ruleX,JL as ruleY,sW as search,VT as skewness,aW as slider,xb as socketConnector,BF as sphere,oF as spike,tr as sql,Qp as stddev,YT as stddevPop,WT as stringAgg,C8 as style,de as sum,QD as symbolDomain,cC as symbolLegend,ZD as symbolRange,HD as symbolScale,cW as table,HL as text,QL as textX,ZL as textY,tF as tickX,eF as tickY,Tf as toggle,KF as toggleColor,HF as toggleX,QF as toggleY,ZF as toggleZ,XT as varPop,GT as variance,uW as vconcat,rF as vector,nF as vectorX,iF as vectorY,_F as voronoi,wF as voronoiMesh,hW as vspace,UF as waffleX,$F as waffleY,b5 as wasmConnector,k8 as width,sO as xAlign,TO as xAriaDescription,IO as xAriaLabel,uO as xAxis,NO as xBase,iO as xClamp,RO as xConstant,K8 as xDomain,OO as xExponent,SO as xFontVariant,gO as xGrid,eO as xInset,rO as xInsetLeft,nO as xInsetRight,bO as xLabel,_O as xLabelAnchor,wO as xLabelArrow,vO as xLabelOffset,xO as xLine,tO as xNice,aO as xPadding,cO as xPaddingInner,lO as xPaddingOuter,AO as xPercent,J8 as xRange,EO as xReverse,oO as xRound,Z8 as xScale,mO as xTickFormat,pO as xTickPadding,yO as xTickRotate,dO as xTickSize,hO as xTickSpacing,fO as xTicks,MO as xZero,F8 as xyDomain,zO as yAlign,sR as yAriaDescription,oR as yAriaLabel,YO as yAxis,uR as yBase,UO as yClamp,dR as yConstant,LO as yDomain,fR as yExponent,iR as yFontVariant,KO as yGrid,kO as yInset,PO as yInsetBottom,BO as yInsetTop,tR as yLabel,eR as yLabelAnchor,rR as yLabelArrow,nR as yLabelOffset,JO as yLine,CO as yNice,jO as yPadding,qO as yPaddingInner,VO as yPaddingOuter,aR as yPercent,FO as yRange,cR as yReverse,$O as yRound,DO as yScale,QO as yTickFormat,HO as yTickPadding,ZO as yTickRotate,GO as yTickSize,XO as yTickSpacing,WO as yTicks,lR as yZero};