@uwdata/vgplot 0.12.0 → 0.12.2

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 DW=Object.create;var JI=Object.defineProperty;var LW=Object.getOwnPropertyDescriptor;var FW=Object.getOwnPropertyNames;var kW=Object.getPrototypeOf,CW=Object.prototype.hasOwnProperty;var yk=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ti=(e,t)=>{for(var r in t)JI(e,r,{get:t[r],enumerable:!0})},BW=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of FW(t))!CW.call(e,i)&&i!==r&&JI(e,i,{get:()=>t[i],enumerable:!(n=LW(t,i))||n.enumerable});return e};var PW=(e,t,r)=>(r=e!=null?DW(kW(e)):{},BW(t||!e||!e.__esModule?JI(r,"default",{value:e,enumerable:!0}):r,e));var WV=yk((lne,YV)=>{"use strict";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=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 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(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 ect(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 q0(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)}YV.exports={ge:function(e,t,r,n,i){return q0(e,t,r,n,i,Zat)},gt:function(e,t,r,n,i){return q0(e,t,r,n,i,Kat)},lt:function(e,t,r,n,i){return q0(e,t,r,n,i,Jat)},le:function(e,t,r,n,i){return q0(e,t,r,n,i,tct)},eq:function(e,t,r,n,i){return q0(e,t,r,n,i,ect)}}});var tY=yk((une,JV)=>{"use strict";var TI=WV(),rp=0,_f=1,II=2;JV.exports=nct;function c8(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 V0=c8.prototype;function s8(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 HV(e,t){var r=np(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 GV(e,t){var r=e.intervals([]);r.push(t),HV(e,r)}function XV(e,t){var r=e.intervals([]),n=r.indexOf(t);return n<0?rp:(r.splice(n,1),HV(e,r),_f)}V0.intervals=function(e){return e.push.apply(e,this.leftPoints),this.left&&this.left.intervals(e),this.right&&this.right.intervals(e),e};V0.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)?GV(this,e):this.left.insert(e):this.left=np([e]);else if(e[0]>this.mid)this.right?4*(this.right.count+1)>3*(t+1)?GV(this,e):this.right.insert(e):this.right=np([e]);else{var r=TI.ge(this.leftPoints,e,l8),n=TI.ge(this.rightPoints,e,u8);this.leftPoints.splice(r,0,e),this.rightPoints.splice(n,0,e)}};V0.remove=function(e){var t=this.count-this.leftPoints;if(e[1]<this.mid){if(!this.left)return rp;var r=this.right?this.right.count:0;if(4*r>3*(t-1))return XV(this,e);var n=this.left.remove(e);return n===II?(this.left=null,this.count-=1,_f):(n===_f&&(this.count-=1),n)}else if(e[0]>this.mid){if(!this.right)return rp;var i=this.left?this.left.count:0;if(4*i>3*(t-1))return XV(this,e);var n=this.right.remove(e);return n===II?(this.right=null,this.count-=1,_f):(n===_f&&(this.count-=1),n)}else{if(this.count===1)return this.leftPoints[0]===e?II:rp;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}s8(this,s),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?s8(this,this.left):s8(this,this.right);return _f}for(var a=TI.ge(this.leftPoints,e,l8);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=TI.ge(this.rightPoints,e,u8);n<this.rightPoints.length&&this.rightPoints[n][1]===e[1];++n)if(this.rightPoints[n]===e)return this.rightPoints.splice(n,1),_f}return rp}};function QV(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 ZV(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 KV(e,t){for(var r=0;r<e.length;++r){var n=t(e[r]);if(n)return n}}V0.queryPoint=function(e,t){if(e<this.mid){if(this.left){var r=this.left.queryPoint(e,t);if(r)return r}return QV(this.leftPoints,e,t)}else if(e>this.mid){if(this.right){var r=this.right.queryPoint(e,t);if(r)return r}return ZV(this.rightPoints,e,t)}else return KV(this.leftPoints,t)};V0.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?QV(this.leftPoints,t,r):e>this.mid?ZV(this.rightPoints,e,r):KV(this.leftPoints,r)};function rct(e,t){return e-t}function l8(e,t){var r=e[0]-t[0];return r||e[1]-t[1]}function u8(e,t){var r=e[1]-t[1];return r||e[0]-t[0]}function np(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(rct);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(l8),l.sort(u8),new c8(n,np(i),np(o),c,l)}function a8(e){this.root=e}var ip=a8.prototype;ip.insert=function(e){this.root?this.root.insert(e):this.root=new c8(e[0],null,null,[e],[e])};ip.remove=function(e){if(this.root){var t=this.root.remove(e);return t===II&&(this.root=null),t!==rp}return!1};ip.queryPoint=function(e,t){if(this.root)return this.root.queryPoint(e,t)};ip.queryInterval=function(e,t,r){if(e<=t&&this.root)return this.root.queryInterval(e,t,r)};Object.defineProperty(ip,"count",{get:function(){return this.root?this.root.count:0}});Object.defineProperty(ip,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}});function nct(e){return!e||e.length===0?new a8(null):new a8(np(e))}});var gk={};function dp(e,t=!1){let r,n,i=gk;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=gk,a(u)}),i=l}return t?c:a}var Pn=class{constructor(t){this._filterBy=t,this._requestUpdate=dp(()=>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 hp=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},Ar={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,Ix=Uint16Array,Tx=Uint32Array,Ax=BigUint64Array,pp=Int8Array,xk=Int16Array,Un=Int32Array,ei=BigInt64Array,tT=Float32Array,lc=Float64Array;function bk(e,t){let r=Math.log2(e)-3;return(t?[pp,xk,Un,ei]:[Nf,Ix,Tx,Ax])[r]}var Qlt=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 Ex(e,t,r){if(t(e))return e;throw new Error(r(e))}function $n(e,t,r){return t=Array.isArray(t)?t:Object.values(t),Ex(e,n=>t.includes(n),r??(()=>`${e} must be one of ${t}`))}function Mx(e,t){for(let[r,n]of Object.entries(e))if(n===t)return r;return"<Unknown>"}var Vs=e=>`Unsupported data type: "${Mx(j,e)}" (id ${e})`,mp=(e,t,r=!0,n=null)=>({name:e,type:t,nullable:r,metadata:n});function _k(e){return Object.hasOwn(e,"name")&&wk(e.type)}function wk(e){return typeof e?.typeId=="number"}function uc(e,t="",r=!0){return _k(e)?e:mp(t,Ex(e,wk,()=>"Data type expected."),r)}var Nx=(e,t,r=!1,n=-1)=>({typeId:j.Dictionary,id:n,dictionary:e,indices:t||Rf(),ordered:r});var Ox=(e=32,t=!0)=>({typeId:j.Int,bitWidth:$n(e,[8,16,32,64]),signed:t,values:bk(e,t)});var Rf=()=>Ox(32);var eT=(e=2)=>({typeId:j.Float,precision:$n(e,Mf),values:[Ix,tT,lc][e]});var rT=()=>({typeId:j.Binary,offsets:Un}),Rx=()=>({typeId:j.Utf8,offsets:Un});var nT=(e,t,r=128)=>({typeId:j.Decimal,precision:e,scale:t,bitWidth:$n(r,[128,256]),values:Ax}),iT=e=>({typeId:j.Date,unit:$n(e,js),values:e===js.DAY?Un:ei});var oT=(e=Ar.MILLISECOND,t=32)=>({typeId:j.Time,unit:$n(e,Ar),bitWidth:$n(t,[32,64]),values:t===32?Un:ei});var Dx=(e=Ar.MILLISECOND,t=null)=>({typeId:j.Timestamp,unit:$n(e,Ar),timezone:t,values:ei}),sT=(e=Ei.MONTH_DAY_NANO)=>({typeId:j.Interval,unit:$n(e,Ei),values:e===Ei.MONTH_DAY_NANO?void 0:Un}),Lx=e=>({typeId:j.List,children:[uc(e)],offsets:Un}),Fx=e=>({typeId:j.Struct,children:Array.isArray(e)&&_k(e[0])?e:Object.entries(e).map(([t,r])=>mp(t,r))}),aT=(e,t,r,n)=>(r??=t.map((i,o)=>o),{typeId:j.Union,mode:$n(e,qs),typeIds:r,typeMap:r.reduce((i,o,s)=>(i[o]=s,i),{}),children:t.map((i,o)=>uc(i,`_${o}`)),typeIdForValue:n,offsets:Un}),cT=e=>({typeId:j.FixedSizeBinary,stride:e}),kx=(e,t)=>({typeId:j.FixedSizeList,stride:t,children:[uc(e)]}),vk=(e,t)=>({typeId:j.Map,keysSorted:e,children:[t],offsets:Un});var lT=(e=Ar.MILLISECOND)=>({typeId:j.Duration,unit:$n(e,Ar),values:ei}),uT=()=>({typeId:j.LargeBinary,offsets:ei}),fT=()=>({typeId:j.LargeUtf8,offsets:ei}),dT=e=>({typeId:j.LargeList,children:[uc(e)],offsets:ei}),hT=(e,t)=>({typeId:j.RunEndEncoded,children:[Ex(uc(e,"run_ends"),r=>r.type.typeId===j.Int,()=>"Run-ends must have an integer type."),uc(t,"values")]});var pT=e=>({typeId:j.ListView,children:[uc(e,"value")],offsets:Un}),mT=e=>({typeId:j.LargeListView,children:[uc(e,"value")],offsets:ei});var UW=new lc(2),Cx=UW.buffer,out=new ei(Cx),sut=new Tx(Cx),aut=new Un(Cx),cut=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 Bx(e,t){return Number(e/t)+Number(e%t)/Number(t)}var Df=e=>BigInt.asUintN(64,e);function Ik(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 Tk(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 zW=new TextDecoder("utf-8"),hut=new TextEncoder;function Lf(e){return zW.decode(e)}var kl=4;function yT(e,t){return(e[t>>3]&1<<t%8)!==0}function nn(e,t){let r=t+xe(e,t),n=r-xe(e,r),i=jr(e,n);return(o,s,a=null)=>{if(o<i){let c=jr(e,n+o);if(c)return s(e,r+c)}return a}}function eo(e,t){return t}function fc(e,t){return!!jW(e,t)}function jW(e,t){return yp(e,t)<<24>>24}function yp(e,t){return e[t]}function jr(e,t){return qW(e,t)<<16>>16}function qW(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 Ak(e,t){return xe(e,t)>>>0}function Er(e,t){return Uo(BigInt.asIntN(64,BigInt(Ak(e,t))+(BigInt(Ak(e,t+kl))<<32n)))}function Cl(e,t){let r=t+xe(e,t),n=xe(e,r);return r+=kl,Lf(e.subarray(r,r+n))}function ri(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 gT=Symbol("rowIndex");function gp(e,t){class r{constructor(o){this[gT]=o}toJSON(){return Ek(e,t,this[gT])}}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[gT])},enumerable:!0})}return i=>new r(i)}function Px(e,t){return r=>Ek(e,t,r)}function Ek(e,t,r){let n={};for(let i=0;i<e.length;++i)n[e[i]]=t[i].at(r);return n}function Mk(e){return e instanceof dc}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 yT(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)}},dc=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]()}},xp=class extends Bl{static ArrayType=lc},$e=class extends Bl{static ArrayType=Array},bp=class extends $e{value(t){return null}},$o=class extends xp{value(t){return Uo(this.values[t])}},Ux=class extends xp{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)}},$x=class extends $e{value(t){return yT(this.values,t)}},zx=class extends Bl{constructor(t){super(t);let{bitWidth:r,scale:n}=this.type;this.decimal=r===128?Ik:Tk,this.scale=10n**BigInt(n)}},jx=class extends zx{static ArrayType=lc;value(t){return Bx(this.decimal(this.values,t),this.scale)}},qx=class extends zx{static ArrayType=Array;value(t){return this.decimal(this.values,t)}},_p=class extends $e{constructor(t){super(t),this.source=t}value(t){return new Date(this.source.value(t))}},Vx=class extends xp{value(t){return 864e5*this.values[t]}},Nk=$o,Yx=class extends $o{value(t){return super.value(t)*1e3}},Ok=$o,Wx=class extends $o{value(t){return Bx(this.values[t],1000n)}},Gx=class extends $o{value(t){return Bx(this.values[t],1000000n)}},Xx=class extends $e{value(t){return this.values.subarray(t<<1,t+1<<1)}},Hx=class extends $e{value(t){let r=this.values,n=t<<4;return Float64Array.of(xe(r,n),xe(r,n+4),Er(r,n+8))}},Rk=({values:e,offsets:t},r)=>e.subarray(t[r],t[r+1]),Dk=({values:e,offsets:t},r)=>e.subarray(Uo(t[r]),Uo(t[r+1])),Qx=class extends $e{value(t){return Rk(this,t)}},Zx=class extends $e{value(t){return Dk(this,t)}},Kx=class extends $e{value(t){return Lf(Rk(this,t))}},Jx=class extends $e{value(t){return Lf(Dk(this,t))}},tb=class extends $e{value(t){let r=this.offsets;return this.children[0].slice(r[t],r[t+1])}},eb=class extends $e{value(t){let r=this.offsets;return this.children[0].slice(Uo(r[t]),Uo(r[t+1]))}},rb=class extends $e{value(t){let r=this.offsets[t],n=r+this.sizes[t];return this.children[0].slice(r,n)}},nb=class extends $e{value(t){let r=this.offsets[t],n=r+this.sizes[t];return this.children[0].slice(Uo(r),Uo(n))}},ib=class extends $e{constructor(t){super(t),this.stride=this.type.stride}},ob=class extends ib{value(t){let{stride:r,values:n}=this;return n.subarray(t*r,(t+1)*r)}},sb=class extends ib{value(t){let{children:r,stride:n}=this;return r[0].slice(t*n,(t+1)*n)}};function Lk({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 ab=class extends $e{value(t){return Lk(this,t)}},cb=class extends $e{value(t){return new Map(Lk(this,t))}},wp=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)}},lb=class extends wp{value(t){return super.value(t,this.offsets[t])}},vp=class extends $e{constructor(t,r=Px){super(t),this.names=this.type.children.map(n=>n.name),this.factory=r(this.names,this.children)}value(t){return this.factory(t)}},ub=class extends vp{constructor(t){super(t,gp)}},fb=class extends $e{value(t){let[{values:r},n]=this.children;return n.at(Of(r,t))}},db=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]}},hb=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)}},pb=class extends hb{value(t){return this.view(t)}},mb=class extends hb{value(t){return Lf(this.view(t))}};function xT(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]():VW(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&&Mk(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?YW(a,n):WW(a,n)}cache(){return this._cache??(this._cache=this.toArray())}};function*VW(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 YW(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 WW(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?gp:Px;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)=>GW(s[a],r[c]))},t.map(a=>n[a]),i===gp)}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 GW(e,t){return t!=null&&t!==e.name?{...e,name:t}:e}function Sp(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 bp;case j.Bool:return $x;case j.Int:case j.Time:case j.Duration:return s||n<64?dc:$o;case j.Float:return i?dc:Ux;case j.Date:return Fk(o===js.DAY?Vx:Nk,a&&_p);case j.Timestamp:return Fk(o===Ar.SECOND?Yx:o===Ar.MILLISECOND?Ok:o===Ar.MICROSECOND?Wx:Gx,a&&_p);case j.Decimal:return c?qx:jx;case j.Interval:return o===Ei.DAY_TIME?Xx:o===Ei.YEAR_MONTH?dc:Hx;case j.FixedSizeBinary:return ob;case j.Utf8:return Kx;case j.LargeUtf8:return Jx;case j.Binary:return Qx;case j.LargeBinary:return Zx;case j.BinaryView:return pb;case j.Utf8View:return mb;case j.List:return tb;case j.LargeList:return eb;case j.Map:return l?cb:ab;case j.ListView:return rb;case j.LargeListView:return nb;case j.FixedSizeList:return sb;case j.Struct:return u?ub:vp;case j.RunEndEncoded:return fb;case j.Dictionary:return db;case j.Union:return e.mode?lb:wp}throw new Error(Vs(r))}function Fk(e,t){return t?class extends t{constructor(n){super(new e(n))}}:e}function XW(e,t){return{offset:Er(e,t),metadataLength:xe(e,t+8),bodyLength:Er(e,t+16)}}function bT(e,t){return ri(e,t,24,XW)}function yb(e,t,r){let n=nn(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,Er,0),nodes:ri(e,n(6,eo),16,(o,s)=>({length:Er(o,s),nullCount:Er(o,s+8)})),regions:ri(e,n(8,eo),16+i,(o,s)=>({offset:Er(o,s+i),length:Er(o,s+i+8)})),variadic:ri(e,n(12,eo),8,Er)}}function kk(e,t,r){let n=nn(e,t);return{id:n(4,Er,0),data:n(6,(i,o)=>yb(i,o,r)),isDelta:n(8,fc,!1)}}function _T(e,t,r,n){$n(r,j,Vs);let i=nn(e,t);switch(r){case j.Binary:return rT();case j.Utf8:return Rx();case j.LargeBinary:return uT();case j.LargeUtf8:return fT();case j.List:return Lx(n[0]);case j.ListView:return pT(n[0]);case j.LargeList:return dT(n[0]);case j.LargeListView:return mT(n[0]);case j.Struct:return Fx(n);case j.RunEndEncoded:return hT(n[0],n[1]);case j.Int:return Ox(i(4,xe,0),i(6,fc,!1));case j.Float:return eT(i(4,jr,Mf.HALF));case j.Decimal:return nT(i(4,xe,0),i(6,xe,0),i(8,xe,128));case j.Date:return iT(i(4,jr,js.MILLISECOND));case j.Time:return oT(i(4,jr,Ar.MILLISECOND),i(6,xe,32));case j.Timestamp:return Dx(i(4,jr,Ar.SECOND),i(6,Cl));case j.Interval:return sT(i(4,jr,Ei.YEAR_MONTH));case j.Duration:return lT(i(4,jr,Ar.MILLISECOND));case j.FixedSizeBinary:return cT(i(4,xe,0));case j.FixedSizeList:return kx(n[0],i(4,xe,0));case j.Map:return vk(i(4,fc,!1),n[0]);case j.Union:return aT(i(4,jr,qs.Sparse),n,ri(e,i(6,eo),4,xe))}return{typeId:r}}function Ip(e,t){let r=ri(e,t,4,(n,i)=>{let o=nn(n,i);return[o(4,Cl),o(6,Cl)]});return r.length?new Map(r):null}function gb(e,t,r){let n=nn(e,t);return{version:r,endianness:n(4,jr,0),fields:n(6,HW,[]),metadata:n(8,Ip)}}function HW(e,t){return ri(e,t,4,Ck)}function Ck(e,t){let r=nn(e,t),n=r(8,yp,j.NONE),i=r(10,eo,0),o=r(12,ZW),s=r(14,(c,l)=>QW(c,l)),a=_T(e,i,n,s);return o&&(o.dictionary=a,a=o),{name:r(4,Cl),type:a,nullable:r(6,fc,!1),metadata:r(16,Ip)}}function QW(e,t){let r=ri(e,t,4,Ck);return r.length?r:null}function ZW(e,t){if(!t)return null;let r=nn(e,t);return Nx(null,r(6,KW,Rf()),r(8,fc,!1),r(4,Er,0))}function KW(e,t){return _T(e,t,j.Int)}var JW=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,tG=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,eG=e=>`Unsupported message type: ${e} (${Mx(Ai,e)})`;function xb(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(JW(r,n.byteLength));let i=nn(n,0),o=i(4,jr,Ti.V1),s=i(6,yp,Ai.NONE),a=i(8,eo,0),c=i(10,Er,0),l;if(a){let u=s===Ai.Schema?gb:s===Ai.DictionaryBatch?kk:s===Ai.RecordBatch?yb:null;if(!u)throw new Error(eG(s));if(l=u(n,a,o),c>0){let f=e.subarray(t,t+=c);if(f.byteLength<c)throw new Error(tG(c,f.byteLength));l.body=f}}return{version:o,type:s,index:t,content:l}}function Bk(e){let t=e instanceof ArrayBuffer?new Uint8Array(e):e;return t instanceof Uint8Array&&rG(t)?iG(t):nG(t)}function rG(e){if(!e||e.length<4)return!1;for(let t=0;t<6;++t)if(hp[t]!==e[t])return!1;return!0}function nG(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=xb(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 iG(e){let t=e.byteLength-(hp.length+4),r=xe(e,t),n=nn(e,t-r),i=n(4,jr,Ti.V1),o=n(8,bT,[]),s=n(10,bT,[]);return{schema:n(6,(a,c)=>gb(a,c,i)),dictionaries:o.map(({offset:a})=>xb(e,a).content),records:s.map(({offset:a})=>xb(e,a).content),metadata:n(12,Ip)}}function vT(e,t){return oG(Bk(e),t)}function oG(e,t={}){let{schema:r={fields:[]},dictionaries:n,records:i}=e,{version:o,fields:s}=r,a=new Map,c=aG(t,o,a),l=new Map;sG(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=wT(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,xT(g).add(x))}}u.forEach((d,h)=>a.set(h,d.done()));let f=s.map(d=>xT(d.type));for(let d of i){let h=c(d);s.forEach((p,m)=>f[m].add(wT(p.type,h)))}return new Ff(r,f.map(d=>d.done()),t.useProxy)}function sG(e,t){e.fields.forEach(function r(n){t(n),n.type.dictionary?.children?.forEach(r),n.type.children?.forEach(r)})}function aG(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=>wT(p.type,this))}}}}function wT(e,t){let{typeId:r}=e,{length:n,options:i,node:o,buffer:s,variadic:a,version:c}=t,l=Sp(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(pp),offsets:e.mode===qs.Sparse?null:s(e.offsets),children:t.visit(e.children)});default:throw new Error(Vs(r))}}var jft=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;function hc(e){return vT(e,{useDate:!0})}function bb(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(hc(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 kf="COLUMN_REF",Cf="COLUMN_PARAM",Vk="TABLE_REF",Yk="LITERAL",Wk="INTERVAL",_b="ORDER_BY",wb="CAST",vb="CASE",Sb="WHEN",Ib="UNARY",Gk="UNARY_POSTFIX",Tb="BINARY",Ab="BETWEEN",Eb="NOT_BETWEEN",Mb="LOGICAL_OPERATOR",Nb="IN",Ob="FUNCTION",$l="AGGREGATE",Bf="WINDOW",Rb="WINDOW_DEF",Db="WINDOW_FRAME",Xk="EXPRESSION",Pf="FRAGMENT",Lb="VERBATIM",Uf="PARAM",Hk="WITH_CLAUSE",Fb="SELECT_CLAUSE",kb="FROM_CLAUSE";var Qk="SAMPLE_CLAUSE";var Cb="WINDOW_CLAUSE";var Bb="SELECT_QUERY",Pb="DESCRIBE_QUERY",Ub="SET_OPERATION";function Mr(e){return e instanceof tr}var tr=class{constructor(t){this.type=t}},Bt=class extends tr{};var zl=class extends Bt{constructor(t){super(Yk),this.value=t}toString(){return ST(this.value)}};function ST(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(Uf),this.param=t}get value(){return this.param.value}toString(){return ST(this.value)}};function IT(e){return e.split(".")}function no(e){return`"${e}"`}function $b(e){return e&&OG(e)?e.slice(1,-1):e}function OG(e){return e[0]==='"'&&e[e.length-1]==='"'}function pc(e){return e instanceof $f}var $f=class extends Bt{constructor(t){super(Vk),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,Tp(t).map(qt))}function ee(e,...t){return new Ep(e,Tp(t).map(qt))}function Mi(e,...t){return new ql(new Ap(e,Tp(t).map(qt)))}function zn(e,t=qt){return e.flat().filter(r=>r!=null).map(r=>t(r))}function Tp(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 Mp(e){return Array.isArray(e)}function io(e){return e&&typeof e.addEventListener=="function"&&e.dynamic!==!1&&"value"in e}var Op=class extends tr{constructor(t,r){super(Cb),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(Bf),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}`}},Ap=class extends jl{constructor(t,r){super(t,r)}},Vl=class extends tr{constructor(t,r,n,i){super(Rb),this.name=t,this.partition=r,this.order=n,this.frame=i}over(t){return Np(this,{name:t})}partitionby(...t){return Np(this,{partition:zn(t)})}orderby(...t){return Np(this,{order:zn(t)})}rows(t){return Np(this,{frame:new Rp(t)})}range(t){return Np(this,{frame:new Rp(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(" ")})`}},Rp=class extends tr{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]=Mr(n)?n.value:n,a=Zk(o,"PRECEDING"),c=Zk(s,"FOLLOWING");return`${i} BETWEEN ${a} AND ${c}${r?` ${r}`:""}`}};function Np(e,t){return new Vl(t.name??e.name,t.partition??e.partition,t.order??e.order,t.frame??e.frame)}function Zk(e,t){return e===0?"CURRENT ROW":Number.isFinite(e)?`${Math.abs(e)} ${t}`:`UNBOUNDED ${t}`}function mc(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}},Dp=class extends Ws{constructor(t,r){super(kf,r),this.name=t}get column(){return this.name}};function TT(e){return e instanceof zf}var zf=class extends Ws{constructor(t,r){super(Cf,r),this.param=t}get column(){return`${this.param.value}`}};function Yl(e,t){let r=Wl(t);return io(e)?new zf(new ro(e),r):new Dp(e,r)}var Gl=class extends Bt{constructor(t){super(Lb),this.value=t}toString(){return this.value}};function Nr(e){return new zl(e)}function Kk(e){return new Gl(e)}function zb(...e){let t=zn(e,String);return t?.length?new $f(t):void 0}function qt(e){return Ni(e)?RG(e):Hl(e)}function Xl(e){return Ni(e)?Kk(e):Hl(e)}function Hl(e){return e instanceof Bt?e:io(e)?new ro(e):Nr(e)}function Wl(e){return Ni(e)?DG(e):Mp(e)?zb(e):e}function RG(e){let t=IT(e);return Yl(t.pop(),zb(t))}function DG(e){return zb(IT(e))}function AT(){return new Vl}var Ep=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=Xl(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}`}},Jk=["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")}},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 jf=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 qf(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"}},qf=class extends tr{constructor(t,r){super(Sb),this.when=t,this.then=r}toString(){return`WHEN ${this.when} THEN ${this.then}`}};var kp=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(Pf),this.spans=t}toString(){return this.spans.join("")}};var Bp=class extends tr{constructor(t,r=!1,n=void 0,i=void 0){super(Qk),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 tr{constructor(t,r){super(Fb),this.expr=t,this.alias=r}toString(){let{expr:t,alias:r}=this;return!r||LG(t,r)?`${t}`:`${t} AS ${no(r)}`}};function LG(e,t){return e instanceof Ws&&e.table==null&&e.column===t}var Up=class extends tr{constructor(t,r){super(Hk),this.name=t,this.query=r}toString(){return`"${this.name}" AS (${this.query})`}};function qb(e){return e instanceof ft}function yc(e){return e instanceof Kl}function ET(e){return e instanceof $p}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 $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(zn(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(pc(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(mc(o))n(o,o.column);else if(Mp(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(Wl(i),$b(o)));return t.flat().forEach(i=>{if(i!=null)if(Ni(i))n(i,i);else if(pc(i))n(i,i.name);else if(Mr(i))n(i);else if(Mp(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(zn(t,Xl)),this}setWhere(...t){return this._where=[],this.where(...t)}groupby(...t){return this._groupby=this._groupby.concat(zn(t)),this}setGroupby(...t){return this._groupby=[],this.groupby(...t)}having(...t){return this._having=this._having.concat(zn(t,Xl)),this}window(...t){let r=[];return t.flat().forEach(n=>{if(n!=null)for(let i in n)r.push(new Op($b(i),n[i]))}),this._window=this._window.concat(r),this}qualify(...t){return this._qualify=this._qualify.concat(zn(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(" ")}},$p=class e extends tr{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 zp=class extends tr{constructor(t,r){super(kb),this.expr=t,this.alias=r}toString(){let{expr:t,alias:r}=this,n=qb(t)?`(${t})`:`${t}`;return r&&!(pc(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(Wk),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 Vf=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(Gk,t,r)}toString(){return`(${this.expr} ${this.op})`}};function gc(e,t){return ee("arg_max",e,t)}function xc(e,t){return ee("arg_min",e,t)}function MT(e){return ee("array_agg",e)}function Xp(e){return ee("avg",e)}function NT(e,t){return ee("corr",e,t)}function Or(e){return ee("count",e)}function OT(e,t){return ee("covar_samp",e,t)}function RT(e,t){return ee("covar_pop",e,t)}function DT(e){return ee("entropy",e)}function LT(e){return ee("first",e)}function FT(e){return ee("kurtosis",e)}function kT(e){return ee("mad",e)}function qr(e){return ee("max",e)}function CT(e){return ee("median",e)}function jn(e){return ee("min",e)}function BT(e){return ee("mode",e)}function PT(e){return ee("last",e)}function UT(e){return ee("product",e)}function $T(e,t){return ee("quantile",e,t)}function Hp(e,t){return ee("regr_avgx",e,t)}function zT(e,t){return ee("regr_avgy",e,t)}function Qp(e,t){return ee("regr_count",e,t)}function jT(e,t){return ee("regr_intercept",e,t)}function qT(e,t){return ee("regr_sxx",e,t)}function VT(e,t){return ee("regr_syy",e,t)}function YT(e,t){return ee("regr_slope",e,t)}function WT(e){return ee("skewness",e)}function Zp(e){return ee("stddev",e)}function GT(e){return ee("stddev_pop",e)}function XT(e){return ee("string_agg",e)}function de(e){return ee("sum",e)}function HT(e){return ee("var_samp",e)}function QT(e){return ee("var_pop",e)}function Gs(e,t,r){return e?new jf(void 0,[new qf(qt(e),qt(t))],qt(r)):new jf}function Yf(e,t){return new kp(qt(e),t)}function ve(e){return Yf(e,"INTEGER")}function ZT(e){return Yf(e,"FLOAT")}function Xe(e){return Yf(e,"DOUBLE")}function Wb(e,t){return new qp(e,t)}function KT(e){return we("epoch_ms",e)}function JT(e,t,r=1){return we("time_bucket",Wb(t,r),e)}function tA(e){return we("make_date",2012,we("month",e),1)}function eA(e){let t=qt(e);return we("make_date",2012,we("month",t),we("day",t))}function rA(e){return we("make_date",2012,1,we("day",e))}function nA(...e){return we("greatest",...e)}function Gb(e){return we("exp",e)}function iA(e){return we("log",e)}function Wf(e){return we("ln",e)}function oo(e){return we("sign",e)}function Rr(e){return we("abs",e)}function Xs(e){return we("sqrt",e)}function oA(e){return we("ceil",e)}function Dr(e){return we("floor",e)}function Hs(e,t){return we("round",e,t)}function FG(e,t){return new Wp(e,qt(t))}function tC(e,t){return new Gp(e,qt(t))}function qn(e,t,r){return new Fp(e,qt(t),qt(r))}function eC(e,t,r=!1){let n=r?Lp:Ql;return new n(qt(e),t?.map(qt))}function on(...e){return new Vp(zn(e))}function Oi(...e){return new Yp(zn(e))}function sA(e){return FG("NOT",e)}function Jl(e){return tC("IS NULL",e)}function Ri(e){return tC("IS NOT NULL",e)}function Kp(e,t){return qn("&",e,t)}function te(e,t){return qn("+",e,t)}function Tt(e,t){return qn("-",e,t)}function Nt(e,t){return qn("*",e,t)}function se(e,t){return qn("/",e,t)}function ir(e,t){return qn("**",e,t)}function aA(e,t){return qn("=",e,t)}function so(e,t){return qn("<>",e,t)}function ze(e,t){return qn("<",e,t)}function Di(e,t){return qn(">",e,t)}function ni(e,t){return qn("<=",e,t)}function cA(e,t){return qn(">=",e,t)}function lA(e,t){return qn("IS DISTINCT FROM",e,t)}function Jp(e,t){return qn("IS NOT DISTINCT FROM",e,t)}function Vr(e,t){return eC(e,t,!1)}function uA(e,t){return eC(e,t,!0)}function Xb(e,t){return new jp(qt(e),t.map(qt))}function fA(e,t){return new Vf(qt(e),!1,t)}function dA(e,t){return new Vf(qt(e),!0,t)}function tm(e){return we("st_asgeojson",e)}function rC(e){return we("st_x",e)}function nC(e){return we("st_y",e)}function em(e){return we("st_centroid",e)}function hA(e){return rC(em(e))}function pA(e){return nC(em(e))}function er(e,...t){return new Cp(kG(e,t))}function kG(e,t){let r=[e[0]],n=t.length;for(let i=0,o=0;i<n;){let s=t[i];Mr(s)?r[++o]=s:io(s)?r[++o]=new ro(s):r[o]+=Ni(s)?s:Nr(s);let a=e[++i];Mr(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,...Tp(r).map(Hl))}function mA(e,t,r){return Hb("regexp_matches",e,t,r)}function yA(e,t){return Hb("contains",e,t)}function gA(e,t){return Hb("starts_with",e,t)}function xA(e,t){return Hb("ends_with",e,t)}function bA(){return Mi("row_number")}function _A(){return Mi("rank")}function wA(){return Mi("dense_rank")}function vA(){return Mi("percent_rank")}function SA(){return Mi("cume_dist")}function IA(e){return Mi("ntile",e)}function TA(e,t,r){return Mi("lag",e,t,r)}function Gf(e,t,r){return Mi("lead",e,t,r)}function AA(e){return Mi("first_value",e)}function EA(e){return Mi("last_value",e)}function MA(e,t){return Mi("nth_value",e,t)}var Qb={[$l]:["args","filter"],[Ab]:["expr","extent"],[Tb]:["left","right"],[vb]:["expr","_when","_else"],[wb]:["expr"],[Cf]:["param","table"],[kf]:["table"],[Pb]:["query"],[Xk]:["node"],[Pf]:["spans"],[kb]:["expr"],[Ob]:["args"],[Nb]:["expr","values"],[Mb]:["clauses"],[Eb]:["expr","extent"],[_b]:["expr"],[Uf]:["value"],[Fb]:["expr"],[Bb]:["_with","_select","_from","_where","_sample","_groupby","_having","_window","_qualify","_orderby"],[Ub]:["subqueries","_orderby"],[Ib]:["expr"],[Sb]:["when","then"],[Bf]:["func","def"],[Cb]:["def"],[Rb]:["partition","order","frame"],[Db]:["extent"]};function rm(e,t){if(t.has(e))return t.get(e);if(Mr(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]=rm(s[c],t)}else s&&(e[o]=rm(s,t))}}return e}function zo(e,t){if(!Mr(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(`^(${Jk.join("|")})$`),BG=/(\\'|\\"|"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\w+\()/g;function PG(e){return e.split(BG).some(t=>t.endsWith("(")&&CG.test(t.slice(0,-1)))}function gn(e){let t=0;return zo(e,r=>{switch(r.type){case Bf:return-1;case $l:return t|=1,-1;case Pf:case Lb:{let n=`${r}`.toLowerCase(),i=n.indexOf("(select ");return i>=0&&(n=n.slice(0,i)),n.includes(") over ")?-1:PG(n)?(t|=2,-1):1}}}),t}function NA(e){let t=new Set;return zo(e,r=>{r.type===$l&&t.add(r)}),Array.from(t)}function Xf(e){let t={};return zo(e,r=>{(r.type===kf||r.type===Cf)&&(t[r]=r)}),Object.values(t)}function OA(e){let t=new Set;return zo(e,r=>{r.type===Uf&&t.add(r.param)}),Array.from(t)}function bc(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 RA(e,{strict:t=!1}={}){return"CREATE SCHEMA "+(t?"":"IF NOT EXISTS ")+e}function DA(e){return`INSTALL ${e}; LOAD ${e}`}function iC(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=UG({...i,...u}),d=`${e}('${r}'${f?", "+f:""})`,h=s?` WHERE ${s}`:"",p=`SELECT ${o.join(", ")} FROM ${d}${h}`;return bc(t,p,{view:a,temp:c,replace:l})}function FA(e,t,r){return Zb("read_csv",e,t,r,{auto_detect:!0,sample_size:-1})}function kA(e,t,r){return Zb("read_json",e,t,r,{auto_detect:!0,format:"auto"})}function CA(e,t,r){return Zb("read_parquet",e,t,r)}function BA(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 PA(e,t,r={}){let{select:n=["*"],...i}=r,o=iC(t),s=n.length===1&&n[0]==="*"?o:`SELECT ${n} FROM ${o}`;return bc(e,s,i)}function UG(e){return Object.entries(e).map(([t,r])=>`${t}=${LA(r)}`).join(", ")}function LA(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=>LA(t)).join(", ")+"]":"{"+Object.entries(e).map(([t,r])=>`'${t}': ${LA(r)}`).join(", ")+"}";default:return e}}function UA(e,t,r,n,i){let o=i?Tt(r,Xe(e)):Tt(Xe(e),t),s=r===t?0:n/(r-t);return s?Nt(o,Xe(s)):o}function $A(e,t,r,n,i,o){return e.select({index:te(ve(Dr(t)),Nt(ve(Dr(r)),i)),...n}).groupby("index",o)}function zA(e,t,r=void 0,n=[]){let i=r?a=>Nt(a,r):a=>a,o=Dr(t),s=te(o,1);return ft.from(ft.unionAll(e.clone().select({i:ve(o),w:i(Tt(s,t))}),e.clone().select({i:ve(s),w:i(Tt(t,o))}))).select({index:"i",density:de("w")},n).groupby("index",n).having(so("density",0))}function $G(e){return e}function jA(e,t,r,n,i,o=[]){let s=n?g=>Nt(g,n):$G,a=(g,x)=>e.clone().select({xp:t,yp:r,i:g,w:x}),c=(g,x)=>te(g,Nt(x,i)),l=ve(Dr(t)),u=ve(Dr(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 qA(e,t,r,n,i,o,s=[],a=!0){e.select({x:ve(Dr(t)),y:ve(Dr(r))});let c=s.concat(n),l=ft.from(e).select(c,{x0:"x",y0:"y",dx:Tt(Gf("x").over("sw"),"x"),dy:Tt(Gf("y").over("sw"),"y")}).window({sw:AT().partitionby(c).orderby(fA("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:nA(qr(Rr("dx")),qr(Rr("dy")))}).from("pairs"),f=ft.select({i:ve(er`UNNEST(range((${u})))`)}),d=ft.unionAll(ft.select(c,{x:te("x0","i"),y:te("y0",ve(Hs(se(Nt("i","dy"),"dx"))))}).from("pairs","indices").where([ni(Rr("dy"),Rr("dx")),ze("i",Rr("dx"))]),ft.select(c,{x:te("x0",ve(Hs(se(Nt(Nt(oo("dy"),"i"),"dx"),"dy")))),y:te("y0",Nt(oo("dy"),"i"))}).from("pairs","indices").where([Di(Rr("dy"),Rr("dx")),ze("i",Rr("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,Or().partitionby(["x"].concat(c)))}:null).where([ni(0,"x"),ze("x",i),ni(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"):Or()}).groupby("index",s)}function VA(e,t,r,n,i=[]){let o=ve(Dr(t)),s=a=>ft.from(e).select(a).groupby(o,i);return ft.union(s([{[r]:jn(r),[n]:xc(n,r)},...i]),s([{[r]:qr(r),[n]:gc(n,r)},...i]),s([{[r]:xc(r,n),[n]:jn(n)},...i]),s([{[r]:gc(r,n),[n]:qr(n)},...i])).orderby(i,r)}var Kb=e=>e;function oC(){return{apply:Kb,invert:Kb,sqlApply:qt,sqlInvert:Kb}}function zG({base:e=null}={}){if(e==null||e===Math.E)return{apply:Math.log,invert:Math.exp,sqlApply:t=>Wf(t),sqlInvert:t=>Gb(t)};if(e===10)return{apply:Math.log10,invert:t=>Math.pow(10,t),sqlApply:t=>iA(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(Wf(r),Wf(t)),sqlInvert:r=>ir(t,r)}}}function jG({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),Wf(te(t,Rr(r))))),sqlInvert:r=>Nt(oo(r),Tt(Gb(Rr(r)),t))}}function qG(){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),Xs(Rr(e)))),sqlInvert:e=>Nt(oo(e),ir(e,2))}}function VG({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(Rr(r),t))),sqlInvert:r=>Nt(oo(r),ir(Rr(r),se(1,t)))}}function sC(){return{apply:e=>+e,invert:e=>new Date(e),sqlApply:e=>e instanceof Date?Nr(+e):WG(e)?Nr(+e.value):KT(e),sqlInvert:Kb}}var YG={identity:oC,linear:oC,log:zG,symlog:jG,sqrt:qG,pow:VG,time:sC,utc:sC};function nm(e){let t=YG[e.type];return t?{...e,...t(e)}:null}function WG(e){return e instanceof zl&&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=aC(t^o>>8)),t=aC(t^i&255)}return GG(t)>>>0}function aC(e){return e+(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24)}function GG(e){return e+=e<<13,e^=e>>>7,e+=e<<3,e^=e>>>17,e+=e<<5,e&4294967295}function lC(e,t,r){switch(e.name){case"count":case"sum":return XG(t,e);case"avg":return HG(t,e);case"arg_max":return QG(t,e);case"arg_min":return ZG(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 Xs(t1(t,e,r));case"stddev_pop":return Xs(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 cC(t,e,r);case"regr_count":return Hf(t,e).expr;case"regr_avgx":return hC(t,e);case"regr_avgy":return pC(t,e);case"regr_syy":return WA(t,0,e,r);case"regr_sxx":return WA(t,1,e,r);case"regr_sxy":return e1(t,e,r,null);case"regr_slope":return mC(t,e,r);case"regr_intercept":return KG(t,e,r);case"regr_r2":return ir(cC(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=uC(e);return t[n]=e,er`${e.name}("${n}")`}default:return null}}function uC(e){return"pre_"+Jb(`${e}`).toString(16)}function xn(e,t,r){let n=r?.filter;n&&(t=t.filter?t.where(on(n,t.filter)):t.where(n));let i=uC(t);return e[i]=t,i}function fC(e,t){let r=xn(e,Or(t.args[0]),t);return{expr:de(r),name:r}}function XG(e,t){return de(xn(e,t))}function HG(e,t){let r=xn(e,t),{expr:n,name:i}=fC(e,t);return se(de(Nt(r,i)),n)}function QG(e,t){let r=xn(e,t),n=xn(e,qr(t.args[1]),t);return gc(r,n)}function ZG(e,t){let r=xn(e,t),n=xn(e,jn(t.args[1]),t);return xc(r,n)}function t1(e,t,r,n=!0){let i=t.args[0],{expr:o}=fC(e,t),s=Tt(i,r(i)),a=xn(e,de(ir(s,2)),t),c=xn(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}=Hf(e,t),o=dC(e,t,r),s=im(e,1,t,r),a=im(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 cC(e,t,r){let{expr:n}=Hf(e,t),i=dC(e,t,r),o=YA(e,1,t,r),s=YA(e,0,t,r),a=im(e,1,t,r),c=im(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)),Xs(Nt(l,u)))}function Hf(e,t){let[r,n]=t.args,i=xn(e,Qp(r,n),t);return{expr:de(i),name:i}}function im(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(xn(e,a,r))}function YA(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(xn(e,a,r))}function dC(e,t,r){let[n,i]=t.args,o=de(Nt(Tt(i,r(i)),Tt(n,r(n))));return de(xn(e,o,t))}function hC(e,t){let[r,n]=t.args,{expr:i,name:o}=Hf(e,t),s=xn(e,Hp(r,n),t);return se(de(Nt(s,o)),i)}function pC(e,t){let[r,n]=t.args,{expr:i,name:o}=Hf(e,t),s=xn(e,zT(r,n),t);return se(de(Nt(s,o)),i)}function WA(e,t,r,n){let{expr:i}=Hf(e,r),o=im(e,t,r,n),s=YA(e,t,r,n);return Tt(s,se(ir(o,2),i))}function mC(e,t,r){let n=e1(e,t,r,null),i=WA(e,1,t,r);return se(n,i)}function KG(e,t,r){let n=hC(e,t),i=pC(e,t),o=mC(e,t,r);return Tt(i,Nt(o,n))}function yC(e){if(!e.filterStable)return null;let t=e.query();if(!yc(t))return null;let r=r1(t,c=>{let l=c._from[0]?.expr;return pc(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 er`(SELECT avg(${u??c}) FROM "${r}")`};for(let{alias:c,expr:l}of t._select){if(gn(l)>1)return null;let u=NA(l);if(u.length===0)s.push(c),i[c]=l;else{for(let f of u){if(f.isDistinct)return null;let d=lC(f,i,a);if(!d)return null;n.set(f,d)}o[c]=rm(l,n)}}return n.size?{group:s,preagg:i,output:o}:null}function r1(e,t){let r=e.subqueries;if(yc(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 JG={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=tX(n),c.source===null))return null;if(i.has(t))return i.get(t);let l=yC(t),u;if(!l)u=null;else if(r.skip(t,n))u=JG;else{let f=r.remove(a).predicate(t);u=nX(t.query(f),c,l,s),u.result=o.exec([`CREATE SCHEMA IF NOT EXISTS ${s}`,bc(u.table,u.create,{temp:!1})]),u.result.catch(d=>o.logger().error(d))}return i.set(t,u),u}};function tX(e){let{source:t,meta:r}=e,n=e.predicate,i=Xf(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=>rX(d,u,l));f.some(d=>!d)||(f.length===1?(o=d=>d?Vr("active0",d.extent.map(f[0])):[],s={active0:f[0](n.expr)}):(o=d=>d?on(d.clauses.map((h,p)=>Vr(`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 eX={ceil:oA,round:Hs};function rX(e,t,r){let{type:n,domain:i,range:o,apply:s,sqlApply:a}=nm(e);if(!s)return;let c=eX[`${r}`.toLowerCase()]||Dr,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(Xe(f),p),h=l===0?p=>p:p=>Tt(p,Xe(l));return p=>ve(c(d(h(a(p)))))}function nX(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=>Xf(g).map(x=>x.column));iX(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 GA({table:p,create:d,active:t,select:m})}function iX(e,t){let r=new Set,n=i=>{r.has(i)||(r.add(i),yc(i)&&i._from.length&&i.select(t),i.subqueries.forEach(n))};n(e)}var GA=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 i1(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 oX="count",sX="nulls",aX="max",cX="min",lX="distinct";var uX={[oX]:Or,[lX]:e=>Or(e).distinct(),[aX]:qr,[cX]:jn,[sX]:e=>Or().where(Jl(e))};function fX({table:e,column:t,stats:r}){return ft.from(e).select(Array.from(r,n=>({[n]:uX[n](t)})))}async function XA(e,t){return t.length===1&&t[0].column==="*"?hX(e,t[0].table):(await Promise.all(t.map(r=>dX(e,r)))).filter(r=>r)}async function dX(e,{table:t,column:r,stats:n}){let i=ft.from({source:t}).select({column:r}).groupby(Mr(r)&&gn(r)?er`ALL`:[]),[o]=Array.from(await e.query(ft.describe(i))),s={table:t,column:`${r}`,sqlType:o.column_type,type:i1(o.column_type),nullable:o.null==="YES"};if(!n?.length)return s;let[a]=await e.query(fX({table:t,column:r,stats:n}),{persist:!0});return Object.assign(s,a)}async function hX(e,t){return Array.from(await e.query(`DESCRIBE ${Wl(t)}`)).map(n=>({table:t,column:n.column_name,sqlType:n.column_type,type:i1(n.column_type),nullable:n.null==="YES"}))}var _c=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=_c.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=_c.done,this}ready(t){return this._state=_c.ready,this._value=t,this}reject(t){return this._state=_c.error,this._reject(t),this}get state(){return this._state}};tu.prototype.constructor=Promise;function o1(){return{debug(...e){},info(...e){},log(...e){},warn(...e){},error(...e){}}}function pX(e){return(typeof requestAnimationFrame<"u"?requestAnimationFrame:typeof setImmediate<"u"?setImmediate:setTimeout)(e)}function gC(e,t){let r=[],n=0;function i(){let o=mX(r,t);r=[],n=0;for(let s of o)gX(s,e),_X(s,t)}return{add(o,s){o.request.type==="arrow"?(n=n||pX(()=>i()),r.push({entry:o,priority:s,index:r.length})):e(o,s)}}}function mX(e,t){let r=[],n=new Map;for(let i of e){let{entry:{request:o}}=i,s=yX(o.query,t);if(!n.has(s)){let a=[];r.push(a),n.set(s,a)}n.get(s).push(i)}return r}function yX(e,t){let r=`${e}`;if(yc(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=>mc(s)&&o[s.column]||s))}else e._select.some(o=>gn(o.expr))&&n.setGroupby("ALL");return`${n}`}else return r}function gX(e,t){if(xX(e))t({request:{type:"arrow",cache:!1,query:e.query=bX(e)},result:e.result=new tu});else for(let{entry:r,priority:n}of e)t(r,n)}function xX(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 bX(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=>mc(s)&&o[s.column]||s))}return n.setSelect(Array.from(r.values()))}async function _X(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=ET(n);e.forEach(({entry:a},c)=>{let{request:l,result:u}=a,f=r[c],d=s&&f?vX(o,f):f?wX(o,f):o;l.cache&&t.set(String(l.query),d),u.fulfill(d)})}function wX(e,t){return e.select(t.map(r=>r[0]),t.map(r=>r[1]))}function vX(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 SX=typeof requestIdleCallback<"u"?requestIdleCallback:setTimeout,xC=()=>({get:()=>{},set:(e,t)=>t,clear:()=>{}});function bC({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&&SX(n),o},clear(){r=new Map}}}var s1=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}),a1=class{constructor(t=32){this.queue=new s1(3),this.db=null,this.clientCache=null,this._logger=o1(),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!==_c.pending;){let n=this.pendingResults.shift();n.state===_c.ready?n.fulfill():n.state===_c.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?bC():t||xC():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=gC(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 c1;function Li(e){return e?c1=e:c1==null&&(c1=new om),c1}var om=class{constructor(t=bb(),{logger:r=console,manager:n=new a1,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||o1(),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),IX(this,t.filterBy,t)}async initializeClient(t){let r=t.fields();return r?.length&&t.fieldInfo(await XA(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 IX(e,t,r){if(!t)return;let n=e.filterGroups.get(t);if(!n){let i=s=>TX(e,t,s),o=()=>AX(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 TX(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 AX(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 l1=class{constructor(){this._callbacks=new Map}addEventListener(t,r){this._callbacks.has(t)||this._callbacks.set(t,{callbacks:new Set,pending:null,queue:new HA}),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())})}}}},HA=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 sm(e,t){return e===t?!1:e instanceof Date&&t instanceof Date?+e!=+t:Array.isArray(e)&&Array.isArray(t)?EX(e,t):!0}function EX(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 wc}var wc=class e extends l1{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 sm(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 u1(e,t){return new qo(new f1(e),t&&[t].flat())}var qo=class e extends wc{static intersect({cross:t=!1,empty:r=!1,include:n=[]}={}){return u1({cross:t,empty:r},n)}static union({cross:t=!1,empty:r=!1,include:n=[]}={}){return u1({cross:t,empty:r,union:!0},n)}static single({cross:t=!1,empty:r=!1,include:n=[]}={}){return u1({cross:t,empty:r,single:!0},n)}static crossfilter({empty:t=!1,include:r=[]}={}){return u1({cross:!0,empty:t},r)}constructor(t=new f1,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)}},f1=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[Nr(!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 _C(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"?hc(await(await r).arrayBuffer()):(await r).json()}}}function vC(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 wC(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 Qf(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 wC=="function"?wC(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 eE={};ti(eE,{compareArrayLike:()=>tE,joinUint8Arrays:()=>si,memcpy:()=>lm,rebaseValueOffsets:()=>b1,toArrayBufferView:()=>zt,toArrayBufferViewAsyncIterator:()=>uo,toArrayBufferViewIterator:()=>Yo,toBigInt64Array:()=>x1,toBigUint64Array:()=>CX,toFloat32Array:()=>BX,toFloat32ArrayAsyncIterator:()=>JX,toFloat32ArrayIterator:()=>YX,toFloat64Array:()=>PX,toFloat64ArrayAsyncIterator:()=>tH,toFloat64ArrayIterator:()=>WX,toInt16Array:()=>LX,toInt16ArrayAsyncIterator:()=>HX,toInt16ArrayIterator:()=>zX,toInt32Array:()=>eu,toInt32ArrayAsyncIterator:()=>QX,toInt32ArrayIterator:()=>jX,toInt8Array:()=>DX,toInt8ArrayAsyncIterator:()=>XX,toInt8ArrayIterator:()=>$X,toUint16Array:()=>FX,toUint16ArrayAsyncIterator:()=>ZX,toUint16ArrayIterator:()=>qX,toUint32Array:()=>kX,toUint32ArrayAsyncIterator:()=>KX,toUint32ArrayIterator:()=>VX,toUint8Array:()=>It,toUint8ArrayAsyncIterator:()=>JA,toUint8ArrayIterator:()=>KA,toUint8ClampedArray:()=>UX,toUint8ClampedArrayAsyncIterator:()=>eH,toUint8ClampedArrayIterator:()=>GX});var MX=new TextDecoder("utf-8"),am=e=>MX.decode(e),NX=new TextEncoder,Vo=e=>NX.encode(e);var OX=e=>typeof e=="number",SC=e=>typeof e=="boolean",gr=e=>typeof e=="function",bn=e=>e!=null&&Object(e)===e,co=e=>bn(e)&&gr(e.then);var lo=e=>bn(e)&&gr(e[Symbol.iterator]),Fi=e=>bn(e)&&gr(e[Symbol.asyncIterator]),d1=e=>bn(e)&&bn(e.schema);var h1=e=>bn(e)&&"done"in e&&"value"in e;var p1=e=>bn(e)&&gr(e.stat)&&OX(e.fd);var m1=e=>bn(e)&&cm(e.body),y1=e=>"_getDOMStream"in e&&"_getNodeStream"in e,IC=e=>bn(e)&&gr(e.abort)&&gr(e.getWriter)&&!y1(e),cm=e=>bn(e)&&gr(e.cancel)&&gr(e.getReader)&&!y1(e),TC=e=>bn(e)&&gr(e.end)&&gr(e.write)&&SC(e.writable)&&!y1(e),g1=e=>bn(e)&&gr(e.read)&&gr(e.pipe)&&SC(e.readable)&&!y1(e),AC=e=>bn(e)&&gr(e.clear)&&gr(e.bytes)&&gr(e.position)&&gr(e.setPosition)&&gr(e.capacity)&&gr(e.getBufferIdentifier)&&gr(e.createLong);var ZA=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function RX(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 lm(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=RX(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?lm(s,o,a):s=o;break}lm(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=h1(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 ZA?new e(r):AC(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 DX=e=>zt(Int8Array,e),LX=e=>zt(Int16Array,e),eu=e=>zt(Int32Array,e),x1=e=>zt(BigInt64Array,e),It=e=>zt(Uint8Array,e),FX=e=>zt(Uint16Array,e),kX=e=>zt(Uint32Array,e),CX=e=>zt(BigUint64Array,e),BX=e=>zt(Float32Array,e),PX=e=>zt(Float64Array,e),UX=e=>zt(Uint8ClampedArray,e),QA=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 ZA?r(t):lo(t)?t:r(t);return yield*QA(function*(i){let o=null;do o=i.next(yield zt(e,o));while(!o.done)}(n[Symbol.iterator]())),new e}var $X=e=>Yo(Int8Array,e),zX=e=>Yo(Int16Array,e),jX=e=>Yo(Int32Array,e),KA=e=>Yo(Uint8Array,e),qX=e=>Yo(Uint16Array,e),VX=e=>Yo(Uint32Array,e),YX=e=>Yo(Float32Array,e),WX=e=>Yo(Float64Array,e),GX=e=>Yo(Uint8ClampedArray,e);function uo(e,t){return oi(this,arguments,function*(){if(co(t))return yield Ut(yield Ut(yield*Qf(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*Qf(ao(QA(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 ZA?n(t):lo(t)?i(t):Fi(t)?t:n(t);return yield Ut(yield*Qf(ao(QA(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 XX=e=>uo(Int8Array,e),HX=e=>uo(Int16Array,e),QX=e=>uo(Int32Array,e),JA=e=>uo(Uint8Array,e),ZX=e=>uo(Uint16Array,e),KX=e=>uo(Uint32Array,e),JX=e=>uo(Float32Array,e),tH=e=>uo(Float64Array,e),eH=e=>uo(Uint8ClampedArray,e);function b1(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 tE(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 Yr={fromIterable(e){return _1(rH(e))},fromAsyncIterable(e){return _1(nH(e))},fromDOMStream(e){return _1(iH(e))},fromNodeStream(e){return _1(oH(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')}},_1=e=>(e.next(),e);function*rH(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=KA(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 nH(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=JA(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 iH(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 nE(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 nE=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})}},rE=(e,t)=>{let r=i=>n([t,i]),n;return[t,r,new Promise(i=>(n=i)&&e.once(t,r))]};function oH(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]=rE(e,"end"),r[1]=rE(e,"error");do{if(r[2]=rE(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 He;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(He||(He={}));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),w1=new Float32Array(Wo.buffer),v1=new Float64Array(Wo.buffer),Zf=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var um;(function(e){e[e.UTF8_BYTES=1]="UTF8_BYTES",e[e.UTF16_STRING=2]="UTF16_STRING"})(um||(um={}));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),w1[0]}readFloat64(t){return Wo[Zf?0:1]=this.readInt32(t),Wo[Zf?1:0]=this.readInt32(t+4),v1[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){w1[0]=r,this.writeInt32(t,Wo[0])}writeFloat64(t,r){v1[0]=r,this.writeInt32(t,Wo[Zf?0:1]),this.writeInt32(t+4,Wo[Zf?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===um.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 fm;(function(e){e[e.BUFFER=0]="BUFFER"})(fm||(fm={}));var dm;(function(e){e[e.LZ4_FRAME=0]="LZ4_FRAME",e[e.ZSTD=1]="ZSTD"})(dm||(dm={}));var I1=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):dm.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):fm.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,r){t.addFieldInt8(0,r,dm.LZ4_FRAME)}static addMethod(t,r){t.addFieldInt8(1,r,fm.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 Kf=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 Jf=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 Jf).__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 Kf).__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 I1).__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 Qs=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 vc;(function(e){e[e.Little=0]="Little",e[e.Big=1]="Big"})(vc||(vc={}));var hm;(function(e){e[e.DenseArray=0]="DenseArray"})(hm||(hm={}));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):hm.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,hm.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 pm=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 mm=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 Sc=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):He.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,He.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 Ic=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 Tc=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 Ac=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 Ec=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 Mc=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 ym=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 gm=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 xm=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 Nc=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 bm=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 _m=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 Zs=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 Ks=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 wm=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 Vn=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):vc.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,vc.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 Ci;(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(Ci||(Ci={}));var SE={};ti(SE,{clampRange:()=>Tm,createElementComparator:()=>Lc,wrapIndex:()=>nu});var iE={};ti(iE,{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 cE={};ti(cE,{BN:()=>Sm,bigNumToBigInt:()=>MC,bigNumToNumber:()=>aE,bigNumToString:()=>rd,isArrowBigNumSymbol:()=>EC});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 oE(e,t){return re(e/t)+re(e%t)/re(t)}var EC=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[EC]=!0;yo.prototype.toJSON=function(){return`"${rd(this)}"`};yo.prototype.valueOf=function(e){return aE(this,e)};yo.prototype.toString=function(){return rd(this)};yo.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return aE(this);case"string":return rd(this);case"default":return MC(this)}return rd(this)};function td(...e){return yo.apply(this,e)}function ed(...e){return yo.apply(this,e)}function vm(...e){return yo.apply(this,e)}Object.setPrototypeOf(td.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(ed.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(vm.prototype,Object.create(Uint32Array.prototype));Object.assign(td.prototype,yo.prototype,{constructor:td,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(ed.prototype,yo.prototype,{constructor:ed,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(vm.prototype,yo.prototype,{constructor:vm,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});var sH=BigInt(4294967296)*BigInt(4294967296),aH=sH-BigInt(1);function aE(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^aH)*(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 rd(e){if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return sE(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return sE(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`-${sE(t)}`}function MC(e){return e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:rd(e)}function sE(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 Sm=class e{static new(t,r){switch(r){case!0:return new td(t);case!1:return new ed(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new td(t)}return t.byteLength===16?new vm(t):new ed(t)}static signed(t){return new td(t)}static unsigned(t){return new ed(t)}static decimal(t){return new vm(t)}constructor(t,r){return e.new(t,r)}};var NC,OC,RC,DC,LC,FC,kC,CC,BC,PC,UC,$C,zC,jC,qC,VC,YC,WC,GC,XC,HC,QC,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}};NC=Symbol.toStringTag;K[NC]=(e=>(e.children=null,e.ArrayType=Array,e.OffsetArrayType=Int32Array,e[Symbol.toStringTag]="DataType"))(K.prototype);var _n=class extends K{constructor(){super(D.Null)}toString(){return"Null"}};OC=Symbol.toStringTag;_n[OC]=(e=>e[Symbol.toStringTag]="Null")(_n.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}`}};RC=Symbol.toStringTag;_r[RC]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(_r.prototype);var T1=class extends _r{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},A1=class extends _r{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},Ho=class extends _r{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},E1=class extends _r{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},M1=class extends _r{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},N1=class extends _r{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},O1=class extends _r{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},R1=class extends _r{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(T1.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(A1.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(Ho.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(E1.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(M1.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(N1.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(O1.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(R1.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}`}};DC=Symbol.toStringTag;Bi[DC]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(Bi.prototype);var D1=class extends Bi{constructor(){super(be.HALF)}},L1=class extends Bi{constructor(){super(be.SINGLE)}},F1=class extends Bi{constructor(){super(be.DOUBLE)}};Object.defineProperty(D1.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(L1.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(F1.prototype,"ArrayType",{value:Float64Array});var Js=class extends K{constructor(){super(D.Binary)}toString(){return"Binary"}};LC=Symbol.toStringTag;Js[LC]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(Js.prototype);var ta=class extends K{constructor(){super(D.LargeBinary)}toString(){return"LargeBinary"}};FC=Symbol.toStringTag;ta[FC]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeBinary"))(ta.prototype);var ea=class extends K{constructor(){super(D.Utf8)}toString(){return"Utf8"}};kC=Symbol.toStringTag;ea[kC]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(ea.prototype);var ra=class extends K{constructor(){super(D.LargeUtf8)}toString(){return"LargeUtf8"}};CC=Symbol.toStringTag;ra[CC]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeUtf8"))(ra.prototype);var na=class extends K{constructor(){super(D.Bool)}toString(){return"Bool"}};BC=Symbol.toStringTag;na[BC]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(na.prototype);var ia=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}]`}};PC=Symbol.toStringTag;ia[PC]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(ia.prototype);var oa=class extends K{constructor(t){super(D.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${He[this.unit]}>`}get ArrayType(){return this.unit===He.DAY?Int32Array:BigInt64Array}};UC=Symbol.toStringTag;oa[UC]=(e=>(e.unit=null,e[Symbol.toStringTag]="Date"))(oa.prototype);var sa=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`)}};$C=Symbol.toStringTag;sa[$C]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))(sa.prototype);var aa=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}`:""}>`}};zC=Symbol.toStringTag;aa[zC]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Timestamp"))(aa.prototype);var ca=class extends K{constructor(t){super(D.Interval),this.unit=t}toString(){return`Interval<${xr[this.unit]}>`}};jC=Symbol.toStringTag;ca[jC]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))(ca.prototype);var la=class extends K{constructor(t){super(D.Duration),this.unit=t}toString(){return`Duration<${ct[this.unit]}>`}};qC=Symbol.toStringTag;la[qC]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Duration"))(la.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}};VC=Symbol.toStringTag;go[VC]=(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(", ")}}>`}};YC=Symbol.toStringTag;Re[YC]=(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(" | ")}>`}};WC=Symbol.toStringTag;xo[WC]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(xo.prototype);var ua=class extends K{constructor(t){super(D.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};GC=Symbol.toStringTag;ua[GC]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(ua.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}>`}};XC=Symbol.toStringTag;bo[XC]=(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(", ")}}>`}};HC=Symbol.toStringTag;_o[HC]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(_o.prototype);var cH=(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?cH():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}>`}};QC=Symbol.toStringTag;li[QC]=(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 lH(this,t,r)}getVisitFnByTypeId(t,r=!0){return nd(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 lH(e,t,r=!0){return typeof t=="number"?nd(e,t,r):typeof t=="string"&&t in D?nd(e,D[t],r):t&&t instanceof K?nd(e,ZC(t),r):t?.type&&t.type instanceof K?nd(e,ZC(t.type),r):nd(e,D.NONE,r)}function nd(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 ZC(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 He.DAY:return D.DateDay;case He.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 lE={};ti(lE,{float64ToUint16:()=>Im,uint16ToFloat64:()=>k1});var KC=new Float64Array(1),id=new Uint32Array(KC.buffer);function k1(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 Im(e){if(e!==e)return 32256;KC[0]=e;let t=(id[1]&2147483648)>>16&65535,r=id[1]&2146435072,n=0;return r>=1089470464?id[0]>0?r=31744:(r=(r&2080374784)>>16,n=(id[1]&1048575)>>10):r<=1056964608?(n=1048576+(id[1]&1048575),n=1048576+(n<<(r>>20)-998)>>21,r=0):(r=r-1056964608>>10,n=(id[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 uH=(e,t,r)=>{e[t]=Math.floor(r/864e5)},JC=(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)}},fH=({offset:e,values:t},r,n)=>{let i=e+r;n?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},fa=({values:e},t,r)=>{e[t]=r},uE=({values:e},t,r)=>{e[t]=r},tB=({values:e},t,r)=>{e[t]=Im(r)},dH=(e,t,r)=>{switch(e.type.precision){case be.HALF:return tB(e,t,r);case be.SINGLE:case be.DOUBLE:return uE(e,t,r)}},C1=({values:e},t,r)=>{uH(e,t,r.valueOf())},B1=({values:e},t,r)=>{e[t]=BigInt(r)},fE=({stride:e,values:t},r,n)=>{t.set(n.subarray(0,e),e*r)},eB=({values:e,valueOffsets:t},r,n)=>JC(e,t,r,n),rB=({values:e,valueOffsets:t},r,n)=>JC(e,t,r,Vo(n)),dE=(e,t,r)=>{e.type.unit===He.DAY?C1(e,t,r):B1(e,t,r)},P1=({values:e},t,r)=>{e[t]=BigInt(r/1e3)},U1=({values:e},t,r)=>{e[t]=BigInt(r)},$1=({values:e},t,r)=>{e[t]=BigInt(r*1e3)},z1=({values:e},t,r)=>{e[t]=BigInt(r*1e6)},hE=(e,t,r)=>{switch(e.type.unit){case ct.SECOND:return P1(e,t,r);case ct.MILLISECOND:return U1(e,t,r);case ct.MICROSECOND:return $1(e,t,r);case ct.NANOSECOND:return z1(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},Y1=({values:e},t,r)=>{e[t]=r},pE=(e,t,r)=>{switch(e.type.unit){case ct.SECOND:return j1(e,t,r);case ct.MILLISECOND:return q1(e,t,r);case ct.MICROSECOND:return V1(e,t,r);case ct.NANOSECOND:return Y1(e,t,r)}},mE=({values:e,stride:t},r,n)=>{e.set(n.subarray(0,t),t*r)},hH=(e,t,r)=>{let n=e.children[0],i=e.valueOffsets,o=Wr.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))},pH=(e,t,r)=>{let n=e.children[0],{valueOffsets:i}=e,o=Wr.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},mH=(e,t)=>(r,n,i,o)=>n&&r(n,e,t[o]),yH=(e,t)=>(r,n,i,o)=>n&&r(n,e,t.get(o)),gH=(e,t)=>(r,n,i,o)=>n&&r(n,e,t.get(i.name)),xH=(e,t)=>(r,n,i,o)=>n&&r(n,e,t[i.name]),bH=(e,t,r)=>{let n=e.type.children.map(o=>Wr.getVisitFn(o.type)),i=r instanceof Map?gH(t,r):r instanceof Gt?yH(t,r):Array.isArray(r)?mH(t,r):xH(t,r);e.type.children.forEach((o,s)=>i(n[s],e.children[s],o,s))},_H=(e,t,r)=>{e.type.mode===Se.Dense?nB(e,t,r):iB(e,t,r)},nB=(e,t,r)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[n];Wr.visit(i,e.valueOffsets[t],r)},iB=(e,t,r)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[n];Wr.visit(i,t,r)},wH=(e,t,r)=>{var n;(n=e.dictionary)===null||n===void 0||n.set(e.values[t],r)},yE=(e,t,r)=>{e.type.unit===xr.DAY_TIME?W1(e,t,r):G1(e,t,r)},W1=({values:e},t,r)=>{e.set(r.subarray(0,2),2*t)},G1=({values:e},t,r)=>{e[t]=r[0]*12+r[1]%12},X1=({values:e},t,r)=>{e[t]=r},H1=({values:e},t,r)=>{e[t]=r},Q1=({values:e},t,r)=>{e[t]=r},Z1=({values:e},t,r)=>{e[t]=r},gE=(e,t,r)=>{switch(e.type.unit){case ct.SECOND:return X1(e,t,r);case ct.MILLISECOND:return H1(e,t,r);case ct.MICROSECOND:return Q1(e,t,r);case ct.NANOSECOND:return Z1(e,t,r)}},vH=(e,t,r)=>{let{stride:n}=e,i=e.children[0],o=Wr.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(fH);wt.prototype.visitInt=Ot(fa);wt.prototype.visitInt8=Ot(fa);wt.prototype.visitInt16=Ot(fa);wt.prototype.visitInt32=Ot(fa);wt.prototype.visitInt64=Ot(fa);wt.prototype.visitUint8=Ot(fa);wt.prototype.visitUint16=Ot(fa);wt.prototype.visitUint32=Ot(fa);wt.prototype.visitUint64=Ot(fa);wt.prototype.visitFloat=Ot(dH);wt.prototype.visitFloat16=Ot(tB);wt.prototype.visitFloat32=Ot(uE);wt.prototype.visitFloat64=Ot(uE);wt.prototype.visitUtf8=Ot(rB);wt.prototype.visitLargeUtf8=Ot(rB);wt.prototype.visitBinary=Ot(eB);wt.prototype.visitLargeBinary=Ot(eB);wt.prototype.visitFixedSizeBinary=Ot(fE);wt.prototype.visitDate=Ot(dE);wt.prototype.visitDateDay=Ot(C1);wt.prototype.visitDateMillisecond=Ot(B1);wt.prototype.visitTimestamp=Ot(hE);wt.prototype.visitTimestampSecond=Ot(P1);wt.prototype.visitTimestampMillisecond=Ot(U1);wt.prototype.visitTimestampMicrosecond=Ot($1);wt.prototype.visitTimestampNanosecond=Ot(z1);wt.prototype.visitTime=Ot(pE);wt.prototype.visitTimeSecond=Ot(j1);wt.prototype.visitTimeMillisecond=Ot(q1);wt.prototype.visitTimeMicrosecond=Ot(V1);wt.prototype.visitTimeNanosecond=Ot(Y1);wt.prototype.visitDecimal=Ot(mE);wt.prototype.visitList=Ot(hH);wt.prototype.visitStruct=Ot(bH);wt.prototype.visitUnion=Ot(_H);wt.prototype.visitDenseUnion=Ot(nB);wt.prototype.visitSparseUnion=Ot(iB);wt.prototype.visitDictionary=Ot(wH);wt.prototype.visitInterval=Ot(yE);wt.prototype.visitIntervalDayTime=Ot(W1);wt.prototype.visitIntervalYearMonth=Ot(G1);wt.prototype.visitDuration=Ot(gE);wt.prototype.visitDurationSecond=Ot(X1);wt.prototype.visitDurationMillisecond=Ot(H1);wt.prototype.visitDurationMicrosecond=Ot(Q1);wt.prototype.visitDurationNanosecond=Ot(Z1);wt.prototype.visitFixedSizeList=Ot(vH);wt.prototype.visitMap=Ot(pH);var Wr=new wt;var wo=Symbol.for("parent"),od=Symbol.for("rowIndex"),Oc=class{constructor(t,r){return this[wo]=t,this[od]=r,new Proxy(this,new bE)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[od],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 xE(this[wo],this[od])}},xE=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(Oc.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[wo]:{writable:!0,enumerable:!1,configurable:!1,value:null},[od]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var bE=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[od]);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?(Wr.visit(t[wo].children[i],t[od],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 SH=(e,t)=>864e5*e[t],IH=(e,t)=>null,oB=(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)},TH=({offset:e,values:t},r)=>{let n=e+r;return(t[n>>3]&1<<n%8)!==0},sB=({values:e},t)=>SH(e,t),aB=({values:e},t)=>re(e[t]),Rc=({stride:e,values:t},r)=>t[e*r],AH=({stride:e,values:t},r)=>k1(t[e*r]),cB=({values:e},t)=>e[t],EH=({stride:e,values:t},r)=>t.subarray(e*r,e*(r+1)),lB=({values:e,valueOffsets:t},r)=>oB(e,t,r),uB=({values:e,valueOffsets:t},r)=>{let n=oB(e,t,r);return n!==null?am(n):null},MH=({values:e},t)=>e[t],NH=({type:e,values:t},r)=>e.precision!==be.HALF?t[r]:k1(t[r]),OH=(e,t)=>e.type.unit===He.DAY?sB(e,t):aB(e,t),fB=({values:e},t)=>1e3*re(e[t]),dB=({values:e},t)=>re(e[t]),hB=({values:e},t)=>oE(e[t],BigInt(1e3)),pB=({values:e},t)=>oE(e[t],BigInt(1e6)),RH=(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)}},mB=({values:e},t)=>e[t],yB=({values:e},t)=>e[t],gB=({values:e},t)=>e[t],xB=({values:e},t)=>e[t],DH=(e,t)=>{switch(e.type.unit){case ct.SECOND:return mB(e,t);case ct.MILLISECOND:return yB(e,t);case ct.MICROSECOND:return gB(e,t);case ct.NANOSECOND:return xB(e,t)}},LH=({values:e,stride:t},r)=>Sm.decimal(e.subarray(t*r,t*(r+1))),FH=(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])},kH=(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 Oc(e,t),BH=(e,t)=>e.type.mode===Se.Dense?bB(e,t):_B(e,t),bB=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],n=e.children[r];return sr.visit(n,e.valueOffsets[t])},_B=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],n=e.children[r];return sr.visit(n,t)},PH=(e,t)=>{var r;return(r=e.dictionary)===null||r===void 0?void 0:r.get(e.values[t])},UH=(e,t)=>e.type.unit===xr.DAY_TIME?wB(e,t):vB(e,t),wB=({values:e},t)=>e.subarray(2*t,2*(t+1)),vB=({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},SB=({values:e},t)=>e[t],IB=({values:e},t)=>e[t],TB=({values:e},t)=>e[t],AB=({values:e},t)=>e[t],$H=(e,t)=>{switch(e.type.unit){case ct.SECOND:return SB(e,t);case ct.MILLISECOND:return IB(e,t);case ct.MICROSECOND:return TB(e,t);case ct.NANOSECOND:return AB(e,t)}},zH=(e,t)=>{let{stride:r,children:n}=e,o=n[0].slice(t*r,r);return new Gt([o])};yt.prototype.visitNull=At(IH);yt.prototype.visitBool=At(TH);yt.prototype.visitInt=At(MH);yt.prototype.visitInt8=At(Rc);yt.prototype.visitInt16=At(Rc);yt.prototype.visitInt32=At(Rc);yt.prototype.visitInt64=At(cB);yt.prototype.visitUint8=At(Rc);yt.prototype.visitUint16=At(Rc);yt.prototype.visitUint32=At(Rc);yt.prototype.visitUint64=At(cB);yt.prototype.visitFloat=At(NH);yt.prototype.visitFloat16=At(AH);yt.prototype.visitFloat32=At(Rc);yt.prototype.visitFloat64=At(Rc);yt.prototype.visitUtf8=At(uB);yt.prototype.visitLargeUtf8=At(uB);yt.prototype.visitBinary=At(lB);yt.prototype.visitLargeBinary=At(lB);yt.prototype.visitFixedSizeBinary=At(EH);yt.prototype.visitDate=At(OH);yt.prototype.visitDateDay=At(sB);yt.prototype.visitDateMillisecond=At(aB);yt.prototype.visitTimestamp=At(RH);yt.prototype.visitTimestampSecond=At(fB);yt.prototype.visitTimestampMillisecond=At(dB);yt.prototype.visitTimestampMicrosecond=At(hB);yt.prototype.visitTimestampNanosecond=At(pB);yt.prototype.visitTime=At(DH);yt.prototype.visitTimeSecond=At(mB);yt.prototype.visitTimeMillisecond=At(yB);yt.prototype.visitTimeMicrosecond=At(gB);yt.prototype.visitTimeNanosecond=At(xB);yt.prototype.visitDecimal=At(LH);yt.prototype.visitList=At(FH);yt.prototype.visitStruct=At(CH);yt.prototype.visitUnion=At(BH);yt.prototype.visitDenseUnion=At(bB);yt.prototype.visitSparseUnion=At(_B);yt.prototype.visitDictionary=At(PH);yt.prototype.visitInterval=At(UH);yt.prototype.visitIntervalDayTime=At(wB);yt.prototype.visitIntervalYearMonth=At(vB);yt.prototype.visitDuration=At($H);yt.prototype.visitDurationSecond=At(SB);yt.prototype.visitDurationMillisecond=At(IB);yt.prototype.visitDurationMicrosecond=At(TB);yt.prototype.visitDurationNanosecond=At(AB);yt.prototype.visitFixedSizeList=At(zH);yt.prototype.visitMap=At(kH);var sr=new yt;var Dc=Symbol.for("keys"),ad=Symbol.for("vals"),sd=Symbol.for("kKeysAsStrings"),_E=Symbol.for("_kKeysAsStrings"),Qo=class{constructor(t){return this[Dc]=new Gt([t.children[0]]).memoize(),this[ad]=t.children[1],new Proxy(this,new vE)}get[sd](){return this[_E]||(this[_E]=Array.from(this[Dc].toArray(),String))}[Symbol.iterator](){return new wE(this[Dc],this[ad])}get size(){return this[Dc].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Dc],r=this[ad],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()}},wE=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)]})}},vE=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[sd]}has(t,r){return t[sd].includes(r)}getOwnPropertyDescriptor(t,r){if(t[sd].indexOf(r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,r){if(Reflect.has(t,r))return t[r];let n=t[sd].indexOf(r);if(n!==-1){let i=sr.visit(Reflect.get(t,ad),n);return Reflect.set(t,r,i),i}}set(t,r,n){let i=t[sd].indexOf(r);return i!==-1?(Wr.visit(Reflect.get(t,ad),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"},[Dc]:{writable:!0,enumerable:!1,configurable:!1,value:null},[ad]:{writable:!0,enumerable:!1,configurable:!1,value:null},[_E]:{writable:!0,enumerable:!1,configurable:!1,value:null}});var EB;function Tm(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&&(EB=o,o=s,s=EB),s>i&&(s=i),n?n(e,o,s):[o,s]}var nu=(e,t)=>e<0?t+e:e,MB=e=>e!==e;function Lc(e){if(typeof e!=="object"||e===null)return MB(e)?MB: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?tE(e,r):!1:e instanceof Map?qH(e):Array.isArray(e)?jH(e):e instanceof Gt?VH(e):YH(e,!0)}function jH(e){let t=[];for(let r=-1,n=e.length;++r<n;)t[r]=Lc(e[r]);return K1(t)}function qH(e){let t=-1,r=[];for(let n of e.values())r[++t]=Lc(n);return K1(r)}function VH(e){let t=[];for(let r=-1,n=e.length;++r<n;)t[r]=Lc(e.get(r));return K1(t)}function YH(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]=Lc(e[r[i]]);return K1(n,r)}function K1(e,t){return r=>{if(!r||typeof r!="object")return!1;switch(r.constructor){case Array:return WH(e,r);case Map:return NB(e,r,r.keys());case Qo:case Oc:case Object:case void 0:return NB(e,r,t||Object.keys(r))}return r instanceof Gt?GH(e,r):!1}}function WH(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 GH(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 NB(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 IE={};ti(IE,{BitIterator:()=>iu,getBit:()=>OB,getBool:()=>t_,packBools:()=>su,popcnt_array:()=>RB,popcnt_bit_range:()=>Am,popcnt_uint32:()=>J1,setBool:()=>XH,truncateBitmap:()=>ou});function t_(e,t,r,n){return(r&1<<n)!==0}function OB(e,t,r,n){return(r&1<<n)>>n}function XH(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,t_)).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 Am(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,OB))o+=s;return o}let n=r>>3<<3,i=t+(t%8===0?0:8-t%8);return Am(e,t,i)+Am(e,n,r)+RB(e,i>>3,n-i>>3)}function RB(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+=J1(o.getUint32(i)),i+=4;for(;s-i>=2;)n+=J1(o.getUint16(i)),i+=2;for(;s-i>=1;)n+=J1(o.getUint8(i)),i+=1;return n}function J1(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 HH=-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<=HH&&(r=this.nullBitmap)&&(this._nullCount=t=r.length===0?0:this.length-Am(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[Ci.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[Ci.TYPE])&&(s[Ci.TYPE]=o.subarray(t,t+r)),(o=s[Ci.OFFSET])&&(s[Ci.OFFSET]=o.subarray(t,t+r+1))||(o=s[Ci.DATA])&&(s[Ci.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 TE=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=x1(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=x1(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])}},QH=new TE;function Dt(e){return QH.visit(e)}var Em=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 DB(e){return e.some(t=>t.nullable)}function e_(e){return e.reduce((t,r)=>t+r.nullCount,0)}function r_(e){return e.reduce((t,r,n)=>(t[n+1]=t[n]+r.length,t),new Uint32Array(e.length+1))}function n_(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 AE(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 Mm(e,t){return e.getValid(t)}function cd(e){function t(r,n,i){return e(r[n],i)}return function(r){let n=this.data;return AE(n,this._offsets,r,t)}}function i_(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=AE(o,this._offsets,n,r);return t=void 0,s}}function o_(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):AE(o,this._offsets,i,r);return t=void 0,s}}var gt=class extends mt{};function ZH(e,t){return t===null&&e.length>0?0:-1}function KH(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,t_)){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 KH(e,r)}let n=sr.getVisitFn(e),i=Lc(t);for(let o=(r||0)-1,s=e.length;++o<s;)if(i(n(e,o)))return o;return-1}function LB(e,t,r){let n=sr.getVisitFn(e),i=Lc(t);for(let o=(r||0)-1,s=e.length;++o<s;)if(i(n(e,o)))return o;return-1}gt.prototype.visitNull=ZH;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=LB;gt.prototype.visitSparseUnion=LB;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 Em(e.data.length,n=>{let i=e.data[n];return i.values.subarray(0,i.length)[Symbol.iterator]()});let r=0;return new Em(e.data.length,n=>{let o=e.data[n].length,s=e.slice(r,r+o);return r+=o,new EE(s)})}var EE=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 ld=new xt;var FB,kB={},CB={},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}=kB[s.typeId],u=o[0];this.isValid=f=>Mm(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,CB[s.typeId]),this._offsets=r_(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 DB(this.data)}get nullCount(){return e_(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 ld.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(Tm(this,t,r,({data:n,_offsets:i},o,s)=>n_(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 s_(this.data[0].dictionary),r=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new e(r)}return new s_(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}};FB=Symbol.toStringTag;Gt[FB]=(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=Wr.getVisitFnByTypeId(r),o=au.getVisitFnByTypeId(r);kB[r]={get:n,set:i,indexOf:o},CB[r]=Object.create(e,{isValid:{value:cd(Mm)},get:{value:cd(sr.getVisitFnByTypeId(r))},set:{value:i_(Wr.getVisitFnByTypeId(r))},indexOf:{value:o_(au.getVisitFnByTypeId(r))}})}return"Vector"})(Gt.prototype);var s_=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 BB(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 ${JH(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 JH(e){return typeof e!="bigint"?mo(e):`${mo(e)}n`}function ME(e,t){let r=Math.ceil(e)*t-1;return(r-r%64+64||64)/t}function PB(e,t=0){return e.length>=t?e.subarray(0,t):lm(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?ME(n*1,this.BYTES_PER_ELEMENT):ME(n*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=ME(t*this.stride,this.BYTES_PER_ELEMENT);let r=PB(this.buffer,t);return this.clear(),r}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(t){return this.buffer=PB(this.buffer,t)}},da=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}},ud=class extends da{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()}},fd=class extends da{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 ud,r&&r.length>0&&(this._isValid=BB(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 da(this.ArrayType,0,this.stride)}setValue(t,r){let n=this._values;return n.reserve(t-n.length+1),super.setValue(t,r)}},Yn=class extends Le{constructor(t){super(t),this._pendingLength=0,this._offsets=new fd(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[Dc].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 Vn).__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=NE(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=a_(a_(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:a_(a_(new Map,n[c].metadata),a.metadata)}))&&!1:!0}),s=NE(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 a_(e,t){return new Map([...e||new Map,...t||new Map])}function NE(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&&NE(o.children,t)}return t}var tQ=ru,eQ=ai,ha=class{static decode(t){t=new eQ(It(t));let r=fi.getRootAsFooter(t),n=me.decode(r.schema(),new Map,r.version());return new OE(n,r)}static encode(t){let r=new tQ,n=me.encode(r,t.schema);fi.startRecordBatchesVector(r,t.numRecordBatches);for(let s of[...t.recordBatches()].slice().reverse())pa.encode(r,s);let i=r.endVector();fi.startDictionariesVector(r,t.numDictionaries);for(let s of[...t.dictionaryBatches()].slice().reverse())pa.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 OE=class extends ha{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 pa.decode(r)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let r=this._footer.dictionaries(t);if(r)return pa.decode(r)}return null}},pa=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}),Nm=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())}},c_=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 Yr.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return Yr.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 c_{write(t){if((t=It(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?am(this.toUint8Array(!0)):this.toUint8Array(!1).then(am)}toUint8Array(t=!1){return t?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 RE(Yr.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 ma(Yr.fromAsyncIterable(t)):g1(t)?this.source=new ma(Yr.fromNodeStream(t)):cm(t)?this.source=new ma(Yr.fromDOMStream(t)):m1(t)?this.source=new ma(Yr.fromDOMStream(t.body)):lo(t)?this.source=new ma(Yr.fromIterable(t)):co(t)?this.source=new ma(Yr.fromAsyncIterable(t)):Fi(t)&&(this.source=new ma(Yr.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)}},RE=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)}},ma=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 Om=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}}},Fc=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 LE={};ti(LE,{BaseInt64:()=>Rm,Int128:()=>Dm,Int64:()=>ya,Uint64:()=>je});function dd(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}var hd=8,DE=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],Rm=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`${dd(this.buffer[1])} ${dd(this.buffer[0])}`}},je=class e extends Rm{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=hd<n-o?hd:n-o,a=new e(new Uint32Array([Number.parseInt(t.slice(o,o+s),10),0])),c=new e(new Uint32Array([DE[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)}},ya=class e extends Rm{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=hd<i-s?hd:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0])),l=new e(new Uint32Array([DE[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)}},Dm=class e{constructor(t){this.buffer=t}high(){return new ya(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new ya(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`${dd(this.buffer[3])} ${dd(this.buffer[2])} ${dd(this.buffer[1])} ${dd(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=hd<i-s?hd:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0,0,0])),l=new e(new Uint32Array([DE[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 Lm=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)}},l_=class extends Lm{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,ya.convertArray(n[r])):(K.isInt(t)||K.isTime(t))&&t.bitWidth===64||K.isDuration(t)?zt(Uint8Array,ya.convertArray(n[r])):K.isDate(t)&&t.unit===He.MILLISECOND?zt(Uint8Array,ya.convertArray(n[r])):K.isDecimal(t)?zt(Uint8Array,Dm.convertArray(n[r])):K.isBinary(t)||K.isLargeBinary(t)||K.isFixedSizeBinary(t)?rQ(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 rQ(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 pd=class extends Yn{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 md=class extends Yn{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 u_=class extends Le{constructor(t){super(t),this._values=new ud}setValue(t,r){this._values.set(t,+r)}};var uu=class extends ar{};uu.prototype._setValue=dE;var Fm=class extends uu{};Fm.prototype._setValue=C1;var km=class extends uu{};km.prototype._setValue=B1;var Cm=class extends ar{};Cm.prototype._setValue=mE;var f_=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 Bm=class extends ar{};Bm.prototype._setValue=fE;var d_=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)}},h_=class extends du{setValue(t,r){super.setValue(t,Im(r))}},p_=class extends du{},m_=class extends du{};var hu=class extends ar{};hu.prototype._setValue=yE;var Pm=class extends hu{};Pm.prototype._setValue=W1;var Um=class extends hu{};Um.prototype._setValue=G1;var ga=class extends ar{};ga.prototype._setValue=gE;var $m=class extends ga{};$m.prototype._setValue=X1;var zm=class extends ga{};zm.prototype._setValue=H1;var jm=class extends ga{};jm.prototype._setValue=Q1;var qm=class extends ga{};qm.prototype._setValue=Z1;var Ui=class extends ar{setValue(t,r){this._values.set(t,r)}},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{},S_=class extends Ui{};var I_=class extends Yn{constructor(t){super(t),this._offsets=new fd(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 T_=class extends Yn{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 A_=class extends Le{setValue(t,r){}setValid(t,r){return this.length=Math.max(t+1,this.length),r}};var E_=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 xa=class extends ar{};xa.prototype._setValue=hE;var Vm=class extends xa{};Vm.prototype._setValue=P1;var Ym=class extends xa{};Ym.prototype._setValue=U1;var Wm=class extends xa{};Wm.prototype._setValue=$1;var Gm=class extends xa{};Gm.prototype._setValue=z1;var ba=class extends ar{};ba.prototype._setValue=pE;var Xm=class extends ba{};Xm.prototype._setValue=j1;var Hm=class extends ba{};Hm.prototype._setValue=q1;var Qm=class extends ba{};Qm.prototype._setValue=V1;var Zm=class extends ba{};Zm.prototype._setValue=Y1;var yd=class extends Le{constructor(t){super(t),this._typeIds=new da(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.")}},M_=class extends yd{},N_=class extends yd{constructor(t){super(t),this._offsets=new da(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 Km=class extends Yn{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 Jm=class extends Yn{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){}};Jm.prototype._flushPending=md.prototype._flushPending;var FE=class extends mt{visitNull(){return A_}visitBool(){return u_}visitInt(){return Ui}visitInt8(){return y_}visitInt16(){return g_}visitInt32(){return x_}visitInt64(){return b_}visitUint8(){return __}visitUint16(){return w_}visitUint32(){return v_}visitUint64(){return S_}visitFloat(){return du}visitFloat16(){return h_}visitFloat32(){return p_}visitFloat64(){return m_}visitUtf8(){return Km}visitLargeUtf8(){return Jm}visitBinary(){return pd}visitLargeBinary(){return md}visitFixedSizeBinary(){return Bm}visitDate(){return uu}visitDateDay(){return Fm}visitDateMillisecond(){return km}visitTimestamp(){return xa}visitTimestampSecond(){return Vm}visitTimestampMillisecond(){return Ym}visitTimestampMicrosecond(){return Wm}visitTimestampNanosecond(){return Gm}visitTime(){return ba}visitTimeSecond(){return Xm}visitTimeMillisecond(){return Hm}visitTimeMicrosecond(){return Qm}visitTimeNanosecond(){return Zm}visitDecimal(){return Cm}visitList(){return I_}visitStruct(){return E_}visitUnion(){return yd}visitDenseUnion(){return N_}visitSparseUnion(){return M_}visitDictionary(){return f_}visitInterval(){return hu}visitIntervalDayTime(){return Pm}visitIntervalYearMonth(){return Um}visitDuration(){return ga}visitDurationSecond(){return $m}visitDurationMillisecond(){return zm}visitDurationMicrosecond(){return jm}visitDurationNanosecond(){return qm}visitFixedSizeList(){return d_}visitMap(){return T_}},UB=new FE;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 wn(e,t){return t instanceof e.constructor}function pu(e,t){return e===t||wn(e,t)}function _a(e,t){return e===t||wn(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function O_(e,t){return e===t||wn(e,t)&&e.precision===t.precision}function nQ(e,t){return e===t||wn(e,t)&&e.byteWidth===t.byteWidth}function kE(e,t){return e===t||wn(e,t)&&e.unit===t.unit}function ty(e,t){return e===t||wn(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function ey(e,t){return e===t||wn(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function iQ(e,t){return e===t||wn(e,t)&&e.children.length===t.children.length&&Jo.compareManyFields(e.children,t.children)}function oQ(e,t){return e===t||wn(e,t)&&e.children.length===t.children.length&&Jo.compareManyFields(e.children,t.children)}function CE(e,t){return e===t||wn(e,t)&&e.mode===t.mode&&e.typeIds.every((r,n)=>r===t.typeIds[n])&&Jo.compareManyFields(e.children,t.children)}function sQ(e,t){return e===t||wn(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&Jo.visit(e.indices,t.indices)&&Jo.visit(e.dictionary,t.dictionary)}function BE(e,t){return e===t||wn(e,t)&&e.unit===t.unit}function ry(e,t){return e===t||wn(e,t)&&e.unit===t.unit}function aQ(e,t){return e===t||wn(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&Jo.compareManyFields(e.children,t.children)}function cQ(e,t){return e===t||wn(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=_a;bt.prototype.visitInt8=_a;bt.prototype.visitInt16=_a;bt.prototype.visitInt32=_a;bt.prototype.visitInt64=_a;bt.prototype.visitUint8=_a;bt.prototype.visitUint16=_a;bt.prototype.visitUint32=_a;bt.prototype.visitUint64=_a;bt.prototype.visitFloat=O_;bt.prototype.visitFloat16=O_;bt.prototype.visitFloat32=O_;bt.prototype.visitFloat64=O_;bt.prototype.visitUtf8=pu;bt.prototype.visitLargeUtf8=pu;bt.prototype.visitBinary=pu;bt.prototype.visitLargeBinary=pu;bt.prototype.visitFixedSizeBinary=nQ;bt.prototype.visitDate=kE;bt.prototype.visitDateDay=kE;bt.prototype.visitDateMillisecond=kE;bt.prototype.visitTimestamp=ty;bt.prototype.visitTimestampSecond=ty;bt.prototype.visitTimestampMillisecond=ty;bt.prototype.visitTimestampMicrosecond=ty;bt.prototype.visitTimestampNanosecond=ty;bt.prototype.visitTime=ey;bt.prototype.visitTimeSecond=ey;bt.prototype.visitTimeMillisecond=ey;bt.prototype.visitTimeMicrosecond=ey;bt.prototype.visitTimeNanosecond=ey;bt.prototype.visitDecimal=pu;bt.prototype.visitList=iQ;bt.prototype.visitStruct=oQ;bt.prototype.visitUnion=CE;bt.prototype.visitDenseUnion=CE;bt.prototype.visitSparseUnion=CE;bt.prototype.visitDictionary=sQ;bt.prototype.visitInterval=BE;bt.prototype.visitIntervalDayTime=BE;bt.prototype.visitIntervalYearMonth=BE;bt.prototype.visitDuration=ry;bt.prototype.visitDurationSecond=ry;bt.prototype.visitDurationMillisecond=ry;bt.prototype.visitDurationMicrosecond=ry;bt.prototype.visitDurationNanosecond=ry;bt.prototype.visitFixedSizeList=aQ;bt.prototype.visitMap=cQ;var Jo=new bt;function mu(e,t){return Jo.compareSchemas(e,t)}function $B(e,t){return Jo.compareFields(e,t)}function zB(e,t){return Jo.visit(e,t)}function fu(e){let t=e.type,r=new(UB.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 R_(e,t){return lQ(e,t.map(r=>r.data.concat()))}function lQ(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=uQ(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 Qe(e,f))]}function uQ(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 jB,vn=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 Qe)return[c];if(c instanceof e)return c.batches;if(c instanceof ae){if(c.type instanceof Re)return[new Qe(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]=R_(f,u);return d.length===0?[new Qe(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 Qe))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??r_(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=e_(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?ld.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 Qe(r,i)))}slice(t,r){let n=this.schema;[t,r]=Tm({length:this.numRows},t,r);let i=n_(this.data,this._offsets,t,r);return new e(n,i.map(o=>new Qe(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 _n,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]=R_(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(...R_(o,s))}};jB=Symbol.toStringTag;vn[jB]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e.isValid=cd(Mm),e.get=cd(sr.getVisitFn(D.Struct)),e.set=i_(Wr.getVisitFn(D.Struct)),e.indexOf=o_(au.getVisitFn(D.Struct)),"Table"))(vn.prototype);var VB,Qe=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]=qB(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]=qB(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=YB(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 Wr.visit(this.data,t,r)}indexOf(t,r){return au.visit(this.data,t,r)}[Symbol.iterator](){return ld.visit(new Gt([this.data]))}toArray(){return[...this]}concat(...t){return new vn(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 _n,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)}};VB=Symbol.toStringTag;Qe[VB]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(Qe.prototype);function qB(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 YB(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)||[]])YB(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 Qe{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 PE=class extends mt{visit(t,r){return t==null||r==null?void 0:super.visit(t,r)}visitNull(t,r){return bm.startNull(r),bm.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 Ec.startFloatingPoint(r),Ec.addPrecision(r,t.precision),Ec.endFloatingPoint(r)}visitBinary(t,r){return pm.startBinary(r),pm.endBinary(r)}visitLargeBinary(t,r){return ym.startLargeBinary(r),ym.endLargeBinary(r)}visitBool(t,r){return mm.startBool(r),mm.endBool(r)}visitUtf8(t,r){return wm.startUtf8(r),wm.endUtf8(r)}visitLargeUtf8(t,r){return gm.startLargeUtf8(r),gm.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 Sc.startDate(r),Sc.addUnit(r,t.unit),Sc.endDate(r)}visitTime(t,r){return Zs.startTime(r),Zs.addUnit(r,t.unit),Zs.addBitWidth(r,t.bitWidth),Zs.endTime(r)}visitTimestamp(t,r){let n=t.timezone&&r.createString(t.timezone)||void 0;return Ks.startTimestamp(r),Ks.addUnit(r,t.unit),n!==void 0&&Ks.addTimezone(r,n),Ks.endTimestamp(r)}visitInterval(t,r){return Mc.startInterval(r),Mc.addUnit(r,t.unit),Mc.endInterval(r)}visitDuration(t,r){return Ic.startDuration(r),Ic.addUnit(r,t.unit),Ic.endDuration(r)}visitList(t,r){return xm.startList(r),xm.endList(r)}visitStruct(t,r){return _m.startStruct_(r),_m.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 Tc.startFixedSizeBinary(r),Tc.addByteWidth(r,t.byteWidth),Tc.endFixedSizeBinary(r)}visitFixedSizeList(t,r){return Ac.startFixedSizeList(r),Ac.addListSize(r,t.listSize),Ac.endFixedSizeList(r)}visitMap(t,r){return Nc.startMap(r),Nc.addKeysSorted(r,t.keysSorted),Nc.endMap(r)}},D_=new PE;function HB(e,t=new Map){return new me(dQ(e,t),L_(e.metadata),t)}function UE(e){return new Gr(e.count,ZB(e.columns),KB(e.columns))}function QB(e){return new Gn(UE(e.data),e.id,e.isDelta)}function dQ(e,t){return(e.fields||[]).filter(Boolean).map(r=>jt.fromJSON(r,t))}function WB(e,t){return(e.children||[]).filter(Boolean).map(r=>jt.fromJSON(r,t))}function ZB(e){return(e||[]).reduce((t,r)=>[...t,new $i(r.count,hQ(r.VALIDITY)),...ZB(r.children)],[])}function KB(e,t=[]){for(let r=-1,n=(e||[]).length;++r<n;){let i=e[r];i.VALIDITY&&t.push(new Wn(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new Wn(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new Wn(t.length,i.OFFSET.length)),i.DATA&&t.push(new Wn(t.length,i.DATA.length)),t=KB(i.children,t)}return t}function hQ(e){return(e||[]).reduce((t,r)=>t+ +(r===0),0)}function JB(e,t){let r,n,i,o,s,a;return!t||!(o=e.dictionary)?(s=XB(e,WB(e,t)),i=new jt(e.name,s,e.nullable,L_(e.metadata))):t.has(r=o.id)?(n=(n=o.indexType)?GB(n):new Ho,a=new li(t.get(r),n,r,o.isOrdered),i=new jt(e.name,a,e.nullable,L_(e.metadata))):(n=(n=o.indexType)?GB(n):new Ho,t.set(r,s=XB(e,WB(e,t))),a=new li(s,n,r,o.isOrdered),i=new jt(e.name,a,e.nullable,L_(e.metadata))),i||null}function L_(e=[]){return new Map(e.map(({key:t,value:r})=>[t,r]))}function GB(e){return new _r(e.isSigned,e.bitWidth)}function XB(e,t){let r=e.type.name;switch(r){case"NONE":return new _n;case"null":return new _n;case"binary":return new Js;case"largebinary":return new ta;case"utf8":return new ea;case"largeutf8":return new ra;case"bool":return new na;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 ia(n.scale,n.precision,n.bitWidth)}case"date":{let n=e.type;return new oa(He[n.unit])}case"time":{let n=e.type;return new sa(ct[n.unit],n.bitWidth)}case"timestamp":{let n=e.type;return new aa(ct[n.unit],n.timezone)}case"interval":{let n=e.type;return new ca(xr[n.unit])}case"duration":{let n=e.type;return new la(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 ua(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 pQ=ru,mQ=ai,Xn=class e{static fromJSON(t,r){let n=new e(0,he.V5,r);return n._createHeader=yQ(t,r),n}static decode(t){t=new mQ(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=gQ(r,o),s}static encode(t){let r=new pQ,n=-1;return t.isSchema()?n=me.encode(r,t.header()):t.isRecordBatch()?n=Gr.encode(r,t.header()):t.isDictionaryBatch()&&(n=Gn.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 Gr)return new e(r,he.V5,Vt.RecordBatch,t);if(t instanceof Gn)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)}},Gr=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)}},Gn=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)}},Wn=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 yQ(e,t){return()=>{switch(t){case Vt.Schema:return me.fromJSON(e);case Vt.RecordBatch:return Gr.fromJSON(e);case Vt.DictionaryBatch:return Gn.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${Vt[t]}, type: ${t} }`)}}function gQ(e,t){return()=>{switch(t){case Vt.Schema:return me.decode(e.header(new Vn),new Map,e.version());case Vt.RecordBatch:return Gr.decode(e.header(new ci),e.version());case Vt.DictionaryBatch:return Gn.decode(e.header(new Qs),e.version())}throw new Error(`Unrecognized Message type: { name: ${Vt[t]}, type: ${t} }`)}}jt.encode=MQ;jt.decode=AQ;jt.fromJSON=JB;me.encode=EQ;me.decode=xQ;me.fromJSON=HB;Gr.encode=NQ;Gr.decode=bQ;Gr.fromJSON=UE;Gn.encode=OQ;Gn.decode=_Q;Gn.fromJSON=QB;$i.encode=RQ;$i.decode=vQ;Wn.encode=DQ;Wn.decode=wQ;function xQ(e,t=new Map,r=he.V5){let n=TQ(e,t);return new me(n,F_(e),t,r)}function bQ(e,t=he.V5){if(e.compression()!==null)throw new Error("Record batch compression not implemented");return new Gr(e.length(),SQ(e),IQ(e,t))}function _Q(e,t=he.V5){return new Gn(Gr.decode(e.data(),t),e.id(),e.isDelta())}function wQ(e){return new Wn(e.offset(),e.length())}function vQ(e){return new $i(e.length(),e.nullCount())}function SQ(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 IQ(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]=Wn.decode(n));return r}function TQ(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 t5(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 AQ(e,t){let r,n,i,o,s,a;return!t||!(a=e.dictionary())?(i=r5(e,t5(e,t)),n=new jt(e.name(),i,e.nullable(),F_(e))):t.has(r=re(a.id()))?(o=(o=a.indexType())?e5(o):new Ho,s=new li(t.get(r),o,r,a.isOrdered()),n=new jt(e.name(),s,e.nullable(),F_(e))):(o=(o=a.indexType())?e5(o):new Ho,t.set(r,i=r5(e,t5(e,t))),s=new li(i,o,r,a.isOrdered()),n=new jt(e.name(),s,e.nullable(),F_(e))),n||null}function F_(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 e5(e){return new _r(e.isSigned(),e.bitWidth())}function r5(e,t){let r=e.typeType();switch(r){case Ie.NONE:return new _n;case Ie.Null:return new _n;case Ie.Binary:return new Js;case Ie.LargeBinary:return new ta;case Ie.Utf8:return new ea;case Ie.LargeUtf8:return new ra;case Ie.Bool:return new na;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 Ec);return new Bi(n.precision())}case Ie.Decimal:{let n=e.type(new Xo);return new ia(n.scale(),n.precision(),n.bitWidth())}case Ie.Date:{let n=e.type(new Sc);return new oa(n.unit())}case Ie.Time:{let n=e.type(new Zs);return new sa(n.unit(),n.bitWidth())}case Ie.Timestamp:{let n=e.type(new Ks);return new aa(n.unit(),n.timezone())}case Ie.Interval:{let n=e.type(new Mc);return new ca(n.unit())}case Ie.Duration:{let n=e.type(new Ic);return new la(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 Tc);return new ua(n.byteWidth())}case Ie.FixedSizeList:{let n=e.type(new Ac);return new bo(n.listSize(),(t||[])[0])}case Ie.Map:{let n=e.type(new Nc);return new _o((t||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${Ie[r]}" (${r})`)}function EQ(e,t){let r=t.fields.map(o=>jt.encode(e,o));Vn.startFieldsVector(e,r.length);let n=Vn.createFieldsVector(e,r),i=t.metadata&&t.metadata.size>0?Vn.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 Vn.startSchema(e),Vn.addFields(e,n),Vn.addEndianness(e,LQ?vc.Little:vc.Big),i!==-1&&Vn.addCustomMetadata(e,i),Vn.endSchema(e)}function MQ(e,t){let r=-1,n=-1,i=-1,o=t.type,s=t.typeId;K.isDictionary(o)?(s=o.dictionary.typeId,i=D_.visit(o,e),n=D_.visit(o.dictionary,e)):n=D_.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 NQ(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())Wn.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 OQ(e,t){let r=Gr.encode(e,t.data);return Qs.startDictionaryBatch(e),Qs.addId(e,BigInt(t.id)),Qs.addIsDelta(e,t.isDelta),Qs.addData(e,r),Qs.endDictionaryBatch(e)}function RQ(e,t){return Jf.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function DQ(e,t){return Kf.createBuffer(e,BigInt(t.offset),BigInt(t.length))}var LQ=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})();var zE=e=>`Expected ${Vt[e]} Message in stream, but was null or length 0.`,jE=e=>`Header pointer of flatbuffer-encoded ${Vt[e]} Message is null or length 0.`,n5=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,i5=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,gd=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(zE(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(i5(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(jE(r));return i}readMetadataLength(){let t=this.source.read(k_),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(n5(t,r.byteLength));return{done:!1,value:Xn.decode(r)}}},ny=class{constructor(t,r){this.source=t instanceof Pi?t:p1(t)?new Fc(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(zE(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(i5(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(jE(r));return i})}readMetadataLength(){return Q(this,void 0,void 0,function*(){let t=yield this.source.read(k_),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(n5(t,r.byteLength));return{done:!1,value:Xn.decode(r)}})}},iy=class extends gd{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof Nm?t:new Nm(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:Xn.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:Xn.fromJSON(r,Vt.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let r=t.batches[this._batchIndex++];return this._body=r.columns,{done:!1,value:Xn.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(zE(t));return r.value}readSchema(){let t=Vt.Schema,r=this.readMessage(t),n=r?.header();if(!r||!n)throw new Error(jE(t));return n}},k_=4,$E="ARROW1",xd=new Uint8Array($E.length);for(let e=0;e<$E.length;e+=1)xd[e]=$E.codePointAt(e);function C_(e,t=0){for(let r=-1,n=xd.length;++r<n;)if(xd[r]!==e[t+r])return!1;return!0}var bd=xd.length,qE=bd+k_,o5=bd*2+k_;var Xr=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 Yr.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return Yr.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:d1(t)?kQ(t):p1(t)?PQ(t):co(t)?Q(this,void 0,void 0,function*(){return yield e.from(yield t)}):m1(t)||cm(t)||g1(t)||Fi(t)?BQ(new Pi(t)):CQ(new Ko(t))}static readAll(t){return t instanceof e?t.isSync()?s5(t):a5(t):d1(t)||ArrayBuffer.isView(t)||lo(t)||h1(t)?s5(t):a5(t)}},ts=class extends Xr{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*Qf(ao(this[Symbol.iterator]())))})}},kc=class extends Xr{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]()}},Cc=class extends ts{constructor(t){super(t),this._impl=t}},oy=class extends kc{constructor(t){super(t),this._impl=t}},B_=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 Qe(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 Lm(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}},_d=class extends B_{constructor(t,r){super(r),this._reader=d1(t)?new iy(this._handle=t):new gd(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=c5(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)}},wd=class extends B_{constructor(t,r){super(r),this._reader=new ny(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=c5(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)})}},P_=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){super(t instanceof Om?t:new Om(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-qE,n=t.readInt32(r),i=t.readAt(r-n,n);return ha.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}},VE=class extends wd{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 Fc?t:new Fc(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-qE,n=yield t.readInt32(r),i=yield t.readAt(r-n,n);return ha.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})}},YE=class extends _d{constructor(t,r){super(t,r)}_loadVectors(t,r,n){return new l_(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}};function c5(e,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:e.autoDestroy}function*s5(e){let t=Xr.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function a5(e){return oi(this,arguments,function*(){let r=yield Ut(Xr.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 kQ(e){return new ts(new YE(e))}function CQ(e){let t=e.peek(bd+7&-8);return t&&t.byteLength>=4?C_(t)?new Cc(new P_(e.read())):new ts(new _d(e)):new ts(new _d(function*(){}()))}function BQ(e){return Q(this,void 0,void 0,function*(){let t=yield e.peek(bd+7&-8);return t&&t.byteLength>=4?C_(t)?new Cc(new P_(yield e.read())):new kc(new wd(e)):new kc(new wd(function(){return oi(this,arguments,function*(){})}()))})}function PQ(e){return Q(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),r=new Fc(e,t);return t>=o5&&C_(yield r.readAt(0,bd+7&-8))?new oy(new VE(r)):new kc(new wd(r))})}var Ce=class e extends mt{static assemble(...t){let r=i=>i.flatMap(o=>Array.isArray(o)?r(o):o instanceof Qe?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 Wn(this._byteLength,t)),this._byteLength+=t,this}function UQ(e){var t;let{type:r,length:n,typeIds:i,valueOffsets:o}=e;if(Io.call(this,i),r.mode===Se.Sparse)return WE.call(this,e);if(r.mode===Se.Dense){if(e.offset<=0)return Io.call(this,o),WE.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 $Q(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 wa(e){return Io.call(this,e.values.subarray(0,e.length*e.stride))}function U_(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,b1(-i,t+1,n)),Io.call(this,r.subarray(i,i+s)),this}function GE(e){let{length:t,valueOffsets:r}=e;if(r){let{[0]:n,[t]:i}=r;return Io.call(this,b1(-n,t+1,r)),this.visit(e.children[0].slice(n,i-n))}return this.visit(e.children[0])}function WE(e){return this.visitMany(e.type.children.map((t,r)=>e.children[r]).filter(Boolean))[0]}Ce.prototype.visitBool=$Q;Ce.prototype.visitInt=wa;Ce.prototype.visitFloat=wa;Ce.prototype.visitUtf8=U_;Ce.prototype.visitLargeUtf8=U_;Ce.prototype.visitBinary=U_;Ce.prototype.visitLargeBinary=U_;Ce.prototype.visitFixedSizeBinary=wa;Ce.prototype.visitDate=wa;Ce.prototype.visitTimestamp=wa;Ce.prototype.visitTime=wa;Ce.prototype.visitDecimal=wa;Ce.prototype.visitList=GE;Ce.prototype.visitStruct=WE;Ce.prototype.visitUnion=UQ;Ce.prototype.visitInterval=wa;Ce.prototype.visitDuration=wa;Ce.prototype.visitFixedSizeList=GE;Ce.prototype.visitMap=GE;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,bn(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)?HE(this,t):XE(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&&IC(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&TC(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 vn&&!(r=t.schema))return this.finish()&&void 0;if(t instanceof Qe&&!(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 Qe?t instanceof yu||this._writeRecordBatch(t):t instanceof vn?this.writeAll(t.batches):lo(t)&&this.writeAll(t)}_writeMessage(t,r=8){let n=r-1,i=Xn.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 pa(a,t.bodyLength,this._position)):t.headerType===Vt.DictionaryBatch&&this._dictionaryBlocks.push(new pa(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(Xn.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(xd)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:r,nodes:n,bufferRegions:i,buffers:o}=Ce.assemble(t),s=new Gr(t.numRows,n,i),a=Xn.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}=Ce.assemble(new Gt([t])),c=new Gr(t.length,o,s),l=new Gn(c,r,n),u=Xn.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)?HE(n,t):XE(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)?HE(r,t):XE(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=ha.encode(new ha(t,he.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(r)._write(Int32Array.of(r.byteLength))._writeMagic()}};function XE(e,t){let r=t;t instanceof vn&&(r=t.batches,e.reset(void 0,t.schema));for(let n of r)e.write(n);return e.finish()}function HE(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 l5(e,t){if(Fi(e))return jQ(e,t);if(lo(e))return zQ(e,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}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){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 jQ(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 d5(e){return new QE(e)}var QE=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:r,["writableStrategy"]:n,["queueingStrategy"]:i="count"}=t,o=vC(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=fu(o),this._getSize=i!=="bytes"?u5:f5;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"?u5:f5}),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)}},u5=e=>{var t;return(t=e?.length)!==null&&t!==void 0?t:0},f5=e=>{var t;return(t=e?.byteLength)!==null&&t!==void 0?t:0};function $_(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 Xr.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 z_(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 j_(e,t="stream"){return(t==="stream"?xu:bu).writeAll(e).toUint8Array(!0)}var WQ=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},cE),LE),IE),lE),eE),SE),iE),{compareSchemas:mu,compareFields:$B,compareTypes:zB});Yr.toDOMStream=l5;Le.throughDOM=d5;Xr.throughDOM=$_;Cc.throughDOM=$_;ts.throughDOM=$_;gu.throughDOM=z_;bu.throughDOM=z_;xu.throughDOM=z_;var GQ=Object.create,p5=Object.defineProperty,XQ=Object.getOwnPropertyDescriptor,HQ=Object.getOwnPropertyNames,QQ=Object.getPrototypeOf,ZQ=Object.prototype.hasOwnProperty,KQ=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),JQ=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of HQ(t))!ZQ.call(e,i)&&i!==r&&p5(e,i,{get:()=>t[i],enumerable:!(n=XQ(t,i))||n.enumerable});return e},tZ=(e,t,r)=>(r=e!=null?GQ(QQ(e)):{},JQ(t||!e||!e.__esModule?p5(r,"default",{value:e,enumerable:!0}):r,e)),eZ=KQ((e,t)=>{t.exports=Worker}),rZ=(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))(rZ||{}),nZ=(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))(nZ||{}),iZ=(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))(iZ||{}),oZ=(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))(oZ||{}),sZ=(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))(sZ||{}),aZ=(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))(aZ||{}),m5=class{log(e){}},y5=class{constructor(e=2){this.level=e}log(e){e.level>=this.level&&console.log(e)}};var cZ=(e=>(e[e.SUCCESS=0]="SUCCESS",e))(cZ||{}),lZ=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=Xr.from(t);return console.assert(r.isSync(),"Reader is not sync"),console.assert(r.isFile(),"Reader is not file"),new vn(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 g5(this._bindings,this._conn,t),n=await Xr.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 uZ(this._bindings,this._conn,t)}async insertArrowTable(e,t){let r=j_(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)}},g5=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}},uZ=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=Xr.from(t);return console.assert(r.isSync()),console.assert(r.isFile()),new vn(r)}async send(...e){let t=await this.bindings.sendPrepared(this.connectionId,this.statementId,e),r=new g5(this.bindings,this.connectionId,t),n=await Xr.from(r);return console.assert(n.isAsync()),console.assert(n.isStream()),n}},fZ=(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))(fZ||{}),dZ=(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))(dZ||{}),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 q_(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:q_(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=>rM(t.name,t.type))};case D.Map:{let t=e;return{sqlType:"map",keyType:q_(t.keyType),valueType:q_(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 rM(e,t){let r=q_(t);return r.name=e,r}var hZ=new TextEncoder,x5=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 lZ(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=hZ.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(rM(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(rM(o,s))}r.columnsFlat=i,delete r.columns}let n=new oe("IMPORT_JSON_FROM_PATH",[e,t,r]);await this.postTask(n)}};var pZ=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])),mZ=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])),yZ=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])),gZ=()=>(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])),nM={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"}}},xZ=nM.name,bZ=nM.version,iM=nM.version.split("."),JMt=iM[0],t3t=iM[1],e3t=iM[2],_Z=()=>typeof navigator>"u";function b5(){let e="https://cdn.jsdelivr.net/npm/".concat(xZ,"@").concat(bZ,"/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 ZE=null,KE=null,JE=null,tM=null,eM=null;async function wZ(){return ZE==null&&(ZE=typeof BigInt64Array<"u"),KE==null&&(KE=await mZ()),JE==null&&(JE=await gZ()),tM==null&&(tM=await yZ()),eM==null&&(eM=await pZ()),{bigInt64Array:ZE,crossOriginIsolated:_Z()||globalThis.crossOriginIsolated||!1,wasmExceptions:KE,wasmSIMD:tM,wasmThreads:JE,wasmBulkMemory:eM}}async function _5(e){let t=await wZ();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 r3t=tZ(eZ());function vZ(){let e=new TextDecoder;return t=>(typeof SharedArrayBuffer<"u"&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),e.decode(t))}var n3t=vZ(),SZ=(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))(SZ||{});function TZ(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 w5(e={}){let{duckdb:t,connection:r,...n}=e,i=t,o=r,s;function a(){return s||(s=(i?Promise.resolve(i):AZ(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 TZ(h,d);return f==="exec"?void 0:f==="arrow"?hc(p):hc(p).toArray()}}}async function AZ({log:e=!1}={}){let t=b5(),r=await _5(t),n=URL.createObjectURL(new Blob([`importScripts("${r.mainWorker}");`],{type:"text/javascript"})),i=new Worker(n),o=e?new y5:new m5,s=new x5(o,i);return await s.instantiate(r.mainModule,r.pthreadWorker),URL.revokeObjectURL(n),s}function Bc(e,t,{source:r,clients:n=r?new Set([r]):void 0}){let i=t!==void 0?Xb(e,[Nr(t)]):null;return{meta:{type:"point"},source:r,clients:n,value:t,predicate:i}}function va(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=>Nr(s[0])))]:t.map(s=>on(s.map((a,c)=>Jp(e[c],Nr(a)))));i=t.length===0?Nr(!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?Vr(e,t):null;return{meta:{type:"interval",scales:o&&[o],bin:i,pixelSize:s},source:r,clients:n,value:t,predicate:a}}function oM(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)=>Vr(l,t[u]))):null;return{meta:{type:"interval",scales:o,bin:i,pixelSize:s},source:r,clients:n,value:t,predicate:a}}var EZ={contains:yA,prefix:gA,suffix:xA,regexp:mA};function sM(e,t,{source:r,clients:n=void 0,method:i="contains"}){let o=EZ[i],s=t?o(e,Nr(t)):null;return{meta:{type:"match",method:i},source:r,clients:n,value:t,predicate:s}}function aM(e){return typeof e?.getChild=="function"}function cM(){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 Hn(e){return aM(e)?MZ(e):NZ(e)}function MZ(e){let{numRows:t}=e;return{numRows:t,columns:e.toColumns()}}function NZ(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 dk={};ti(dk,{Fixed:()=>es,Param:()=>wc,Query:()=>ft,Selection:()=>qo,align:()=>Y8,and:()=>on,area:()=>LL,areaX:()=>FL,areaY:()=>kL,argmax:()=>gc,argmin:()=>xc,ariaDescription:()=>J8,ariaLabel:()=>K8,arrayAgg:()=>MT,arrow:()=>MF,aspectRatio:()=>W8,avg:()=>Xp,axis:()=>G8,axisFx:()=>LF,axisFy:()=>FF,axisX:()=>RF,axisY:()=>DF,barX:()=>UL,barY:()=>$L,bin:()=>E8,cast:()=>Yf,cell:()=>zL,cellX:()=>jL,cellY:()=>qL,centroid:()=>em,centroidX:()=>hA,centroidY:()=>pA,circle:()=>QL,clip:()=>Q8,colorBase:()=>CD,colorClamp:()=>ID,colorConstant:()=>PD,colorDomain:()=>vD,colorExponent:()=>BD,colorInterpolate:()=>MD,colorLabel:()=>RD,colorLegend:()=>lk,colorN:()=>TD,colorNice:()=>AD,colorPercent:()=>DD,colorPivot:()=>ND,colorRange:()=>SD,colorReverse:()=>LD,colorScale:()=>wD,colorScheme:()=>ED,colorSymmetric:()=>OD,colorTickFormat:()=>kD,colorZero:()=>FD,column:()=>Yl,contour:()=>pF,coordinator:()=>Li,corr:()=>NT,count:()=>Or,covarPop:()=>RT,covariance:()=>OT,createSchema:()=>RA,createTable:()=>bc,cume_dist:()=>SA,dateDay:()=>rA,dateMonth:()=>tA,dateMonthDay:()=>eA,delaunayLink:()=>TF,delaunayMesh:()=>AF,denseLine:()=>hF,dense_rank:()=>wA,density:()=>dF,densityX:()=>uF,densityY:()=>fF,dot:()=>GL,dotX:()=>XL,dotY:()=>HL,entropy:()=>DT,eq:()=>aA,errorbarX:()=>wF,errorbarY:()=>vF,facetGrid:()=>wR,facetLabel:()=>vR,facetMargin:()=>yR,facetMarginBottom:()=>xR,facetMarginLeft:()=>bR,facetMarginRight:()=>_R,facetMarginTop:()=>gR,first:()=>LT,first_value:()=>AA,float32:()=>ZT,float64:()=>Xe,frame:()=>OF,from:()=>bW,fxAlign:()=>NR,fxAriaDescription:()=>GR,fxAriaLabel:()=>WR,fxAxis:()=>LR,fxDomain:()=>SR,fxFontVariant:()=>YR,fxGrid:()=>$R,fxInset:()=>TR,fxInsetLeft:()=>AR,fxInsetRight:()=>ER,fxLabel:()=>jR,fxLabelAnchor:()=>qR,fxLabelOffset:()=>VR,fxLine:()=>zR,fxPadding:()=>OR,fxPaddingInner:()=>RR,fxPaddingOuter:()=>DR,fxRange:()=>IR,fxReverse:()=>XR,fxRound:()=>MR,fxTickFormat:()=>PR,fxTickPadding:()=>BR,fxTickRotate:()=>UR,fxTickSize:()=>kR,fxTickSpacing:()=>CR,fxTicks:()=>FR,fyAlign:()=>eD,fyAriaDescription:()=>bD,fyAriaLabel:()=>xD,fyAxis:()=>oD,fyDomain:()=>HR,fyFontVariant:()=>gD,fyGrid:()=>dD,fyInset:()=>ZR,fyInsetBottom:()=>JR,fyInsetTop:()=>KR,fyLabel:()=>pD,fyLabelAnchor:()=>mD,fyLabelOffset:()=>yD,fyLine:()=>hD,fyPadding:()=>rD,fyPaddingInner:()=>nD,fyPaddingOuter:()=>iD,fyRange:()=>QR,fyReverse:()=>_D,fyRound:()=>tD,fyTickFormat:()=>uD,fyTickPadding:()=>lD,fyTickRotate:()=>fD,fyTickSize:()=>aD,fyTickSpacing:()=>cD,fyTicks:()=>sD,geo:()=>UF,geojson:()=>tm,graticule:()=>zF,grid:()=>H8,gridFx:()=>BF,gridFy:()=>PF,gridX:()=>kF,gridY:()=>CF,gt:()=>Di,gte:()=>cA,hconcat:()=>dW,heatmap:()=>mF,height:()=>$8,hexagon:()=>ZL,hexbin:()=>xF,hexgrid:()=>bF,highlight:()=>VF,hspace:()=>mW,hull:()=>EF,image:()=>lF,inset:()=>X8,int32:()=>ve,intervalX:()=>YF,intervalXY:()=>GF,intervalY:()=>WF,isBetween:()=>Vr,isDistinct:()=>lA,isNotBetween:()=>uA,isNotDistinct:()=>Jp,isNotNull:()=>Ri,isNull:()=>Jl,kurtosis:()=>FT,lag:()=>TA,last:()=>PT,last_value:()=>EA,lead:()=>Gf,lengthBase:()=>bL,lengthClamp:()=>mL,lengthConstant:()=>wL,lengthDomain:()=>hL,lengthExponent:()=>_L,lengthNice:()=>yL,lengthPercent:()=>gL,lengthRange:()=>pL,lengthScale:()=>dL,lengthZero:()=>xL,line:()=>CL,lineX:()=>BL,lineY:()=>PL,link:()=>NF,literal:()=>Nr,loadCSV:()=>FA,loadExtension:()=>DA,loadJSON:()=>kA,loadObjects:()=>PA,loadParquet:()=>CA,loadSpatial:()=>BA,lt:()=>ze,lte:()=>ni,mad:()=>kT,margin:()=>C8,marginBottom:()=>V8,marginLeft:()=>z8,marginRight:()=>j8,marginTop:()=>q8,margins:()=>k8,max:()=>qr,median:()=>CT,menu:()=>sW,min:()=>jn,mode:()=>BT,name:()=>L8,nearest:()=>XF,nearestX:()=>HF,nearestY:()=>QF,neq:()=>so,not:()=>sA,nth_value:()=>MA,ntile:()=>IA,opacityBase:()=>HD,opacityClamp:()=>jD,opacityConstant:()=>ZD,opacityDomain:()=>$D,opacityExponent:()=>QD,opacityLabel:()=>VD,opacityLegend:()=>uk,opacityNice:()=>qD,opacityPercent:()=>YD,opacityRange:()=>zD,opacityReverse:()=>WD,opacityScale:()=>UD,opacityTickFormat:()=>XD,opacityZero:()=>GD,or:()=>Oi,padding:()=>Z8,pan:()=>rk,panX:()=>nk,panY:()=>ik,panZoom:()=>ok,panZoomX:()=>sk,panZoomY:()=>ak,percent_rank:()=>vA,plot:()=>SW,product:()=>UT,projectionClip:()=>DL,projectionDomain:()=>AL,projectionInset:()=>EL,projectionInsetBottom:()=>RL,projectionInsetLeft:()=>ML,projectionInsetRight:()=>NL,projectionInsetTop:()=>OL,projectionParallels:()=>SL,projectionPrecision:()=>IL,projectionRotate:()=>TL,projectionType:()=>vL,quantile:()=>$T,rBase:()=>lL,rClamp:()=>iL,rConstant:()=>fL,rDomain:()=>rL,rExponent:()=>uL,rLabel:()=>sL,rNice:()=>oL,rPercent:()=>aL,rRange:()=>nL,rScale:()=>eL,rZero:()=>cL,rank:()=>_A,raster:()=>yF,rasterTile:()=>gF,rect:()=>VL,rectX:()=>YL,rectY:()=>WL,region:()=>ZF,regressionY:()=>_F,row_number:()=>bA,ruleX:()=>eF,ruleY:()=>rF,search:()=>aW,skewness:()=>WT,slider:()=>cW,sphere:()=>$F,spike:()=>cF,sql:()=>er,stddev:()=>Zp,stddevPop:()=>GT,stringAgg:()=>XT,style:()=>P8,sum:()=>de,symbolDomain:()=>JD,symbolLegend:()=>fk,symbolRange:()=>tL,symbolScale:()=>KD,table:()=>lW,text:()=>KL,textX:()=>JL,textY:()=>tF,tickX:()=>nF,tickY:()=>iF,toggle:()=>Tf,toggleColor:()=>ek,toggleX:()=>KF,toggleY:()=>JF,toggleZ:()=>tk,varPop:()=>QT,variance:()=>HT,vconcat:()=>fW,vector:()=>oF,vectorX:()=>sF,vectorY:()=>aF,voronoi:()=>SF,voronoiMesh:()=>IF,vspace:()=>pW,waffleX:()=>jF,waffleY:()=>qF,width:()=>U8,xAlign:()=>lO,xAriaDescription:()=>MO,xAriaLabel:()=>EO,xAxis:()=>hO,xBase:()=>DO,xClamp:()=>aO,xConstant:()=>FO,xDomain:()=>eO,xExponent:()=>LO,xFontVariant:()=>AO,xGrid:()=>_O,xInset:()=>iO,xInsetLeft:()=>oO,xInsetRight:()=>sO,xLabel:()=>vO,xLabelAnchor:()=>SO,xLabelArrow:()=>IO,xLabelOffset:()=>TO,xLine:()=>wO,xNice:()=>nO,xPadding:()=>uO,xPaddingInner:()=>fO,xPaddingOuter:()=>dO,xPercent:()=>NO,xRange:()=>rO,xReverse:()=>OO,xRound:()=>cO,xScale:()=>tO,xTickFormat:()=>xO,xTickPadding:()=>gO,xTickRotate:()=>bO,xTickSize:()=>mO,xTickSpacing:()=>yO,xTicks:()=>pO,xZero:()=>RO,xyDomain:()=>B8,yAlign:()=>VO,yAriaDescription:()=>lR,yAriaLabel:()=>cR,yAxis:()=>XO,yBase:()=>hR,yClamp:()=>jO,yConstant:()=>mR,yDomain:()=>CO,yExponent:()=>pR,yFontVariant:()=>aR,yGrid:()=>eR,yInset:()=>UO,yInsetBottom:()=>zO,yInsetTop:()=>$O,yLabel:()=>nR,yLabelAnchor:()=>iR,yLabelArrow:()=>oR,yLabelOffset:()=>sR,yLine:()=>rR,yNice:()=>PO,yPadding:()=>YO,yPaddingInner:()=>WO,yPaddingOuter:()=>GO,yPercent:()=>uR,yRange:()=>BO,yReverse:()=>fR,yRound:()=>qO,yScale:()=>kO,yTickFormat:()=>JO,yTickPadding:()=>KO,yTickRotate:()=>tR,yTickSize:()=>QO,yTickSpacing:()=>ZO,yTicks:()=>HO,yZero:()=>dR});var es=Symbol("Fixed"),Hr=Symbol("Transient"),sy=Symbol("Transform");var h8={};ti(h8,{Area:()=>hf,Arrow:()=>v0,BarX:()=>pf,BarY:()=>mf,Cell:()=>yf,Contour:()=>L0,Density:()=>C0,Dot:()=>gf,Frame:()=>m0,Geo:()=>B0,Hexgrid:()=>P0,Image:()=>U0,Line:()=>xf,Link:()=>_0,Mark:()=>vt,Raster:()=>N0,Rect:()=>df,RuleX:()=>s0,RuleY:()=>a0,Text:()=>lf,TickX:()=>T0,TickY:()=>A0,Tip:()=>y0,Vector:()=>ff,WaffleX:()=>z0,WaffleY:()=>j0,area:()=>b0,areaX:()=>Tl,areaY:()=>sc,arrow:()=>bq,auto:()=>Oq,autoSpec:()=>PN,axisFx:()=>qS,axisFy:()=>jS,axisX:()=>l0,axisY:()=>c0,barX:()=>Fs,barY:()=>ks,bin:()=>oc,binX:()=>Ds,binY:()=>Ls,bollinger:()=>Nl,bollingerX:()=>Cq,bollingerY:()=>Bq,boxX:()=>Pq,boxY:()=>Uq,cell:()=>Al,cellX:()=>wq,cellY:()=>vq,centroid:()=>yI,circle:()=>Tq,cluster:()=>BV,column:()=>Ur,contour:()=>Xq,crosshair:()=>Zq,crosshairX:()=>Kq,crosshairY:()=>Jq,delaunayLink:()=>rV,delaunayMesh:()=>nV,density:()=>cV,differenceX:()=>fV,differenceY:()=>dV,dodgeX:()=>nY,dodgeY:()=>iY,dot:()=>to,dotX:()=>Sq,dotY:()=>Iq,filter:()=>R$,find:()=>$$,formatIsoDate:()=>lN,formatMonth:()=>Yz,formatNumber:()=>cN,formatWeekday:()=>Wz,frame:()=>qh,geo:()=>gI,geoCentroid:()=>pV,graticule:()=>yV,gridFx:()=>GS,gridFy:()=>YS,gridX:()=>WS,gridY:()=>VS,group:()=>Kg,groupX:()=>ul,groupY:()=>fl,groupZ:()=>Zg,hexagon:()=>Aq,hexbin:()=>gV,hexgrid:()=>xV,hull:()=>iV,identity:()=>G,image:()=>_V,indexOf:()=>Ee,initializer:()=>Ne,interpolateNearest:()=>R0,interpolateNone:()=>mI,interpolatorBarycentric:()=>O0,interpolatorRandomWalk:()=>D0,legend:()=>zj,line:()=>bf,lineX:()=>El,lineY:()=>Ml,linearRegressionX:()=>SV,linearRegressionY:()=>IV,link:()=>sI,map:()=>Kn,mapX:()=>Hh,mapY:()=>Qh,marks:()=>yr,normalize:()=>AI,normalizeX:()=>cY,normalizeY:()=>lY,numberInterval:()=>A4,plot:()=>Vh,pointer:()=>gl,pointerX:()=>xl,pointerY:()=>nc,raster:()=>Vq,rect:()=>p0,rectX:()=>zh,rectY:()=>jh,reverse:()=>D$,ruleX:()=>vi,ruleY:()=>Si,scale:()=>dl,select:()=>hY,selectFirst:()=>Y0,selectLast:()=>W0,selectMaxX:()=>OI,selectMaxY:()=>RI,selectMinX:()=>MI,selectMinY:()=>NI,shiftX:()=>uY,shiftY:()=>fY,shuffle:()=>L$,sort:()=>uS,sphere:()=>mV,spike:()=>wj,stackX:()=>EN,stackX1:()=>Gj,stackX2:()=>Xj,stackY:()=>MN,stackY1:()=>Hj,stackY2:()=>Qj,text:()=>Rs,textX:()=>kS,textY:()=>CS,tickX:()=>dI,tickY:()=>hI,timeInterval:()=>Yg,tip:()=>tI,transform:()=>mr,tree:()=>i8,treeLink:()=>vI,treeNode:()=>$0,utcInterval:()=>Ku,valueof:()=>_t,vector:()=>IN,vectorX:()=>US,vectorY:()=>$S,voronoi:()=>oV,voronoiMesh:()=>sV,waffleX:()=>qV,waffleY:()=>VV,window:()=>Zh,windowX:()=>Rq,windowY:()=>Dq});function Ft(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Sn(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===Sn?e:OZ,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 OZ(){return 0}function ay(e){return e===null?NaN:+e}function*v5(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 S5=To(Ft),I5=S5.right,RZ=S5.left,DZ=To(ay).center,Sa=I5;var cy=T5(A5),lM=T5(LZ);function T5(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?(vd(a,l,i,o,s),vd(a,i,l,o,s),vd(a,l,i,o,s),Sd(c,i,l,o,s),Sd(c,l,i,o,s),Sd(c,i,l,o,s)):a?(vd(a,i,l,o,s),vd(a,l,i,o,s),vd(a,i,l,o,s)):c&&(Sd(c,i,l,o,s),Sd(c,l,i,o,s),Sd(c,i,l,o,s)),t}}function vd(e,t,r,n,i){for(let o=0,s=n*i;o<s;)e(t,r,o,o+=n,1)}function Sd(e,t,r,n,i){for(let o=0,s=n*i;o<n;++o)e(t,r,o,o+s,n)}function LZ(e){let t=A5(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 A5(e){let t=Math.floor(e);if(t===e)return FZ(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 FZ(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 kZ(e){return e.length|0}function CZ(e){return!(e>0)}function BZ(e){return typeof e!="object"||"length"in e?e:Array.from(e)}function PZ(e){return t=>e(...t)}function V_(...e){let t=typeof e[e.length-1]=="function"&&PZ(e.pop());e=e.map(BZ);let r=e.map(kZ),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 Y_(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 Qr=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 In=class extends Map{constructor(t,r=N5){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(uM(this,t))}has(t){return super.has(uM(this,t))}set(t,r){return super.set(E5(this,t),r)}delete(t){return super.delete(M5(this,t))}},Tn=class extends Set{constructor(t,r=N5){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(uM(this,t))}add(t){return super.add(E5(this,t))}delete(t){return super.delete(M5(this,t))}};function uM({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):r}function E5({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function M5({_intern:e,_key:t},r){let n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function N5(e){return e!==null&&typeof e=="object"?e.valueOf():e}function ly(e){return e}function Zr(e,...t){return dM(e,ly,ly,t)}function Ao(e,t,...r){return dM(e,ly,t,r)}function fM(e,t,...r){return dM(e,Array.from,t,r)}function dM(e,t,r,n){return function i(o,s){if(s>=n.length)return r(o);let a=new In,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 hM(e,t){return Array.from(t,r=>e[r])}function Ia(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]))),hM(e,n)}return e.sort(uy(r))}function uy(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 Id(e,t,r){return(t.length!==2?Ia(Ao(e,t,r),([n,i],[o,s])=>Ft(i,s)||Ft(n,o)):Ia(Zr(e,r),([n,i],[o,s])=>t(i,s)||Ft(n,o))).map(([n])=>n)}var UZ=Math.sqrt(50),$Z=Math.sqrt(10),zZ=Math.sqrt(2);function W_(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>=UZ?10:o>=$Z?5:o>=zZ?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?W_(e,t,r*2):[a,c,l]}function Kr(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?W_(t,e,r):W_(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 Ta(e,t,r){return t=+t,e=+e,r=+r,W_(e,t,r)[2]}function Td(e,t,r){t=+t,e=+e,r=+r;let n=t<e,i=n?Ta(t,e,r):Ta(e,t,r);return(n?-1:1)*(i<0?1/-i:i)}function Ad(e,t,r){let n;for(;;){let i=Ta(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 Xt(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 Qt(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 X_(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 H_(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:uy(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));H_(e,t,h,p,i)}let o=e[t],s=r,a=n;for(fy(e,r,t),i(e[n],o)>0&&fy(e,r,n);s<a;){for(fy(e,s,a),++s,--a;i(e[s],o)<0;)++s;for(;i(e[a],o)>0;)--a}i(e[r],o)===0?fy(e,r,a):(++a,fy(e,a,n)),a<=t&&(r=a+1),t<=a&&(n=a-1)}return e}function fy(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 An(e,t,r){if(e=Float64Array.from(v5(e,r)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return Qt(e);if(t>=1)return Xt(e);var n,i=(n-1)*t,o=Math.floor(i),s=Xt(H_(e,o).subarray(0,o+1)),a=Qt(e.subarray(o+1));return s+(a-s)*(i-o)}}function pM(e,t,r=ay){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 Q_(e,t,r){let n=rs(e),i=An(e,.75)-An(e,.25);return n&&i?Math.ceil((r-t)/(2*i*Math.pow(n,-1/3))):1}function dy(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 Aa(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 An(e,.5,t)}function*qZ(e){for(let t of e)yield*t}function Ed(e){return Array.from(qZ(e))}function Md(e,t){let r=new In;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 Z_(e,t=VZ){let r=[],n,i=!1;for(let o of e)i&&r.push(t(n,o)),n=o,i=!0;return r}function VZ(e,t){return[e,t]}function rr(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 hy(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]):uy(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 K_(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 wr(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 O5(e){return e}var mM=1,yM=2,gM=3,J_=4,R5=1e-6;function YZ(e){return"translate("+e+",0)"}function WZ(e){return"translate(0,"+e+")"}function GZ(e){return t=>+e(t)}function XZ(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),r=>+e(r)+t}function HZ(){return!this.__axis}function QZ(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===mM||e===J_?-1:1,u=e===J_||e===yM?"x":"y",f=e===mM||e===gM?YZ:WZ;function d(h){var p=n??(t.ticks?t.ticks.apply(t,r):t.domain()),m=i??(t.tickFormat?t.tickFormat.apply(t,r):O5),y=Math.max(o,0)+a,g=t.range(),x=+g[0]+c,b=+g[g.length-1]+c,_=(t.bandwidth?XZ:GZ)(t.copy(),c),v=h.selection?h.selection():h,w=v.selectAll(".domain").data([null]),S=v.selectAll(".tick").data(p,t).order(),A=S.exit(),E=S.enter().append("g").attr("class","tick"),M=S.select("line"),T=S.select("text");w=w.merge(w.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),S=S.merge(E),M=M.merge(E.append("line").attr("stroke","currentColor").attr(u+"2",l*o)),T=T.merge(E.append("text").attr("fill","currentColor").attr(u,l*y).attr("dy",e===mM?"0em":e===gM?"0.71em":"0.32em")),h!==v&&(w=w.transition(h),S=S.transition(h),M=M.transition(h),T=T.transition(h),A=A.transition(h).attr("opacity",R5).attr("transform",function(R){return isFinite(R=_(R))?f(R+c):this.getAttribute("transform")}),E.attr("opacity",R5).attr("transform",function(R){var k=this.parentNode.__axis;return f((k&&isFinite(k=k(R))?k:_(R))+c)})),A.remove(),w.attr("d",e===J_||e===yM?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),S.attr("opacity",1).attr("transform",function(R){return f(_(R)+c)}),M.attr(u+"2",l*o),T.attr(u,l*y).text(m),v.filter(HZ).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===yM?"start":e===J_?"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 xM(e){return QZ(gM,e)}var ZZ={value:()=>{}};function L5(){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 tw(r)}function tw(e){this._=e}function KZ(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}})}tw.prototype=L5.prototype={constructor:tw,on:function(e,t){var r=this._,n=KZ(e+"",r),i,o=-1,s=n.length;if(arguments.length<2){for(;++o<s;)if((i=(e=n[o]).type)&&(i=JZ(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]=D5(r[i],e.name,t);else if(t==null)for(i in r)r[i]=D5(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 tw(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 JZ(e,t){for(var r=0,n=e.length,i;r<n;++r)if((i=e[r]).name===t)return i.value}function D5(e,t,r){for(var n=0,i=e.length;n<i;++n)if(e[n].name===t){e[n]=ZZ,e=e.slice(0,n).concat(e.slice(n+1));break}return r!=null&&e.push({name:t,value:r}),e}var Su=L5;var ew="http://www.w3.org/1999/xhtml",En={svg:"http://www.w3.org/2000/svg",xhtml:ew,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ea(e){var t=e+="",r=t.indexOf(":");return r>=0&&(t=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),En.hasOwnProperty(t)?{space:En[t],local:e}:e}function tK(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===ew&&t.documentElement.namespaceURI===ew?t.createElement(e):t.createElementNS(r,e)}}function eK(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ma(e){var t=Ea(e);return(t.local?eK:tK)(t)}function rK(){}function Iu(e){return e==null?rK:function(){return this.querySelector(e)}}function F5(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 Ze(n,this._parents)}function bM(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function nK(){return[]}function py(e){return e==null?nK:function(){return this.querySelectorAll(e)}}function iK(e){return function(){return bM(e.apply(this,arguments))}}function k5(e){typeof e=="function"?e=iK(e):e=py(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 Ze(n,i)}function my(e){return function(){return this.matches(e)}}function rw(e){return function(t){return t.matches(e)}}var oK=Array.prototype.find;function sK(e){return function(){return oK.call(this.children,e)}}function aK(){return this.firstElementChild}function C5(e){return this.select(e==null?aK:sK(typeof e=="function"?e:rw(e)))}var cK=Array.prototype.filter;function lK(){return Array.from(this.children)}function uK(e){return function(){return cK.call(this.children,e)}}function B5(e){return this.selectAll(e==null?lK:uK(typeof e=="function"?e:rw(e)))}function P5(e){typeof e!="function"&&(e=my(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 Ze(n,this._parents)}function nw(e){return new Array(e.length)}function U5(){return new Ze(this._enter||this._groups.map(nw),this._parents)}function yy(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}yy.prototype={constructor:yy,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 $5(e){return function(){return e}}function fK(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 yy(e,o[s]);for(;s<c;++s)(a=t[s])&&(i[s]=a)}function dK(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 yy(e,o[a]);for(a=0;a<u;++a)(c=t[a])&&l.get(d[a])===c&&(i[a]=c)}function hK(e){return e.__data__}function z5(e,t){if(!arguments.length)return Array.from(this,hK);var r=t?dK:fK,n=this._parents,i=this._groups;typeof e!="function"&&(e=$5(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=pK(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 Ze(s,n),s._enter=a,s._exit=c,s}function pK(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function j5(){return new Ze(this._exit||this._groups.map(nw),this._parents)}function q5(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 V5(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 Ze(a,this._parents)}function Y5(){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 W5(e){e||(e=mK);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 Ze(i,this._parents).order()}function mK(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function G5(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function X5(){return Array.from(this)}function H5(){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 Q5(){let e=0;for(let t of this)++e;return e}function Z5(){return!this.node()}function K5(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 yK(e){return function(){this.removeAttribute(e)}}function gK(e){return function(){this.removeAttributeNS(e.space,e.local)}}function xK(e,t){return function(){this.setAttribute(e,t)}}function bK(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function _K(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function wK(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 J5(e,t){var r=Ea(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?gK:yK:typeof t=="function"?r.local?wK:_K:r.local?bK:xK)(r,t))}function iw(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function vK(e){return function(){this.style.removeProperty(e)}}function SK(e,t,r){return function(){this.style.setProperty(e,t,r)}}function IK(e,t,r){return function(){var n=t.apply(this,arguments);n==null?this.style.removeProperty(e):this.style.setProperty(e,n,r)}}function t7(e,t,r){return arguments.length>1?this.each((t==null?vK:typeof t=="function"?IK:SK)(e,t,r??"")):zc(this.node(),e)}function zc(e,t){return e.style.getPropertyValue(t)||iw(e).getComputedStyle(e,null).getPropertyValue(t)}function TK(e){return function(){delete this[e]}}function AK(e,t){return function(){this[e]=t}}function EK(e,t){return function(){var r=t.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function e7(e,t){return arguments.length>1?this.each((t==null?TK:typeof t=="function"?EK:AK)(e,t)):this.node()[e]}function r7(e){return e.trim().split(/^|\s+/)}function _M(e){return e.classList||new n7(e)}function n7(e){this._node=e,this._names=r7(e.getAttribute("class")||"")}n7.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 i7(e,t){for(var r=_M(e),n=-1,i=t.length;++n<i;)r.add(t[n])}function o7(e,t){for(var r=_M(e),n=-1,i=t.length;++n<i;)r.remove(t[n])}function MK(e){return function(){i7(this,e)}}function NK(e){return function(){o7(this,e)}}function OK(e,t){return function(){(t.apply(this,arguments)?i7:o7)(this,e)}}function s7(e,t){var r=r7(e+"");if(arguments.length<2){for(var n=_M(this.node()),i=-1,o=r.length;++i<o;)if(!n.contains(r[i]))return!1;return!0}return this.each((typeof t=="function"?OK:t?MK:NK)(r,t))}function RK(){this.textContent=""}function DK(e){return function(){this.textContent=e}}function LK(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function a7(e){return arguments.length?this.each(e==null?RK:(typeof e=="function"?LK:DK)(e)):this.node().textContent}function FK(){this.innerHTML=""}function kK(e){return function(){this.innerHTML=e}}function CK(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function c7(e){return arguments.length?this.each(e==null?FK:(typeof e=="function"?CK:kK)(e)):this.node().innerHTML}function BK(){this.nextSibling&&this.parentNode.appendChild(this)}function l7(){return this.each(BK)}function PK(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function u7(){return this.each(PK)}function f7(e){var t=typeof e=="function"?e:Ma(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function UK(){return null}function d7(e,t){var r=typeof e=="function"?e:Ma(e),n=t==null?UK:typeof t=="function"?t:Iu(t);return this.select(function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)})}function $K(){var e=this.parentNode;e&&e.removeChild(this)}function h7(){return this.each($K)}function zK(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function jK(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function p7(e){return this.select(e?jK:zK)}function m7(e){return arguments.length?this.property("__data__",e):this.node().__data__}function qK(e){return function(t){e.call(this,t,this.__data__)}}function VK(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 YK(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 WK(e,t,r){return function(){var n=this.__on,i,o=qK(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 y7(e,t,r){var n=VK(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?WK:YK,i=0;i<o;++i)this.each(a(n[i],t,r));return this}function g7(e,t,r){var n=iw(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 GK(e,t){return function(){return g7(this,e,t)}}function XK(e,t){return function(){return g7(this,e,t.apply(this,arguments))}}function x7(e,t){return this.each((typeof t=="function"?XK:GK)(e,t))}function*b7(){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 wM=[null];function Ze(e,t){this._groups=e,this._parents=t}function _7(){return new Ze([[document.documentElement]],wM)}function HK(){return this}Ze.prototype=_7.prototype={constructor:Ze,select:F5,selectAll:k5,selectChild:C5,selectChildren:B5,filter:P5,data:z5,enter:U5,exit:j5,join:q5,merge:V5,selection:HK,order:Y5,sort:W5,call:G5,nodes:X5,node:H5,size:Q5,empty:Z5,each:K5,attr:J5,style:t7,property:e7,classed:s7,text:a7,html:c7,raise:l7,lower:u7,append:f7,insert:d7,remove:h7,clone:p7,datum:m7,on:y7,dispatch:x7,[Symbol.iterator]:b7};var Na=_7;function Zt(e){return typeof e=="string"?new Ze([[document.querySelector(e)]],[document.documentElement]):new Ze([[e]],wM)}function w7(e){let t;for(;t=e.sourceEvent;)e=t;return e}function an(e,t){if(e=w7(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 ow={capture:!0,passive:!1};function sw(e){e.preventDefault(),e.stopImmediatePropagation()}function gy(e){var t=e.document.documentElement,r=Zt(e).on("dragstart.drag",sw,ow);"onselectstart"in t?r.on("selectstart.drag",sw,ow):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function xy(e,t){var r=e.document.documentElement,n=Zt(e).on("dragstart.drag",null);t&&(n.on("click.drag",sw,ow),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 Oa(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,Nd="\\s*([+-]?\\d+)\\s*",by="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ns="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",QK=/^#([0-9a-f]{3,8})$/,ZK=new RegExp(`^rgb\\(${Nd},${Nd},${Nd}\\)$`),KK=new RegExp(`^rgb\\(${ns},${ns},${ns}\\)$`),JK=new RegExp(`^rgba\\(${Nd},${Nd},${Nd},${by}\\)$`),tJ=new RegExp(`^rgba\\(${ns},${ns},${ns},${by}\\)$`),eJ=new RegExp(`^hsl\\(${by},${ns},${ns}\\)$`),rJ=new RegExp(`^hsla\\(${by},${ns},${ns},${by}\\)$`),v7={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};Oa(is,di,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:S7,formatHex:S7,formatHex8:nJ,formatHsl:iJ,formatRgb:I7,toString:I7});function S7(){return this.rgb().formatHex()}function nJ(){return this.rgb().formatHex8()}function iJ(){return O7(this).formatHsl()}function I7(){return this.rgb().formatRgb()}function di(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=QK.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?T7(t):r===3?new cr(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?aw(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?aw(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=ZK.exec(e))?new cr(t[1],t[2],t[3],1):(t=KK.exec(e))?new cr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=JK.exec(e))?aw(t[1],t[2],t[3],t[4]):(t=tJ.exec(e))?aw(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=eJ.exec(e))?M7(t[1],t[2]/100,t[3]/100,1):(t=rJ.exec(e))?M7(t[1],t[2]/100,t[3]/100,t[4]):v7.hasOwnProperty(e)?T7(v7[e]):e==="transparent"?new cr(NaN,NaN,NaN,0):null}function T7(e){return new cr(e>>16&255,e>>8&255,e&255,1)}function aw(e,t,r,n){return n<=0&&(e=t=r=NaN),new cr(e,t,r,n)}function _y(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 vr(e,t,r,n){return arguments.length===1?_y(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}Oa(cr,vr,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),lw(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:A7,formatHex:A7,formatHex8:oJ,formatRgb:E7,toString:E7}));function A7(){return`#${Tu(this.r)}${Tu(this.g)}${Tu(this.b)}`}function oJ(){return`#${Tu(this.r)}${Tu(this.g)}${Tu(this.b)}${Tu((isNaN(this.opacity)?1:this.opacity)*255)}`}function E7(){let e=lw(this.opacity);return`${e===1?"rgb(":"rgba("}${Au(this.r)}, ${Au(this.g)}, ${Au(this.b)}${e===1?")":`, ${e})`}`}function lw(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 M7(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 O7(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 wy(e,t,r,n){return arguments.length===1?O7(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}Oa(Mo,wy,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(vM(e>=240?e-240:e+120,i,n),vM(e,i,n),vM(e<120?e+240:e-120,i,n),this.opacity)},clamp(){return new Mo(N7(this.h),cw(this.s),cw(this.l),lw(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=lw(this.opacity);return`${e===1?"hsl(":"hsla("}${N7(this.h)}, ${cw(this.s)*100}%, ${cw(this.l)*100}%${e===1?")":`, ${e})`}`}}));function N7(e){return e=(e||0)%360,e<0?e+360:e}function cw(e){return Math.max(0,Math.min(1,e||0))}function vM(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 uw=Math.PI/180,fw=180/Math.PI;var dw=18,R7=.96422,D7=1,L7=.82521,F7=4/29,Od=6/29,k7=3*Od*Od,sJ=Od*Od*Od;function C7(e){if(e instanceof os)return new os(e.l,e.a,e.b,e.opacity);if(e instanceof Ra)return B7(e);e instanceof cr||(e=_y(e));var t=AM(e.r),r=AM(e.g),n=AM(e.b),i=SM((.2225045*t+.7168786*r+.0606169*n)/D7),o,s;return t===r&&r===n?o=s=i:(o=SM((.4360747*t+.3850649*r+.1430804*n)/R7),s=SM((.0139322*t+.0971045*r+.7141733*n)/L7)),new os(116*i-16,500*(o-i),200*(i-s),e.opacity)}function Rd(e,t,r,n){return arguments.length===1?C7(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}Oa(os,Rd,jc(is,{brighter(e){return new os(this.l+dw*(e??1),this.a,this.b,this.opacity)},darker(e){return new os(this.l-dw*(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=R7*IM(t),e=D7*IM(e),r=L7*IM(r),new cr(TM(3.1338561*t-1.6168667*e-.4906146*r),TM(-.9787684*t+1.9161415*e+.033454*r),TM(.0719453*t-.2289914*e+1.4052427*r),this.opacity)}}));function SM(e){return e>sJ?Math.pow(e,1/3):e/k7+F7}function IM(e){return e>Od?e*e*e:k7*(e-F7)}function TM(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function AM(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function aJ(e){if(e instanceof Ra)return new Ra(e.h,e.c,e.l,e.opacity);if(e instanceof os||(e=C7(e)),e.a===0&&e.b===0)return new Ra(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*fw;return new Ra(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function vy(e,t,r,n){return arguments.length===1?aJ(e):new Ra(e,t,r,n??1)}function Ra(e,t,r,n){this.h=+e,this.c=+t,this.l=+r,this.opacity=+n}function B7(e){if(isNaN(e.h))return new os(e.l,0,0,e.opacity);var t=e.h*uw;return new os(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}Oa(Ra,vy,jc(is,{brighter(e){return new Ra(this.h,this.c,this.l+dw*(e??1),this.opacity)},darker(e){return new Ra(this.h,this.c,this.l-dw*(e??1),this.opacity)},rgb(){return B7(this).rgb()}}));var z7=-.14861,EM=1.78277,MM=-.29227,hw=-.90649,Sy=1.97294,P7=Sy*hw,U7=Sy*EM,$7=EM*MM-hw*z7;function cJ(e){if(e instanceof Mu)return new Mu(e.h,e.s,e.l,e.opacity);e instanceof cr||(e=_y(e));var t=e.r/255,r=e.g/255,n=e.b/255,i=($7*n+P7*t-U7*r)/($7+P7-U7),o=n-i,s=(Sy*(r-i)-MM*o)/hw,a=Math.sqrt(s*s+o*o)/(Sy*i*(1-i)),c=a?Math.atan2(s,o)*fw-120:NaN;return new Mu(c<0?c+360:c,a,i,e.opacity)}function Mn(e,t,r,n){return arguments.length===1?cJ(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}Oa(Mu,Mn,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)*uw,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*(z7*n+EM*i)),255*(t+r*(MM*n+hw*i)),255*(t+r*(Sy*n)),this.opacity)}}));function NM(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 j7(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 NM((r-n/t)*t,s,i,o,a)}}function q7(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 NM((r-n/t)*t,i,o,s,a)}}var Dd=e=>()=>e;function V7(e,t){return function(r){return e+r*t}}function lJ(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 Ld(e,t){var r=t-e;return r?V7(e,r>180||r<-180?r-360*Math.round(r/360):r):Dd(isNaN(e)?t:e)}function Y7(e){return(e=+e)==1?Be:function(t,r){return r-t?lJ(t,r,e):Dd(isNaN(t)?r:t)}}function Be(e,t){var r=t-e;return r?V7(e,r):Dd(isNaN(e)?t:e)}var ji=function e(t){var r=Y7(t);function n(i,o){var s=r((i=vr(i)).r,(o=vr(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 W7(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=vr(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 OM=W7(j7),uJ=W7(q7);function G7(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 X7(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function H7(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 Q7(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 Z7(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 DM=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,RM=new RegExp(DM.source,"g");function fJ(e){return function(){return e}}function dJ(e){return function(t){return e(t)+""}}function Iy(e,t){var r=DM.lastIndex=RM.lastIndex=0,n,i,o,s=-1,a=[],c=[];for(e=e+"",t=t+"";(n=DM.exec(e))&&(i=RM.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=RM.lastIndex;return r<t.length&&(o=t.slice(r),a[s]?a[s]+=o:a[++s]=o),a.length<2?c[0]?dJ(c[0].x):fJ(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"?Dd(t):(r==="number"?Fe:r==="string"?(n=di(t))?(t=n,ji):Iy:t instanceof di?ji:t instanceof Date?Q7:X7(t)?G7:Array.isArray(t)?H7:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Z7:Fe)(e,t)}function Nu(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}var K7=180/Math.PI,pw={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function LM(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)*K7,skewX:Math.atan(c)*K7,scaleX:s,scaleY:a}}var mw;function J7(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?pw:LM(t.a,t.b,t.c,t.d,t.e,t.f)}function tP(e){return e==null?pw:(mw||(mw=document.createElementNS("http://www.w3.org/2000/svg","g")),mw.setAttribute("transform",e),(e=mw.transform.baseVal.consolidate())?(e=e.matrix,LM(e.a,e.b,e.c,e.d,e.e,e.f)):pw)}function eP(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 FM=eP(J7,"px, ","px)","deg)"),kM=eP(tP,", ",")",")");var hJ=1e-12;function rP(e){return((e=Math.exp(e))+1/e)/2}function pJ(e){return((e=Math.exp(e))-1/e)/2}function mJ(e){return((e=Math.exp(2*e))-1)/(e+1)}var CM=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<hJ)g=Math.log(d/l)/t,y=function(S){return[a+S*h,c+S*p,l*Math.exp(t*S*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(S){var A=S*g,E=rP(v),M=l/(r*x)*(E*mJ(t*A+v)-pJ(v));return[a+M*h,c+M*p,l*E/rP(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 nP(e){return function(t,r){var n=e((t=wy(t)).h,(r=wy(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 BM=nP(Ld),yJ=nP(Be);function yw(e,t){var r=Be((e=Rd(e)).l,(t=Rd(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 iP(e){return function(t,r){var n=e((t=vy(t)).h,(r=vy(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 PM=iP(Ld),gJ=iP(Be);function oP(e){return function t(r){r=+r;function n(i,o){var s=e((i=Mn(i)).h,(o=Mn(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 xJ=oP(Ld),Fd=oP(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 kd=0,Ay=0,Ty=0,aP=1e3,gw,Ey,xw=0,Ou=0,bw=0,My=typeof performance=="object"&&performance.now?performance:Date,cP=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Oy(){return Ou||(cP(bJ),Ou=My.now()+bw)}function bJ(){Ou=0}function Ny(){this._call=this._time=this._next=null}Ny.prototype=_w.prototype={constructor:Ny,restart:function(e,t,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?Oy():+r)+(t==null?0:+t),!this._next&&Ey!==this&&(Ey?Ey._next=this:gw=this,Ey=this),this._call=e,this._time=r,UM()},stop:function(){this._call&&(this._call=null,this._time=1/0,UM())}};function _w(e,t,r){var n=new Ny;return n.restart(e,t,r),n}function lP(){Oy(),++kd;for(var e=gw,t;e;)(t=Ou-e._time)>=0&&e._call.call(void 0,t),e=e._next;--kd}function sP(){Ou=(xw=My.now())+bw,kd=Ay=0;try{lP()}finally{kd=0,wJ(),Ou=0}}function _J(){var e=My.now(),t=e-xw;t>aP&&(bw-=t,xw=e)}function wJ(){for(var e,t=gw,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:gw=r);Ey=e,UM(n)}function UM(e){if(!kd){Ay&&(Ay=clearTimeout(Ay));var t=e-Ou;t>24?(e<1/0&&(Ay=setTimeout(sP,e-My.now()-bw)),Ty&&(Ty=clearInterval(Ty))):(Ty||(xw=My.now(),Ty=setInterval(_J,aP)),kd=1,cP(sP))}}function ww(e,t,r){var n=new Ny;return t=t==null?0:+t,n.restart(i=>{n.stop(),e(i+t)},t,r),n}var vJ=Su("start","end","cancel","interrupt"),SJ=[],dP=0,uP=1,Sw=2,vw=3,fP=4,Iw=5,Ry=6;function Vc(e,t,r,n,i,o){var s=e.__transition;if(!s)e.__transition={};else if(r in s)return;IJ(e,r,{name:t,index:n,group:i,on:vJ,tween:SJ,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:dP})}function Dy(e,t){var r=Sr(e,t);if(r.state>dP)throw new Error("too late; already scheduled");return r}function Jr(e,t){var r=Sr(e,t);if(r.state>vw)throw new Error("too late; already running");return r}function Sr(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw new Error("transition not found");return r}function IJ(e,t,r){var n=e.__transition,i;n[t]=r,r.timer=_w(o,0,r.time);function o(l){r.state=uP,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!==uP)return c();for(u in n)if(h=n[u],h.name===r.name){if(h.state===vw)return ww(s);h.state===fP?(h.state=Ry,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete n[u]):+u<t&&(h.state=Ry,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete n[u])}if(ww(function(){r.state===vw&&(r.state=fP,r.timer.restart(a,r.delay,r.time),a(l))}),r.state=Sw,r.on.call("start",e,e.__data__,r.index,r.group),r.state===Sw){for(r.state=vw,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=Iw,1),f=-1,d=i.length;++f<d;)i[f].call(e,u);r.state===Iw&&(r.on.call("end",e,e.__data__,r.index,r.group),c())}function c(){r.state=Ry,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>Sw&&n.state<Iw,n.state=Ry,n.timer.stop(),n.on.call(i?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete r[s]}o&&delete e.__transition}}function hP(e){return this.each(function(){as(this,e)})}function TJ(e,t){var r,n;return function(){var i=Jr(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 AJ(e,t,r){var n,i;if(typeof r!="function")throw new Error;return function(){var o=Jr(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 pP(e,t){var r=this._id;if(e+="",arguments.length<2){for(var n=Sr(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?TJ:AJ)(r,e,t))}function Cd(e,t,r){var n=e._id;return e.each(function(){var i=Jr(this,n);(i.value||(i.value={}))[t]=r.apply(this,arguments)}),function(i){return Sr(i,n).value[t]}}function Tw(e,t){var r;return(typeof t=="number"?Fe:t instanceof di?ji:(r=di(t))?(t=r,ji):Iy)(e,t)}function EJ(e){return function(){this.removeAttribute(e)}}function MJ(e){return function(){this.removeAttributeNS(e.space,e.local)}}function NJ(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 OJ(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 RJ(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 DJ(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 mP(e,t){var r=Ea(e),n=r==="transform"?kM:Tw;return this.attrTween(e,typeof t=="function"?(r.local?DJ:RJ)(r,n,Cd(this,"attr."+e,t)):t==null?(r.local?MJ:EJ)(r):(r.local?OJ:NJ)(r,n,t))}function LJ(e,t){return function(r){this.setAttribute(e,t.call(this,r))}}function FJ(e,t){return function(r){this.setAttributeNS(e.space,e.local,t.call(this,r))}}function kJ(e,t){var r,n;function i(){var o=t.apply(this,arguments);return o!==n&&(r=(n=o)&&FJ(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)&&LJ(e,o)),r}return i._value=t,i}function yP(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=Ea(e);return this.tween(r,(n.local?kJ:CJ)(n,t))}function BJ(e,t){return function(){Dy(this,e).delay=+t.apply(this,arguments)}}function PJ(e,t){return t=+t,function(){Dy(this,e).delay=t}}function gP(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?BJ:PJ)(t,e)):Sr(this.node(),t).delay}function UJ(e,t){return function(){Jr(this,e).duration=+t.apply(this,arguments)}}function $J(e,t){return t=+t,function(){Jr(this,e).duration=t}}function xP(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?UJ:$J)(t,e)):Sr(this.node(),t).duration}function zJ(e,t){if(typeof t!="function")throw new Error;return function(){Jr(this,e).ease=t}}function bP(e){var t=this._id;return arguments.length?this.each(zJ(t,e)):Sr(this.node(),t).ease}function jJ(e,t){return function(){var r=t.apply(this,arguments);if(typeof r!="function")throw new Error;Jr(this,e).ease=r}}function _P(e){if(typeof e!="function")throw new Error;return this.each(jJ(this._id,e))}function wP(e){typeof e!="function"&&(e=my(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 Nn(n,this._parents,this._name,this._id)}function vP(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 Nn(s,this._parents,this._name,this._id)}function qJ(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 VJ(e,t,r){var n,i,o=qJ(t)?Dy:Jr;return function(){var s=o(this,e),a=s.on;a!==n&&(i=(n=a).copy()).on(t,r),s.on=i}}function SP(e,t){var r=this._id;return arguments.length<2?Sr(this.node(),r).on.on(e):this.each(VJ(r,e,t))}function YJ(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}function IP(){return this.on("end.remove",YJ(this._id))}function TP(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,Sr(u,r)));return new Nn(o,this._parents,t,r)}function AP(e){var t=this._name,r=this._id;typeof e!="function"&&(e=py(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=Sr(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 Nn(o,s,t,r)}var WJ=Na.prototype.constructor;function EP(){return new WJ(this._groups,this._parents)}function GJ(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 MP(e){return function(){this.style.removeProperty(e)}}function XJ(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 HJ(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 QJ(e,t){var r,n,i,o="style."+t,s="end."+o,a;return function(){var c=Jr(this,e),l=c.on,u=c.value[o]==null?a||(a=MP(t)):void 0;(l!==r||i!==u)&&(n=(r=l).copy()).on(s,i=u),c.on=n}}function NP(e,t,r){var n=(e+="")=="transform"?FM:Tw;return t==null?this.styleTween(e,GJ(e,n)).on("end.style."+e,MP(e)):typeof t=="function"?this.styleTween(e,HJ(e,n,Cd(this,"style."+e,t))).each(QJ(this._id,e)):this.styleTween(e,XJ(e,n,t),r).on("end.style."+e,null)}function ZJ(e,t,r){return function(n){this.style.setProperty(e,t.call(this,n),r)}}function KJ(e,t,r){var n,i;function o(){var s=t.apply(this,arguments);return s!==i&&(n=(i=s)&&ZJ(e,s,r)),n}return o._value=t,o}function OP(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,KJ(e,t,r??""))}function JJ(e){return function(){this.textContent=e}}function ttt(e){return function(){var t=e(this);this.textContent=t??""}}function RP(e){return this.tween("text",typeof e=="function"?ttt(Cd(this,"text",e)):JJ(e==null?"":e+""))}function ett(e){return function(t){this.textContent=e.call(this,t)}}function rtt(e){var t,r;function n(){var i=e.apply(this,arguments);return i!==r&&(t=(r=i)&&ett(i)),t}return n._value=e,n}function DP(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,rtt(e))}function LP(){for(var e=this._name,t=this._id,r=Aw(),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=Sr(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 Nn(n,this._parents,e,r)}function FP(){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=Jr(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 ntt=0;function Nn(e,t,r,n){this._groups=e,this._parents=t,this._name=r,this._id=n}function kP(e){return Na().transition(e)}function Aw(){return++ntt}var Da=Na.prototype;Nn.prototype=kP.prototype={constructor:Nn,select:TP,selectAll:AP,selectChild:Da.selectChild,selectChildren:Da.selectChildren,filter:wP,merge:vP,selection:EP,transition:LP,call:Da.call,nodes:Da.nodes,node:Da.node,size:Da.size,empty:Da.empty,each:Da.each,on:SP,attr:mP,attrTween:yP,style:NP,styleTween:OP,text:RP,textTween:DP,remove:IP,tween:pP,delay:gP,duration:xP,ease:bP,easeVarying:_P,end:FP,[Symbol.iterator]:Da[Symbol.iterator]};function Ew(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var itt={time:null,delay:0,duration:250,ease:Ew};function ott(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 CP(e){var t,r;e instanceof Nn?(t=e._id,e=e._name):(t=Aw(),(r=itt).time=Oy(),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||ott(c,t));return new Nn(n,this._parents,e,t)}Na.prototype.interrupt=hP;Na.prototype.transition=CP;var Mw=e=>()=>e;function $M(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 BP(e){e.stopImmediatePropagation()}function Nw(e){e.preventDefault(),e.stopImmediatePropagation()}var PP={name:"drag"},zM={name:"space"},Bd={name:"handle"},Pd={name:"center"},{abs:UP,max:ln,min:un}=Math;function $P(e){return[+e[0],+e[1]]}function qM(e){return[$P(e[0]),$P(e[1])]}var Ow={name:"x",handles:["w","e"].map(Ly),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]]}},Rw={name:"y",handles:["n","s"].map(Ly),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]]}},stt={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(Ly),input:function(e){return e==null?null:qM(e)},output:function(e){return e}},La={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"},zP={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},jP={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},att={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},ctt={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function Ly(e){return{type:e}}function ltt(e){return!e.ctrlKey&&!e.button}function utt(){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 ftt(){return navigator.maxTouchPoints||"ontouchstart"in this}function jM(e){for(;!e.__brush;)if(!(e=e.parentNode))return;return e.__brush}function dtt(e){return e[0][0]===e[1][0]||e[0][1]===e[1][1]}function VM(){return GM(Ow)}function YM(){return GM(Rw)}function WM(){return GM(stt)}function GM(e){var t=utt,r=ltt,n=ftt,i=!0,o=Su("start","brush","end"),s=6,a;function c(y){var g=y.property("__brush",m).selectAll(".overlay").data([Ly("overlay")]);g.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",La.overlay).merge(g).each(function(){var b=jM(this).extent;Zt(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([Ly("selection")]).enter().append("rect").attr("class","selection").attr("cursor",La.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 La[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,S=e.input(typeof g=="function"?g.apply(this,arguments):g,_.extent),A=hi(w,S);function E(M){_.selection=M===1&&S===null?null:A(M),l.call(b),v.brush()}return w!==null&&S!==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),S=u(b,_).beforestart();as(b),v.selection=w===null?null:w,l.call(b),S.start(x).brush(x).end(x)})},c.clear=function(y,g){c.move(y,null,g)};function l(){var y=Zt(this),g=jM(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=Zt(this.that).datum();o.call(y,this.that,new $M(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"?PP:i&&y.altKey?Pd:Bd,_=e===Rw?null:att[x],v=e===Ow?null:ctt[x],w=jM(g),S=w.extent,A=w.selection,E=S[0][0],M,T,R=S[0][1],k,I,N=S[1][0],O,L,B=S[1][1],C,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=[[M=e===Rw?E:un(tt[0][0],tt[1][0]),k=e===Ow?R:un(tt[0][1],tt[1][1])],[O=e===Rw?N:ln(tt[0][0],tt[1][0]),C=e===Ow?B:ln(tt[0][1],tt[1][1])]],Y.length>1&&Pt(y)}else M=A[0][0],k=A[0][1],O=A[1][0],C=A[1][1];T=M,I=k,L=O,P=C;var q=Zt(g).attr("pointer-events","none"),H=q.selectAll(".overlay").attr("cursor",La[x]);if(y.touches)st.moved=z,st.ended=ht;else{var nt=Zt(y.view).on("mousemove.brush",z,!0).on("mouseup.brush",ht,!0);i&&nt.on("keydown.brush",Kt,!0).on("keyup.brush",Jt,!0),gy(y.view)}l.call(g),st.start(y,b.name);function z(tt){for(let ge of tt.changedTouches||[tt])for(let Jn of Y)Jn.identifier===ge.identifier&&(Jn.cur=an(ge,g));if(rt&&!ot&&!at&&Y.length===1){let ge=Y[0];UP(ge.cur[0]-ge[0])>UP(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,Nw(tt),Pt(tt)}function Pt(tt){let ge=Y[0],Jn=ge.point0;var Bo;switch(U=ge[0]-Jn[0],$=ge[1]-Jn[1],b){case zM:case PP:{_&&(U=ln(E-M,un(N-O,U)),T=M+U,L=O+U),v&&($=ln(R-k,un(B-C,$)),I=k+$,P=C+$);break}case Bd:{Y[1]?(_&&(T=ln(E,un(N,Y[0][0])),L=ln(E,un(N,Y[1][0])),_=1),v&&(I=ln(R,un(B,Y[0][1])),P=ln(R,un(B,Y[1][1])),v=1)):(_<0?(U=ln(E-M,un(N-M,U)),T=M+U,L=O):_>0&&(U=ln(E-O,un(N-O,U)),T=M,L=O+U),v<0?($=ln(R-k,un(B-k,$)),I=k+$,P=C):v>0&&($=ln(R-C,un(B-C,$)),I=k,P=C+$));break}case Pd:{_&&(T=ln(E,un(N,M-U*_)),L=ln(E,un(N,O+U*_))),v&&(I=ln(R,un(B,k-$*v)),P=ln(R,un(B,C+$*v)));break}}L<T&&(_*=-1,Bo=M,M=O,O=Bo,Bo=T,T=L,L=Bo,x in zP&&H.attr("cursor",La[x=zP[x]])),P<I&&(v*=-1,Bo=k,k=C,C=Bo,Bo=I,I=P,P=Bo,x in jP&&H.attr("cursor",La[x=jP[x]])),w.selection&&(A=w.selection),ot&&(T=A[0][0],L=A[1][0]),at&&(I=A[0][1],P=A[1][1]),(A[0][0]!==T||A[0][1]!==I||A[1][0]!==L||A[1][1]!==P)&&(w.selection=[[T,I],[L,P]],l.call(g),st.brush(tt,b.name))}function ht(tt){if(BP(tt),tt.touches){if(tt.touches.length)return;a&&clearTimeout(a),a=setTimeout(function(){a=null},500)}else xy(tt.view,X),nt.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);q.attr("pointer-events","all"),H.attr("cursor",La.overlay),w.selection&&(A=w.selection),dtt(A)&&(w.selection=null,l.call(g)),st.end(tt,b.name)}function Kt(tt){switch(tt.keyCode){case 16:{rt=_&&v;break}case 18:{b===Bd&&(_&&(O=L-U*_,M=T+U*_),v&&(C=P-$*v,k=I+$*v),b=Pd,Pt(tt));break}case 32:{(b===Bd||b===Pd)&&(_<0?O=L-U:_>0&&(M=T-U),v<0?C=P-$:v>0&&(k=I-$),b=zM,H.attr("cursor",La.selection),Pt(tt));break}default:return}Nw(tt)}function Jt(tt){switch(tt.keyCode){case 16:{rt&&(ot=at=rt=!1,Pt(tt));break}case 18:{b===Pd&&(_<0?O=L:_>0&&(M=T),v<0?C=P:v>0&&(k=I),b=Bd,Pt(tt));break}case 32:{b===zM&&(tt.altKey?(_&&(O=L-U*_,M=T+U*_),v&&(C=P-$*v,k=I+$*v),b=Pd):(_<0?O=L:_>0&&(M=T),v<0?C=P:v>0&&(k=I),b=Bd),H.attr("cursor",La[x]),Pt(tt));break}default:return}Nw(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=qM(t.apply(this,arguments)),y.dim=e,y}return c.extent=function(y){return arguments.length?(t=typeof y=="function"?y:Mw(qM(y)),c):t},c.filter=function(y){return arguments.length?(r=typeof y=="function"?y:Mw(!!y),c):r},c.touchable=function(y){return arguments.length?(n=typeof y=="function"?y:Mw(!!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 XM=Math.PI,HM=2*XM,Ru=1e-6,htt=HM-Ru;function qP(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=arguments[t]+e[t]}function ptt(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return qP;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?qP:ptt(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((XM-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%HM+HM),d>htt?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>=XM)},${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 VP(){return new Yc}VP.prototype=Yc.prototype;function On(e=3){return new Yc(+e)}var mtt=Array.prototype,Dw=mtt.slice;function YP(e,t){return e-t}function WP(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 GP(e,t){for(var r=-1,n=t.length,i;++r<n;)if(i=ytt(e,t[r]))return i;return 0}function ytt(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(gtt(c,f,t))return 0;u>n!=h>n&&r<(d-l)*(n-u)/(h-u)+l&&(i=-i)}return i}function gtt(e,t,r){var n;return xtt(e,t,r)&&btt(e[n=+(e[0]===t[0])],r[n],t[n])}function xtt(e,t,r){return(t[0]-e[0])*(r[1]-e[1])===(r[0]-e[0])*(t[1]-e[1])}function btt(e,t,r){return e<=t&&t<=r||r<=t&&t<=e}function XP(){}var Fa=[[],[[[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(YP);else{let f=ce(l,_tt);for(u=Kr(...Ad(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),WP(p)>0?d.push([p]):h.push(p)}),h.forEach(function(p){for(var m=0,y=d.length,g;m<y;++m)if(GP((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),Fa[g<<1].forEach(_);++p<e-1;)y=g,g=Du(l[p+1],u),Fa[y|g<<1].forEach(_);for(Fa[g<<0].forEach(_);++m<t-1;){for(p=-1,g=Du(l[m*e+e],u),x=Du(l[m*e],u),Fa[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),Fa[y|g<<1|x<<2|b<<3].forEach(_);Fa[g|x<<3].forEach(_)}for(p=-1,x=l[m*e]>=u,Fa[x<<2].forEach(_);++p<e-1;)b=x,x=Du(l[m*e+p+1],u),Fa[x<<2|b<<3].forEach(_);Fa[x<<3].forEach(_);function _(v){var w=[v[0][0]+p,v[0][1]+m],S=[v[1][0]+p,v[1][1]+m],A=a(w),E=a(S),M,T;(M=h[A])?(T=d[E])?(delete h[M.end],delete d[T.start],M===T?(M.ring.push(S),f(M.ring)):d[M.start]=h[T.end]={start:M.start,end:T.end,ring:M.ring.concat(T.ring)}):(delete h[M.end],M.ring.push(S),h[M.end=E]=M):(M=d[E])?(T=h[A])?(delete d[M.start],delete h[T.end],M===T?(M.ring.push(S),f(M.ring)):d[T.start]=h[M.end]={start:T.start,end:M.end,ring:T.ring.concat(M.ring)}):(delete d[M.start],M.ring.unshift(w),d[M.start=A]=M):d[A]=h[E]={start:A,end:E,ring:[w,S]}}}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=QM(u[y*e+m]);h>0&&h<e&&m===h&&(d[0]=HP(h,QM(u[y*e+m-1]),g,f)),p>0&&p<t&&y===p&&(d[1]=HP(p,QM(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(Dw.call(l)):cs(l),i):r},i.smooth=function(l){return arguments.length?(n=l?c:XP,i):n===c},i}function _tt(e){return isFinite(e)?e:NaN}function Du(e,t){return e==null?!1:+e>=t}function QM(e){return e==null||isNaN(e=+e)?-1/0:e}function HP(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 wtt(e){return e[0]}function vtt(e){return e[1]}function Stt(){return 1}function ZM(){var e=wtt,t=vtt,r=Stt,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 k of x){var w=(e(k,++v,x)+a)*_,S=(t(k,v,x)+a)*_,A=+r(k,v,x);if(A&&w>=0&&w<c&&S>=0&&S<l){var E=Math.floor(w),M=Math.floor(S),T=w-E-.5,R=S-M-.5;b[E+M*c]+=(1-T)*(1-R)*A,b[E+1+M*c]+=T*(1-R)*A,b[E+1+(M+1)*c]+=T*R*A,b[E+(M+1)*c]+=(1-T)*R*A}}return cy({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(_)||(_=Kr(Number.MIN_VALUE,Xt(b)/v,_)),Wc().size([c,l]).thresholds(_.map(w=>w*v))(b).map((w,S)=>(w.value=+_[S],h(w)))}d.contours=function(x){var b=f(x),_=Wc().size([c,l]),v=Math.pow(2,2*s),w=S=>{S=+S;var A=h(_.contour(b,S*v));return A.value=S,A};return Object.defineProperty(w,"max",{get:()=>Xt(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(Dw.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,Fy=(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 ky(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 Itt=(3+16*ne)*ne,Ttt=(2+12*ne)*ne,Att=(9+64*ne)*ne*ne,Ud=V(4),QP=V(8),ZP=V(12),KP=V(16),Rn=V(4);function Ett(e,t,r,n,i,o,s){let a,c,l,u,f,d,h,p,m,y,g,x,b,_,v,w,S,A,E=e-i,M=r-i,T=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=T*M,d=lr*T,h=d-(d-T),p=T-h,d=lr*M,m=d-(d-M),y=M-m,S=p*y-(w-h*m-p*m-h*y),g=v-S,f=v-g,Ud[0]=v-(g+f)+(f-S),x=_+g,f=x-_,b=_-(x-f)+(g-f),g=b-w,f=b-g,Ud[1]=b-(g+f)+(f-w),A=x+g,f=A-x,Ud[2]=x-(A-f)+(g-f),Ud[3]=A;let k=ky(4,Ud),I=Ttt*s;if(k>=I||-k>=I||(f=e-E,a=e-(E+f)+(f-i),f=r-M,l=r-(M+f)+(f-i),f=t-T,c=t-(T+f)+(f-o),f=n-R,u=n-(R+f)+(f-o),a===0&&c===0&&l===0&&u===0)||(I=Att*s+Fy*Math.abs(k),k+=E*u+R*a-(T*l+M*c),k>=I||-k>=I))return k;_=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*M,d=lr*c,h=d-(d-c),p=c-h,d=lr*M,m=d-(d-M),y=M-m,S=p*y-(w-h*m-p*m-h*y),g=v-S,f=v-g,Rn[0]=v-(g+f)+(f-S),x=_+g,f=x-_,b=_-(x-f)+(g-f),g=b-w,f=b-g,Rn[1]=b-(g+f)+(f-w),A=x+g,f=A-x,Rn[2]=x-(A-f)+(g-f),Rn[3]=A;let N=Lu(4,Ud,4,Rn,QP);_=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=T*l,d=lr*T,h=d-(d-T),p=T-h,d=lr*l,m=d-(d-l),y=l-m,S=p*y-(w-h*m-p*m-h*y),g=v-S,f=v-g,Rn[0]=v-(g+f)+(f-S),x=_+g,f=x-_,b=_-(x-f)+(g-f),g=b-w,f=b-g,Rn[1]=b-(g+f)+(f-w),A=x+g,f=A-x,Rn[2]=x-(A-f)+(g-f),Rn[3]=A;let O=Lu(N,QP,4,Rn,ZP);_=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,S=p*y-(w-h*m-p*m-h*y),g=v-S,f=v-g,Rn[0]=v-(g+f)+(f-S),x=_+g,f=x-_,b=_-(x-f)+(g-f),g=b-w,f=b-g,Rn[1]=b-(g+f)+(f-w),A=x+g,f=A-x,Rn[2]=x-(A-f)+(g-f),Rn[3]=A;let L=Lu(O,ZP,4,Rn,KP);return KP[L-1]}function $d(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)>=Itt*l?c:-Ett(e,t,r,n,i,o,l)}var YFt=(7+56*ne)*ne,WFt=(3+28*ne)*ne,GFt=(26+288*ne)*ne*ne,XFt=V(4),HFt=V(4),QFt=V(4),ZFt=V(4),KFt=V(4),JFt=V(4),tkt=V(4),ekt=V(4),rkt=V(4),nkt=V(8),ikt=V(8),okt=V(8),skt=V(4),akt=V(8),ckt=V(8),lkt=V(8),ukt=V(12),fkt=V(192),dkt=V(192);var mkt=(10+96*ne)*ne,ykt=(4+48*ne)*ne,gkt=(44+576*ne)*ne*ne,xkt=V(4),bkt=V(4),_kt=V(4),wkt=V(4),vkt=V(4),Skt=V(4),Ikt=V(4),Tkt=V(4),Akt=V(8),Ekt=V(8),Mkt=V(8),Nkt=V(8),Okt=V(8),Rkt=V(8),Dkt=V(8),Lkt=V(8),Fkt=V(8),kkt=V(4),Ckt=V(4),Bkt=V(4),Pkt=V(8),Ukt=V(16),$kt=V(16),zkt=V(16),jkt=V(32),qkt=V(32),Vkt=V(48),Ykt=V(64),Wkt=V(1152),Gkt=V(1152);var Zkt=(16+224*ne)*ne,Kkt=(5+72*ne)*ne,Jkt=(71+1408*ne)*ne*ne,tCt=V(4),eCt=V(4),rCt=V(4),nCt=V(4),iCt=V(4),oCt=V(4),sCt=V(4),aCt=V(4),cCt=V(4),lCt=V(4),uCt=V(24),fCt=V(24),dCt=V(24),hCt=V(24),pCt=V(24),mCt=V(24),yCt=V(24),gCt=V(24),xCt=V(24),bCt=V(24),_Ct=V(1152),wCt=V(1152),vCt=V(1152),SCt=V(1152),ICt=V(1152),TCt=V(2304),ACt=V(2304),ECt=V(3456),MCt=V(5760),NCt=V(8),OCt=V(8),RCt=V(8),DCt=V(16),LCt=V(24),FCt=V(48),kCt=V(48),CCt=V(96),BCt=V(192),PCt=V(384),UCt=V(384),$Ct=V(384),zCt=V(768);var jCt=V(96),qCt=V(96),VCt=V(96),YCt=V(1152);var t9=Math.pow(2,-52),Lw=new Uint32Array(512),jd=class e{static from(t,r=Ltt,n=Ftt){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 M=t[2*E],T=t[2*E+1];M<a&&(a=M),T<c&&(c=T),M>l&&(l=M),T>u&&(u=T),this._ids[E]=E}let f=(a+l)/2,d=(c+u)/2,h,p,m;for(let E=0,M=1/0;E<s;E++){let T=KM(f,d,t[2*E],t[2*E+1]);T<M&&(h=E,M=T)}let y=t[2*h],g=t[2*h+1];for(let E=0,M=1/0;E<s;E++){if(E===h)continue;let T=KM(y,g,t[2*E],t[2*E+1]);T<M&&T>0&&(p=E,M=T)}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 M=Rtt(y,g,x,b,t[2*E],t[2*E+1]);M<_&&(m=E,_=M)}let v=t[2*m],w=t[2*m+1];if(_===1/0){for(let T=0;T<s;T++)this._dists[T]=t[2*T]-t[0]||t[2*T+1]-t[1];zd(this._ids,this._dists,0,s-1);let E=new Uint32Array(s),M=0;for(let T=0,R=-1/0;T<s;T++){let k=this._ids[T],I=this._dists[k];I>R&&(E[M++]=k,R=I)}this.hull=E.subarray(0,M),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if($d(y,g,x,b,v,w)<0){let E=p,M=x,T=b;p=m,x=v,b=w,m=E,v=M,w=T}let S=Dtt(y,g,x,b,v,w);this._cx=S.x,this._cy=S.y;for(let E=0;E<s;E++)this._dists[E]=KM(t[2*E],t[2*E+1],S.x,S.y);zd(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,M,T;E<this._ids.length;E++){let R=this._ids[E],k=t[2*R],I=t[2*R+1];if(E>0&&Math.abs(k-M)<=t9&&Math.abs(I-T)<=t9||(M=k,T=I,R===h||R===p||R===m))continue;let N=0;for(let P=0,U=this._hashKey(k,I);P<this._hashSize&&(N=o[(U+P)%this._hashSize],!(N!==-1&&N!==n[N]));P++);N=r[N];let O=N,L;for(;L=n[O],$d(k,I,t[2*O],t[2*O+1],t[2*L],t[2*L+1])>=0;)if(O=L,O===N){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 C=n[O];for(;L=n[C],$d(k,I,t[2*C],t[2*C+1],t[2*L],t[2*L+1])<0;)B=this._addTriangle(C,R,L,i[R],-1,i[C]),i[R]=this._legalize(B+2),n[C]=C,A--,C=L;if(O===N)for(;L=r[O],$d(k,I,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[C]=R,n[R]=C,o[this._hashKey(k,I)]=R,o[this._hashKey(t[2*O],t[2*O+1])]=O}this.hull=new Uint32Array(A);for(let E=0,M=this._hullStart;E<A;E++)this.hull[E]=M,M=n[M];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,r){return Math.floor(Ntt(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=Lw[--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(Ott(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<Lw.length&&(Lw[o++]=x)}else{if(o===0)break;t=Lw[--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 Ntt(e,t){let r=e/(Math.abs(e)+Math.abs(t));return(t>0?3-r:1+r)/4}function KM(e,t,r,n){let i=e-r,o=t-n;return i*i+o*o}function Ott(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 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=(l*u-a*f)*d,p=(s*f-c*u)*d;return h*h+p*p}function Dtt(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 zd(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?(zd(e,t,o,n),zd(e,t,r,s-1)):(zd(e,t,r,s-1),zd(e,t,o,n))}}function Cy(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}function Ltt(e){return e[0]}function Ftt(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 By=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,S=t[_],A=t[_+1],E=t[v],M=t[v+1],T=t[w],R=t[w+1],k=E-S,I=M-A,N=T-S,O=R-A,L=(k*O-I*N)*2;if(Math.abs(L)<1e-9){if(o===void 0){o=s=0;for(let C of r)o+=t[C*2],s+=t[C*2+1];o/=r.length,s/=r.length}let B=1e9*Math.sign((o-S)*O-(s-A)*N);x=(S+T)/2-B*O,b=(A+R)/2+B*N}else{let B=1/L,C=k*k+I*I,P=N*N+O*O;x=S+(O*C-I*P)*B,b=A+(k*P-N*C)*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 ktt=2*Math.PI,qd=Math.pow;function Ctt(e){return e[0]}function Btt(e){return e[1]}function Ptt(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 Utt(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=Btt,i){return new e("length"in t?$tt(t,r,n,i):Float64Array.from(ztt(t,r,n,i)))}constructor(t){this._delaunator=new jd(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&&Ptt(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=Utt(r[2*d],r[2*d+1],f);r[2*d]=p[0],r[2*d+1]=p[1]}this._delaunator=new jd(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 By(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=qd(r-l[t*2],2)+qd(n-l[t*2+1],2),d=i[t],h=d;do{let p=c[h],m=qd(r-l[p*2],2)+qd(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&&qd(r-l[h*2],2)+qd(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,ktt)}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 $tt(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*ztt(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 e9(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 r9(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 n9(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var jtt=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function us(e){if(!(t=jtt.exec(e)))throw new Error("invalid format: "+e);var t;return new Fw({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=Fw.prototype;function Fw(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+""}Fw.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 i9(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 JM;function o9(e,t){var r=Fu(e,t);if(!r)return e+"";var n=r[0],i=r[1],o=i-(JM=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 t3(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 e3={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:e9,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)=>t3(e*100,t),r:t3,s:o9,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function r3(e){return e}var s9=Array.prototype.map,a9=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function c9(e){var t=e.grouping===void 0||e.thousands===void 0?r3:r9(s9.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?r3:n9(s9.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"):e3[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():"",S=m==="$"?n:/[%p]/.test(v)?s:"",A=e3[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 M(T){var R=w,k=S,I,N,O;if(v==="c")k=A(T)+k,T="";else{T=+T;var L=T<0||1/T<0;if(T=isNaN(T)?c:A(Math.abs(T),b),_&&(T=i9(T)),L&&+T==0&&p!=="+"&&(L=!1),R=(L?p==="("?p:a:p==="-"||p==="("?"":p)+R,k=(v==="s"?a9[8+JM/3]:"")+k+(L&&p==="("?")":""),E){for(I=-1,N=T.length;++I<N;)if(O=T.charCodeAt(I),48>O||O>57){k=(O===46?i+T.slice(I+1):T.slice(I))+k,T=T.slice(0,I);break}}}x&&!y&&(T=t(T,1/0));var B=R.length+T.length+k.length,C=B<g?new Array(g-B+1).join(d):"";switch(x&&y&&(T=t(C+T,C.length?g-k.length:1/0),C=""),h){case"<":T=R+T+k+C;break;case"=":T=R+C+T+k;break;case"^":T=C.slice(0,B=C.length>>1)+R+T+k+C.slice(B);break;default:T=C+R+T+k;break}return o(T)}return M.toString=function(){return f+""},M}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=a9[8+p/3];return function(g){return h(m*g)+y}}return{format:l,formatPrefix:u}}var kw,Yi,Cw;n3({thousands:",",grouping:[3],currency:["$",""]});function n3(e){return kw=c9(e),Yi=kw.format,Cw=kw.formatPrefix,kw}function i3(e){return Math.max(0,-ls(Math.abs(e)))}function o3(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(ls(t)/3)))*3-ls(Math.abs(e)))}function s3(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,ls(t)-ls(e))+1}var et=1e-6,ku=1e-12,kt=Math.PI,Te=kt/2,a3=kt/4,Lr=kt*2,Ke=180/kt,Yt=kt/180,$t=Math.abs,Wi=Math.atan,ur=Math.atan2,J=Math.cos,Py=Math.ceil,Bw=Math.exp;var Pw=Math.hypot,Cu=Math.log,Uw=Math.pow,Z=Math.sin,fn=Math.sign||function(e){return e>0?1:e<0?-1:0},Ae=Math.sqrt,Vd=Math.tan;function $w(e){return e>1?0:e<-1?kt:Math.acos(e)}function ke(e){return e>1?Te:e<-1?-Te:Math.asin(e)}function fr(){}function zw(e,t){e&&u9.hasOwnProperty(e.type)&&u9[e.type](e,t)}var l9={Feature:function(e,t){zw(e.geometry,t)},FeatureCollection:function(e,t){for(var r=e.features,n=-1,i=r.length;++n<i;)zw(r[n].geometry,t)}},u9={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){c3(e.coordinates,t,0)},MultiLineString:function(e,t){for(var r=e.coordinates,n=-1,i=r.length;++n<i;)c3(r[n],t,0)},Polygon:function(e,t){f9(e.coordinates,t)},MultiPolygon:function(e,t){for(var r=e.coordinates,n=-1,i=r.length;++n<i;)f9(r[n],t)},GeometryCollection:function(e,t){for(var r=e.geometries,n=-1,i=r.length;++n<i;)zw(r[n],t)}};function c3(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 f9(e,t){var r=-1,n=e.length;for(t.polygonStart();++r<n;)c3(e[r],t,1);t.polygonEnd()}function pi(e,t){e&&l9.hasOwnProperty(e.type)?l9[e.type](e,t):zw(e,t)}function Uy(e){return[ur(e[1],e[0]),ke(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 $y(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Yd(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 jw(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function zy(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function jy(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 qy,qw,Vw,Yw,Ww,Gw,Xw,Hw,l3,u3,f3,p9,m9,Dn,Ln,Fn,No={sphere:fr,point:d3,lineStart:d9,lineEnd:h9,polygonStart:function(){No.lineStart=Ytt,No.lineEnd=Wtt},polygonEnd:function(){No.lineStart=d9,No.lineEnd=h9}};function d3(e,t){e*=Yt,t*=Yt;var r=J(t);Vy(r*J(e),r*Z(e),Z(t))}function Vy(e,t,r){++qy,Vw+=(e-Vw)/qy,Yw+=(t-Yw)/qy,Ww+=(r-Ww)/qy}function d9(){No.point=qtt}function qtt(e,t){e*=Yt,t*=Yt;var r=J(t);Dn=r*J(e),Ln=r*Z(e),Fn=Z(t),No.point=Vtt,Vy(Dn,Ln,Fn)}function Vtt(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=Ln*o-Fn*i)*s+(s=Fn*n-Dn*o)*s+(s=Dn*i-Ln*n)*s),Dn*n+Ln*i+Fn*o);qw+=s,Gw+=s*(Dn+(Dn=n)),Xw+=s*(Ln+(Ln=i)),Hw+=s*(Fn+(Fn=o)),Vy(Dn,Ln,Fn)}function h9(){No.point=d3}function Ytt(){No.point=Gtt}function Wtt(){y9(p9,m9),No.point=d3}function Gtt(e,t){p9=e,m9=t,e*=Yt,t*=Yt,No.point=y9;var r=J(t);Dn=r*J(e),Ln=r*Z(e),Fn=Z(t),Vy(Dn,Ln,Fn)}function y9(e,t){e*=Yt,t*=Yt;var r=J(t),n=r*J(e),i=r*Z(e),o=Z(t),s=Ln*o-Fn*i,a=Fn*n-Dn*o,c=Dn*i-Ln*n,l=Pw(s,a,c),u=ke(l),f=l&&-u/l;l3.add(f*s),u3.add(f*a),f3.add(f*c),qw+=u,Gw+=u*(Dn+(Dn=n)),Xw+=u*(Ln+(Ln=i)),Hw+=u*(Fn+(Fn=o)),Vy(Dn,Ln,Fn)}function h3(e){qy=qw=Vw=Yw=Ww=Gw=Xw=Hw=0,l3=new Qr,u3=new Qr,f3=new Qr,pi(e,No);var t=+l3,r=+u3,n=+f3,i=Pw(t,r,n);return i<ku&&(t=Gw,r=Xw,n=Hw,qw<et&&(t=Vw,r=Yw,n=Ww),i=Pw(t,r,n),i<ku)?[NaN,NaN]:[ur(r,t)*Ke,ke(n/i)*Ke]}function Yy(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 p3(e,t){return $t(e)>kt&&(e-=Math.round(e/Lr)*Lr),[e,t]}p3.invert=p3;function m3(e,t,r){return(e%=Lr)?t||r?Yy(x9(e),b9(t,r)):x9(e):t||r?b9(t,r):p3}function g9(e){return function(t,r){return t+=e,$t(t)>kt&&(t-=Math.round(t/Lr)*Lr),[t,r]}}function x9(e){var t=g9(e);return t.invert=g9(-e),t}function b9(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),ke(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),ke(h*r-u*n)]},s}function _9(e){e=m3(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]*=Ke,r[1]*=Ke,r}return t.invert=function(r){return r=e.invert(r[0]*Yt,r[1]*Yt),r[0]*=Ke,r[1]*=Ke,r},t}function v9(e,t,r,n,i,o){if(r){var s=J(t),a=Z(t),c=n*r;i==null?(i=t+n*Lr,o=t-c/2):(i=w9(s,i),o=w9(s,o),(n>0?i<o:i>o)&&(i+=n*Lr));for(var l,u=i;n>0?u>o:u<o;u-=c)l=Uy([s,-a*J(u),-a*Z(u)]),e.point(l[0],l[1])}}function w9(e,t){t=fs(t),t[0]-=e,jy(t);var r=$w(-t[1]);return((-t[2]<0?-r:r)+Lr-et)%Lr}function Qw(){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 Wd(e,t){return $t(e[0]-t[0])<et&&$t(e[1]-t[1])<et}function Zw(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 Kw(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(Wd(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 Zw(y,p,null,!0)),s.push(x.o=new Zw(y,null,x,!1)),o.push(x=new Zw(g,p,null,!1)),s.push(x.o=new Zw(g,null,x,!0))}}),!!o.length){for(s.sort(t),S9(o),S9(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 S9(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 y3(e){return $t(e[0])<=kt?e[0]:fn(e[0])*(($t(e[0])+kt)%Lr-kt)}function I9(e,t){var r=y3(t),n=t[1],i=Z(n),o=[Z(r),-J(r),0],s=0,a=0,c=new Qr;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=y3(h),m=h[1]/2+a3,y=Z(m),g=J(m),x=0;x<d;++x,p=_,y=w,g=S,h=b){var b=f[x],_=y3(b),v=b[1]/2+a3,w=Z(v),S=J(v),A=_-p,E=A>=0?1:-1,M=E*A,T=M>kt,R=y*w;if(c.add(ur(R*E*Z(M),g*S+R*J(M))),s+=T?A+E*Lr:A,T^p>=r^_>=r){var k=Yd(fs(h),fs(b));jy(k);var I=Yd(o,k);jy(I);var N=(T^A>=0?-1:1)*ke(I[2]);(n>N||n===N&&(k[0]||k[1]))&&(a+=T^A>=0?1:-1)}}return(s<-et||s<et&&c<-ku)^a&1}function Jw(e,t,r,n){return function(i){var o=t(i),s=Qw(),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=Ed(u);var _=I9(l,n);u.length?(c||(i.polygonStart(),c=!0),Kw(u,Htt,_,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,S=v.length,A,E,M;if(f.pop(),l.push(f),f=null,!!S){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((M=E[w])[0],M[1]);i.lineEnd()}return}S>1&&_&2&&v.push(v.pop().concat(v.shift())),u.push(v.filter(Xtt))}}return d}}function Xtt(e){return e.length>1}function Htt(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 g3=Jw(function(){return!0},Qtt,Ktt,[-kt,-Te]);function Qtt(e){var t=NaN,r=NaN,n=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(o,s){var a=o>0?kt:-kt,c=$t(o-t);$t(c-kt)<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>=kt&&($t(t-n)<et&&(t-=n*et),$t(o-a)<et&&(o-=a*et),r=Ztt(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 Ztt(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 Ktt(e,t,r,n){var i;if(e==null)i=r*Te,n.point(-kt,i),n.point(0,i),n.point(kt,i),n.point(kt,0),n.point(kt,-i),n.point(0,-i),n.point(-kt,-i),n.point(-kt,0),n.point(-kt,i);else if($t(e[0]-t[0])>et){var o=e[0]<t[0]?kt:-kt;i=r*o/2,n.point(-o,i),n.point(0,i),n.point(o,i)}else n.point(t[0],t[1])}function T9(e){var t=J(e),r=2*Yt,n=t>0,i=$t(t)>et;function o(u,f,d,h){v9(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?kt:-kt),g):0;if(!f&&(p=h=_)&&u.lineStart(),_!==h&&(b=c(f,x),(!b||Wd(f,b)||Wd(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||!Wd(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=Yd(h,p),g=$y(y,y),x=y[0],b=g-x*x;if(!b)return!d&&u;var _=t*g/b,v=-t*x/b,w=Yd(m,y),S=zy(m,_),A=zy(y,v);jw(S,A);var E=w,M=$y(S,E),T=$y(E,E),R=M*M-T*($y(S,S)-1);if(!(R<0)){var k=Ae(R),I=zy(E,(-M-k)/T);if(jw(I,S),I=Uy(I),!d)return I;var N=u[0],O=f[0],L=u[1],B=f[1],C;O<N&&(C=N,N=O,O=C);var P=O-N,U=$t(P-kt)<et,$=U||P<et;if(!U&&B<L&&(C=L,L=B,B=C),$?U?L+B>0^I[1]<($t(I[0]-N)<et?L:B):L<=I[1]&&I[1]<=B:P>kt^(N<=I[0]&&I[0]<=O)){var X=zy(E,(-M+k)/T);return jw(X,S),[I,Uy(X)]}}}function l(u,f){var d=n?e:kt-e,h=0;return u<-d?h|=1:u>d&&(h|=2),f<-d?h|=4:f>d&&(h|=8),h}return Jw(s,a,o,n?[0,-e]:[-kt,e-kt])}function A9(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 Wy=1e9,tv=-Wy;function Gd(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=Qw(),d,h,p,m,y,g,x,b,_,v,w,S={point:A,lineStart:R,lineEnd:k,polygonStart:M,polygonEnd:T};function A(N,O){i(N,O)&&u.point(N,O)}function E(){for(var N=0,O=0,L=h.length;O<L;++O)for(var B=h[O],C=1,P=B.length,U=B[0],$,X,rt=U[0],ot=U[1];C<P;++C)$=rt,X=ot,U=B[C],rt=U[0],ot=U[1],X<=n?ot>n&&(rt-$)*(n-X)>(ot-X)*(e-$)&&++N:ot<=n&&(rt-$)*(n-X)<(ot-X)*(e-$)&&--N;return N}function M(){u=f,d=[],h=[],w=!0}function T(){var N=E(),O=w&&N,L=(d=Ed(d)).length;(O||L)&&(l.polygonStart(),O&&(l.lineStart(),o(null,null,1,l),l.lineEnd()),L&&Kw(d,a,N,o,l),l.polygonEnd()),u=l,d=h=p=null}function R(){S.point=I,h&&h.push(p=[]),v=!0,_=!1,x=b=NaN}function k(){d&&(I(m,y),g&&_&&f.rejoin(),d.push(f.result())),S.point=A,_&&u.lineEnd()}function I(N,O){var L=i(N,O);if(h&&p.push([N,O]),v)m=N,y=O,g=L,v=!1,L&&(u.lineStart(),u.point(N,O));else if(L&&_)u.point(N,O);else{var B=[x=Math.max(tv,Math.min(Wy,x)),b=Math.max(tv,Math.min(Wy,b))],C=[N=Math.max(tv,Math.min(Wy,N)),O=Math.max(tv,Math.min(Wy,O))];A9(B,C,e,t,r,n)?(_||(u.lineStart(),u.point(B[0],B[1])),u.point(C[0],C[1]),L||u.lineEnd(),w=!1):L&&(u.lineStart(),u.point(N,O),w=!1)}x=N,b=O,_=L}return S}}function E9(e,t,r){var n=rr(e,t-et,r).concat(t);return function(i){return n.map(function(o){return[i,o]})}}function M9(e,t,r){var n=rr(e,t-et,r).concat(t);return function(i){return n.map(function(o){return[o,i]})}}function x3(){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 rr(Py(n/u)*u,r,u).map(p).concat(rr(Py(a/f)*f,s,f).map(m)).concat(rr(Py(t/c)*c,e,c).filter(function(b){return $t(b%u)>et}).map(d)).concat(rr(Py(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=E9(o,i,90),h=M9(t,e,y),p=E9(a,s,90),m=M9(n,r,y),g):y},g.extentMajor([[-180,-90+et],[180,90-et]]).extentMinor([[-180,-80-et],[180,80+et]])}function b3(){return x3()()}var Gy=e=>e;var _3=new Qr,w3=new Qr,N9,O9,v3,S3,Xc={point:fr,lineStart:fr,lineEnd:fr,polygonStart:function(){Xc.lineStart=Jtt,Xc.lineEnd=eet},polygonEnd:function(){Xc.lineStart=Xc.lineEnd=Xc.point=fr,_3.add($t(w3)),w3=new Qr},result:function(){var e=_3/2;return _3=new Qr,e}};function Jtt(){Xc.point=tet}function tet(e,t){Xc.point=R9,N9=v3=e,O9=S3=t}function R9(e,t){w3.add(S3*e-v3*t),v3=e,S3=t}function eet(){R9(N9,O9)}var I3=Xc;var Xd=1/0,ev=Xd,Xy=-Xd,rv=Xy,ret={point:net,lineStart:fr,lineEnd:fr,polygonStart:fr,polygonEnd:fr,result:function(){var e=[[Xd,ev],[Xy,rv]];return Xy=rv=-(ev=Xd=1/0),e}};function net(e,t){e<Xd&&(Xd=e),e>Xy&&(Xy=e),t<ev&&(ev=t),t>rv&&(rv=t)}var Hd=ret;var T3=0,A3=0,Hy=0,nv=0,iv=0,Qd=0,E3=0,M3=0,Qy=0,F9,k9,ds,hs,Oo={point:Bu,lineStart:D9,lineEnd:L9,polygonStart:function(){Oo.lineStart=set,Oo.lineEnd=aet},polygonEnd:function(){Oo.point=Bu,Oo.lineStart=D9,Oo.lineEnd=L9},result:function(){var e=Qy?[E3/Qy,M3/Qy]:Qd?[nv/Qd,iv/Qd]:Hy?[T3/Hy,A3/Hy]:[NaN,NaN];return T3=A3=Hy=nv=iv=Qd=E3=M3=Qy=0,e}};function Bu(e,t){T3+=e,A3+=t,++Hy}function D9(){Oo.point=iet}function iet(e,t){Oo.point=oet,Bu(ds=e,hs=t)}function oet(e,t){var r=e-ds,n=t-hs,i=Ae(r*r+n*n);nv+=i*(ds+e)/2,iv+=i*(hs+t)/2,Qd+=i,Bu(ds=e,hs=t)}function L9(){Oo.point=Bu}function set(){Oo.point=cet}function aet(){C9(F9,k9)}function cet(e,t){Oo.point=C9,Bu(F9=ds=e,k9=hs=t)}function C9(e,t){var r=e-ds,n=t-hs,i=Ae(r*r+n*n);nv+=i*(ds+e)/2,iv+=i*(hs+t)/2,Qd+=i,i=hs*e-ds*t,E3+=i*(ds+e),M3+=i*(hs+t),Qy+=i*3,Bu(ds=e,hs=t)}var N3=Oo;function ov(e){this._context=e}ov.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,Lr);break}}},result:fr};var R3=new Qr,O3,B9,P9,Zy,Ky,sv={point:fr,lineStart:function(){sv.point=uet},lineEnd:function(){O3&&U9(B9,P9),sv.point=fr},polygonStart:function(){O3=!0},polygonEnd:function(){O3=null},result:function(){var e=+R3;return R3=new Qr,e}};function uet(e,t){sv.point=U9,B9=Zy=e,P9=Ky=t}function U9(e,t){Zy-=e,Ky-=t,R3.add(Ae(Zy*Zy+Ky*Ky)),Zy=e,Ky=t}var D3=sv;var $9,av,z9,j9,Zd=class{constructor(t){this._append=t==null?q9:fet(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!==z9||this._append!==av){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`,z9=n,av=this._append,j9=this._,this._=i}this._+=j9;break}}}result(){let t=this._;return this._="",t.length?t:null}};function q9(e){let t=1;this._+=e[0];for(let r=e.length;t<r;++t)this._+=arguments[t]+e[t]}function fet(e){let t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return q9;if(t!==$9){let r=10**t;$9=t,av=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 av}function Fr(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(I3)),I3.result()},s.measure=function(a){return pi(a,i(D3)),D3.result()},s.bounds=function(a){return pi(a,i(Hd)),Hd.result()},s.centroid=function(a){return pi(a,i(N3)),N3.result()},s.projection=function(a){return arguments.length?(i=a==null?(e=null,Gy):(e=a).stream,s):e},s.context=function(a){return arguments.length?(o=a==null?(t=null,new Zd(r)):new ov(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 Zd(r)),s},s.projection(e).digits(r).context(t)}function Pu(e){return{stream:Kd(e)}}function Kd(e){return function(t){var r=new L3;for(var n in e)r[n]=e[n];return r.stream=t,r}}function L3(){}L3.prototype={constructor:L3,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 F3(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(Hd)),t(Hd.result()),n!=null&&e.clipExtent(n),e}function Jy(e,t,r){return F3(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 cv(e,t,r){return Jy(e,[[0,0],t],r)}function lv(e,t,r){return F3(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 uv(e,t,r){return F3(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 V9=16,det=J(30*Yt);function k3(e,t){return+t?pet(e,t):het(e)}function het(e){return Kd({point:function(t,r){t=e(t,r),this.stream.point(t[0],t[1])}})}function pet(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,S=Ae(_*_+v*v+w*w),A=ke(w/=S),E=$t($t(w)-1)<et||$t(o-f)<et?(o+f)/2:ur(v,_),M=e(E,A),T=M[0],R=M[1],k=T-n,I=R-i,N=x*k-g*I;(N*N/b>t||$t((g*k+x*I)/b-.5)>.3||s*d+a*h+c*p<det)&&(r(n,i,o,s,a,c,T,R,E,_/=S,v/=S,w,m,y),y.point(T,R),r(T,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 M=fs([A,E]),T=e(A,E);r(f,d,u,h,p,m,f=T[0],d=T[1],u=A,h=M[0],p=M[1],m=M[2],V9,n),n.point(f,d)}function _(){y.point=g,n.lineEnd()}function v(){x(),y.point=w,y.lineEnd=S}function w(A,E){b(i=A,E),o=f,s=d,a=h,c=p,l=m,y.point=b}function S(){r(f,d,u,h,p,m,o,s,i,a,c,l,V9,n),y.lineEnd=_,_()}return y}}var met=Kd({point:function(e,t){this.stream.point(e*Yt,t*Yt)}});function yet(e){return Kd({point:function(t,r){var n=e(t,r);return this.stream.point(n[0],n[1])}})}function get(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 Y9(e,t,r,n,i,o){if(!o)return get(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 tn(e){return C3(function(){return e})()}function C3(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=g3,y=null,g,x,b,_=Gy,v=.5,w,S,A,E,M;function T(N){return A(N[0]*Yt,N[1]*Yt)}function R(N){return N=A.invert(N[0],N[1]),N&&[N[0]*Ke,N[1]*Ke]}T.stream=function(N){return E&&M===N?E:E=met(yet(u)(m(w(_(M=N)))))},T.preclip=function(N){return arguments.length?(m=N,p=void 0,I()):m},T.postclip=function(N){return arguments.length?(_=N,y=g=x=b=null,I()):_},T.clipAngle=function(N){return arguments.length?(m=+N?T9(p=N*Yt):(p=null,g3),I()):p*Ke},T.clipExtent=function(N){return arguments.length?(_=N==null?(y=g=x=b=null,Gy):Gd(y=+N[0][0],g=+N[0][1],x=+N[1][0],b=+N[1][1]),I()):y==null?null:[[y,g],[x,b]]},T.scale=function(N){return arguments.length?(r=+N,k()):r},T.translate=function(N){return arguments.length?(n=+N[0],i=+N[1],k()):[n,i]},T.center=function(N){return arguments.length?(o=N[0]%360*Yt,s=N[1]%360*Yt,k()):[o*Ke,s*Ke]},T.rotate=function(N){return arguments.length?(a=N[0]%360*Yt,c=N[1]%360*Yt,l=N.length>2?N[2]%360*Yt:0,k()):[a*Ke,c*Ke,l*Ke]},T.angle=function(N){return arguments.length?(f=N%360*Yt,k()):f*Ke},T.reflectX=function(N){return arguments.length?(d=N?-1:1,k()):d<0},T.reflectY=function(N){return arguments.length?(h=N?-1:1,k()):h<0},T.precision=function(N){return arguments.length?(w=k3(S,v=N*N),I()):Ae(v)},T.fitExtent=function(N,O){return Jy(T,N,O)},T.fitSize=function(N,O){return cv(T,N,O)},T.fitWidth=function(N,O){return lv(T,N,O)},T.fitHeight=function(N,O){return uv(T,N,O)};function k(){var N=Y9(r,0,0,d,h,f).apply(null,t(o,s)),O=Y9(r,n-N[0],i-N[1],d,h,f);return u=m3(a,c,l),S=Yy(t,O),A=Yy(u,S),w=k3(S,v),I()}function I(){return E=M=null,T}return function(){return t=e.apply(this,arguments),T.invert=t.invert&&R,k()}}function Jd(e){var t=0,r=kt/3,n=C3(e),i=n(t,r);return i.parallels=function(o){return arguments.length?n(t=o[0]*Yt,r=o[1]*Yt):[t*Ke,r*Ke]},i}function W9(e){var t=J(e);function r(n,i){return[n*t,Z(i)/t]}return r.invert=function(n,i){return[n/t,ke(i*t)]},r}function G9(e,t){var r=Z(e),n=(r+Z(t))/2;if($t(n)<et)return W9(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-=kt*fn(a)*fn(l)),[u/n,ke((i-(a*a+l*l)*n*n)/(2*n))]},s}function Hc(){return Jd(G9).scale(155.424).center([0,33.6442])}function tg(){return Hc().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function xet(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 B3(){var e,t,r=tg(),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=xet([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 Jy(u,d,h)},u.fitSize=function(d,h){return cv(u,d,h)},u.fitWidth=function(d,h){return lv(u,d,h)},u.fitHeight=function(d,h){return uv(u,d,h)};function f(){return e=t=null,u}return u.scale(1070)}function fv(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),ke(n&&r*o/n)]}}var P3=fv(function(e){return Ae(2/(1+e))});P3.invert=ps(function(e){return 2*ke(e/2)});function U3(){return tn(P3).scale(124.75).clipAngle(180-.001)}var $3=fv(function(e){return(e=$w(e))&&e/Z(e)});$3.invert=ps(function(e){return e});function z3(){return tn($3).scale(79.4188).clipAngle(180-.001)}function th(e,t){return[e,Cu(Vd((Te+t)/2))]}th.invert=function(e,t){return[e,2*Wi(Bw(t))-Te]};function j3(){return q3(th).scale(961/Lr)}function q3(e){var t=tn(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=kt*n(),d=t(_9(t.rotate()).invert([0,0]));return o(s==null?[[d[0]-f,d[1]-f],[d[0]+f,d[1]+f]]:e===th?[[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 dv(e){return Vd((Te+e)/2)}function X9(e,t){var r=J(e),n=e===t?Z(e):Cu(r/J(t))/Cu(dv(t)/dv(e)),i=r*Uw(dv(e),n)/n;if(!n)return th;function o(s,a){i>0?a<-Te+et&&(a=-Te+et):a>Te-et&&(a=Te-et);var c=i/Uw(dv(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-=kt*fn(s)*fn(c)),[u/n,2*Wi(Uw(i/l,1/n))-Te]},o}function V3(){return Jd(X9).scale(109.5).parallels([30,30])}function eh(e,t){return[e,t]}eh.invert=eh;function Y3(){return tn(eh).scale(152.63)}function H9(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 eh;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-=kt*fn(s)*fn(c)),[l/n,i-fn(n)*Ae(s*s+c*c)]},o}function W3(){return Jd(H9).scale(131.154).center([0,13.9389])}var eg=1.340264,rg=-.081106,ng=893e-6,ig=.003796,hv=Ae(3)/2,bet=12;function G3(e,t){var r=ke(hv*Z(t)),n=r*r,i=n*n*n;return[e*J(r)/(hv*(eg+3*rg*n+i*(7*ng+9*ig*n))),r*(eg+rg*n+i*(ng+ig*n))]}G3.invert=function(e,t){for(var r=t,n=r*r,i=n*n*n,o=0,s,a,c;o<bet&&(a=r*(eg+rg*n+i*(ng+ig*n))-t,c=eg+3*rg*n+i*(7*ng+9*ig*n),r-=s=a/c,n=r*r,i=n*n*n,!($t(s)<ku));++o);return[hv*e*(eg+3*rg*n+i*(7*ng+9*ig*n))/J(r),ke(Z(r)/hv)]};function X3(){return tn(G3).scale(177.158)}function H3(e,t){var r=J(t),n=J(e)*r;return[r*Z(e)/n,Z(t)/n]}H3.invert=ps(Wi);function Q3(){return tn(H3).scale(144.049).clipAngle(60)}function Z3(e,t){return[J(t)*Z(e),Z(t)]}Z3.invert=ps(ke);function K3(){return tn(Z3).scale(249.5).clipAngle(90+et)}function J3(e,t){var r=J(t),n=1+J(e)*r;return[r*Z(e)/n,Z(t)/n]}J3.invert=ps(function(e){return 2*Wi(e)});function t6(){return tn(J3).scale(250).clipAngle(142)}function e6(e,t){return[Cu(Vd((Te+t)/2)),-e]}e6.invert=function(e,t){return[-t,2*Wi(Bw(e))-Te]};function r6(){var e=q3(e6),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 _et(e,t){return e.parent===t.parent?1:2}function wet(e){return e.reduce(vet,0)/e.length}function vet(e,t){return e+t.x}function Iet(e){return 1+e.reduce(Tet,0)}function Tet(e,t){return Math.max(e,t.y)}function Aet(e){for(var t;t=e.children;)e=t[0];return e}function Eet(e){for(var t;t=e.children;)e=t[t.length-1];return e}function pv(){var e=_et,t=1,r=1,n=!1;function i(o){var s,a=0;o.eachAfter(function(d){var h=d.children;h?(d.x=wet(h),d.y=Iet(h)):(d.x=s?a+=e(d,s):0,d.y=0,s=d)});var c=Aet(o),l=Eet(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 Met(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 Q9(){return this.eachAfter(Met)}function Z9(e,t){let r=-1;for(let n of this)e.call(t,n,++r,this);return this}function K9(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 J9(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 tU(e,t){let r=-1;for(let n of this)if(e.call(t,n,++r,this))return n}function eU(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 rU(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function nU(e){for(var t=this,r=Net(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 Net(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 iU(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function oU(){return Array.from(this)}function sU(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function aU(){var e=this,t=[];return e.each(function(r){r!==e&&t.push({source:r.parent,target:r})}),t}function*cU(){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 n6(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=Det)):t===void 0&&(t=Ret);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(i6)}function Oet(){return n6(this).eachBefore(Let)}function Ret(e){return e.children}function Det(e){return Array.isArray(e)?e[1]:null}function Let(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function i6(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=n6.prototype={constructor:Qc,count:Q9,each:Z9,eachAfter:J9,eachBefore:K9,find:tU,sum:eU,sort:rU,path:nU,ancestors:iU,descendants:oU,leaves:sU,links:aU,copy:Oet,[Symbol.iterator]:cU};function mv(e){return e==null?null:Fet(e)}function Fet(e){if(typeof e!="function")throw new Error;return e}var ket={depth:-1},lU={},o6={};function Cet(e){return e.id}function Bet(e){return e.parentId}function yv(){var e=Cet,t=Bet,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)=>Pet(r(_,v,i))),x=g.map(uU),b=new Set(g).add("");for(let _ of x)b.has(_)||(b.add(_),g.push(_),x.push(uU(_)),o.push(o6));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)?lU: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===lU)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===o6&&f.children.length===1;)f=f.children[0],--c;for(let g=o.length-1;g>=0&&(h=o[g],h.data===o6);--g)h.data=null}if(f.parent=ket,f.eachBefore(function(g){g.depth=g.parent.depth+1,--c}).eachBefore(i6),f.parent=null,c>0)throw new Error("cycle");return f}return n.id=function(i){return arguments.length?(e=mv(i),n):e},n.parentId=function(i){return arguments.length?(t=mv(i),n):t},n.path=function(i){return arguments.length?(r=mv(i),n):r},n}function Pet(e){e=`${e}`;let t=e.length;return s6(e,t-1)&&!s6(e,t-2)&&(e=e.slice(0,-1)),e[0]==="/"?e:`/${e}`}function uU(e){let t=e.length;if(t<2)return"";for(;--t>1&&!s6(e,t););return e.slice(0,t)}function s6(e,t){if(e[t]==="/"){let r=0;for(;t>0&&e[--t]==="\\";)++r;if(!(r&1))return!0}return!1}function Uet(e,t){return e.parent===t.parent?1:2}function a6(e){var t=e.children;return t?t[0]:e.t}function c6(e){var t=e.children;return t?t[t.length-1]:e.t}function $et(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 zet(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 jet(e,t,r){return e.a.parent===t.parent?e.a:r}function gv(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}gv.prototype=Object.create(Qc.prototype);function qet(e){for(var t=new gv(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 gv(o[s],s)),i.parent=r;return(t.parent=new gv(null,0)).children=[t],t}function Uu(){var e=Uet,t=1,r=1,n=null;function i(l){var u=qet(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){zet(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=c6(p),d=a6(d),p&&d;)m=a6(m),h=c6(h),h.a=l,_=p.z+x-d.z-y+e(p._,d._),_>0&&($et(jet(p,l,f),l,_),y+=_,g+=_),x+=p.m,y+=d.m,b+=m.m,g+=h.m;p&&!c6(h)&&(h.t=p,h.m+=x-g),d&&!a6(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 fU=23283064365386963e-26;function $u(e=Math.random()){let t=(0<=e&&e<1?e/fU:Math.abs(e))|0;return()=>(t=1664525*t+1013904223|0,fU*(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 og(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 sg=Symbol("implicit");function zu(){var e=new In,t=[],r=[],n=sg;function i(o){let s=e.get(o);if(s===void 0){if(n!==sg)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 In;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=rr(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 dU(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return dU(t())},e}function l6(){return dU(Zc.apply(null,arguments).paddingInner(1))}function u6(e){return function(){return e}}function rh(e){return+e}var hU=[0,1];function Qn(e){return e}function f6(e,t){return(t-=e=+e)?function(r){return(r-e)/t}:u6(isNaN(t)?NaN:.5)}function Vet(e,t){var r;return e>t&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function Yet(e,t,r){var n=e[0],i=e[1],o=t[0],s=t[1];return i<n?(n=f6(i,n),o=r(s,o)):(n=f6(n,i),o=r(o,s)),function(a){return o(n(a))}}function Wet(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]=f6(e[s],e[s+1]),o[s]=r(t[s],t[s+1]);return function(a){var c=Sa(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=hU,t=hU,r=hi,n,i,o,s=Qn,a,c,l;function u(){var d=Math.min(e.length,t.length);return s!==Qn&&(s=Vet(e[0],e[d-1])),a=d>2?Wet:Yet,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,rh),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:Qn,u()):s!==Qn},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 ag(){return ju()(Qn,Qn)}function d6(e,t,r,n){var i=Td(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=o3(i,s))&&(n.precision=o),Cw(n,s)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(o=s3(i,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=o-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(o=i3(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 Kr(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var i=t();return d6(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=Ta(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 Ca(){var e=ag();return e.copy=function(){return ms(e,Ca())},dr.apply(e,arguments),ka(e)}function cg(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,rh),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return cg(e).unknown(t)},e=arguments.length?Array.from(e,rh):[0,1],ka(r)}function lg(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 pU(e){return Math.log(e)}function mU(e){return Math.exp(e)}function Get(e){return-Math.log(-e)}function Xet(e){return-Math.exp(-e)}function Het(e){return isFinite(e)?+("1e"+e):e<0?0:e}function Qet(e){return e===10?Het:e===Math.E?Math.exp:t=>Math.pow(e,t)}function Zet(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 yU(e){return(t,r)=>-e(-t,r)}function h6(e){let t=e(pU,mU),r=t.domain,n=10,i,o;function s(){return i=Zet(n),o=Qet(n),r()[0]<0?(i=yU(i),o=yU(o),e(Get,Xet)):e(pU,mU),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=Kr(l,u,y))}else g=Kr(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(lg(r(),{floor:a=>o(Math.floor(i(a))),ceil:a=>o(Math.ceil(i(a)))})),t}function ug(){let e=h6(ju()).domain([1,10]);return e.copy=()=>ms(e,ug()).base(e.base()),dr.apply(e,arguments),e}function gU(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function xU(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function p6(e){var t=1,r=e(gU(t),xU(t));return r.constant=function(n){return arguments.length?e(gU(t=+n),xU(t)):t},ka(r)}function fg(){var e=p6(ju());return e.copy=function(){return ms(e,fg()).constant(e.constant())},dr.apply(e,arguments)}function bU(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Ket(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function Jet(e){return e<0?-e*e:e*e}function m6(e){var t=e(Qn,Qn),r=1;function n(){return r===1?e(Qn,Qn):r===.5?e(Ket,Jet):e(bU(r),bU(1/r))}return t.exponent=function(i){return arguments.length?(r=+i,n()):r},ka(t)}function dg(){var e=m6(ju());return e.copy=function(){return ms(e,dg()).exponent(e.exponent())},dr.apply(e,arguments),e}function hg(){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]=pM(e,s/a);return o}function o(s){return s==null||isNaN(s=+s)?n:t[Sa(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 hg().domain(e).range(t).unknown(n)},dr.apply(o,arguments)}function pg(){var e=[.5],t=[0,1],r,n=1;function i(o){return o!=null&&o<=o?t[Sa(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 pg().domain(e).range(t).unknown(r)},dr.apply(i,arguments)}var y6=new Date,g6=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)=>(y6.setTime(+o),g6.setTime(+s),e(y6),e(g6),Math.floor(r(y6,g6))),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 mg=Me(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);mg.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):mg);var e$t=mg.range;var kr=Me(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*1e3)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds()),_U=kr.range;var Ba=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()),trt=Ba.range,Pa=Me(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes()),ert=Pa.range;var Ua=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()),rrt=Ua.range,$a=Me(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours()),nrt=$a.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),irt=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),ort=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)),srt=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),xv=Gu(2),bv=Gu(3),gs=Gu(4),_v=Gu(5),wv=Gu(6),vU=mi.range,art=Kc.range,crt=xv.range,lrt=bv.range,urt=gs.range,frt=_v.range,drt=wv.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),vv=Xu(2),Sv=Xu(3),xs=Xu(4),Iv=Xu(5),Tv=Xu(6),SU=yi.range,hrt=Jc.range,prt=vv.range,mrt=Sv.range,yrt=xs.range,grt=Iv.range,xrt=Tv.range;var za=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()),brt=za.range,ja=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()),_rt=ja.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 wrt=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 vrt=hn.range;function TU(e,t,r,n,i,o){let s=[[kr,1,1e3],[kr,5,5*1e3],[kr,15,15*1e3],[kr,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(Td(l/31536e6,u/31536e6,f));if(h===0)return mg.every(Math.max(Td(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[x6,gg]=TU(hn,ja,yi,Wu,$a,Pa),[b6,_6]=TU(dn,za,mi,Gi,Ua,Ba);function w6(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 v6(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 xg(e,t,r){return{y:e,m:t,d:r,H:0,M:0,S:0,L:0}}function S6(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=bg(i),u=_g(i),f=bg(o),d=_g(o),h=bg(s),p=_g(s),m=bg(a),y=_g(a),g=bg(c),x=_g(c),b={a:L,A:B,b:C,B:P,c:null,d:RU,e:RU,f:Wrt,g:rnt,G:int,H:qrt,I:Vrt,j:Yrt,L:CU,m:Grt,M:Xrt,p:U,q:$,Q:FU,s:kU,S:Hrt,u:Qrt,U:Zrt,V:Krt,w:Jrt,W:tnt,x:null,X:null,y:ent,Y:nnt,Z:ont,"%":LU},_={a:X,A:rt,b:ot,B:at,c:null,d:DU,e:DU,f:lnt,g:bnt,G:wnt,H:snt,I:ant,j:cnt,L:PU,m:unt,M:fnt,p:Y,q:st,Q:FU,s:kU,S:dnt,u:hnt,U:pnt,V:mnt,w:ynt,W:gnt,x:null,X:null,y:xnt,Y:_nt,Z:vnt,"%":LU},v={a:M,A:T,b:R,B:k,c:I,d:NU,e:NU,f:Urt,g:MU,G:EU,H:OU,I:OU,j:krt,L:Prt,m:Frt,M:Crt,p:E,q:Lrt,Q:zrt,s:jrt,S:Brt,u:Mrt,U:Nrt,V:Ort,w:Ert,W:Rrt,x:N,X:O,y:MU,Y:EU,Z:Drt,"%":$rt};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,Kt=q.length,Jt,tt,ge;for(nt instanceof Date||(nt=new Date(+nt));++Pt<Kt;)q.charCodeAt(Pt)===37&&(z.push(q.slice(ht,Pt)),(tt=AU[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 S(q,H){return function(nt){var z=xg(1900,void 0,1),Pt=A(z,q,nt+="",0),ht,Kt;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=v6(xg(z.y,0,1)),Kt=ht.getUTCDay(),ht=Kt>4||Kt===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=w6(xg(z.y,0,1)),Kt=ht.getDay(),ht=Kt>4||Kt===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),Kt="Z"in z?v6(xg(z.y,0,1)).getUTCDay():w6(xg(z.y,0,1)).getDay(),z.m=0,z.d="W"in z?(z.w+6)%7+z.W*7-(Kt+5)%7:z.w+z.U*7-(Kt+6)%7);return"Z"in z?(z.H+=z.Z/100|0,z.M+=z.Z%100,v6(z)):w6(z)}}function A(q,H,nt,z){for(var Pt=0,ht=H.length,Kt=nt.length,Jt,tt;Pt<ht;){if(z>=Kt)return-1;if(Jt=H.charCodeAt(Pt++),Jt===37){if(Jt=H.charAt(Pt++),tt=v[Jt in AU?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 M(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 T(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 k(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 I(q,H,nt){return A(q,t,H,nt)}function N(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 C(q){return c[q.getMonth()]}function P(q){return a[q.getMonth()]}function U(q){return i[+(q.getHours()>=12)]}function $(q){return 1+~~(q.getMonth()/3)}function X(q){return s[q.getUTCDay()]}function 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=S(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=S(q+="",!0);return H.toString=function(){return q},H}}}var AU={"-":"",_:" ",0:"0"},Cr=/^\s*\d+/,Irt=/^%/,Trt=/[\\^$*+?|[\]().{}]/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 Art(e){return e.replace(Trt,"\\$&")}function bg(e){return new RegExp("^(?:"+e.map(Art).join("|")+")","i")}function _g(e){return new Map(e.map((t,r)=>[t.toLowerCase(),r]))}function Ert(e,t,r){var n=Cr.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function Mrt(e,t,r){var n=Cr.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function Nrt(e,t,r){var n=Cr.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function Ort(e,t,r){var n=Cr.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function Rrt(e,t,r){var n=Cr.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function EU(e,t,r){var n=Cr.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function MU(e,t,r){var n=Cr.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function Drt(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 Lrt(e,t,r){var n=Cr.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function Frt(e,t,r){var n=Cr.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function NU(e,t,r){var n=Cr.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function krt(e,t,r){var n=Cr.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function OU(e,t,r){var n=Cr.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function Crt(e,t,r){var n=Cr.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function Brt(e,t,r){var n=Cr.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function Prt(e,t,r){var n=Cr.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function Urt(e,t,r){var n=Cr.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function $rt(e,t,r){var n=Irt.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function zrt(e,t,r){var n=Cr.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function jrt(e,t,r){var n=Cr.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function RU(e,t){return le(e.getDate(),t,2)}function qrt(e,t){return le(e.getHours(),t,2)}function Vrt(e,t){return le(e.getHours()%12||12,t,2)}function Yrt(e,t){return le(1+Gi.count(dn(e),e),t,3)}function CU(e,t){return le(e.getMilliseconds(),t,3)}function Wrt(e,t){return CU(e,t)+"000"}function Grt(e,t){return le(e.getMonth()+1,t,2)}function Xrt(e,t){return le(e.getMinutes(),t,2)}function Hrt(e,t){return le(e.getSeconds(),t,2)}function Qrt(e){var t=e.getDay();return t===0?7:t}function Zrt(e,t){return le(mi.count(dn(e)-1,e),t,2)}function BU(e){var t=e.getDay();return t>=4||t===0?gs(e):gs.ceil(e)}function Krt(e,t){return e=BU(e),le(gs.count(dn(e),e)+(dn(e).getDay()===4),t,2)}function Jrt(e){return e.getDay()}function tnt(e,t){return le(Kc.count(dn(e)-1,e),t,2)}function ent(e,t){return le(e.getFullYear()%100,t,2)}function rnt(e,t){return e=BU(e),le(e.getFullYear()%100,t,2)}function nnt(e,t){return le(e.getFullYear()%1e4,t,4)}function int(e,t){var r=e.getDay();return e=r>=4||r===0?gs(e):gs.ceil(e),le(e.getFullYear()%1e4,t,4)}function ont(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+le(t/60|0,"0",2)+le(t%60,"0",2)}function DU(e,t){return le(e.getUTCDate(),t,2)}function snt(e,t){return le(e.getUTCHours(),t,2)}function ant(e,t){return le(e.getUTCHours()%12||12,t,2)}function cnt(e,t){return le(1+Yu.count(hn(e),e),t,3)}function PU(e,t){return le(e.getUTCMilliseconds(),t,3)}function lnt(e,t){return PU(e,t)+"000"}function unt(e,t){return le(e.getUTCMonth()+1,t,2)}function fnt(e,t){return le(e.getUTCMinutes(),t,2)}function dnt(e,t){return le(e.getUTCSeconds(),t,2)}function hnt(e){var t=e.getUTCDay();return t===0?7:t}function pnt(e,t){return le(yi.count(hn(e)-1,e),t,2)}function UU(e){var t=e.getUTCDay();return t>=4||t===0?xs(e):xs.ceil(e)}function mnt(e,t){return e=UU(e),le(xs.count(hn(e),e)+(hn(e).getUTCDay()===4),t,2)}function ynt(e){return e.getUTCDay()}function gnt(e,t){return le(Jc.count(hn(e)-1,e),t,2)}function xnt(e,t){return le(e.getUTCFullYear()%100,t,2)}function bnt(e,t){return e=UU(e),le(e.getUTCFullYear()%100,t,2)}function _nt(e,t){return le(e.getUTCFullYear()%1e4,t,4)}function wnt(e,t){var r=e.getUTCDay();return e=r>=4||r===0?xs(e):xs.ceil(e),le(e.getUTCFullYear()%1e4,t,4)}function vnt(){return"+0000"}function LU(){return"%"}function FU(e){return+e}function kU(e){return Math.floor(+e/1e3)}var nh,ih,$U,bs,zU;I6({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 I6(e){return nh=S6(e),ih=nh.format,$U=nh.parse,bs=nh.utcFormat,zU=nh.utcParse,nh}function Snt(e){return new Date(e)}function Int(e){return e instanceof Date?+e:+new Date(+e)}function Av(e,t,r,n,i,o,s,a,c,l){var u=ag(),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,Int)):d().map(Snt)},u.ticks=function(w){var S=d();return e(S[0],S[S.length-1],w??10)},u.tickFormat=function(w,S){return S==null?v:l(S)},u.nice=function(w){var S=d();return(!w||typeof w.range!="function")&&(w=t(S[0],S[S.length-1],w??10)),w?d(lg(S,w)):u},u.copy=function(){return ms(u,Av(e,t,r,n,i,o,s,a,c,l))},u}function Ev(){return dr.apply(Av(b6,_6,dn,za,mi,Gi,Ua,Ba,kr,ih).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function Mv(){return dr.apply(Av(x6,gg,hn,ja,yi,Yu,$a,Pa,kr,bs).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function wg(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function Nv(){var e=0,t=.5,r=1,n=1,i,o,s,a,c,l=Qn,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 vg(){var e=ka(Nv()(Qn));return e.copy=function(){return wg(e,vg())},og.apply(e,arguments)}function Ov(){var e=h6(Nv()).domain([.1,1,10]);return e.copy=function(){return wg(e,Ov()).base(e.base())},og.apply(e,arguments)}function Rv(){var e=p6(Nv());return e.copy=function(){return wg(e,Rv()).constant(e.constant())},og.apply(e,arguments)}function Dv(){var e=m6(Nv());return e.copy=function(){return wg(e,Dv()).exponent(e.exponent())},og.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 T6=W("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");var A6=W("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666");var E6=W("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666");var M6=W("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0");var N6=W("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");var O6=W("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2");var R6=W("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc");var D6=W("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999");var L6=W("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3");var F6=W("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");var k6=W("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");var pt=e=>OM(e[e.length-1]);var Lv=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(W),Fv=pt(Lv);var kv=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(W),Cv=pt(kv);var Bv=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(W),Pv=pt(Bv);var Uv=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(W),$v=pt(Uv);var Sg=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(W),oh=pt(Sg);var zv=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(W),jv=pt(zv);var Ig=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(W),sh=pt(Ig);var qv=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(W),Vv=pt(qv);var Yv=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(W),Wv=pt(Yv);var Gv=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(W),Xv=pt(Gv);var Hv=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(W),Qv=pt(Hv);var Zv=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(W),Kv=pt(Zv);var Jv=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(W),t2=pt(Jv);var e2=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(W),r2=pt(e2);var n2=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(W),i2=pt(n2);var o2=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(W),s2=pt(o2);var a2=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(W),c2=pt(a2);var l2=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(W),u2=pt(l2);var f2=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(W),d2=pt(f2);var h2=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(W),p2=pt(h2);var m2=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(W),y2=pt(m2);var g2=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(W),x2=pt(g2);var b2=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(W),_2=pt(b2);var w2=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(W),v2=pt(w2);var S2=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(W),I2=pt(S2);var T2=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(W),A2=pt(T2);var E2=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(W),M2=pt(E2);function N2(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 O2=Fd(Mn(300,.5,0),Mn(-240,.5,1));var D2=Fd(Mn(-100,.75,.35),Mn(80,1.5,.8)),L2=Fd(Mn(260,.75,.35),Mn(80,1.5,.8)),R2=Mn();function F2(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return R2.h=360*e-100,R2.s=1.5-1.5*t,R2.l=.8-.9*t,R2+""}var k2=vr(),Tnt=Math.PI/3,Ant=Math.PI*2/3;function C2(e){var t;return e=(.5-e)*Math.PI,k2.r=255*(t=Math.sin(e))*t,k2.g=255*(t=Math.sin(e+Tnt))*t,k2.b=255*(t=Math.sin(e+Ant))*t,k2+""}function B2(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 P2(e){var t=e.length;return function(r){return e[Math.max(0,Math.min(t-1,Math.floor(r*t)))]}}var U2=P2(W("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),$2=P2(W("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),z2=P2(W("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),j2=P2(W("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function hr(e){return function(){return e}}var C6=Math.cos;var ah=Math.min,Tg=Math.sin,ue=Math.sqrt,B6=1e-12,Hu=Math.PI,AVt=Hu/2,ch=2*Hu;function q2(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 OVt=Array.prototype.slice;function V2(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function jU(e){this._context=e}jU.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 qa(e){return new jU(e)}function Y2(e){return e[0]}function W2(e){return e[1]}function Ag(e,t){var r=hr(!0),n=null,i=qa,o=null,s=q2(a);e=typeof e=="function"?e:e===void 0?Y2:hr(e),t=typeof t=="function"?t:t===void 0?W2:hr(t);function a(c){var l,u=(c=V2(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 lh(e,t,r){var n=null,i=hr(!0),o=null,s=qa,a=null,c=q2(l);e=typeof e=="function"?e:e===void 0?Y2:hr(+e),t=typeof t=="function"?t:t===void 0?hr(0):hr(+t),r=typeof r=="function"?r:r===void 0?W2:hr(+r);function l(f){var d,h,p,m=(f=V2(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 Ag().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 G2=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 P6(e){return new G2(e,!0)}function U6(e){return new G2(e,!1)}var Ent=ue(3),Eg={draw(e,t){let r=ue(t+ah(t/28,.75))*.59436,n=r/2,i=n*Ent;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 Va={draw(e,t){let r=ue(t/Hu);e.moveTo(r,0),e.arc(0,0,r,0,ch)}};var Mg={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 qU=ue(1/3),Mnt=qU*2,Ng={draw(e,t){let r=ue(t/Mnt),n=r*qU;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}};var Og={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 Rg={draw(e,t){let r=ue(t-ah(t/7,2))*.87559;e.moveTo(-r,0),e.lineTo(r,0),e.moveTo(0,r),e.lineTo(0,-r)}};var Dg={draw(e,t){let r=ue(t),n=-r/2;e.rect(n,n,r,r)}};var Lg={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 Nnt=.8908130915292852,VU=Tg(Hu/10)/Tg(7*Hu/10),Ont=Tg(ch/10)*VU,Rnt=-C6(ch/10)*VU,Fg={draw(e,t){let r=ue(t*Nnt),n=Ont*r,i=Rnt*r;e.moveTo(0,-r),e.lineTo(n,i);for(let o=1;o<5;++o){let s=ch*o/5,a=C6(s),c=Tg(s);e.lineTo(c*r,-a*r),e.lineTo(a*n-c*i,c*n+a*i)}e.closePath()}};var $6=ue(3),kg={draw(e,t){let r=-ue(t/($6*3));e.moveTo(0,r*2),e.lineTo(-$6*r,-r),e.lineTo($6*r,-r),e.closePath()}};var Dnt=ue(3),Cg={draw(e,t){let r=ue(t)*.6824,n=r/2,i=r*Dnt/2;e.moveTo(0,-r),e.lineTo(i,n),e.lineTo(-i,n),e.closePath()}};var Xi=-.5,Hi=ue(3)/2,z6=1/ue(12),Lnt=(z6/2+1)*3,Bg={draw(e,t){let r=ue(t/Lnt),n=r/2,i=r*z6,o=n,s=r*z6+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 uh={draw(e,t){let r=ue(t-ah(t/6,1.7))*.6189;e.moveTo(-r,-r),e.lineTo(r,r),e.moveTo(-r,r),e.lineTo(r,-r)}};var X2=[Va,Mg,Ng,Dg,Fg,kg,Bg],j6=[Va,Rg,uh,Cg,Eg,Lg,Og];function Qi(){}function fh(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 Pg(e){this._context=e}Pg.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:fh(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:fh(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function q6(e){return new Pg(e)}function YU(e){this._context=e}YU.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:fh(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function V6(e){return new YU(e)}function WU(e){this._context=e}WU.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:fh(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Y6(e){return new WU(e)}function GU(e,t){this._basis=new Pg(e),this._beta=t}GU.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 W6=function e(t){function r(n){return t===1?new Pg(n):new GU(n,t)}return r.beta=function(n){return e(+n)},r}(.85);function dh(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 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(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:dh(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:dh(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 Q2(e,t){this._context=e,this._k=(1-t)/6}Q2.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:dh(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 X6=function e(t){function r(n){return new Q2(n,t)}return r.tension=function(n){return e(+n)},r}(0);function Z2(e,t){this._context=e,this._k=(1-t)/6}Z2.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:dh(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 H6=function e(t){function r(n){return new Z2(n,t)}return r.tension=function(n){return e(+n)},r}(0);function Ug(e,t,r){var n=e._x1,i=e._y1,o=e._x2,s=e._y2;if(e._l01_a>B6){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>B6){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 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(){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:Ug(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 H2(n,0)}return r.alpha=function(n){return e(+n)},r}(.5);function HU(e,t){this._context=e,this._alpha=t}HU.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:Ug(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 Z6=function e(t){function r(n){return t?new HU(n,t):new Q2(n,0)}return r.alpha=function(n){return e(+n)},r}(.5);function QU(e,t){this._context=e,this._alpha=t}QU.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:Ug(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 K6=function e(t){function r(n){return t?new QU(n,t):new Z2(n,0)}return r.alpha=function(n){return e(+n)},r}(.5);function ZU(e){this._context=e}ZU.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 J6(e){return new ZU(e)}function KU(e){return e<0?-1:1}function JU(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(KU(o)+KU(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(a))||0}function t$(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function t4(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 K2(e){this._context=e}K2.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:t4(this,this._t0,t$(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,t4(this,t$(this,r=JU(this,e,t)),r);break;default:t4(this,this._t0,r=JU(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function e$(e){this._context=new r$(e)}(e$.prototype=Object.create(K2.prototype)).point=function(e,t){K2.prototype.point.call(this,t,e)};function r$(e){this._context=e}r$.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 e4(e){return new K2(e)}function r4(e){return new e$(e)}function i$(e){this._context=e}i$.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=n$(e),i=n$(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 n$(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 n4(e){return new i$(e)}function J2(e,t){this._context=e,this._t=t}J2.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 i4(e){return new J2(e,.5)}function o4(e){return new J2(e,0)}function s4(e){return new J2(e,1)}var $g=e=>()=>e;function a4(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 zg=new gi(1,0,0);c4.prototype=gi.prototype;function c4(e){for(;!e.__zoom;)if(!(e=e.parentNode))return zg;return e.__zoom}function tS(e){e.stopImmediatePropagation()}function hh(e){e.preventDefault(),e.stopImmediatePropagation()}function Fnt(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function knt(){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 o$(){return this.__zoom||zg}function Cnt(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Bnt(){return navigator.maxTouchPoints||"ontouchstart"in this}function Pnt(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 l4(){var e=Fnt,t=knt,r=Pnt,n=Cnt,i=Bnt,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=CM,l=Su("start","zoom","end"),u,f,d,h=500,p=150,m=0,y=10;function g(I){I.property("__zoom",o$).on("wheel.zoom",A,{passive:!1}).on("mousedown.zoom",E).on("dblclick.zoom",M).filter(i).on("touchstart.zoom",T).on("touchmove.zoom",R).on("touchend.zoom touchcancel.zoom",k).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(I,N,O,L){var B=I.selection?I.selection():I;B.property("__zoom",o$),I!==B?v(I,N,O,L):B.interrupt().each(function(){w(this,arguments).event(L).start().zoom(null,typeof N=="function"?N.apply(this,arguments):N).end()})},g.scaleBy=function(I,N,O,L){g.scaleTo(I,function(){var B=this.__zoom.k,C=typeof N=="function"?N.apply(this,arguments):N;return B*C},O,L)},g.scaleTo=function(I,N,O,L){g.transform(I,function(){var B=t.apply(this,arguments),C=this.__zoom,P=O==null?_(B):typeof O=="function"?O.apply(this,arguments):O,U=C.invert(P),$=typeof N=="function"?N.apply(this,arguments):N;return r(b(x(C,$),P,U),B,s)},O,L)},g.translateBy=function(I,N,O,L){g.transform(I,function(){return r(this.__zoom.translate(typeof N=="function"?N.apply(this,arguments):N,typeof O=="function"?O.apply(this,arguments):O),t.apply(this,arguments),s)},null,L)},g.translateTo=function(I,N,O,L,B){g.transform(I,function(){var C=t.apply(this,arguments),P=this.__zoom,U=L==null?_(C):typeof L=="function"?L.apply(this,arguments):L;return r(zg.translate(U[0],U[1]).scale(P.k).translate(typeof N=="function"?-N.apply(this,arguments):-N,typeof O=="function"?-O.apply(this,arguments):-O),C,s)},L,B)};function x(I,N){return N=Math.max(o[0],Math.min(o[1],N)),N===I.k?I:new gi(N,I.x,I.y)}function b(I,N,O){var L=N[0]-O[0]*I.k,B=N[1]-O[1]*I.k;return L===I.x&&B===I.y?I:new gi(I.k,L,B)}function _(I){return[(+I[0][0]+ +I[1][0])/2,(+I[0][1]+ +I[1][1])/2]}function v(I,N,O,L){I.on("start.zoom",function(){w(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).event(L).end()}).tween("zoom",function(){var B=this,C=arguments,P=w(B,C).event(L),U=t.apply(B,C),$=O==null?_(U):typeof O=="function"?O.apply(B,C):O,X=Math.max(U[1][0]-U[0][0],U[1][1]-U[0][1]),rt=B.__zoom,ot=typeof N=="function"?N.apply(B,C):N,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(I,N,O){return!O&&I.__zooming||new S(I,N)}function S(I,N){this.that=I,this.args=N,this.active=0,this.sourceEvent=null,this.extent=t.apply(I,N),this.taps=0}S.prototype={event:function(I){return I&&(this.sourceEvent=I),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(I,N){return this.mouse&&I!=="mouse"&&(this.mouse[1]=N.invert(this.mouse[0])),this.touch0&&I!=="touch"&&(this.touch0[1]=N.invert(this.touch0[0])),this.touch1&&I!=="touch"&&(this.touch1[1]=N.invert(this.touch1[0])),this.that.__zoom=N,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(I){var N=Zt(this.that).datum();l.call(I,this.that,new a4(I,{sourceEvent:this.sourceEvent,target:g,type:I,transform:this.that.__zoom,dispatch:l}),N)}};function A(I,...N){if(!e.apply(this,arguments))return;var O=w(this,N).event(I),L=this.__zoom,B=Math.max(o[0],Math.min(o[1],L.k*Math.pow(2,n.apply(this,arguments)))),C=an(I);if(O.wheel)(O.mouse[0][0]!==C[0]||O.mouse[0][1]!==C[1])&&(O.mouse[1]=L.invert(O.mouse[0]=C)),clearTimeout(O.wheel);else{if(L.k===B)return;O.mouse=[C,L.invert(C)],as(this),O.start()}hh(I),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(I,...N){if(d||!e.apply(this,arguments))return;var O=I.currentTarget,L=w(this,N,!0).event(I),B=Zt(I.view).on("mousemove.zoom",$,!0).on("mouseup.zoom",X,!0),C=an(I,O),P=I.clientX,U=I.clientY;gy(I.view),tS(I),L.mouse=[C,this.__zoom.invert(C)],as(this),L.start();function $(rt){if(hh(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),xy(rt.view,L.moved),hh(rt),L.event(rt).end()}}function M(I,...N){if(e.apply(this,arguments)){var O=this.__zoom,L=an(I.changedTouches?I.changedTouches[0]:I,this),B=O.invert(L),C=O.k*(I.shiftKey?.5:2),P=r(b(x(O,C),L,B),t.apply(this,N),s);hh(I),a>0?Zt(this).transition().duration(a).call(v,P,L,I):Zt(this).call(g.transform,P,L,I)}}function T(I,...N){if(e.apply(this,arguments)){var O=I.touches,L=O.length,B=w(this,N,I.changedTouches.length===L).event(I),C,P,U,$;for(tS(I),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=$,C=!0,B.taps=1+!!u);u&&(u=clearTimeout(u)),C&&(B.taps<2&&(f=$[0],u=setTimeout(function(){u=null},h)),as(this),B.start())}}function R(I,...N){if(this.__zooming){var O=w(this,N).event(I),L=I.changedTouches,B=L.length,C,P,U,$;for(hh(I),C=0;C<B;++C)P=L[C],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 k(I,...N){if(this.__zooming){var O=w(this,N).event(I),L=I.changedTouches,B=L.length,C,P;for(tS(I),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),C=0;C<B;++C)P=L[C],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=Zt(this).on("dblclick.zoom");U&&U.apply(this,arguments)}}}return g.wheelDelta=function(I){return arguments.length?(n=typeof I=="function"?I:$g(+I),g):n},g.filter=function(I){return arguments.length?(e=typeof I=="function"?I:$g(!!I),g):e},g.touchable=function(I){return arguments.length?(i=typeof I=="function"?I:$g(!!I),g):i},g.extent=function(I){return arguments.length?(t=typeof I=="function"?I:$g([[+I[0][0],+I[0][1]],[+I[1][0],+I[1][1]]]),g):t},g.scaleExtent=function(I){return arguments.length?(o[0]=+I[0],o[1]=+I[1],g):[o[0],o[1]]},g.translateExtent=function(I){return arguments.length?(s[0][0]=+I[0][0],s[1][0]=+I[1][0],s[0][1]=+I[0][1],s[1][1]=+I[1][1],g):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},g.constrain=function(I){return arguments.length?(r=I,g):r},g.duration=function(I){return arguments.length?(a=+I,g):a},g.interpolate=function(I){return arguments.length?(c=I,g):c},g.on=function(){var I=l.on.apply(l,arguments);return I===l?g:I},g.clickDistance=function(I){return arguments.length?(m=(I=+I)*I,g):Math.sqrt(m)},g.tapDistance=function(I){return arguments.length?(y=+I,g):y},g}function Pe(e){return e!=null&&!Number.isNaN(e)}function Br(e,t){return+Pe(t)-+Pe(e)||Ft(e,t)}function Qu(e,t){return+Pe(t)-+Pe(e)||Sn(e,t)}function jg(e){return e!=null&&`${e}`!=""}function ph(e){return isFinite(e)?e:NaN}function kn(e){return e>0&&isFinite(e)?e:NaN}function tl(e){return e<0&&isFinite(e)?e:NaN}function mh(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`${Unt(e.getUTCFullYear(),4)}-${Ya(e.getUTCMonth()+1,2)}-${Ya(e.getUTCDate(),2)}${r||n||i||o?`T${Ya(r,2)}:${Ya(n,2)}${i||o?`:${Ya(i,2)}${o?`.${Ya(o,3)}`:""}`:""}Z`:""}`}function Unt(e){return e<0?`-${Ya(-e,6)}`:e>9999?`+${Ya(e,6)}`:Ya(e,4)}function Ya(e,t){return`${e}`.padStart(t,"0")}var $nt=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function qg(e,t){return $nt.test(e+="")?new Date(e):typeof t=="function"?t(e):t}function Wa(e){if(e==null)return;let t=e[0],r=e[e.length-1];return Sn(t,r)}var gh=1e3,rl=gh*60,nl=rl*60,ws=nl*24,_s=ws*7,Zu=ws*30,el=ws*365,u4=[["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",gh],["5 seconds",5*gh],["15 seconds",15*gh],["30 seconds",30*gh],["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]],f4=new Map([["second",gh],["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]]),a$=new Map([["second",kr],["minute",Ba],["hour",Ua],["day",Gi],["monday",Kc],["tuesday",xv],["wednesday",bv],["thursday",gs],["friday",_v],["saturday",wv],["sunday",mi],["week",mi],["month",za],["year",dn]]),d4=new Map([["second",kr],["minute",Pa],["hour",$a],["day",Wu],["monday",Jc],["tuesday",vv],["wednesday",Sv],["thursday",xs],["friday",Iv],["saturday",Tv],["sunday",yi],["week",yi],["month",ja],["year",hn]]),xh=Symbol("intervalDuration"),rS=Symbol("intervalType");for(let[e,t]of a$)t[xh]=f4.get(e),t[rS]="time";for(let[e,t]of d4)t[xh]=f4.get(e),t[rS]="utc";var Vg=[["year",hn,"utc"],["month",ja,"utc"],["day",Wu,"utc",6*Zu],["hour",$a,"utc",3*ws],["minute",Pa,"utc",6*nl],["second",kr,"utc",30*rl]],eS=[["year",dn,"time"],["month",za,"time"],["day",Gi,"time",6*Zu],["hour",Ua,"time",3*ws],["minute",Ba,"time",6*nl],["second",kr,"time",30*rl]],znt=[Vg[0],eS[0],Vg[1],eS[1],Vg[2],eS[2],...Vg.slice(3)];function nS(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=d4.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 Yg(e){return c$(nS(e),"time")}function Ku(e){return c$(nS(e),"utc")}function c$([e,t],r){let n=(r==="time"?a$:d4).get(e);return t>1&&(n=n.every(t),n[xh]=f4.get(e)*t,n[rS]=r),n}function h4(e,t){if(!(t>1))return;let r=e[xh];if(!u4.some(([,i])=>i===r)||r%ws===0&&ws<r&&r<Zu)return;let[n]=u4[To(([,i])=>Math.log(i)).center(u4,Math.log(r*t))];return(e[rS]==="time"?Yg:Ku)(n)}function s$(e,t,r){let n=t==="time"?ih: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=jnt(r);switch(e){case"millisecond":return yh(n(".%L"),n(":%M:%S"),i);case"second":return yh(n(":%S"),n("%-I:%M"),i);case"minute":return yh(n("%-I:%M"),n("%p"),i);case"hour":return yh(n("%-I %p"),n("%b %-d"),i);case"day":return yh(n("%-d"),n("%b"),i);case"month":return yh(n("%b"),n("%Y"),i);case"year":return n("%Y")}throw new Error("unable to format time ticks")}function jnt(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 qnt(e){return e==="time"?eS:e==="utc"?Vg:znt}function l$(e,t,r){let n=Xt(Z_(t,(i,o)=>Math.abs(o-i)));if(n<1e3)return s$("millisecond","utc",r);for(let[i,o,s,a]of qnt(e)){if(n>a||i==="hour"&&!n)break;if(t.every(c=>o.floor(c)>=c))return s$(i,s,r)}}function yh(e,t,r){return(n,i,o)=>{let s=e(n,i),a=t(n,i),c=i-Wa(o);return i!==c&&o[c]!==void 0&&a===t(o[c],c)?s:r(s,a)}}var Wg=Object.getPrototypeOf(Uint8Array),Vnt=Object.prototype.toString;function Zn(e){return e instanceof Array||e instanceof Wg}function f$(e){return e instanceof Wg&&!Ynt(e)}function d$(e){return e?.prototype instanceof Wg&&!Wnt(e)}function Ynt(e){return e instanceof BigInt64Array||e instanceof BigUint64Array}function Wnt(e){return e===BigInt64Array||e===BigUint64Array}var m4=Symbol("reindex");function _t(e,t,r){let n=typeof t;return n==="string"?I$(e)?y4(e.getChild(t),r):u$(e,g4(t),r):n==="function"?u$(e,t,r):n==="number"||t instanceof Date||n==="boolean"?Ht(e,Ye(t),r):typeof t?.transform=="function"?p4(t.transform(e),r):Gnt(p4(t,r),e?.[m4])}function Gnt(e,t){return e!=null&&t?Xg(e,t):e}function u$(e,t,r){return Ht(e,d$(r)?(n,i)=>x4(t(n,i)):t,r)}function p4(e,t){return t===void 0?xi(e):T$(e)?y4(e,t):e instanceof t?e:t.from(e,d$(t)&&!f$(e)?x4:void 0)}function y4(e,t){return e==null?e:(t===void 0||t===Array)&&Qnt(e.type)?b4(e.toArray()):p4(e.toArray(),t)}var il=[null],g4=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 Gg=()=>1,h$=()=>!0,nr=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,p$=e=>e?e[2]:void 0,Ye=e=>()=>e;function bh(e){let t=+`${e}`.slice(1)/100;return(r,n)=>An(r,t,n)}function pr(e){return f$(e)?e:Ht(e,x4,Float64Array)}function x4(e){return e==null?NaN:Number(e)}function b4(e){return Ht(e,_4)}function _4(e){return e instanceof Date&&!isNaN(e)?e:typeof e=="string"?qg(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 w4(e,t,r){if(e!=null)return Ir(e,t,r)}function Ir(e,t,r){let n=`${e}`.toLowerCase();if(!r.includes(n))throw new Error(`invalid ${t}: ${e}`);return n}function Ga(e){return I$(e)?e:xi(e)}function xi(e){if(e==null||Zn(e))return e;if(T$(e))return y4(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 Ht(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 v4({x:e,x1:t,x2:r}){return e!==void 0||t!==void 0||r!==void 0}function S4({y:e,y1:t,y2:r}){return e!==void 0||t!==void 0||r!==void 0}function Xa(e){return v4(e)||S4(e)||e.interval!==void 0}function Pr(e){return e?.toString===Vnt}function vs(e){return Pr(e)&&(e.type!==void 0||e.domain!==void 0)}function bi(e){return Pr(e)&&typeof e.transform!="function"}function Ss(e){return bi(e)&&e.value===void 0&&e.channel===void 0}function I4(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 Je(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 Zn(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 Xg(e,t){return Zn(e)?Ht(t,r=>e[r],e.constructor):Ht(t,r=>e.at(r))}function _h(e){return e.length===1?(t,r)=>e(Xg(r,t)):e}function Ha(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 iS(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 Ur(e){let t;return[{transform:()=>t,label:rn(e)},r=>t=r]}function en(e){return e==null?[e]:Ur(e)}function rn(e,t){return typeof e=="string"?e:e&&e.label!==void 0?e.label:t}function wh(e,t){return{transform(r){let n=e.transform(r),i=t.transform(r);return Ve(n)||Ve(i)?Ht(n,(o,s)=>new Date((+n[s]+ +i[s])/2)):Ht(n,(o,s)=>(+n[s]+ +i[s])/2,Float64Array)},label:e.label}}function tf(e,t){let r=T4(t?.interval,t?.type);return r?Ht(e,r):e}function T4(e,t){let r=vh(e,t);return r&&(n=>Pe(n)?r.floor(n):n)}function vh(e,t){if(e!=null){if(typeof e=="number")return A4(e);if(typeof e=="string")return(t==="time"?Yg: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 A4(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)=>rr(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)=>rr(Math.ceil(r/t),n/t).map(i=>i*t)}}function Is(e,t){if(e=vh(e,t),e&&typeof e.range!="function")throw new Error("invalid interval: missing range method");return e}function m$(e,t){if(e=Is(e,t),e&&typeof e.ceil!="function")throw new Error("invalid interval: missing ceil method");return e}function y$(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 g$(e){return e==null?null:{transform:t=>_t(t,e,Float64Array),label:rn(e)}}function x$(e){if(!Bn(e))return!1;for(let t of e)if(t!=null)return typeof t=="object"&&"0"in t&&"1"in t}function Bn(e){return e&&typeof e[Symbol.iterator]=="function"}function oS(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 b$(e){for(let t of e)if(t!=null)return typeof t=="string"&&isNaN(t)&&qg(t)}function _$(e){for(let t of e)if(t!=null){if(typeof t!="string")return!1;if(t.trim())return!isNaN(t)}}function Qa(e){for(let t of e)if(t!=null)return typeof t=="number"}function sS(e,t){let r;for(let n of e)if(n!=null){if(!t(n))return!1;r=!0}return r}var Xnt=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)||Xnt.has(e))}function w$(e){return typeof e=="number"&&(0<=e&&e<=1||isNaN(e))}function fe(e){return e==null||Za(e)}function Za(e){return/^\s*none\s*$/i.test(e)}function v$(e){return/^\s*round\s*$/i.test(e)}function aS(e,t){return w4(e,t,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function Ts(e="middle"){return aS(e,"frameAnchor")}function S$(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 Hnt(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 Hg(e){return Bn(e)?Hnt(e):e}function cS(e){return e===!0?e="frame":e===!1?e=null:e!=null&&(e=Ir(e,"clip",["frame","sphere"])),e}function I$(e){return e&&typeof e.getChild=="function"&&typeof e.toArray=="function"&&e.schema&&Array.isArray(e.schema.fields)}function T$(e){return e&&typeof e.toArray=="function"&&e.type}function Qnt(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"),Sh=Symbol("symbol"),A$=Symbol("projection"),_e=new Map([["x",Ji],["y",Ji],["fx",Ji],["fy",Ji],["r",ef],["color",_i],["opacity",nf],["symbol",Sh],["length",rf],["projection",A$]]);function E$(e){return e===Ji||e===A$}function M$(e){return e===Ji||e===ef||e===rf||e===nf}var E4=Math.sqrt(3),M4=2/E4,Znt={draw(e,t){let r=Math.sqrt(t/Math.PI),n=r*M4,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()}},N4=new Map([["asterisk",Eg],["circle",Va],["cross",Mg],["diamond",Ng],["diamond2",Og],["hexagon",Znt],["plus",Rg],["square",Dg],["square2",Lg],["star",Fg],["times",uh],["triangle",kg],["triangle2",Cg],["wye",Bg]]);function O4(e){return e&&typeof e.draw=="function"}function N$(e){return O4(e)?!0:typeof e!="string"?!1:N4.has(e.toLowerCase())}function Ih(e){if(e==null||O4(e))return e;let t=N4.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid symbol: ${e}`)}function O$(e){if(e==null||O4(e))return[void 0,e];if(typeof e=="string"){let t=N4.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=L4(e)),t!=null&&!Ss(t)&&(n=R4(n,k4(t))),r&&(n=R4(n,F4))),s!=null&&i!=null)throw new Error("transforms cannot be applied after initializers");return{...o,...(t===null||Ss(t))&&{sort:t},transform:R4(n,s)}}function Ne({filter:e,sort:t,reverse:r,initializer:n,...i}={},o){return n===void 0&&(e!=null&&(n=L4(e)),t!=null&&!Ss(t)&&(n=D4(n,k4(t))),r&&(n=D4(n,F4))),{...i,...(t===null||Ss(t))&&{sort:t},initializer:D4(n,o)}}function R4(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,Ga(r),n,i)}}function D4(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 lS(e,t){return(e.initializer!=null?Ne:mr)(e,t)}function R$(e,t){return lS(t,L4(e))}function L4(e){return(t,r)=>{let n=_t(t,e);return{data:t,facets:r.map(i=>i.filter(o=>n[o]))}}}function D$({sort:e,...t}={}){return{...lS(t,F4),sort:Ss(e)?e:null}}function F4(e,t){return{data:e,facets:t.map(r=>r.slice().reverse())}}function L$({seed:e,sort:t,...r}={}){return{...lS(r,F$(e==null?Math.random:$u(e))),sort:Ss(t)?t:null}}function uS(e,{sort:t,...r}={}){return{...(bi(e)&&e.channel!==void 0?Ne:lS)(r,k4(e)),sort:Ss(t)?t:null}}function k4(e){return(typeof e=="function"&&e.length!==1?Knt:F$)(e)}function Knt(e){return(t,r)=>{let n=Zn(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 F$(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:Br),typeof r!="function")switch(`${r}`.toLowerCase()){case"ascending":r=Br;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 Zg(e,t){return fS(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 fS(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 fS(null,r,e,t)}function Kg(e={fill:"count"},t={}){let{x:r,y:n}=t;if([r,n]=Je(r,n),r==null)throw new Error("missing channel: x");if(n==null)throw new Error("missing channel: y");return fS(r,n,e,t)}function fS(e,t,{data:r=pS,filter:n,sort:i,reverse:o,...s}={},a={}){s=B4(s,a),r=U$(r,G),i=i==null?void 0:B$("sort",i,a),n=n==null?void 0:P$("filter",n,a);let[c,l]=en(e),[u,f]=en(t),{z:d,fill:h,stroke:p,x1:m,x2:y,y1:g,y2:x,...b}=a,[_,v]=en(d),[w]=qe(h),[S]=qe(p),[A,E]=en(w),[M,T]=en(S);return{..."z"in a&&{z:_||d},..."fill"in a&&{fill:A||h},..."stroke"in a&&{stroke:M||p},...mr(b,(R,k,I)=>{let N=tf(_t(R,e),I?.x),O=tf(_t(R,t),I?.y),L=_t(R,d),B=_t(R,w),C=_t(R,S),P=Jg(s,{z:L,fill:B,stroke:C}),U=[],$=[],X=N&&l([]),rt=O&&f([]),ot=L&&v([]),at=B&&E([]),Y=C&&T([]),st=0;for(let q of s)q.initialize(R);i&&i.initialize(R),n&&n.initialize(R);for(let q of k){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[Kt,Jt]of As(ht,N)){let tt={data:R};if(N&&(tt.x=Kt),O&&(tt.y=Pt),P&&(tt.z=nt),!(n&&!n.reduce(Jt,tt))){H.push(st++),$.push(r.reduceIndex(Jt,R,tt)),N&&X.push(Kt),O&&rt.push(Pt),L&&ot.push(P===L?nt:L[Jt[0]]),B&&at.push(P===B?nt:B[Jt[0]]),C&&Y.push(P===C?nt:C[Jt[0]]);for(let ge of s)ge.reduce(Jt,tt);i&&i.reduce(Jt,tt)}}U.push(H)}return P4(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:k})=>[R,k]))}}function Es(e,...t){for(let{name:r}of e)if(t.includes(r))return!0;return!1}function C4(e,t,r=dS){let n=Object.entries(e);return t.title!=null&&e.title===void 0&&n.push(["title",iit]),t.href!=null&&e.href===void 0&&n.push(["href",mS]),n.filter(([,i])=>i!==void 0).map(([i,o])=>o===null?Jnt(i):r(i,o,t))}function dS(e,t,r,n=hS){let i;Pr(t)&&"reduce"in t&&(i=t.scale,t=t.reduce);let o=n(e,t,r),[s,a]=Ur(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 Jnt(e){return{name:e,initialize(){},scope(){},reduce(){}}}function hS(e,t,r,n=Th){let i=iS(e,r),o=n(t,i),s,a;return{label:rn(o===Qg?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?Zr(e,r=>t[r]):[[,e]]}function Th(e,t,r=tit){if(e==null)return r(e);if(typeof e.reduceIndex=="function")return e;if(typeof e.reduce=="function"&&Pr(e))return rit(e);if(typeof e=="function")return nit(e);if(/^p\d{2}$/i.test(e))return Ka(bh(e));switch(`${e}`.toLowerCase()){case"first":return mS;case"last":return oit;case"identity":return pS;case"count":return Qg;case"distinct":return sit;case"sum":return t==null?Qg:ait;case"proportion":return C$(t,"data");case"proportion-facet":return C$(t,"facet");case"deviation":return Ka(zi);case"min":return Ka(Qt);case"min-index":return Ka(X_);case"max":return Ka(Xt);case"max-index":return Ka(G_);case"mean":return k$(Aa);case"median":return k$(Eo);case"variance":return Ka(Pc);case"mode":return Ka(Md)}return r(e)}function tit(e){throw new Error(`invalid reduce: ${e}`)}function B4(e,t){return C4(e,t,B$)}function B$(e,t,r){return dS(e,t,r,P$)}function P$(e,t,r){return hS(e,t,r,U$)}function U$(e,t){return Th(e,t,eit)}function eit(e){switch(`${e}`.toLowerCase()){case"x":return cit;case"y":return lit;case"z":return U4}throw new Error(`invalid group reduce: ${e}`)}function Jg(e,t){for(let r in t){let n=t[r];if(n!==void 0&&!e.some(i=>i.name===r))return n}}function P4(e,t,r){if(t){let n=t.output.transform(),i=(o,s)=>Br(n[o],n[s]);e.forEach(o=>o.sort(i))}r&&e.forEach(n=>n.reverse())}function rit(e){return console.warn("deprecated reduce interface; implement reduceIndex instead."),{...e,reduceIndex:e.reduce.bind(e)}}function nit(e){return{reduceIndex(t,r,n){return e(Xg(r,t),n)}}}function Ka(e){return{reduceIndex(t,r){return e(t,n=>r[n])}}}function k$(e){return{reduceIndex(t,r){let n=e(t,i=>r[i]);return Ve(r)?new Date(n):n}}}var pS={reduceIndex(e,t){return Xg(t,e)}},mS={reduceIndex(e,t){return t[e[0]]}},iit={reduceIndex(e,t){let n=Ia(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`,wr(o,ol)]}return i.map(([o,s])=>`${o} (${s.toLocaleString("en-US")})`).join(`
16
+ `)}},oit={reduceIndex(e,t){return t[e[e.length-1]]}},Qg={label:"Frequency",reduceIndex(e){return e.length}},sit={label:"Distinct",reduceIndex(e,t){let r=new Tn;for(let n of e)r.add(t[n]);return r.size}},ait=Ka(wr);function C$(e,t){return e==null?{scope:t,label:"Frequency",reduceIndex:(r,n,i=1)=>r.length/i}:{scope:t,reduceIndex:(r,n,i=1)=>wr(r,o=>n[o])/i}}var cit={reduceIndex(e,t,{x:r}){return r}},lit={reduceIndex(e,t,{y:r}){return r}},U4={reduceIndex(e,t,{z:r}){return r}};function $$(e){if(typeof e!="function")throw new Error(`invalid test function: ${e}`);return{reduceIndex(t,r,{data:n}){return r[t.find(Zn(n)?i=>e(n[i],i,n):i=>e(n.get(i),i,n))]}}}function Ah(e,{scale:t,type:r,value:n,filter:i,hint:o,label:s=rn(n)},a){return o===void 0&&typeof n?.transform=="function"&&(o=n.hint),z4(a,{scale:t,type:r,value:_t(e,n),label:s,filter:i,hint:o})}function yS(e,t){return Object.fromEntries(Object.entries(e).map(([r,n])=>[r,Ah(t,n,r)]))}function Eh(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:Ht(o,s)]}));return r.channels=e,r}function z4(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&&sS(n,ll)?null:"color",t.defaultScale="color";break;case"fillOpacity":case"strokeOpacity":case"opacity":t.scale=r!==!0&&sS(n,w$)?null:"opacity",t.defaultScale="opacity";break;case"symbol":r!==!0&&sS(n,N$)?(t.scale=null,t.value=Ht(n,Ih)):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 j$(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")?V$:q$:dit(f),h==null||h===!1)continue;let y=l==="fx"||l==="fy"?fit(t,n[l]):uit(r,l);if(!y)throw new Error(`missing channel for scale: ${l}`);let g=y.value,[x=0,b=1/0]=Bn(p)?p:p<0?[p]:[0,p];if(u==null)y.domain=()=>{let _=Array.from(new Tn(g));return d&&(_=_.reverse()),(x!==0||b!==1/0)&&(_=_.slice(x,b)),_};else{let _=u==="data"?e:u==="height"?z$(r,"y1","y2"):u==="width"?z$(r,"x1","x2"):$4(r,u,u==="y"?"y2":u==="x"?"x2":void 0),v=Th(h===!0?"max":h,_);y.domain=()=>{let w=fM(Cn(g),S=>v.reduceIndex(S,_),S=>g[S]);return f&&w.sort(f),d&&w.reverse(),(x!==0||b!==1/0)&&(w=w.slice(x,b)),w.map(Ju)}}}}function uit(e,t){for(let r in e){let n=e[r];if(n.scale===t)return n}}function fit(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 z$(e,t,r){let n=$4(e,t),i=$4(e,r);return Ht(i,(o,s)=>Math.abs(o-n[s]),Float64Array)}function $4(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 dit(e){if(e==null||typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"ascending":return q$;case"descending":return V$}throw new Error(`invalid order: ${e}`)}function q$([e,t],[r,n]){return Br(t,n)||Br(e,r)}function V$([e,t],[r,n]){return Qu(t,n)||Br(e,r)}function t0(e,t){let r=e[t];if(r){for(;r.source;)r=r.source;return r.source===null?null:r}}var H$=new Map([["accent",A6],["category10",T6],["dark2",E6],["observable10",M6],["paired",N6],["pastel1",O6],["pastel2",R6],["set1",D6],["set2",L6],["set3",F6],["tableau10",k6]]);function Q$(e){return e!=null&&H$.has(`${e}`.toLowerCase())}var Y$=new Map([...H$,["brbg",Ja(Lv,Fv)],["prgn",Ja(kv,Cv)],["piyg",Ja(Bv,Pv)],["puor",Ja(Uv,$v)],["rdbu",Ja(Sg,oh)],["rdgy",Ja(zv,jv)],["rdylbu",Ja(Ig,sh)],["rdylgn",Ja(qv,Vv)],["spectral",Ja(Yv,Wv)],["burd",W$(Sg,oh)],["buylrd",W$(Ig,sh)],["blues",$r(g2,x2)],["greens",$r(b2,_2)],["greys",$r(w2,v2)],["oranges",$r(E2,M2)],["purples",$r(S2,I2)],["reds",$r(T2,A2)],["turbo",tc(B2)],["viridis",tc(U2)],["magma",tc($2)],["inferno",tc(z2)],["plasma",tc(j2)],["cividis",tc(N2)],["cubehelix",tc(O2)],["warm",tc(D2)],["cool",tc(L2)],["bugn",$r(Gv,Xv)],["bupu",$r(Hv,Qv)],["gnbu",$r(Zv,Kv)],["orrd",$r(Jv,t2)],["pubu",$r(n2,i2)],["pubugn",$r(e2,r2)],["purd",$r(o2,s2)],["rdpu",$r(a2,c2)],["ylgn",$r(f2,d2)],["ylgnbu",$r(l2,u2)],["ylorbr",$r(h2,p2)],["ylorrd",$r(m2,y2)],["rainbow",G$(F2)],["sinebow",G$(C2)]]);function $r(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 Ja(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 W$(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 tc(e){return({length:t})=>cn(e,Math.max(2,Math.floor(t)))}function G$(e){return({length:t})=>cn(e,Math.floor(t)+1).slice(0,-1)}function j4(e){let t=`${e}`.toLowerCase();if(!Y$.has(t))throw new Error(`unknown ordinal scheme: ${t}`);return Y$.get(t)}function e0(e,t){let r=j4(e),n=typeof r=="function"?r({length:t}):r;return n.length!==t?n.slice(0,t):n}function Z$(e,t="greys"){let r=new Set,[n,i]=e0(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 X$=new Map([["brbg",Fv],["prgn",Cv],["piyg",Pv],["puor",$v],["rdbu",oh],["rdgy",jv],["rdylbu",sh],["rdylgn",Vv],["spectral",Wv],["burd",e=>oh(1-e)],["buylrd",e=>sh(1-e)],["blues",x2],["greens",_2],["greys",v2],["purples",I2],["reds",A2],["oranges",M2],["turbo",B2],["viridis",U2],["magma",$2],["inferno",z2],["plasma",j2],["cividis",N2],["cubehelix",O2],["warm",D2],["cool",L2],["bugn",Xv],["bupu",Qv],["gnbu",Kv],["orrd",t2],["pubugn",r2],["pubu",i2],["purd",s2],["rdpu",c2],["ylgnbu",u2],["ylgn",d2],["ylorbr",p2],["ylorrd",y2],["rainbow",F2],["sinebow",C2]]);function Mh(e){let t=`${e}`.toLowerCase();if(!X$.has(t))throw new Error(`unknown quantitative scheme: ${t}`);return X$.get(t)}var hit=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function K$(e){return e!=null&&hit.has(`${e}`.toLowerCase())}var V4=e=>t=>e(1-t),q4=[0,1],J$=new Map([["number",Fe],["rgb",ji],["hsl",BM],["hcl",PM],["lab",yw]]);function Y4(e){let t=`${e}`.toLowerCase();if(!J$.has(t))throw new Error(`unknown interpolator: ${t}`);return J$.get(t)}function Oh(e,t,r,{type:n,nice:i,clamp:o,zero:s,domain:a=az(e,r),unknown:c,round:l,scheme:u,interval:f,range:d=_e.get(e)===ef?git(r,a):_e.get(e)===rf?xit(r,a):_e.get(e)===nf?q4:void 0,interpolate:h=_e.get(e)===_i?u==null&&d!==void 0?ji:Mh(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=Y4(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=V4(h),p=!1),d===void 0&&(d=Float64Array.from(a,(m,y)=>y/(a.length-1)),d.length===2&&(d=q4)),t.interpolate((d===q4?Ye:r0)(h))):t.interpolate(h),s){let[m,y]=ce(a);(m>0||y<0)&&(a=sl(a),(Wa(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(pit(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 pit(e,t){return e===!0?void 0:typeof e=="number"?e:m$(e,t)}function tz(e,t,r){return Oh(e,Ca(),t,r)}function ez(e,t,r){return W4(e,t,{...r,exponent:.5})}function W4(e,t,{exponent:r=1,...n}){return Oh(e,dg().exponent(r),t,{...n,type:"pow"})}function rz(e,t,{base:r=10,domain:n=bit(t),...i}){return Oh(e,ug().base(r),t,{...i,domain:n})}function nz(e,t,{constant:r=1,...n}){return Oh(e,fg().constant(r),t,n)}function iz(e,t,{range:r,quantiles:n=r===void 0?5:(r=[...r]).length,n:i=n,scheme:o="rdylbu",domain:s=_it(t),unknown:a,interpolate:c,reverse:l}){return r===void 0&&(r=c!==void 0?cn(c,i):_e.get(e)===_i?e0(o,i):void 0),s.length>0&&(s=hg(s,r===void 0?{length:i}:r).quantiles()),gS(e,t,{domain:s,range:r,reverse:l,unknown:a})}function oz(e,t,{range:r,n=r===void 0?5:(r=[...r]).length,scheme:i="rdylbu",domain:o=az(e,t),unknown:s,interpolate:a,reverse:c}){let[l,u]=ce(o),f;return r===void 0?(f=Kr(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?e0(i,n):void 0):(f=cn(Fe(l,u),n+1).slice(1,-1),l instanceof Date&&(f=f.map(d=>new Date(d)))),Wa(xi(o))<0&&f.reverse(),gS(e,t,{domain:f,range:r,reverse:c,unknown:s})}function gS(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?e0(i,r.length+1):void 0,reverse:a}){r=xi(r);let c=Wa(r);if(!isNaN(c)&&!mit(r,c))throw new Error(`the ${e} scale has a non-monotonic domain`);return a&&(s=$c(s)),{type:"threshold",scale:pg(c<0?$c(r):r,s===void 0?[]:s).unknown(n),domain:r,range:s}}function mit(e,t){for(let r=1,n=e.length,i=e[0];r<n;++r){let o=Sn(i,i=e[r]);if(o!==0&&o!==t)return!1}return!0}function sz(e){return{type:"identity",scale:M$(_e.get(e))?cg():t=>t}}function Nh(e,t=ph){return e.length?[Qt(e,({value:r})=>r===void 0?r:Qt(r,t)),Xt(e,({value:r})=>r===void 0?r:Xt(r,t))]:[0,1]}function az(e,t){let r=_e.get(e);return(r===ef||r===nf||r===rf?yit:Nh)(t)}function yit(e){return[0,e.length?Xt(e,({value:t})=>t===void 0?t:Xt(t,ph)):1]}function git(e,t){let r=e.find(({radius:s})=>s!==void 0);if(r!==void 0)return[0,r.radius];let n=An(e,.5,({value:s})=>s===void 0?NaN:An(s,.25,kn)),i=t.map(s=>3*Math.sqrt(s/n)),o=30/Xt(i);return o<1?i.map(s=>s*o):i}function xit(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/Xt(n);return i<1?n.map(o=>o*i):n}function bit(e){for(let{value:t}of e)if(t!==void 0)for(let r of t){if(r>0)return Nh(e,kn);if(r<0)return Nh(e,tl)}return[1,10]}function _it(e){let t=[];for(let{value:r}of e)if(r!==void 0)for(let n of r)t.push(n);return t}function r0(e){return(t,r)=>n=>e(t+n*(r-t))}var G4=0,X4;function cz(){let e=G4;return G4=0,X4=void 0,e}function mn(e){e!==X4&&(X4=e,console.warn(e),++G4)}function xS(e,t,r,n,{type:i,nice:o,clamp:s,domain:a=Nh(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:Mh(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.`),Sn(m,y)<0&&([m,y]=[y,m],p=!p),m=Math.min(m,l),y=Math.max(y,l),typeof h!="function"&&(h=Y4(h)),f!==void 0&&(h=h.length===1?r0(h)(...f):ss(h,f)),p&&(h=V4(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 lz(e,t,r){return xS(e,vg(),wit,t,r)}function uz(e,t,r){return H4(e,t,{...r,exponent:.5})}function H4(e,t,{exponent:r=1,...n}){return xS(e,Dv().exponent(r=+r),Iit(r),t,{...n,type:"diverging-pow"})}function fz(e,t,{base:r=10,pivot:n=1,domain:i=Nh(t,n<0?tl:kn),...o}){return xS(e,Ov().base(r=+r),vit,t,{domain:i,pivot:n,...o})}function dz(e,t,{constant:r=1,...n}){return xS(e,Rv().constant(r=+r),Tit(r),t,n)}var wit={apply(e){return e},invert(e){return e}},vit={apply:Math.log,invert:Math.exp},Sit={apply(e){return Math.sign(e)*Math.sqrt(Math.abs(e))},invert(e){return Math.sign(e)*(e*e)}};function Iit(e){return e===.5?Sit:{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 Tit(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 hz(e,t,r,n){return Oh(e,t,r,n)}function pz(e,t,r){return hz(e,Ev(),t,r)}function mz(e,t,r){return hz(e,Mv(),t,r)}var Rh=Symbol("ordinal");function gz(e,t,r,{type:n,interval:i,domain:o,range:s,reverse:a,hint:c}){return i=Is(i,n),o===void 0&&(o=vz(r,i,e)),(n==="categorical"||n===Rh)&&(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 xz(e,t,{type:r,interval:n,domain:i,range:o,scheme:s,unknown:a,...c}){n=Is(n,r),i===void 0&&(i=vz(t,n,e));let l;if(_e.get(e)===Sh)l=Ait(t),o=o===void 0?Eit(l):Ht(o,Ih);else if(_e.get(e)===_i&&(o===void 0&&(r==="ordinal"||r===Rh)&&(o=Z$(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=Mh(s),f=o[0],d=o[1]-o[0];o=({length:h})=>cn(p=>u(f+d*p),h)}else o=j4(s);if(a===sg)throw new Error(`implicit unknown on ${e} scale is not supported`);return gz(e,zu().unknown(a),t,{...c,type:r,domain:i,range:o,hint:l})}function bz(e,t,{align:r=.5,padding:n=.5,...i}){return wz(l6().align(r).padding(n),t,i,e)}function _z(e,t,{align:r=.5,padding:n=.1,paddingInner:i=n,paddingOuter:o=e==="fx"||e==="fy"?0:n,...s}){return wz(Zc().align(r).paddingInner(i).paddingOuter(o),t,s,e)}function wz(e,t,r,n){let{round:i}=r;return i!==void 0&&e.round(i=!!i),e=gz(n,e,t,r),e.round=i,e}function vz(e,t,r){let n=new Tn;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 Ia(n,Br)}function yz(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 Ait(e){return{fill:yz(e,"fill"),stroke:yz(e,"stroke")}}function Eit(e){return fe(e.fill)?j6:X2}function n0(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],_=Oz(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:S,inset:A,insetTop:E=A!==void 0?A:g==="y"?n:0,insetRight:M=A!==void 0?A:g==="x"?i:0,insetBottom:T=A!==void 0?A:g==="y"?o:0,insetLeft:R=A!==void 0?A:g==="x"?s:0}=b||{};if(S==null)S=void 0;else if(typeof S!="function")throw new Error("invalid scale transform; not a function");_.percent=!!w,_.label=v===void 0?Mit(x,_):v,_.transform=S,g==="x"||g==="fx"?(_.insetLeft=+R,_.insetRight=+M):(g==="y"||g==="fy")&&(_.insetTop=+E,_.insetBottom=+T),y[g]=_}}return y}function Z4(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]=Dz(i),r[n]=o,o.type=s,a!=null&&(o.interval=a),c!=null&&(o.label=c)}return r}function Ez(e,t){let{x:r,y:n,fx:i,fy:o}=e,s=i||o?wS(t):t;i&&Sz(i,s),o&&Iz(o,s);let a=i||o?K4(e,t):t;r&&Sz(r,a),n&&Iz(n,a)}function Mit(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 _S(e){return Math.sign(Wa(e.domain()))*Math.sign(Wa(e.range()))}function wS(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 K4({fx:e,fy:t},r){let{marginTop:n,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=wS(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 Sz(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=Nz(e)),e.scale.range(e.range)}Mz(e)}function Iz(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=Nz(e),e.scale.range(e.range)}Mz(e)}function Mz(e){e.round===void 0&&Rit(e)&&Nit(e)<=30&&e.scale.round(!0)}function Nit({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 Nz(e){let t=e.scale.domain().length+J4(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 vS(e,t,r){return Oz(e,r===void 0?void 0:[{hint:r}],{...t})}function Oz(e,t=[],r={}){let n=Oit(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 "${Dh(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 "${Dh(n)}".`):i.some(b$)?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 "${Dh(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 "${Dh(n)}".`):i.some(_$)&&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 "${Dh(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 "${Dh(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=bS(t,r,pr);break;case"identity":switch(_e.get(e)){case Ji:r=bS(t,r,pr);break;case Sh:r=bS(t,r,Dit);break}break;case"utc":case"time":r=bS(t,r,b4);break}switch(n){case"diverging":return lz(e,t,r);case"diverging-sqrt":return uz(e,t,r);case"diverging-pow":return H4(e,t,r);case"diverging-log":return fz(e,t,r);case"diverging-symlog":return dz(e,t,r);case"categorical":case"ordinal":case Rh:return xz(e,t,r);case"cyclical":case"sequential":case"linear":return tz(e,t,r);case"sqrt":return ez(e,t,r);case"threshold":return gS(e,t,r);case"quantile":return iz(e,t,r);case"quantize":return oz(e,t,r);case"pow":return W4(e,t,r);case"log":return rz(e,t,r);case"symlog":return nz(e,t,r);case"utc":return mz(e,t,r);case"time":return pz(e,t,r);case"point":return bz(e,t,r);case"band":return _z(e,t,r);case"identity":return sz(e);case void 0:return;default:throw new Error(`unknown scale type: ${n}`)}}function Dh(e){return typeof e=="symbol"?e.description:e}function Tz(e){return typeof e=="string"?`${e}`.toLowerCase():e}var Az={toString:()=>"projection"};function Oit(e,t,{type:r,domain:n,range:i,scheme:o,pivot:s,projection:a}){if(r=Tz(r),e==="fx"||e==="fy")return"band";(e==="x"||e==="y")&&a!=null&&(r=Az);for(let l of t){let u=Tz(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===Az)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===Sh)return"ordinal";if((n||i||[]).length>2)return Q4(c);if(n!==void 0){if(Ue(n))return Q4(c);if(Ve(n))return"utc"}else{let l=t.map(({value:u})=>u).filter(u=>u!==void 0);if(l.some(Ue))return Q4(c);if(l.some(Ve))return"utc"}if(c===_i){if(s!=null||K$(o))return"diverging";if(Q$(o))return"categorical"}return"linear"}function Q4(e){switch(e){case Ji:return"point";case _i:return Rh;default:return"ordinal"}}function Ms({type:e}){return e==="ordinal"||e==="point"||e==="band"||e===Rh}function J4({type:e}){return e==="threshold"}function Rit({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 bS(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 Dit(e){return Ht(e,Ih)}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=Dz(vS(r,e[r]))}if(t===void 0)throw new Error("invalid scale definition; no scale found");return t}function Rz(e){return t=>{if(!_e.has(t=`${t}`))throw new Error(`unknown scale: ${t}`);return e[t]}}function Dz({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 Fz(e,t){let{fx:r,fy:n}=n0(e,t),i=r?.scale.domain(),o=n?.scale.domain();return i&&o?V_(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 kz(e,{x:t,y:r}){return t&&=iN(t),r&&=iN(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 IS(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 Cz(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 Bz(e){let t=[],r=new Uint32Array(wr(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 Lit=new Map([["top",tN],["right",nN],["bottom",eN],["left",rN],["top-left",SS(tN,rN)],["top-right",SS(tN,nN)],["bottom-left",SS(eN,rN)],["bottom-right",SS(eN,nN)],["top-empty",kit],["right-empty",Pit],["bottom-empty",Cit],["left-empty",Bit],["empty",Uit]]);function Pz(e){if(e==null)return null;let t=Lit.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid facet anchor: ${e}`)}var Lz=new WeakMap;function iN(e){let t=Lz.get(e);return t||Lz.set(e,t=new In(Ht(e,(r,n)=>[r,n]))),t}function hl(e,t){return iN(e).get(t)}function Fit(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 TS(e,t,r){return Fit(e,t,r)?.empty}function tN(e,{y:t},{y:r}){return t?hl(t,r)===0:!0}function eN(e,{y:t},{y:r}){return t?hl(t,r)===t.length-1:!0}function rN(e,{x:t},{x:r}){return t?hl(t,r)===0:!0}function nN(e,{x:t},{x:r}){return t?hl(t,r)===t.length-1:!0}function kit(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 TS(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=hl(t,n);if(o<t.length-1)return TS(e,r,t[o+1])}function Bit(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 TS(e,t[o-1],n)}function Pit(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 TS(e,t[o+1],n)}function Uit(e,t,{empty:r}){return r}function SS(e,t){return function(){return e.apply(null,arguments)&&t.apply(null,arguments)}}function AS(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 Uz=Math.PI,ec=2*Uz,oN=.618;function $z({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(Pr(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}=sN(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=$it(l,d,p,u-h,f-m);let x=d+o,b=p+r,_;if(c!=null){let[[v,w],[S,A]]=Fr(e).bounds(c),E=Math.min(y/(S-v),g/(A-w));E>0?(x-=(E*(v+S)-y)/2,b-=(E*(w+A)-g)/2,_=Pu({point(M,T){this.stream.point(M*E+x,T*E+b)}})):mn("Warning: the projection could not be fit to the specified domain; using the default scale.")}return _??=x===0&&b===0?zz():Pu({point(v,w){this.stream.point(v+x,w+b)}}),{stream:v=>e.stream(_.stream(l(v)))}}function sN(e){switch(`${e}`.toLowerCase()){case"albers-usa":return Ro(B3,.7463,.4673);case"albers":return ES(tg,.7463,.4673);case"azimuthal-equal-area":return Ro(U3,4,4);case"azimuthal-equidistant":return Ro(z3,ec,ec);case"conic-conformal":return ES(V3,ec,ec);case"conic-equal-area":return ES(Hc,6.1702,2.9781);case"conic-equidistant":return ES(W3,7.312,3.6282);case"equal-earth":return Ro(X3,5.4133,2.6347);case"equirectangular":return Ro(Y3,ec,Uz);case"gnomonic":return Ro(Q3,3.4641,3.4641);case"identity":return{type:zz};case"reflect-y":return{type:zit};case"mercator":return Ro(j3,ec,ec);case"orthographic":return Ro(K3,2,2);case"stereographic":return Ro(t6,2,2);case"transverse-mercator":return Ro(r6,ec,ec);default:throw new Error(`unknown projection type: ${e}`)}}function $it(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 Gd(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 ES(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 zz=Ye({stream:e=>e}),zit=Ye(Pu({point(e,t){this.stream.point(e,-t)}}));function aN(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 jz({projection:e}={}){return e==null?!1:typeof e.stream=="function"?!0:(Pr(e)&&(e=e.type),e!=null)}function qz(e){if(typeof e?.stream=="function")return oN;if(Pr(e)){let t,r;if({domain:t,type:e,...r}=e,t!=null&&e!=null){let n=typeof e=="string"?sN(e).type:e,[[i,o],[s,a]]=Fr(n({...r,width:100,height:100})).bounds(t),c=(a-o)/(s-i);return c&&isFinite(c)?c<.2?.2:c>5?5:c:oN}}if(e!=null){if(typeof e!="function"){let{aspectRatio:t}=sN(e);if(t)return t}return oN}}function Ns(e,t,{projection:r}){let{x:n,y:i}=e,o={};return n&&(o.x=n),i&&(o.y=i),o=Eh(o,t),r&&n?.scale==="x"&&i?.scale==="y"&&aN("x","y",o,r),n&&(o.x=pr(o.x)),i&&(o.y=pr(o.y)),o}function Vz(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:cS(r)}}function lt(e,{document:t}){return Zt(Ma(e).call(t.documentElement))}var MS=Symbol("unset");function ml(e){return(e.length===1?jit:qit)(e)}function jit(e){let t,r=MS;return n=>(Object.is(r,n)||(r=n,t=e(n)),t)}function qit(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 Vit=ml(e=>new Intl.NumberFormat(e)),Yit=ml((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{month:t}})),Wit=ml((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{weekday:t}}));function cN(e="en-US"){let t=Vit(e);return r=>r!=null&&!isNaN(r)?t.format(r):void 0}function Yz(e="en-US",t="short"){let r=Yit(e,t);return n=>n!=null&&!isNaN(n=+new Date(Date.UTC(2e3,+n)))?r.format(n):void 0}function Wz(e="en-US",t="short"){let r=Wit(e,t);return n=>n!=null&&!isNaN(n=+new Date(Date.UTC(2001,0,+n)))?r.format(n):void 0}function lN(e){return mh(e,"Invalid Date")}function Git(e="en-US"){let t=cN(e);return r=>(r instanceof Date?lN:typeof r=="number"?t:nr)(r)}var Os=Git();var We=(typeof window<"u"?window.devicePixelRatio>1:typeof it>"u")?0:.5,Xit=0,Hit=0;function uN(){return`plot-clip-${++Xit}`}function Gz(){return`plot-pattern-${++Hit}`}function NS(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:S},{ariaLabel:A,fill:E="currentColor",fillOpacity:M,stroke:T="none",strokeOpacity:R,strokeWidth:k,strokeLinecap:I,strokeLinejoin:N,strokeMiterlimit:O,paintOrder:L}){E===null&&(a=null,c=null),T===null&&(l=null,f=null),fe(E)?!fe(T)&&(!fe(a)||S?.fill)&&(T="none"):fe(T)&&(!fe(l)||S?.stroke)&&(E="none");let[B,C]=qe(a,E),[P,U]=ye(c,M),[$,X]=qe(l,T),[rt,ot]=ye(f,R),[at,Y]=ye(g);Za(X)||(u===void 0&&(u=k),h===void 0&&(h=I),d===void 0&&(d=N),p===void 0&&!v$(d)&&(p=O),!Za(C)&&_===void 0&&(_=L));let[st,q]=ye(u);return E!==null&&(e.fill=Oe(C,"currentColor"),e.fillOpacity=i0(U,1)),T!==null&&(e.stroke=Oe(X,"none"),e.strokeWidth=i0(q,1),e.strokeOpacity=i0(ot,1),e.strokeLinejoin=Oe(d,"miter"),e.strokeLinecap=Oe(h,"butt"),e.strokeMiterlimit=i0(p,4),e.strokeDasharray=Oe(m,"none"),e.strokeDashoffset=Oe(y,"0")),e.target=nr(s),e.ariaLabel=nr(A),e.ariaDescription=nr(i),e.ariaHidden=nr(o),e.opacity=i0(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 Qit(e,t){t&&e.filter(r=>jg(t[r])).append("title").call(Kit,t)}function Zit(e,t){t&&e.filter(([r])=>jg(t[r])).append("title").call(Jit,t)}function Kit(e,t){t&&e.text(r=>Os(t[r]))}function Jit(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&&Hz(e,d=>f[d],t),r||Qit(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&&Hz(e,([d])=>f[d],t),r||Zit(e,i)}function tot({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 o0(e,t,r){let n=Zr(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*OS(e,t,r,n){let{z:i}=r,{z:o}=n,s=tot(n,r),a=[...t,...s];for(let c of o?o0(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 eot(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=rot(n,r);break}case"sphere":{i=not(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 Xz(e){let t=new WeakMap;return(r,n)=>{let i=t.get(r);if(!i){let o=uN();Zt(r.ownerSVGElement).append("clipPath").attr("id",o).call(e,r,n),t.set(r,i=`url(#${o})`)}return i}}var rot=Xz((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)}),not=Xz((e,t)=>{let{projection:r}=t;if(!r)throw new Error('the "sphere" clip option requires a projection');e.append("path").attr("d",Fr(r)({type:"Sphere"}))});function Ct(e,t,r,n){eot(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){iot(e,"mix-blend-mode",t.mixBlendMode),dt(e,"opacity",t.opacity)}function Hz(e,t,r){e.each(function(n){let i=t(n);if(i!=null){let o=this.ownerDocument.createElementNS(En.svg,"a");o.setAttribute("fill","inherit"),o.setAttributeNS(En.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 iot(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=nr(e))!==t)return e}function i0(e,t){if((e=ie(e))!==t)return e}var oot=/^-?([_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}`,!oot.test(e))throw new Error(`invalid class name: ${e}`);return e}function Lh(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 zr({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=Ir(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=Pz(s),r=Hg(r),b!==void 0&&(r={...sot(b),...r}),i!==void 0&&(r={...NS(this,n,i),...r}),this.channels=Object.fromEntries(Object.entries(r).map(([w,S])=>{if(bi(S.value)){let{value:A,label:E=S.label,scale:M=S.scale}=S.value;S={...S,label:E,scale:M,value:A}}if(t===il&&typeof S.value=="string"){let{value:A}=S;S={...S,value:[A]}}return[w,S]}).filter(([w,{value:S,optional:A}])=>{if(S!=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=cS(x),this.tip=aot(_),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:S}=r[w];if(!(S!=="x"&&S!=="y"))throw new Error("super-faceting cannot use x or y")}}v!=null&&(this.render=rc(v,this.render))}initialize(t,r,n){let i=Ga(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=Ga(i)),t!==void 0&&(t.original=o);let s=yS(this.channels,i);return this.sort!=null&&j$(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"&&aN(i,o,r,n.projection)}}scale(t,r,n){let i=Eh(t,r);return n.projection&&this.project(t,i,n),i}};function yr(...e){return e.plot=vt.prototype.plot,e}function rc(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 sot(e){return Object.fromEntries(Object.entries(Hg(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 aot(e){return e===!0?"xy":e===!1||e==null?null:typeof e=="string"?Ir(e,"tip",["x","y","xy"]):e}function Do(e,t){return e?.tip===!0?{...e,tip:t}:Pr(e?.tip)&&e.tip.pointer===void 0?{...e,tip:{...e.tip,pointer:t}}:e}function Zz(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=cot(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 cot({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=qz(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=Qz("y",t)/(Qz("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 Qz(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 Kz=new WeakMap;function fN(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:rc(function(u,f,d,h,p,m){p={...p,pointerSticky:!1};let y=p.ownerSVGElement,{data:g}=p.getMarkState(this),x=Kz.get(y);x||Kz.set(y,x={sticky:!1,roots:[],renders:[]});let b=x.renders.push(X)-1,{x:_,y:v,fx:w,fy:S}=f,A=w?w(u.fx)-h.marginLeft:0,E=S?S(u.fy)-h.marginTop:0;_?.bandwidth&&(A+=_.bandwidth()/2),v?.bandwidth&&(E+=v.bandwidth()/2);let M=u.fi!=null,T;if(M){let Y=x.facetStates;Y||(x.facetStates=Y=new Map),T=Y.get(this),T||Y.set(this,T=new Map)}let[R,k]=zr(this,h),{px:I,py:N}=d,O=I?Y=>I[Y]:dN(d,R),L=N?Y=>N[Y]:hN(d,k),B,C,P,U;function $(Y,st){if(M)if(U&&(U=cancelAnimationFrame(U)),Y==null)T.delete(u.fi);else{T.set(u.fi,st),U=requestAnimationFrame(()=>{U=null;for(let[q,H]of T)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];M&&(st.fx=u.fx,st.fy=u.fy,st.fi=u.fi);let q=m(st,f,d,h,p);if(C){if(M){let H=C.parentNode,nt=C.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")}C.replaceWith(q)}if(x.roots[b]=C=q,!(B==null&&T?.size>1)){let H=B==null?null:Zn(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 Kt=H*(O(ht)-st),Jt=nt*(L(ht)-q),tt=Kt*Kt+Jt*Jt;tt<=Pt&&(z=ht,Pt=tt)}if(z!=null&&(e!==1||t!==1)){let ht=O(z)-st,Kt=L(z)-q;Pt=ht*ht+Kt*Kt}$(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 fN(1,1,e)}function xl(e){return fN(1,.01,e)}function nc(e){return fN(.01,1,e)}function dN({x1:e,x2:t,x:r=e},n){return e&&t?i=>(e[i]+t[i])/2:r?i=>r[i]:()=>n}function hN({y1:e,y2:t,y:r=e},n){return e&&t?i=>(e[i]+t[i])/2:r?i=>r[i]:()=>n}function RS(e){return Ms(e)&&e.interval===void 0?void 0:"tabular-nums"}function Jz(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=RS(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) {
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(Lh,u),b=R=>R.selectAll(".tick line").attr("y1",s+c-o),_,v=p?(R,k)=>R.rangeRound(k):(R,k)=>R.range(k),{type:w,domain:S,range:A,interpolate:E,scale:M,pivot:T}=e;if(E){let R=A===void 0?E:ss(E.length===1?r0(E):E,A);_=v(M.copy(),cn(Fe(l,i-a),Math.min(S.length+(T!==void 0),A===void 0?1/0:A.length)));let k=256,I=g.document.createElement("canvas");I.width=k,I.height=1;let N=I.getContext("2d");for(let O=0,L=k-1;O<k;++O)N.fillStyle=R(O/L),N.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",I.toDataURL())}else if(w==="threshold"){let R=S,k=d===void 0?I=>I:typeof d=="string"?Yi(d):d;_=v(Ca().domain([-1,A.length-1]),[l,i-a]),x.append("g").attr("fill-opacity",m).selectAll().data(A).enter().append("rect").attr("x",(I,N)=>_(N-1)).attr("y",s).attr("width",(I,N)=>_(N)-_(N-1)).attr("height",o-s-c).attr("fill",I=>I),f=Ht(R,(I,N)=>N),d=I=>k(R[I],I)}else _=v(Zc().domain(S),[l,i-a]),x.append("g").attr("fill-opacity",m).selectAll().data(S).enter().append("rect").attr("x",_).attr("y",s).attr("width",Math.max(0,_.bandwidth()-1)).attr("height",o-s-c).attr("fill",M),b=()=>{};return x.append("g").attr("transform",`translate(0,${o-c})`).call(xM(_).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 Fh=Math.PI/180;function Lo(e,{marker:t,markerStart:r=t,markerMid:n=t,markerEnd:i=t}={}){e.markerStart=pN(r),e.markerMid=pN(n),e.markerEnd=pN(i)}function pN(e){if(e==null||e===!1)return null;if(e===!0)return ej;if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"none":return null;case"arrow":return tj("auto");case"arrow-reverse":return tj("auto-start-reverse");case"dot":return lot;case"circle":case"circle-fill":return ej;case"circle-stroke":return uot;case"tick":return mN("auto");case"tick-x":return mN(90);case"tick-y":return mN(0)}throw new Error(`invalid marker: ${e}`)}function tj(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 lot(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 ej(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 uot(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 mN(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 fot=0;function ic(e,t,{stroke:r},n){return ij(e,t,r&&(i=>r[i]),null,n)}function rj(e,t,{stroke:r,z:n},i){return ij(e,t,r&&(([o])=>r[o]),n,i)}var yN=1,nj=2;function dot(e,t){let r=new Uint8Array(t.length),n=e.data().filter(o=>o.length>1),i=n.length;for(let o=0,s=MS;o<i;++o){let a=n[o];if(a.length>1){let c=a[0];s!==(s=Zi(t[c]))&&(r[c]|=yN)}}for(let o=i-1,s=MS;o>=0;--o){let a=n[o];if(a.length>1){let c=a[0];s!==(s=Zi(t[c]))&&(r[c]|=nj)}}return([o])=>r[o]}function ij(e,{markerStart:t,markerMid:r,markerEnd:n,stroke:i},o=()=>i,s,a){if(!t&&!r&&!n)return;let c=new Map,l=s&&dot(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-${++fot}`;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)&yN))),r&&l&&e.each(u("marker-start",r,f=>!(l(f)&yN))),r&&e.each(u("marker-mid",r)),n&&e.each(u("marker-end",n,l&&(f=>l(f)&nj)))}function sf({inset:e,insetLeft:t,insetRight:r,...n}={}){return[t,r]=oj(e,t,r),{inset:e,insetLeft:t,insetRight:r,...n}}function af({inset:e,insetTop:t,insetBottom:r,...n}={}){return[t,r]=oj(e,t,r),{inset:e,insetTop:t,insetBottom:r,...n}}function oj(e,t,r){return e===void 0&&t===void 0&&r===void 0?We?[1,0]:[.5,.5]:[t,r]}function sj(e,{interval:t}){return e={...Ki(e)},e.interval=vh(e.interval===void 0?t:e.interval),e}function DS(e,t,r,n){let{[e]:i,[`${e}1`]:o,[`${e}2`]:s}=r,{value:a,interval:c}=sj(i,r);if(a==null||c==null&&!n)return r;let l=rn(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=Ht(_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 aj(e,t,r){let{[e]:n}=r,{value:i,interval:o}=sj(n,r);return i==null||o==null?r:t({...r,[e]:{label:rn(n),transform:s=>{let a=Ht(_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 gN(e={}){return DS("x",sf,e,!0)}function xN(e={}){return DS("y",af,e,!0)}function kh(e={}){return DS("x",sf,e)}function Ch(e={}){return DS("y",af,e)}function LS(e={}){return aj("x",sf,e)}function FS(e={}){return aj("y",af,e)}var cj={ariaLabel:"rule",fill:null,stroke:"currentColor"},s0=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"),cj),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(Ct,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(ic,this,n,o)).node()}},a0=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"),cj),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(Ct,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(ic,this,n,o)).node()}};function vi(e,t){let{x:r=G,y:n,y1:i,y2:o,...s}=Ch(t);return[i,o]=lj(n,i,o),new s0(e,{...s,x:r,y1:i,y2:o})}function Si(e,t){let{y:r=G,x:n,x1:i,x2:o,...s}=kh(t);return[i,o]=lj(n,i,o),new a0(e,{...s,y:r,x1:i,x2:o})}function lj(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 hot={ariaLabel:"text",strokeLinejoin:"round",strokeWidth:3,paintOrder:"stroke"},pj="\xAD",lf=class extends vt{constructor(t,r={}){let{x:n,y:i,text:o=Bn(t)&&oS(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]=got(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:g$(b),optional:!0},text:{value:o,filter:jg,optional:!0}},r,hot),this.rotate=_,this.textAnchor=Oe(a,"middle"),this.lineAnchor=Ir(c,"lineAnchor",["top","middle","bottom"]),this.lineHeight=+l,this.lineWidth=+u,this.textOverflow=_N(f),this.monospace=!!d,this.fontFamily=nr(h),this.fontSize=w,this.fontStyle=nr(m),this.fontVariant=nr(y),this.fontWeight=nr(g),this.frameAnchor=Ts(s),!(this.lineWidth>=0))throw new Error(`invalid lineWidth: ${u}`);this.splitLines=vN(this),this.clipLine=SN(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]=zr(this,i);return lt("svg:g",o).call(Ct,this,i,o).call(wN,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(pot,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 _N(e){return e==null?null:Ir(e,"textOverflow",["clip","ellipsis","clip-start","clip-end","ellipsis-start","ellipsis-middle","ellipsis-end"]).replace(/^(clip|ellipsis)$/,"$1-end")}function pot(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(En.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(En.svg,"title");h.textContent=r[l],this.appendChild(h)}})}function Rs(e,{x:t,y:r,...n}={}){return n.frameAnchor===void 0&&([t,r]=Je(t,r)),new lf(e,{...n,x:t,y:r})}function kS(e,{x:t=G,...r}={}){return new lf(e,FS({...r,x:t}))}function CS(e,{y:t=G,...r}={}){return new lf(e,LS({...r,y:t}))}function wN(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?mot(r):t.fontVariant),dt(e,"font-weight",t.fontWeight)}function mot(e){return e&&(Qa(e)||Ve(e))?"tabular-nums":void 0}var yot=new Set(["inherit","initial","revert","unset","xx-small","x-small","small","medium","large","x-large","xx-large","xxx-large","larger","smaller"]);function got(e){return e==null||typeof e=="number"?[void 0,e]:typeof e!="string"?[e,void 0]:(e=e.trim().toLowerCase(),yot.has(e)||/^[+-]?\d*\.?\d+(e[+-]?\d+)?(\w*|%)$/.test(e)?[void 0,e]:[e,void 0])}function xot(e,t,r){let n=[],i,o=0;for(let[s,a,c]of bot(e)){if(i===void 0&&(i=s),o>i&&r(e,i,a)>t&&(n.push(e.slice(i,o)+(e[o-1]===pj?"-":"")),i=s),c){n.push(e.slice(i,a)),i=void 0;continue}o=a}return n}function*bot(e){let t=0,r=0,n=e.length;for(;r<n;){let i=1;switch(e[r]){case pj: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 uj={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 BS(e,t=0,r=e.length){let n=0;for(let i=t;i<r;i=Bh(e,i))n+=uj[e[i]]??(yj(e,i)?120:uj.e);return n}function PS(e,t=0,r=e.length){let n=0;for(let i=t;i<r;i=Bh(e,i))n+=yj(e,i)?126:63;return n}function vN({monospace:e,lineWidth:t,textOverflow:r}){if(r!=null||t==1/0)return o=>o.split(/\r\n?|\n/g);let n=e?PS:BS,i=t*100;return o=>xot(o,i,n)}function SN({monospace:e,lineWidth:t,textOverflow:r}){if(r==null||t==1/0)return o=>o;let n=e?PS:BS,i=t*100;switch(r){case"clip-start":return o=>dj(o,i,n,"");case"clip-end":return o=>fj(o,i,n,"");case"ellipsis-start":return o=>dj(o,i,n,cf);case"ellipsis-middle":return o=>_ot(o,i,n,cf);case"ellipsis-end":return o=>fj(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=Bh(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 fj(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 _ot(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(Bh(e,c)).trimStart()}function dj(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(Bh(e,s)).trimStart()}var bN=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,hj=/\p{Extended_Pictographic}/uy;function Bh(e,t){return t+=wot(e,t)?2:1,Sot(e,t)&&(t=bN.lastIndex),vot(e,t)?Bh(e,t+1):t}function mj(e,t){return e.charCodeAt(t)<128}function wot(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 vot(e,t){return e.charCodeAt(t)===8205}function Sot(e,t){return mj(e,t)?!1:(bN.lastIndex=t,bN.test(e))}function yj(e,t){return mj(e,t)?!1:(hj.lastIndex=t,hj.test(e))}var gj={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},xj=3.5,Iot=xj*5,bj={draw(e,t,r){let n=t*r/Iot;e.moveTo(0,0),e.lineTo(0,-t),e.moveTo(-n,n-t),e.lineTo(0,-t),e.lineTo(n,n-t)}},_j={draw(e,t,r){e.moveTo(-r,0),e.lineTo(0,-t),e.lineTo(r,0)}},Tot=new Map([["arrow",bj],["spike",_j]]);function Aot(e){return e&&typeof e.draw=="function"}function Eot(e){if(Aot(e))return e;let t=Tot.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=xj,length:s,rotate:a,shape:c=bj,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,gj),this.r=+o,this.length=d,this.rotate=p,this.shape=Eot(c),this.anchor=Ir(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]=zr(this,i);return lt("svg:g",o).call(Ct,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=On();return m.draw(v,u[_],y),v}:(()=>{let _=On();return m.draw(_,d,y),_})()).call(Wt,this,n)).node()}};function IN(e,t={}){let{x:r,y:n,...i}=t;return t.frameAnchor===void 0&&([r,n]=Je(r,n)),new ff(e,{...i,x:r,y:n})}function US(e,t={}){let{x:r=G,...n}=t;return new ff(e,{...n,x:r})}function $S(e,t={}){let{y:r=G,...n}=t;return new ff(e,{...n,y:r})}function wj(e,t={}){let{shape:r=_j,stroke:n=gj.stroke,strokeWidth:i=1,fill:o=n,fillOpacity:s=.3,anchor:a="start",...c}=t;return IN(e,{...c,shape:r,stroke:n,strokeWidth:i,fill:o,fillOpacity:s,anchor:a})}function bl(e,t){return arguments.length<2&&!Bn(e)&&(t=e,e=null),t===void 0&&(t={}),[e,t]}function zS({anchor:e}={},t){return e===void 0?t[0]:Ir(e,"anchor",t)}function vj(e){return zS(e,["left","right"])}function Sj(e){return zS(e,["right","left"])}function Ij(e){return zS(e,["bottom","top"])}function Tj(e){return zS(e,["top","bottom"])}function c0(){let[e,t]=bl(...arguments);return Aj("y",vj(t),e,t)}function jS(){let[e,t]=bl(...arguments);return Aj("fy",Sj(t),e,t)}function l0(){let[e,t]=bl(...arguments);return Ej("x",Ij(t),e,t)}function qS(){let[e,t]=bl(...arguments);return Ej("fx",Tj(t),e,t)}function Aj(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:S,labelAnchor:A,labelArrow:E,labelOffset:M,...T}){return p=ie(p),m=ie(m),y=ie(y),A!==void 0&&(A=Ir(A,"labelAnchor",["center","top","bottom"])),E=kj(E),yr(p&&!fe(o)?Mot(e,t,r,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:m,tickRotate:y,x:g,...T}):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,x:g,marginTop:b,marginRight:_,marginBottom:v,marginLeft:w,...T}),!fe(c)&&S!==null?Rs([],Rj({fill:c,fillOpacity:l,...T},function(R,k,I,N,O){let L=N[e],{marginTop:B,marginRight:C,marginBottom:P,marginLeft:U}=e==="y"&&O.inset||O,$=A??(L.bandwidth?"center":"top"),X=M??(t==="right"?C:U)-3;return $==="center"?(this.textAnchor=void 0,this.lineAnchor=t==="right"?"bottom":"top",this.frameAnchor=t,this.rotate=-90):(this.textAnchor=t==="right"?"end":"start",this.lineAnchor=$,this.frameAnchor=`${$}-${t}`,this.rotate=0),this.dy=$==="top"?3-B:$==="bottom"?P-3:0,this.dx=t==="right"?X:-X,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[Fj(e,L,{anchor:t,label:S,labelAnchor:$,labelArrow:E})]}}}})):null)}function Ej(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:S,labelAnchor:A,labelArrow:E,labelOffset:M,...T}){return p=ie(p),m=ie(m),y=ie(y),A!==void 0&&(A=Ir(A,"labelAnchor",["center","left","right"])),E=kj(E),yr(p&&!fe(o)?Not(e,t,r,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:m,tickRotate:y,y:g,...T}):null,fe(c)?null:Rot(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,...T}),!fe(c)&&S!==null?Rs([],Rj({fill:c,fillOpacity:l,...T},function(R,k,I,N,O){let L=N[e],{marginTop:B,marginRight:C,marginBottom:P,marginLeft:U}=e==="x"&&O.inset||O,$=A??(L.bandwidth?"center":"right"),X=M??(t==="top"?B:P)-3;return $==="center"?(this.frameAnchor=t,this.textAnchor=void 0):(this.frameAnchor=`${t}-${$}`,this.textAnchor=$==="right"?"end":"start"),this.lineAnchor=t,this.dy=t==="top"?-X:X,this.dx=$==="right"?C-3:$==="left"?3-U:0,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[Fj(e,L,{anchor:t,label:S,labelAnchor:$,labelArrow:E})]}}}})):null)}function Mot(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 Ph($S,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"?kot:Cot})}function Not(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 Ph(US,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"?Lot:Fot})}function Oot(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*Fh):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 Ph(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=Lj(x)),c===void 0&&(w.text=Dj(x,b,_,v,t))})}function Rot(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*Fh):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 Ph(kS,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=Lj(x)),c===void 0&&(w.text=Dj(x,b,_,v,t))})}function VS(){let[e,t]=bl(...arguments);return Mj("y",vj(t),e,t)}function YS(){let[e,t]=bl(...arguments);return Mj("fy",Sj(t),e,t)}function WS(){let[e,t]=bl(...arguments);return Nj("x",Ij(t),e,t)}function GS(){let[e,t]=bl(...arguments);return Nj("fx",Tj(t),e,t)}function Mj(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 Ph(Si,e,r,{ariaLabel:`${e}-grid`,ariaHidden:!0},{y:n,x1:o,x2:s,...Oj(a)})}function Nj(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 Ph(vi,e,r,{ariaLabel:`${e}-grid`,ariaHidden:!0},{x:n,y1:o,y2:s,...Oj(a)})}function Oj({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 Rj({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 Ph(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"&&Cj(g)&&(b=_,_=void 0),_===void 0&&(_=Is(b,g.type)??Dot(g,w)),u==null){if(Bn(_))u=xi(_);else if(cl(_))u=TN(_,...ce(x));else if(g.interval){let A=g.interval;if(g.ticks){let[E,M]=ce(x),T=(M-E)/A[xh];A=h4(A,T/_)??A,u=TN(A,E,M)}else{u=x;let E=u.length;A=h4(A,E/_)??A,A!==g.interval&&(u=TN(A,...ce(u)))}if(A===g.interval){let E=Math.round(u.length/_);E>1&&(u=u.filter((M,T)=>T%E===0))}}else g.ticks?u=g.ticks(_):u=x;if(!g.ticks&&u.length&&u!==x){let A=new Tn(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 S=Object.fromEntries(Object.entries(s).map(([A,E])=>[A,{...E,value:_t(u,E.value)}]));return y&&(f=m.filterFacets(u,S)),{data:u,facets:f,channels:S}}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 Dot(e,t){let[r,n]=ce(e.range());return(n-r)/t}function Dj(e,t,r,n,i){return{value:u0(e,t,r,n,i)}}function u0(e,t,r,n,i){return typeof n=="function"&&!(e.type==="log"&&e.tickFormat)?n:n===void 0&&t&&Ve(t)?l$(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 TN(e,t,r){return e.range(t,e.offset(e.floor(r)))}var Lot={draw(e,t){e.moveTo(0,0),e.lineTo(0,t)}},Fot={draw(e,t){e.moveTo(0,0),e.lineTo(0,-t)}},kot={draw(e,t){e.moveTo(0,0),e.lineTo(-t,0)}},Cot={draw(e,t){e.moveTo(0,0),e.lineTo(t,0)}};function Lj(e){return e.bandwidth&&!e.interval?void 0:"tabular-nums"}function Fj(e,t,{anchor:r,label:n=t.label,labelAnchor:i,labelArrow:o}={}){if(!(n==null||n.inferred&&Cj(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=_S(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 kj(e="auto"){return fe(e)?!1:typeof e=="boolean"?e:Ir(e,"labelArrow",["auto","up","right","down","left"])}function Cj(e){return Ve(e.domain())}function Bj(e,t){if(t==null)return t;let r=e(t);if(!r)throw new Error(`scale not found: ${t}`);return r}function Pj(e,{opacity:t,...r}={}){if(!Ms(e)&&!J4(e))throw new Error(`swatches legend requires ordinal or threshold color scale (not ${e.type})`);return $j(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 Uj(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=Bj(c,l),p=Bj(c,f),m=s*s*Math.PI;return r=ye(r)[1],i=ye(i)[1],o=ye(o)[1],$j(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=On();return e.scale(_).draw(v,m),v}))}function $j(e,t={},r){let{columns:n,tickFormat:i,fontVariant:o=RS(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=u0(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(Lh,f).node()}var XS=new Map([["symbol",Uj],["color",qj],["opacity",Bot]]);function zj(e={}){for(let[t,r]of XS){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(vS(t,n,o),AN(i,n,e),s=>vs(e[s])?vS(s,e[s]):null)}}throw new Error("unknown legend type; no scale found")}function jj(e,t,r={}){return(n,i)=>{if(!XS.has(n))throw new Error(`unknown legend type: ${n}`);if(n in e)return XS.get(n)(e[n],AN(t,r[n],i),o=>e[o])}}function AN({className:e,...t},{label:r,ticks:n,tickFormat:i}={},o){return S$(o,{className:e,...t},{label:r,ticks:n,tickFormat:i})}function qj(e,{legend:t=!0,...r}){if(t===!0&&(t=e.type==="ordinal"?"swatches":"ramp"),e.domain!==void 0)switch(`${t}`.toLowerCase()){case"swatches":return Pj(e,r);case"ramp":return Jz(e,r);default:throw new Error(`unknown legend type: ${t}`)}}function Bot({type:e,interpolate:t,...r},{legend:n=!0,color:i=vr(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 qj({type:e,...r,interpolate:Pot(i)},{legend:n,...o})}function Pot(e){let{r:t,g:r,b:n}=vr(e)||vr(0,0,0);return i=>`rgba(${t},${r},${n},${i})`}function Vj(e,t,r){let n=[];for(let[i,o]of XS){let s=r[i];if(s?.legend&&i in e){let a=o(e[i],AN(t,e[i],s),c=>e[c]);a!=null&&n.push(a)}}return n}function _l(e={}){return v4(e)?e:{...e,x:G}}function wl(e={}){return S4(e)?e:{...e,y:G}}function HS(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[m4]=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 EN(e={},t={}){arguments.length===1&&([e,t]=Uh(e));let{y1:r,y:n=r,x:i,...o}=t,[s,a,c,l]=$h(n,i,"y","x",e,o);return{...s,y1:r,y:a,x1:c,x2:l,x:wh(c,l)}}function Gj(e={},t={}){arguments.length===1&&([e,t]=Uh(e));let{y1:r,y:n=r,x:i}=t,[o,s,a]=$h(n,i,"y","x",e,t);return{...o,y1:r,y:s,x:a}}function Xj(e={},t={}){arguments.length===1&&([e,t]=Uh(e));let{y1:r,y:n=r,x:i}=t,[o,s,,a]=$h(n,i,"y","x",e,t);return{...o,y1:r,y:s,x:a}}function MN(e={},t={}){arguments.length===1&&([e,t]=Uh(e));let{x1:r,x:n=r,y:i,...o}=t,[s,a,c,l]=$h(n,i,"x","y",e,o);return{...s,x1:r,x:a,y1:c,y2:l,y:wh(c,l)}}function Hj(e={},t={}){arguments.length===1&&([e,t]=Uh(e));let{x1:r,x:n=r,y:i}=t,[o,s,a]=$h(n,i,"x","y",e,t);return{...o,x1:r,x:s,y:a}}function Qj(e={},t={}){arguments.length===1&&([e,t]=Uh(e));let{x1:r,x:n=r,y:i}=t,[o,s,,a]=$h(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?EN({x:e,...n}):([t,r]=I4(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?MN({y:e,...n}):([t,r]=I4(e,t,r),{...n,y1:t,y2:r})}function Uh(e){let{offset:t,order:r,reverse:n,...i}=e;return[{offset:t,order:r,reverse:n},i]}var Uot={length:!0};function $h(e,t=Gg,r,n,{offset:i,order:o,reverse:s},a){if(t===null)throw new Error(`stack requires ${n}`);let c=pn(a),[l,u]=en(e),[f,d]=Ur(t),[h,p]=Ur(t);return f.hint=h.hint=Uot,i=$ot(i),o=qot(o,i,n),[mr(a,(m,y,g)=>{({data:m,facets:y}=HS(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),S=d(new Float64Array(w)),A=p(new Float64Array(w)),E=[];for(let M of y){let T=x?Array.from(Zr(M,R=>x[R]).values()):[M];if(v)for(let R of T)R.sort(v);for(let R of T){let k=0,I=0;s&&R.reverse();for(let N of R){let O=b[N];O<0?k=A[N]=(S[N]=k)+O:O>0?I=A[N]=(S[N]=I)+O:A[N]=S[N]=I}}E.push(T)}return i&&i(E,S,A,_),{data:m,facets:y}}),l,f,h]}function $ot(e){if(e!=null){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"expand":case"normalize":return zot;case"center":case"silhouette":return jot;case"wiggle":return Kj}throw new Error(`unknown offset: ${e}`)}}function Zj(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 zot(e,t,r){for(let n of e)for(let i of n){let[o,s]=Zj(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 jot(e,t,r){for(let n of e){for(let i of n){let[o,s]=Zj(i,r);for(let a of i){let c=(s+o)/2;t[a]-=c,r[a]-=c}}Jj(n,t,r)}tq(e,t,r)}function Kj(e,t,r,n){for(let i of e){let o=new In,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,...Y_(u)];for(let h of a)t[h]+=s,r[h]+=s;let d=wr(l);d&&(s-=wr(l,(h,p)=>(u[p]/2+f[p])*h)/d)}Jj(i,t,r)}tq(e,t,r)}function Jj(e,t,r){let n=Qt(e,i=>Qt(i,o=>t[o]));for(let i of e)for(let o of i)t[o]-=n,r[o]-=n}function tq(e,t,r){let n=e.length;if(n===1)return;let i=e.map(a=>a.flat()),o=i.map(a=>(Qt(a,c=>t[c])+Xt(a,c=>r[c]))/2),s=Qt(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 qot(e,t,r){if(e===void 0&&t===Kj)return Yj(Br);if(e!=null){if(typeof e=="string"){let n=e.startsWith("-"),i=n?Qu:Br;switch((n?e.slice(1):e).toLowerCase()){case"value":case r:return Vot(i);case"z":return Yot(i);case"sum":return Wot(i);case"appearance":return Got(i);case"inside-out":return Yj(i)}return Wj(g4(e))}if(typeof e=="function")return(e.length===1?Wj:Xot)(e);if(Zn(e))return Hot(e);throw new Error(`invalid order: ${e}`)}}function Vot(e){return(t,r,n)=>(i,o)=>e(n[i],n[o])}function Yot(e){return(t,r,n,i)=>(o,s)=>e(i[o],i[s])}function Wot(e){return QS(e,(t,r,n,i)=>Id(Cn(t),o=>wr(o,s=>n[s]),o=>i[o]))}function Got(e){return QS(e,(t,r,n,i)=>Id(Cn(t),o=>r[vu(o,s=>n[s])],o=>i[o]))}function Yj(e){return QS(e,(t,r,n,i)=>{let o=Cn(t),s=Id(o,f=>r[vu(f,d=>n[d])],f=>i[f]),a=Ao(o,f=>wr(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 Wj(e){return t=>{let r=_t(t,e);return(n,i)=>Br(r[n],r[i])}}function Xot(e){return t=>Zn(t)?(r,n)=>e(t[r],t[n]):(r,n)=>e(t.get(r),t.get(n))}function Hot(e){return QS(Br,()=>e)}function QS(e,t){return(r,n,i,o)=>{if(!o)throw new Error("missing channel: z");let s=new In(t(r,n,i,o).map((a,c)=>[a,c]));return(a,c)=>e(s.get(o[a]),s.get(o[c]))}}var Qot={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,Qot),f0(this,r),d0(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:S,ry:A,rx1y1:E,rx1y2:M,rx2y1:T,rx2y2:R}=this;(c||u)&&!x&&wi(s)&&(c=u=null),(l||f)&&!x&&wi(a)&&(l=f=null);let k=s?.bandwidth?s.bandwidth():0,I=a?.bandwidth?a.bandwidth():0;return lt("svg:g",o).call(Ct,this,i,o).call(Rt,this,{},0,0).call(N=>N.selectAll().data(t).enter().call(E||M||T||R?O=>O.append("path").call(Mt,this).call(h0,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]+k-_:y-h-_,l&&f?L=>f[L]-(f[L]<l[L]?-b:v):l?L=>l[L]+I-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])+k-w-_):k-w-_:y-h-m-_-w).attr("height",l?f?L=>Math.max(0,Math.abs(l[L]-f[L])+I-b-v):I-b-v:g-d-p-b-v).call(dt,"rx",S).call(dt,"ry",A).call(Wt,this,n))).node()}};function f0(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 d0(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 h0(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,S=Math.min(1,(_-b)/u,(w-v)/f),A=S*(g?x?l:c:x?a:s),E=S*(g?x?a:s:x?l:c),M=S*(g?x?s:a:x?c:l),T=S*(g?x?c:l:x?s:a);return`M${b},${v+KS(A,T)}A${A},${A} 0 0 ${A<0?0:1} ${b+ZS(A,T)},${v}H${_-ZS(E,M)}A${E},${E} 0 0 ${E<0?0:1} ${_},${v+KS(E,M)}V${w-KS(M,E)}A${M},${M} 0 0 ${M<0?0:1} ${_-ZS(M,E)},${w}H${b+ZS(T,A)}A${T},${T} 0 0 ${T<0?0:1} ${b},${w-KS(T,A)}Z`})}function ZS(e,t){return t<0?e:Math.abs(e)}function KS(e,t){return t<0?Math.abs(e):e}function p0(e,t){return new df(e,gN(xN(t)))}function zh(e,t={}){return Xa(t)||(t={...t,y:Ee,x2:G,interval:1}),new df(e,vl(xN(_l(t))))}function jh(e,t={}){return Xa(t)||(t={...t,x:Ee,y2:G,interval:1}),new df(e,Sl(gN(wl(t))))}var Zot={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},Kot={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1},m0=class extends vt{constructor(t={}){let{anchor:r=null}=t;super(il,void 0,t,r==null?Zot:Kot),this.anchor=w4(r,"anchor",["top","right","bottom","left"]),f0(this,t),r||d0(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,S=l+y,A=u-a-p,E=s+h,M=f-c-m;return lt(d?"svg:line":b||_||v||w?"svg:path":"svg:rect",o).datum(0).call(Ct,this,i,o).call(Mt,this).call(Wt,this,n).call(Rt,this,{}).call(d==="left"?T=>T.attr("x1",S).attr("x2",S).attr("y1",E).attr("y2",M):d==="right"?T=>T.attr("x1",A).attr("x2",A).attr("y1",E).attr("y2",M):d==="top"?T=>T.attr("x1",S).attr("x2",A).attr("y1",E).attr("y2",E):d==="bottom"?T=>T.attr("x1",S).attr("x2",A).attr("y1",M).attr("y2",M):b||_||v||w?T=>T.call(h0,S,E,A,M,this):T=>T.attr("x",S).attr("y",E).attr("width",A-S).attr("height",M-E).attr("rx",g).attr("ry",x)).node()}};function qh(e){return new m0(e)}var NN={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},Jot=new Set(["geometry","href","src","ariaLabel","scales"]),y0=class extends vt{constructor(t,r={}){r.tip&&(r={...r,tip:!1}),r.title===void 0&&Bn(t)&&oS(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:S=8,title:A,pointerSize:E=12,pathFilter:M="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,NN),this.anchor=aS(l,"anchor"),this.preferredAnchor=aS(u,"preferredAnchor"),this.frameAnchor=Ts(b),this.textAnchor=Oe(v,"middle"),this.textPadding=+S,this.pointerSize=+E,this.pathFilter=nr(M),this.lineHeight=+g,this.lineWidth=+x,this.textOverflow=_N(w),this.monospace=!!f,this.fontFamily=nr(d),this.fontSize=ie(h),this.fontStyle=nr(p),this.fontVariant=nr(m),this.fontWeight=nr(y);for(let T in NN)T in this.channels&&(this[T]=NN[T]);this.splitLines=vN(this),this.clipLine=SN(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:S,x2:A,y2:E,x:M=w??A,y:T=S??E}=n,R=l?l(t.fx)-v:0,k=u?u(t.fy)-_:0,[I,N]=zr(this,i),O=dN(n,I),L=hN(n,N),B=p?PS:BS,C=B(cf),P,U;"title"in n?(P=eq.call(this,{title:n.channels.title},r),U=nst):(P=eq.call(this,n.channels,r),U=ist);let $=lt("svg:g",o).call(Ct,this,i,o).call(wN,this).call(Rt,this,{x:M&&a,y:T&&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=Zt(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,C);if(Pt>=0)at=at.slice(0,Pt).trimEnd()+cf,nt=Y.trim(),Y="";else{(at||!Y&&!H)&&(Y=" "+Y);let[Kt]=uf(Y,z-B(at),B,C);Kt>=0&&(nt=Y.trim(),Y=Y.slice(0,Kt).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,Kt=L(Y)+k,Jt=ht+q+x+g*2<ot,tt=ht-q-x-g*2>0,ge=Kt+H+x+g*2<at,Jn=Kt-H-x-g*2>0;nt=Jt&&tt?ge&&Jn?s.preferredAnchor:Jn?"bottom":"top":ge&&Jn?Jt?"left":"right":(Jt||tt)&&(ge||Jn)?`${Jn?"bottom":"top"}-${Jt?"left":"right"}`:s.preferredAnchor}let z=this.firstChild,Pt=this.lastChild;if(z.setAttribute("d",rst(nt,x,g,q,H)),st)for(let ht of Pt.childNodes)ht.setAttribute("x",-st);Pt.setAttribute("y",`${+tst(nt,Pt.childNodes.length,m).toFixed(6)}em`),Pt.setAttribute("transform",`translate(${est(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 tI(e,{x:t,y:r,...n}={}){return n.frameAnchor===void 0&&([t,r]=Je(t,r)),new y0(e,{...n,x:t,y:r})}function tst(e,t,r){return/^top(?:-|$)/.test(e)?.94-r:-.29-t*r}function est(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 rst(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 eq(e,t){let r={},n=this.format;n=rq(n,e,"x"),n=rq(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=t0(e,i);s&&(r[i]=s)}}for(let i in e){if(i in r||i in n||Jot.has(i)||(i==="x"||i==="y")&&e.geometry)continue;let o=t0(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?u0(s,s.domain()):Os}}return r}function rq(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 nst(e,t,{title:r}){return this.format.title(r.value[e],e)}function*ist(e,t,r,n,i){for(let o in r){if(o==="fx"||o==="fy"){yield{label:JS(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:iq(n,r,"x"),value:nq(this.format.x2,r.x1,s,e)};else if(o==="y2"&&"y1"in r)yield{label:iq(n,r,"y"),value:nq(this.format.y2,r.y1,s,e)};else{let a=s.value[e],c=s.scale;if(!Pe(a)&&c==null)continue;yield{label:JS(n,r,o),value:this.format[o](a,e),color:c==="color"?i[o][e]:null,opacity:c==="opacity"?i[o][e]:null}}}}function nq(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 iq(e,t,r){let n=JS(e,t,`${r}1`,r),i=JS(e,t,`${r}2`,r);return n===i?n:`${n}\u2013${i}`}function JS(e,t,r,n=r){let i=t[r],o=e[i?.scale??r];return String(o?.label??i?.label??n)}function Vh(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?[]:sq(e.marks);l.push(...ust(l));let u=cst(t,e),f=new Map;for(let C of l){let P=aq(C,u,e);P&&f.set(C,P)}let d=new Map;u&&g0(d,[u],e),g0(d,f,e);let h=sq(fst(l,d,e));for(let C of h){let P=aq(C,u,e);P&&f.set(C,P)}l.unshift(...h);let p=Fz(d,e);if(p!==void 0){let C=u?AS(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?AS(p,$):C)}let P=new Set;for(let{facetsIndex:U}of f.values())U?.forEach(($,X)=>{$?.length>0&&P.add(X)});p.forEach(0<P.size&&P.size<p.length?(U,$)=>U.empty=!P.has($):U=>U.empty=!1);for(let U of l)if(U.facet==="exclude"){let $=f.get(U);$!==void 0&&($.facetsIndex=Bz($.facetsIndex))}}for(let C of _e.keys())vs(e[C])&&C!=="fx"&&C!=="fy"&&d.set(C,[]);let m=new Map;for(let C of l){if(m.has(C))throw new Error("duplicate mark; each mark must be unique");let{facetsIndex:P,channels:U}=f.get(C)??{},{data:$,facets:X,channels:rt}=C.initialize(P,U,e);DN(rt,e),m.set(C,{data:$,facets:X,channels:rt})}let y=n0(g0(d,m,e),e),g=Zz(y,l,e);Ez(y,g);let x=Z4(y),{fx:b,fy:_}=x,v=b||_?K4(y,g):g,w=b||_?xst(x,g):g,S=pl(e),A=S.document,E=Ma("svg").call(A.documentElement),M=E;S.ownerSVGElement=E,S.className=c,S.projection=$z(e,v),S.filterFacets=(C,P)=>AS(p,{channels:P,groups:IS(C,P)}),S.getMarkState=C=>{let P=m.get(C),U=f.get(C);return{...P,channels:{...P.channels,...U?.channels}}},S.dispatchValue=C=>{M.value!==C&&(M.value=C,M.dispatchEvent(new Event("input",{bubbles:!0})))};let T=new Set;for(let[C,P]of m)if(C.initializer!=null){let U=C.facet==="super"?w:v,$=C.initializer(P.data,P.facets,P.channels,x,U,S);if($.data!==void 0&&(P.data=$.data),$.facets!==void 0&&(P.facets=$.facets),$.channels!==void 0){let{fx:X,fy:rt,...ot}=$.channels;ast(ot),Object.assign(P.channels,ot);for(let at of Object.values(ot)){let{scale:Y}=at;Y!=null&&!E$(_e.get(Y))&&(uq(at,e),T.add(Y))}(X!=null||rt!=null)&&f.set(C,!0)}}if(T.size){let C=new Map;g0(C,m,e,X=>T.has(X)),g0(d,m,e,X=>T.has(X));let P=gst(n0(C,e),y),{scales:U,...$}=Z4(P);Object.assign(y,P),Object.assign(x,$),Object.assign(x.scales,U)}let R,k;p!==void 0&&(R={x:b?.domain(),y:_?.domain()},p=kz(p,R),k=Cz(b,_,g));for(let[C,P]of m)P.values=C.scale(P.channels,x,S);let{width:I,height:N}=g;Zt(E).attr("class",c).attr("fill","currentColor").attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("text-anchor","middle").attr("width",I).attr("height",N).attr("viewBox",`0 0 ${I} ${N}`).attr("aria-label",s).attr("aria-description",a).call(C=>C.append("style").text(`:where(.${c}) {
60
60
  --plot-background: white;
61
61
  display: block;
62
62
  height: auto;
@@ -66,4 +66,4 @@ ${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(Lh,r);for(let C of l){let{channels:P,values:U,facets:$}=m.get(C);if(p===void 0||C.facet==="super"){let X=null;if($&&(X=$[0],X=C.filter(X,P,U),X.length===0))continue;let rt=C.render(X,x,U,w,S);if(rt==null)continue;E.appendChild(rt)}else{let X;for(let rt of p){if(!(C.facetAnchor?.(p,R,rt)??!rt.empty))continue;let ot=null;if($){let Y=f.has(C);if(ot=$[Y?rt.i:0],ot=C.filter(ot,P,U),ot.length===0)continue;!Y&&ot===$[0]&&(ot=Ha(ot)),ot.fx=rt.x,ot.fy=rt.y,ot.fi=rt.i}let at=C.render(ot,x,U,v,S);if(at!=null){(X??=Zt(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",k)}}let O=Vj(y,S,e),{figure:L=n!=null||i!=null||o!=null||O.length>0}=e;L&&(M=A.createElement("figure"),M.className=`${c}-figure`,M.style.maxWidth="initial",n!=null&&M.append(oq(A,n,"h2")),i!=null&&M.append(oq(A,i,"h3")),M.append(...O,E),o!=null&&M.append(ost(A,o)),"value"in E&&(M.value=E.value,delete E.value)),M.scale=Rz(x.scales),M.legend=jj(y,S,e);let B=cz();return B>0&&Zt(E).append("text").attr("x",I).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.`),M}function oq(e,t,r){if(t.ownerDocument)return t;let n=e.createElement(r);return n.append(t),n}function ost(e,t){let r=e.createElement("figcaption");return r.append(t),r}function sq(e){return e.flat(1/0).filter(t=>t!=null).map(sst)}function sst(e){return typeof e.render=="function"?e:new RN(e)}var RN=class extends vt{constructor(t){if(typeof t!="function")throw new TypeError("invalid mark; missing render function");super(),this.render=t}render(){}};function DN(e,t){for(let r in e)uq(e[r],t);return e}function uq(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:T4(s,i)}=t[r]??{};a!=null&&(e.value=Ht(e.value,a),e.transform=!1)}function ast(e){for(let t in e)z4(t,e[t])}function g0(e,t,r,n=h$){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(!jz(r)){let c=r.x?.domain===void 0,l=r.y?.domain===void 0;if(c||l){let[u,f]=Vz(s);c&&ON(e,"x",u),l&&ON(e,"y",f)}}}else ON(e,a,s)}return e}function ON(e,t,r){let n=e.get(t);n!==void 0?n.push(r):e.set(t,[r])}function cst(e,t){if(e==null)return;let{x:r,y:n}=e;if(r==null&&n==null)return;let i=Ga(e.data);if(i==null)throw new Error("missing facet data");let o={};r!=null&&(o.fx=Ah(i,{value:r,scale:"fx"})),n!=null&&(o.fy=Ah(i,{value:n,scale:"fy"})),DN(o,t);let s=IS(i,o);return{channels:o,groups:s,data:e.data}}function aq(e,t,r){if(e.facet===null||e.facet==="super")return;let{fx:n,fy:i}=e;if(n!=null||i!=null){let c=Ga(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=Ah(c,{value:n,scale:"fx"})),i!=null&&(l.fy=Ah(c,{value:i,scale:"fy"})),DN(l,r),{channels:l,groups:IS(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(Ga(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 lst(e,t={}){return Ne({...t,x:null,y:null},(r,n,i,o,s,a)=>a.getMarkState(e))}function ust(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)?nc:gl,n=i(lst(r,n)),n.title=null,o===void 0&&(n.preferredAnchor=i===nc?"left":"bottom");let s=tI(r.data,n);s.facet=r.facet,s.facetAnchor=r.facetAnchor,t.push(s)}}return t}function fst(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)&&!cq("x",e))&&(h=p=null),(n||!vs(o)&&!cq("y",e))&&(m=y=null),t.has("fx")||(g=x=null),t.has("fy")||(b=_=null),h===void 0&&(h=!nI(e,"x")),m===void 0&&(m=!nI(e,"y")),g===void 0&&(g=!nI(e,"fx")),b===void 0&&(b=!nI(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 rI(v,_,YS,a),eI(v,b,jS,"right","left",u,a),rI(v,x,GS,s),eI(v,g,qS,"top","bottom",u,s),rI(v,y,VS,o),eI(v,m,c0,"left","right",r,o),rI(v,p,WS,i),eI(v,h,l0,"bottom","top",r,i),v}function eI(e,t,r,n,i,o,s){if(!t)return;let a=dst(t);s=hst(a?n:t,o,s);let{line:c}=s;(r===c0||r===l0)&&c&&!Za(c)&&e.push(qh(pst(s))),e.push(r(s)),a&&e.push(r({...s,anchor:i,label:null}))}function rI(e,t,r,n){!t||Za(t)||e.push(r(mst(t,n)))}function dst(e){return/^\s*both\s*$/i.test(e)}function hst(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 pst(e){let{anchor:t,line:r}=e;return{anchor:t,facetAnchor:t+"-empty",stroke:r===!0?void 0:r}}function mst(e,{stroke:t=ll(e)?e:void 0,ticks:r=yst(e)?e:void 0,tickSpacing:n,ariaLabel:i,ariaDescription:o}){return{stroke:t,ticks:r,tickSpacing:n,ariaLabel:i,ariaDescription:o}}function yst(e){switch(typeof e){case"number":return!0;case"string":return!ll(e)}return Bn(e)||typeof e?.range=="function"}function nI(e,t){let r=`${t}-axis `;return e.some(n=>n.ariaLabel?.startsWith(r))}function cq(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 gst(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 xst({fx:e,fy:t},r){let{marginTop:n,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=wS(r),l=e&&lq(e),u=t&&lq(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 lq(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 bst=new Map([["basis",q6],["basis-closed",V6],["basis-open",Y6],["bundle",W6],["bump-x",P6],["bump-y",U6],["cardinal",G6],["cardinal-closed",X6],["cardinal-open",H6],["catmull-rom",Q6],["catmull-rom-closed",Z6],["catmull-rom-open",K6],["linear",qa],["linear-closed",J6],["monotone-x",e4],["monotone-y",r4],["natural",n4],["step",i4],["step-after",s4],["step-before",o4]]);function x0(e=qa,t){if(typeof e=="function")return e;let r=bst.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 iI(e=Il,t){return typeof e!="function"&&`${e}`.toLowerCase()==="auto"?Il:x0(e,t)}function Il(e){return qa(e)}function Ds(e={y:"count"},t={}){[e,t]=FN(e,t);let{x:r,y:n}=t;return LN(oI(r,t,G),null,null,n,e,sf(t))}function Ls(e={x:"count"},t={}){[e,t]=FN(e,t);let{x:r,y:n}=t;return LN(null,oI(n,t,G),r,null,e,af(t))}function oc(e={fill:"count"},t={}){[e,t]=FN(e,t);let{x:r,y:n}=_st(t);return LN(r,n,null,null,e,sf(af(t)))}function hq(e,t,r={}){if(r?.interval==null)return r;let{reduce:n=mS}=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 Yh(e={}){return hq(Ds,"y",Do(e,"x"))}function Wh(e={}){return hq(Ls,"x",Do(e,"y"))}function LN(e,t,r,n,{data:i=pS,filter:o=Qg,sort:s,reverse:a,...c}={},l={}){e=fq(e),t=fq(t),c=wst(c,l),i=yq(i,G),s=s==null?void 0:pq("sort",s,l),o=o==null?void 0:mq("filter",o,l),r!=null&&Es(c,"x","x1","x2")&&(r=null),n!=null&&Es(c,"y","y1","y2")&&(n=null);let[u,f]=en(e),[d,h]=en(e),[p,m]=en(t),[y,g]=en(t),[x,b]=r!=null?[r,"x"]:n!=null?[n,"y"]:[],[_,v]=en(x),{x:w,y:S,z:A,fill:E,stroke:M,x1:T,x2:R,y1:k,y2:I,domain:N,cumulative:O,thresholds:L,interval:B,...C}=l,[P,U]=en(A),[$]=qe(E),[X]=qe(M),[rt,ot]=en($),[at,Y]=en(X);return{..."z"in l&&{z:P||A},..."fill"in l&&{fill:rt||E},..."stroke"in l&&{stroke:at||M},...mr(C,(st,q,H)=>{let nt=tf(_t(st,x),H?.[b]),z=_t(st,A),Pt=_t(st,$),ht=_t(st,X),Kt=Jg(c,{z,fill:Pt,stroke:ht}),Jt=[],tt=[],ge=nt&&v([]),Jn=z&&U([]),Bo=Pt&&ot([]),IW=ht&&Y([]),hk=e&&f([]),TW=e&&h([]),pk=t&&m([]),AW=t&&g([]),EW=Ist(e,t,st),MW=0;for(let Af of c)Af.initialize(st);s&&s.initialize(st),o&&o.initialize(st);for(let Af of q){let mk=[];for(let Ef of c)Ef.scope("facet",Af);s&&s.scope("facet",Af),o&&o.scope("facet",Af);for(let[Ef,NW]of As(Af,Kt))for(let[OW,Sx]of As(NW,nt))for(let[Po,zs]of EW(Sx))if(Kt&&(zs.z=Ef),!(o&&!o.reduce(Po,zs))){mk.push(MW++),tt.push(i.reduceIndex(Po,st,zs)),nt&&ge.push(OW),z&&Jn.push(Kt===z?Ef:z[(Po.length>0?Po:Sx)[0]]),Pt&&Bo.push(Kt===Pt?Ef:Pt[(Po.length>0?Po:Sx)[0]]),ht&&IW.push(Kt===ht?Ef:ht[(Po.length>0?Po:Sx)[0]]),hk&&(hk.push(zs.x1),TW.push(zs.x2)),pk&&(pk.push(zs.y1),AW.push(zs.y2));for(let RW of c)RW.reduce(Po,zs);s&&s.reduce(Po,zs)}Jt.push(mk)}return P4(Jt,s,a),{data:tt,facets:Jt}}),...!Es(c,"x")&&(u?{x1:u,x2:d,x:wh(u,d)}:{x:w,x1:T,x2:R}),...!Es(c,"y")&&(p?{y1:p,y2:y,y:wh(p,y)}:{y:S,y1:k,y2:I}),..._&&{[b]:_},...Object.fromEntries(c.map(({name:st,output:q})=>[st,q]))}}function FN({cumulative:e,domain:t,thresholds:r,interval:n,...i},o){return[i,{cumulative:e,domain:t,thresholds:r,interval:n,...o}]}function oI(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=kN(e.thresholds,e.interval),e}function _st(e){let{x:t,y:r}=e;return t=oI(t,e),r=oI(r,e),[t.value,r.value]=Je(t.value,r.value),{x:t,y:r}}function fq(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)||Sst(i)){a=Ht(a,_4,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=gg(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=Ta(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=Kr(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?Ast:r>0?Tst:CN)(l,c,a),l};return o.label=rn(t),o}function kN(e,t,r=dq){if(e===void 0)return t===void 0?r:Is(t);if(typeof e=="string"){switch(e.toLowerCase()){case"freedman-diaconis":return Q_;case"scott":return dy;case"sturges":return Uc;case"auto":return dq}return Ku(e)}return e}function wst(e,t){return C4(e,t,pq)}function pq(e,t,r){return dS(e,t,r,mq)}function mq(e,t,r){return hS(e,t,r,yq)}function yq(e,t){return Th(e,t,vst)}function vst(e){switch(`${e}`.toLowerCase()){case"x":return Est;case"x1":return Nst;case"x2":return Ost;case"y":return Mst;case"y1":return Rst;case"y2":return Dst;case"z":return U4}throw new Error(`invalid bin reduce: ${e}`)}function dq(e,t,r){return Math.min(200,dy(e,t,r))}function Sst(e){return y$(e)||Bn(e)&&Ve(e)}function Ist(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 CN(e,t,r){return t=pr(t),n=>{let i=e.map(()=>[]);for(let o of n)i[Sa(t,r[o])-1]?.push(o);return i}}function Tst(e,t,r){let n=CN(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 Ast(e,t,r){let n=CN(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 gq(e,t){let r=(+e+ +t)/2;return e instanceof Date?new Date(r):r}var Est={reduceIndex(e,t,{x1:r,x2:n}){return gq(r,n)}},Mst={reduceIndex(e,t,{y1:r,y2:n}){return gq(r,n)}},Nst={reduceIndex(e,t,{x1:r}){return r}},Ost={reduceIndex(e,t,{x2:r}){return r}},Rst={reduceIndex(e,t,{y1:r}){return r}},Dst={reduceIndex(e,t,{y2:r}){return r}};var Lst={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,Lst),this.z=a,this.curve=x0(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(Ct,this,i,o).call(Rt,this,r,0,0).call(u=>u.selectAll().data(OS(t,[s,a,c,l],this,n)).enter().append("path").call(Mt,this).call(of,this,n).attr("d",lh().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 b0(e,t){return t===void 0?sc(e,{x:Ju,y:ol}):new hf(e,t)}function Tl(e,t){let{y:r=Ee,...n}=Wh(t);return new hf(e,vl(_l({...n,y1:r,y2:void 0})))}function sc(e,t){let{x:r=Ee,...n}=Yh(t);return new hf(e,Sl(wl({...n,x1:r,x2:void 0})))}var Fst={ariaLabel:"link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},_0=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,Fst),this.curve=iI(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(Ct,this,i,o).call(Rt,this,r).call(f=>f.selectAll().data(t).enter().append("path").call(Mt,this).attr("d",u===Il&&o.projection?kst(o.projection,s,a,c,l):d=>{let h=On(),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(ic,this,n,o)).node()}};function kst(e,t,r,n,i){let o=Fr(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 sI(e,{x:t,x1:r,x2:n,y:i,y1:o,y2:s,...a}={}){return[r,n]=w0(t,r,n),[o,s]=w0(i,o,s),new _0(e,{...a,x1:r,x2:n,y1:o,y2:s})}function w0(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},v0=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=Bst(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*Fh/2,b=p/1.5;return lt("svg:g",o).call(Ct,this,i,o).call(Rt,this,r).call(_=>_.selectAll().data(t).enter().append("path").call(Mt,this).attr("d",v=>{let w=s[v],S=a[v],A=c[v],E=l[v],M=Math.hypot(A-w,E-S);if(M<=m+y)return null;let T=Math.atan2(E-S,A-w),R=Math.min(b*g(v),M/3),k=this.sweep(w,S,A,E)*d*Fh,I=Math.hypot(M/Math.tan(k),M)/2;if(m||y)if(I<1e5){let rt=Math.sign(k),[ot,at]=Pst([w,S],[A,E],I,rt);if(m&&([w,S]=xq([ot,at,I],[w,S,m],-rt*Math.sign(m))),y){let[Y,st]=xq([ot,at,I],[A,E,y],rt*Math.sign(y));T+=Math.atan2(st-at,Y-ot)-Math.atan2(E-at,A-ot),A=Y,E=st}}else{let rt=A-w,ot=E-S,at=Math.hypot(rt,ot);m&&(w+=rt/at*m,S+=ot/at*m),y&&(A-=rt/at*y,E-=ot/at*y)}let N=T+k,O=N+x,L=N-x,B=A-R*Math.cos(O),C=E-R*Math.sin(O),P=A-R*Math.cos(L),U=E-R*Math.sin(L),$=I<1e5?`A${I},${I} 0,0,${k>0?1:0} `:"L",X=R?`M${B},${C}L${A},${E}L${P},${U}`:"";return`M${w},${S}${$}${A},${E}${X}`}).call(Wt,this,n)).node()}};function Bst(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(Ir(e,"sweep",["+x","-x","+y","-y"])){case"+x":return(t,r,n)=>Ft(t,n);case"-x":return(t,r,n)=>Sn(t,n);case"+y":return(t,r,n,i)=>Ft(r,i);case"-y":return(t,r,n,i)=>Sn(r,i)}}function Pst([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 xq([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 bq(e,{x:t,x1:r,x2:n,y:i,y1:o,y2:s,...a}={}){return[r,n]=w0(t,r,n),[o,s]=w0(i,o,s),new v0(e,{...a,x1:r,x2:n,y1:o,y2:s})}var Ust={ariaLabel:"bar"},Gh=class extends vt{constructor(t,r,n={},i=Ust){super(t,r,n,i),f0(this,n),d0(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(Ct,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(h0,d,h,_q(d,p),_q(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 _q(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 Gh{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 Gh{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 Xa(t)||(t={...t,y:Ee,x2:G}),new pf(e,vl(kh(_l(t))))}function ks(e,t={}){return Xa(t)||(t={...t,x:Ee,y2:G}),new mf(e,Sl(Ch(wl(t))))}var $st={ariaLabel:"cell"},yf=class extends Gh{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,$st)}_transform(t,r){t.call(Rt,r,{},0,0)}};function Al(e,{x:t,y:r,...n}={}){return[t,r]=Je(t,r),new yf(e,{...n,x:t,y:r})}function wq(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 vq(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 zst={ariaLabel:"dot",fill:"none",stroke:"currentColor",strokeWidth:1.5};function S0(e){return e.sort===void 0&&e.reverse===void 0?uS({channel:"-r"},e):e}var gf=class extends vt{constructor(t,r={}){let{x:n,y:i,r:o,rotate:s,symbol:a=Va,frameAnchor:c}=r,[l,u]=ye(s,0),[f,d]=O$(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:kn,optional:!0},rotate:{value:l,optional:!0},symbol:{value:f,scale:"auto",optional:!0}},S0(r),zst),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]=zr(this,i),x=m===Va,b=u?void 0:h*h*Math.PI;return tl(h)&&(t=[]),lt("svg:g",o).call(Ct,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 S=On();return d[w].draw(S,u[w]*u[w]*Math.PI),S}:u?w=>{let S=On();return m.draw(S,u[w]*u[w]*Math.PI),S}:d?w=>{let S=On();return d[w].draw(S,b),S}:(()=>{let w=On();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]=Je(t,r)),new gf(e,{...n,x:t,y:r})}function Sq(e,{x:t=G,...r}={}){return new gf(e,FS({...r,x:t}))}function Iq(e,{y:t=G,...r}={}){return new gf(e,LS({...r,y:t}))}function Tq(e,t){return to(e,{...t,symbol:"circle"})}function Aq(e,t){return to(e,{...t,symbol:"hexagon"})}var jst={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,jst),this.z=o,this.curve=iI(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(Ct,this,i,o).call(Rt,this,r).call(l=>l.selectAll().data(OS(t,[s,a],this,n)).enter().append("path").call(Mt,this).call(of,this,n).call(rj,this,n,o).attr("d",c===Il&&o.projection?qst(o.projection,s,a):Ag().curve(c).defined(u=>u>=0).x(u=>s[u]).y(u=>a[u]))).node()}};function qst(e,t,r){let n=Fr(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]=Je(t,r),new xf(e,{...n,x:t,y:r})}function El(e,{x:t=G,y:r=Ee,...n}={}){return new xf(e,Wh({...n,x:t,y:r}))}function Ml(e,{x:t=Ee,y:r=G,...n}={}){return new xf(e,Yh({...n,x:t,y:r}))}function PN(e,t){t=Vst(t);let{x:r,y:n,color:i,size:o}=t,s=aI(e,r),a=aI(e,n),c=aI(e,i),l=aI(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:S,reduce:A},mark:E}=t;if(h===void 0&&(h=g==null&&d==null&&S==null&&y!=null?"count":null),g===void 0&&(g=h==null&&y==null&&S==null&&d!=null?"count":null),A===void 0&&S==null&&w==null&&h==null&&g==null&&(d==null||Ue(s))&&(y==null||Ue(a))&&(A="count"),p===void 0&&(p=cI(h)?!0:void 0),x===void 0&&(x=cI(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=S!=null||A!=null?"dot":cI(h)||cI(g)||w!=null?"bar":d!=null&&y!=null?Ue(s)||Ue(a)||h==null&&g==null&&!I0(s)&&!I0(a)?"dot":"line":d!=null||y!=null?"rule":null);let M,T,R;switch(E){case"dot":R=to,T="stroke";break;case"line":R=s&&a||h!=null||g!=null?x||g!=null||s&&I0(s)?Ml:p||h!=null||a&&I0(a)?El:bf:s?El:Ml,T="stroke",Mq(c)&&(M=null);break;case"area":R=!(x||g!=null)&&(p||h!=null||a&&I0(a))?Tl:sc,T="fill",Mq(c)&&(M=null);break;case"rule":R=s?vi:Si,T="stroke";break;case"bar":R=h!=null?Ue(a)?Eq(h)&&s&&Ue(s)?Al:Fs:zh:g!=null?Ue(s)?Eq(g)&&a&&Ue(a)?Al:ks:jh:w!=null||A!=null?s&&Ue(s)&&a&&Ue(a)?Al:s&&Ue(s)?ks:a&&Ue(a)?Fs:p0:s&&Qa(s)&&!(a&&Qa(a))?Fs:a&&Qa(a)&&!(s&&Qa(s))?ks:Al,T="fill";break;default:throw new Error(`invalid mark: ${E}`)}let k={fx:u,fy:f,x:s??void 0,y:a??void 0,[T]:c??v,z:M,r:l??void 0,tip:!0},I,N={[T]:w??void 0,r:A??void 0};if(h!=null&&g!=null)throw new Error("cannot reduce both x and y");return g!=null?(N.y=g,I=Ue(s)?ul:Ds):h!=null?(N.x=h,I=Ue(a)?fl:Ls):(w!=null||A!=null)&&(s&&a?I=Ue(s)&&Ue(a)?Kg:Ue(s)?Ls:Ue(a)?Ds:oc:s?I=Ue(s)?ul:Ds:a&&(I=Ue(a)?fl:Ls)),(I===oc||I===Ds)&&(k.x={value:s,...m}),(I===oc||I===Ls)&&(k.y={value:a,...b}),p===void 0&&(p=s&&!(I===oc||I===Ds)&&(R===Fs||R===Tl||R===zh||R===Si)),x===void 0&&(x=a&&!(I===oc||I===Ls)&&(R===ks||R===sc||R===jh||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:S??null,reduce:A??null},mark:E,markImpl:Nq[R],markOptions:k,transformImpl:Nq[I],transformOptions:N,colorMode:T}}function Oq(e,t){let r=PN(e,t),{fx:n,fy:i,x:{zero:o},y:{zero:s},markOptions:a,transformOptions:c,colorMode:l}=r,u=BN[r.markImpl],f=BN[r.transformImpl],d=n!=null||i!=null?qh({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 I0(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 Vst({x:e,y:t,color:r,size:n,fx:i,fy:o,mark:s}={}){return bi(e)||(e=Xh(e)),bi(t)||(t=Xh(t)),bi(r)||(r=ll(r)?{color:r}:Xh(r)),bi(n)||(n=Xh(n)),bi(i)&&({value:i}=Xh(i)),bi(o)&&({value:o}=Xh(o)),s!=null&&(s=`${s}`.toLowerCase()),{x:e,y:t,color:r,size:n,fx:i,fy:o,mark:s}}function aI(e,t){let r=_t(e,t.value);return r&&(r.label=rn(t.value)),r}function Xh(e){return Yst(e)?{reduce:e}:{value:e}}function cI(e){return/^(?:distinct|count|sum|proportion)$/i.test(e)}function Eq(e){return/^(?:first|last|mode)$/i.test(e)}function Yst(e){if(e==null)return!1;if(typeof e.reduceIndex=="function"||typeof e.reduce=="function"&&Pr(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 Mq(e){return e?new Tn(e).size>e.length>>1:!1}var BN={dot:to,line:bf,lineX:El,lineY:Ml,areaX:Tl,areaY:sc,ruleX:vi,ruleY:Si,barX:Fs,barY:ks,rect:p0,rectX:zh,rectY:jh,cell:Al,bin:oc,binX:Ds,binY:Ls,group:Kg,groupX:ul,groupY:fl},Nq=Object.fromEntries(Object.entries(BN).map(([e,t])=>[t,e]));function Hh(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),Kn(o,t)}function Qh(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),Kn(o,t)}function Kn(e={},t={}){let r=pn(t),n=Object.entries(e).map(([i,o])=>{let s=iS(i,t);if(s==null)throw new Error(`missing channel: ${i}`);let[a,c]=Ur(s);return{key:i,input:s,output:a,setOutput:c,map:Wst(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?Zr(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 Wst(e){if(e==null)throw new Error("missing map");if(typeof e.mapIndex=="function")return e;if(typeof e.map=="function"&&Pr(e))return Gst(e);if(typeof e=="function")return UN(_h(e));switch(`${e}`.toLowerCase()){case"cumsum":return Hst;case"rank":return UN((t,r)=>hy(t,n=>r[n]));case"quantile":return UN((t,r)=>Xst(t,n=>r[n]))}throw new Error(`invalid map: ${e}`)}function Gst(e){return console.warn("deprecated map interface; implement mapIndex instead."),{mapIndex:e.map.bind(e)}}function Xst(e,t){let r=rs(e,t)-1;return hy(e,t).map(n=>n/r)}function UN(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 Hst={mapIndex(e,t,r){let n=0;for(let i of e)r[i]=n+=t[i]}};function Rq(e={},t){return arguments.length===1&&(t=e),Hh(Zh(e),t)}function Dq(e={},t){return arguments.length===1&&(t=e),Qh(Zh(e),t)}function Zh(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=Zst(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 Kst(r)(t,Qst(i,t),o)}function Qst(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 Zst(e){switch(`${e}`.toLowerCase()){case"centered":return"middle";case"leading":return"start";case"trailing":return"end"}throw new Error(`invalid shift: ${e}`)}function Kst(e="mean"){if(typeof e=="string"){if(/^p\d{2}$/i.test(e))return lI(bh(e));switch(e.toLowerCase()){case"deviation":return lI(zi);case"max":return uI((t,r)=>Xt(t,n=>r[n]));case"mean":return Jst;case"median":return lI(Eo);case"min":return uI((t,r)=>Qt(t,n=>r[n]));case"mode":return uI((t,r)=>Md(t,n=>r[n]));case"sum":return Lq;case"variance":return lI(Pc);case"difference":return rat;case"ratio":return nat;case"first":return iat;case"last":return oat}}if(typeof e!="function")throw new Error(`invalid reduce: ${e}`);return uI(_h(e))}function lI(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(Ha(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(Ha(i,0,c+t),a);for(let c=0,l=i.length-r;c<l;++c)s[i[c+r]]=e(Ha(i,c,c+t),a)}}}function uI(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(Ha(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(Ha(i,0,a+t),o);for(let a=0,c=i.length-r;a<c;++a)s[i[a+r]]=e(Ha(i,a,a+t),o)}}}function Lq(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 Jst(e,t,r){if(r){let n=Lq(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 tat(e,t,r,n){for(let i=r+n;r<i;++r){let o=e[t[r]];if(Pe(o))return o}}function eat(e,t,r,n){for(let i=r+n-1;i>=r;--i){let o=e[t[i]];if(Pe(o))return o}}function Fq(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 kq(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 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]]=kq(i,n,s,e)-Fq(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){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]]=kq(i,n,s,e)/Fq(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]]}}:{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)}}}function oat(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]]=eat(i,n,s,e)}}}var ac={n:20,k:2,color:"currentColor",opacity:.2,strict:!0,anchor:"end"};function Cq(e,{x:t=G,y:r,k:n=ac.k,color:i=ac.color,opacity:o=ac.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return yr(fe(s)?null:Tl(e,Kn({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,Kn({x:Nl(f)},{x:t,y:r,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function Bq(e,{x:t,y:r=G,k:n=ac.k,color:i=ac.color,opacity:o=ac.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return yr(fe(s)?null:sc(e,Kn({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,Kn({y:Nl(f)},{x:t,y:r,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function Nl({n:e=ac.n,k:t=0,strict:r=ac.strict,anchor:n=ac.anchor}={}){return Zh({k:e,reduce:i=>Aa(i)+t*(zi(i)||0),strict:r,anchor:n})}var sat={ariaLabel:"tick",fill:null,stroke:"currentColor"},fI=class extends vt{constructor(t,r,n){super(t,r,n,sat),Lo(this,n)}render(t,r,n,i,o){return lt("svg:g",o).call(Ct,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(ic,this,n,o)).node()}},T0=class extends fI{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}},A0=class extends fI{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 dI(e,{x:t=G,...r}={}){return new T0(e,{...r,x:t})}function hI(e,{y:t=G,...r}={}){return new A0(e,{...r,y:t})}function Pq(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:Zg;return yr(Si(e,f({x1:$N,x2:zN},{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})),dI(e,f({x:"p50"},{x:t,y:r,stroke:s,strokeOpacity:a,strokeWidth:c,sort:l,...u})),to(e,Kn({x:$q},{x:t,y:r,z:r,r:n,stroke:s,strokeOpacity:a,...u})))}function Uq(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:Zg;return yr(vi(e,f({y1:$N,y2:zN},{x:r,y:t,stroke:s,strokeOpacity:a,...u})),ks(e,f({y1:"p25",y2:"p75"},{x:r,y:t,fill:i,fillOpacity:o,...u})),hI(e,f({y:"p50"},{x:r,y:t,stroke:s,strokeOpacity:a,strokeWidth:c,sort:l,...u})),to(e,Kn({y:$q},{x:r,y:t,z:r,r:n,stroke:s,strokeOpacity:a,...u})))}function $q(e){let t=$N(e),r=zN(e);return e.map(n=>n<t||n>r?n:NaN)}function $N(e){let t=zq(e)*2.5-jq(e)*1.5;return Qt(e,r=>r>=t?r:NaN)}function zN(e){let t=jq(e)*2.5-zq(e)*1.5;return Xt(e,r=>r<=t?r:NaN)}function zq(e){return An(e,.25)}function jq(e){return An(e,.75)}var aat={ariaLabel:"raster",stroke:null,pixelSize:1};function Kh(e,t){let r=+e;if(isNaN(r))throw new Error(`invalid ${t}: ${e}`);return r}function qq(e,t){let r=Math.floor(e);if(isNaN(r))throw new Error(`invalid ${t}: ${e}`);return r}var M0=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=qq(o,"width")),s!=null&&(s=qq(s,"height")),l!=null&&(l=Kh(l,"x1")),u!=null&&(u=Kh(u,"y1")),f!=null&&(f=Kh(f,"x2")),d!=null&&(d=Kh(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=mat(l,f,o,s)),c===void 0&&u!=null&&d!=null&&(c=yat(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=Kh(h,"pixelSize"),this.blur=Kh(p,"blur"),this.interpolate=a==null||c==null?null:cat(m)}},N0=class extends M0{constructor(t,r={}){let{imageRendering:n}=r;if(t==null){let{fill:i,fillOpacity:o}=r;ye(o)[0]!==void 0&&(r=pI("fillOpacity",r)),qe(i)[0]!==void 0&&(r=pI("fill",r))}super(t,void 0,r,aat),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]??(N=>N),{x:a,y:c}=n,{document:l}=o,[u,f,d,h]=Yq(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 N=g/p,O=x/m,L=Ht(a,C=>(C-u)*N,Float64Array),B=Ht(c,C=>(C-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 S=l.createElement("canvas");S.width=g,S.height=x;let A=S.getContext("2d"),E=A.createImageData(g,x),M=E.data,{r:T,g:R,b:k}=vr(this.fill)??{r:0,g:0,b:0},I=(this.fillOpacity??1)*255;for(let N=0;N<b;++N){let O=N<<2;if(_){let L=s(_[N+w]);if(L==null){M[O+3]=0;continue}({r:T,g:R,b:k}=vr(L))}v&&(I=v[N+w]*255),M[O+0]=T,M[O+1]=R,M[O+2]=k,M[O+3]=I}return this.blur>0&&lM(E,this.blur),A.putImageData(E,0,0),lt("svg:g",o).call(Ct,this,i,o).call(Rt,this,r).call(N=>N.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",S.toDataURL())).node()}};function jN(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&&x$(t)&&(n=Ju,i=ol,o===void 0&&(o=p$)),[t,{...s,x:n,y:i,[e]:o}]}function Vq(){let[e,t]=jN("fill",...arguments);return new N0(e,e==null||t.fill!==void 0||t.fillOpacity!==void 0?t:{...t,fill:G})}function Yq({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 qN({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),Yq(Eh(a,i),o,s)}function pI(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]=qN(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,S=0;for(let A of i??[void 0])for(let E=.5;E<b;++E)for(let M=.5;M<x;++M,++S)_[S]=r(l.invert(f+M*v),u.invert(d+E*w),A);return{data:_,facets:i,channels:{[e]:{value:_,scale:"auto"}}}})}function cat(e){if(typeof e=="function")return e;if(e==null)return mI;switch(`${e}`.toLowerCase()){case"none":return mI;case"nearest":return R0;case"barycentric":return O0();case"random-walk":return D0()}throw new Error(`invalid interpolate: ${e}`)}function mI(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 O0({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=pat(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],S=Math.min(g,x,b),A=Math.max(g,x,b),E=Math.min(_,v,w),M=Math.max(_,v,w),T=(v-w)*(g-b)+(_-w)*(b-x);if(!T)continue;let R=s[t[p]],k=s[t[m]],I=s[t[y]];for(let N=Math.floor(S);N<A;++N)for(let O=Math.floor(E);O<M;++O){if(N<0||N>=r||O<0||O>=n)continue;let L=N+.5,B=O+.5,C=Math.sign(T),P=(v-w)*(L-b)+(B-w)*(b-x);if(P*C<0)continue;let U=(w-_)*(L-b)+(B-w)*(g-b);if(U*C<0)continue;let $=T-(P+U);if($*C<0)continue;let X=N+r*O;u[X]=d(R,P/T,k,U/T,I,$/T,N,O),f[X]=1}}return lat(u,f,i,o,s,r,n,l,t,d),u}}function lat(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)=>fat(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 _=uat(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 uat(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 E0(e,t,r,n){return e*n-r*t}function fat(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 S=v-s,A=w-a,E=v-c,M=w-l;return E0(S,A,E,M)>-1e-6&&E0(S,A,d,h)*b-E0(S,A,p,m)*x>-1e-6&&E0(E,M,y,g)*x-E0(E,M,d,h)*_<=0}}function R0(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 D0({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 dat(e,t,r,n,i,o){return t*e+n*r+o*i}function hat(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 pat(e,t){return Qa(e)||Ve(e)?dat:hat(t)}function mat(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 yat(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 Wq={ariaLabel:"contour",fill:"none",stroke:"currentColor",strokeMiterlimit:1,pixelSize:2},L0=class extends M0{constructor(t,{smooth:r=!0,value:n,...i}={}){let o=NS({},i,Wq);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:rn(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=pI("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}},gat(i),Wq);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=Fr();return lt("svg:g",o).call(Ct,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 gat({thresholds:e,interval:t,...r}){return e=kN(e,t,Uc),Ne(r,function(n,i,o,s,a,c){let[l,u,f,d]=qN(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:M,y:T}=Ns(o,s,c),R=Ht(M,O=>(O-l)*x,Float64Array),k=Ht(T,O=>(O-u)*b,Float64Array),I=[o.x,o.y,o.value],N=[R,k,_];for(let O of i){let L=this.filter(O,I,N);v.push(this.interpolate(L,y,g,R,k,_))}}else if(i){let M=y*g,T=i.length;for(let R=0;R<T;++R)v.push(_.slice(R*M,R*M+M))}else v.push(_);if(this.blur>0)for(let M of v)cy({data:M,width:y,height:g},this.blur);let w=xat(e,_,...bat(v));if(w===null)throw new Error(`unsupported thresholds: ${e}`);let{contour:S}=Wc().size([y,g]).smooth(this.smooth),A=[],E=[];for(let M of v)E.push(rr(A.length,A.push(...Ht(w,T=>S(M,T)))));for(let{coordinates:M}of A)for(let T of M)for(let R of T)for(let k of R)k[0]=k[0]/x+l,k[1]=k[1]/b+u;return{data:A,facets:E,channels:yS(this.contourChannels,A)}})}function xat(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=Kr(...Ad(r,n,e),e);for(;i[i.length-1]>=n;)i.pop();for(;i[1]<r;)i.shift();return i}function Xq(){return new L0(...jN("value",...arguments))}function bat(e){return[Qt(e,t=>Qt(t,Gq)),Xt(e,t=>Xt(t,Gq))]}function Gq(e){return isFinite(e)?e:NaN}function Zq(e,t){return VN(gl,e,t)}function Kq(e,t={}){return VN(xl,e,t)}function Jq(e,t={}){return VN(nc,e,t)}function VN(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,Hq("x",{...s,inset:-6},r))),i!=null&&a.push(Si(t,Hq("y",{...s,inset:-6},r))),n!=null&&a.push(Rs(t,Qq("x",{...s,dy:9,frameAnchor:"bottom",lineAnchor:"top"},r))),i!=null&&a.push(Rs(t,Qq("y",{...s,dx:-9,frameAnchor:"left",textAnchor:"end"},r)));for(let c of a)c.ariaLabel=`crosshair ${c.ariaLabel}`;return yr(...a)}function tV(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:_at(e,u)}}function _at(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 Hq(e,t,r){let{color:n="currentColor",opacity:i=.2,ruleStroke:o=n,ruleStrokeOpacity:s=i,ruleStrokeWidth:a}=r;return{...tV(e,t,r),stroke:o,strokeOpacity:s,strokeWidth:a}}function Qq(e,t,r){let{color:n="currentColor",textFill:i=n,textFillOpacity:o,textStroke:s="var(--plot-background)",textStrokeOpacity:a,textStrokeWidth:c=5}=r;return{...tV(e,t,wat(e,r)),fill:i,fillOpacity:o,stroke:s,strokeOpacity:a,strokeWidth:c}}function wat(e,t){return Ne(t,(r,n,i)=>({channels:{text:{value:t0(i,e)?.value}}}))}var vat={ariaLabel:"delaunay link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},Sat={ariaLabel:"delaunay mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},Iat={ariaLabel:"hull",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:1},Tat={ariaLabel:"voronoi",fill:"none",stroke:"currentColor",strokeMiterlimit:1},Aat={ariaLabel:"voronoi mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},YN=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,vat),this.curve=x0(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]=zr(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 I in n)v[I]=[];let w=[],S=[],A=[],E=[];function M(I,N){I=x[I],N=x[N],_.push(++b),w[b]=p(I),A[b]=m(I),S[b]=p(N),E[b]=m(N);for(let O in n)v[O].push(n[O][N])}let{halfedges:T,hull:R,triangles:k}=Vi.from(x,p,m);for(let I=0;I<T.length;++I){let N=T[I];N>I&&M(k[I],k[N])}for(let I=0;I<R.length;++I)M(R[I],R[(I+1)%R.length]);Zt(this).selectAll().data(_).enter().append("path").call(Mt,y).attr("d",I=>{let N=On(),O=f(N);return O.lineStart(),O.point(w[I],A[I]),O.point(S[I],E[I]),O.lineEnd(),N}).call(Wt,y,v).call(ic,y,v,o)}return lt("svg:g",o).call(Ct,this,i,o).call(Rt,this,{x:c&&s,y:l&&a}).call(u?x=>x.selectAll().data(Zr(t,b=>u[b]).values()).enter().append("g").each(g):x=>x.datum(t).each(g)).node()}},F0=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]=zr(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);Zt(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(Ct,this,i,o).call(Rt,this,{x:c&&s,y:l&&a}).call(u?g=>g.selectAll().data(Zr(t,x=>u[x]).values()).enter().append("g").each(y):g=>g.datum(t).each(y)).node()}},WN=class extends F0{constructor(t,r={}){super(t,r,Sat),this.fill="none"}_render(t){return t.render()}},GN=class extends F0{constructor(t,r={}){super(t,r,Iat,pn)}_render(t){return t.renderHull()}},XN=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]=zr(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),S=eV(w,u);for(let A=0,E=v.length;A<E;++A)m[v[A]]=S.renderCell(A)}}return{data:s,facets:a,channels:{cells:{value:m}}}}),Tat)}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(Ct,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()}},HN=class extends F0{constructor(t,r){super(t,r,Aat),this.fill="none"}_render(t,r){return eV(t,r).render()}};function eV(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 k0(e,t,{x:r,y:n,...i}={}){return[r,n]=Je(r,n),new e(t,{...i,x:r,y:n})}function rV(e,t){return k0(YN,e,t)}function nV(e,t){return k0(WN,e,t)}function iV(e,t){return k0(GN,e,t)}function oV(e,{x:t,y:r,initializer:n,...i}={}){return k0(XN,e,{...mr({...i,x:t,y:r},HS),initializer:n})}function sV(e,t){return k0(HN,e,t)}var Eat={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=aV(s)&&(s="currentColor",!0),u=aV(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}},Nat({...c,fill:s,stroke:a},l,u),Eat),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=Fr();return lt("svg:g",o).call(Ct,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 cV(e,{x:t,y:r,...n}={}){return[t,r]=Je(t,r),new C0(e,{...n,x:t,y:r})}var Mat=new Set(["x","y","z","weight"]);function Nat(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]=zr(this,u),{width:g,height:x}=u,{x:b,y:_}=Ns(c,l,f),v=Object.fromEntries(Object.entries(c).filter(([k])=>!Mat.has(k)).map(([k,I])=>[k,{...I,value:[]}])),w=t&&[],S=r&&[],A=ZM().x(b?k=>b[k]:m).y(_?k=>_[k]:y).weight(d?k=>d[k]:1).size([g,x]).bandwidth(i),E=[];for(let k of a){let I=[];E.push(I);for(let N of h?o0(k,h,p):[k]){let O=A.contours(N);I.push([N,O])}}let M=o;if(!(M instanceof Wg)){let k=0;for(let I of E)for(let[,N]of I){let O=N.max;O>k&&(k=O)}M=Float64Array.from({length:o-1},(I,N)=>k*100*(N+1)/o)}let T=[],R=[];for(let k of E){let I=[];T.push(I);for(let[N,O]of k)for(let L of M){I.push(R.length),R.push(O(L/100)),w&&w.push(L),S&&S.push(L);for(let B in v)v[B].value.push(c[B].value[N[0]])}}return w&&w.push(0),S&&S.push(0),{data:s,facets:T,channels:{...v,...w&&{fill:{value:w,scale:"color"}},...S&&{stroke:{value:S,scale:"color"}},contours:{value:R}}}})}function aV(e){return/^density$/i.test(e)}function fV(e,t){return hV("x",e,t)}function dV(e,t){return hV("y",e,t)}function hV(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]=lV(s,r,n),[i,o]=lV(a,i,o),r===n&&i===o&&(e==="y"?i=cc(0):r=cc(0)),{tip:x}=Do({tip:x},e==="y"?"x":"y"),yr(fe(l)?null:Object.assign(b0(t,{x1:r,x2:n,y1:i,y2:o,z:y,fill:l,fillOpacity:d,render:rc(b,uV(e,!0)),clip:g,..._}),{ariaLabel:"positive difference"}),fe(u)?null:Object.assign(b0(t,{x1:r,x2:n,y1:i,y2:o,z:y,fill:u,fillOpacity:h,render:rc(b,uV(e,!1)),clip:g,..._}),{ariaLabel:"negative difference"}),bf(t,{x:n,y:o,z:y,stroke:p,strokeOpacity:m,tip:x,clip:!0,..._}))}function lV(e,t,r){return t===void 0&&r===void 0?t=r=cc(e):t===void 0?(r=cc(r),t=e===void 0?r:cc(e)):r===void 0?(t=cc(t),r=e===void 0?t:cc(e)):(t=cc(t),r=cc(r)),[t,r]}function cc(e){let t,{value:r,label:n=rn(r)}=Ki(e);return{transform:i=>t||(t=_t(i,r)),label:n}}function uV(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===_S(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 S=uN(),A=lt("svg:clipPath",f).attr("id",S).node();A.appendChild(_.firstChild),v.childNodes[w].setAttribute("clip-path",`url(#${S})`),v.insertBefore(A,v.childNodes[w])}return b}}function yI({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=Fr(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 pV({geometry:e=G,...t}={}){let r=ml(i=>_t(i,e)),n=ml(i=>_t(r(i),h3));return{...t,x:{transform:i=>Float64Array.from(n(i),([o])=>o)},y:{transform:i=>Float64Array.from(n(i),([,o])=>o)},geometry:{transform:r}}}var Oat={ariaLabel:"geo",fill:"none",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},B0=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:kn,optional:!0},geometry:{value:r.geometry,scale:"projection"}},S0(r),Oat),this.r=i}render(t,r,n,i,o){let{geometry:s,r:a}=n,c=Fr(o.projection??Rat(r)),{r:l}=this;return tl(l)?t=[]:l!==void 0&&c.pointRadius(l),lt("svg:g",o).call(Ct,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 Rat({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 gI(e,t={}){return t.tip&&t.x===void 0&&t.y===void 0?t=yI(t):t.geometry===void 0&&(t={...t,geometry:G}),new B0(e,t)}function mV({strokeWidth:e=1.5,...t}={}){return gI({type:"Sphere"},{strokeWidth:e,...t})}function yV({strokeOpacity:e=.1,...t}={}){return gI(b3(),{strokeOpacity:e,...t})}var Jh=.5,tp=0;function gV(e={fill:"count"},{binWidth:t,...r}={}){let{z:n}=r;return t=t===void 0?20:ie(t),e=B4(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=Jg(e,{z:d,fill:h,stroke:p,symbol:m}),g=d&&[],x=h&&[],b=p&&[],_=m&&[],v=[],w=[],S=[],A=-1;for(let R of e)R.initialize(i);for(let R of o){let k=[];for(let I of e)I.scope("facet",R);for(let[I,N]of As(R,y))for(let{index:O,extent:L}of Dat(i,N,u,f,t)){k.push(++A),w.push(L.x),S.push(L.y),d&&g.push(y===d?I:d[O[0]]),h&&x.push(y===h?I:h[O[0]]),p&&b.push(y===p?I:p[O[0]]),m&&_.push(y===m?I:m[O[0]]);for(let B of e)B.reduce(O,L)}v.push(k)}let E=s.x.scale,M=s.y.scale,T={x:{value:w,source:a[E]?{value:Ht(w,a[E].invert),scale:E}:null},y:{value:S,source:a[M]?{value:Ht(S,a[M].invert),scale:M}: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:k})=>[R,{scale:"auto",label:k.label,radius:R==="r"?t/2:void 0,value:k.transform()}]))};return{data:i,facets:v,channels:T}})}function Dat(e,t,r,n,i){let o=i*(1.5/E4),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-tp)/o),f=Math.round(c=(c-Jh)/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+Jh,y:u*o+tp}},s.set(h,p)),p.index.push(a)}return s.values()}var Lat={ariaLabel:"hexgrid",fill:"none",stroke:"currentColor",strokeOpacity:.1};function xV(e){return new P0(e)}var P0=class extends vt{constructor({binWidth:t=20,clip:r=!0,...n}={}){super(il,void 0,{clip:r,...n},Lat),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-Jh,p=f-c-Jh,m=a-tp,y=d-l-tp,g=s/2,x=g*M4,b=x/2,_=g*2,v=x*1.5,w=Math.floor(h/_),S=Math.ceil(p/_),A=Math.floor((m+b)/v),E=Math.ceil((y-b)/v)+1,M=`m0,${Ol(-x)}l${Ol(g)},${Ol(b)}v${Ol(x)}l${Ol(-g)},${Ol(b)}`,T=M;for(let R=A;R<E;++R)for(let k=w;k<S;++k)T+=`M${Ol(k*_+(R&1)*g)},${Ol(R*v)}${M}`;return lt("svg:g",o).datum(0).call(Ct,this,i,o).call(Rt,this,{},We+Jh,We+tp).call(R=>R.append("path").call(Mt,this).call(Wt,this,n).attr("d",T)).node()}};function Ol(e){return Math.round(e*1e3)/1e3}var Fat={ariaLabel:"image",fill:null,stroke:null};function kat(e){return/^\.*\//.test(e)}function Cat(e){return/^(blob|data|file|http|https):/i.test(e)}function Bat(e){return typeof e=="string"&&(kat(e)||Cat(e))?[void 0,e]:[e,void 0]}var U0=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]=Bat(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,S]=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:kn,optional:!0},width:{value:x,filter:kn,optional:!0},height:{value:_,filter:kn,optional:!0},rotate:{value:w,optional:!0},src:{value:p,optional:!0}},S0(r),Fat),this.src=m,this.width=b,this.rotate=S,this.height=v,this.r=g,this.preserveAspectRatio=Oe(u,"xMidYMid"),this.crossOrigin=nr(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,_]=zr(this,i);return lt("svg:g",o).call(Ct,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",bV(c,u,d,b,y,m)).attr("y",bV(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 bV(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 _V(e,{x:t,y:r,...n}={}){return n.frameAnchor===void 0&&([t,r]=Je(t,r)),new U0(e,{...n,x:t,y:r})}function Pat(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=-ep(t)-ep(r)+ep(t+r);s<10;s++){if(h===0||h===1)return h;if(d=Uat(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 Uat(e,t,r){var n=e===0||e===1?0:Math.exp(ep(t+r)-ep(t)-ep(r)+t*Math.log(e)+r*Math.log(1-e));return e<0||e>1?!1:e<(t+1)/(t+r+2)?n*wV(e,t,r)/t:1-n*wV(1-e,r,t)/r}function wV(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 ep(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 vV(e,t){var r=Pat(2*Math.min(e,1-e),.5*t,.5);return r=Math.sqrt(t*(1-r)/r),e>.5?r:-r}var $at={ariaLabel:"linear-regression",fill:"currentColor",fillOpacity:.1,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},xI=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,$at),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(Ct,this,i,o).call(Rt,this,r).call(u=>u.selectAll().data(c?o0(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&&!Za(this.fill)?d=>d.select(zat).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 zat(){return this.parentNode.insertBefore(this.ownerDocument.createElementNS(En.svg,"path"),this)}var QN=class extends xI{constructor(t,r){super(t,r)}_renderBand(t,r,n){let{ci:i,precision:o}=this,[s,a]=ce(t,u=>n[u]),c=bI(t,n,r),l=TV(t,n,r,(1-i)/2,c);return lh().y(u=>u).x0(u=>l(u,-1)).x1(u=>l(u,1))(rr(s,a-o/2,o).concat(a))}_renderLine(t,r,n){let[i,o]=ce(t,a=>n[a]),s=bI(t,n,r);return`M${s(i)},${i}L${s(o)},${o}`}},ZN=class extends xI{constructor(t,r){super(t,r)}_renderBand(t,r,n){let{ci:i,precision:o}=this,[s,a]=ce(t,u=>r[u]),c=bI(t,r,n),l=TV(t,r,n,(1-i)/2,c);return lh().x(u=>u).y0(u=>l(u,-1)).y1(u=>l(u,1))(rr(s,a-o/2,o).concat(a))}_renderLine(t,r,n){let[i,o]=ce(t,a=>r[a]),s=bI(t,r,n);return`M${i},${s(i)}L${o},${s(o)}`}};function SV(e,{y:t=Ee,x:r=G,stroke:n,fill:i=fe(n)?"currentColor":n,...o}={}){return new QN(e,Wh({...o,x:r,y:t,fill:i,stroke:n}))}function IV(e,{x:t=Ee,y:r=G,stroke:n,fill:i=fe(n)?"currentColor":n,...o}={}){return new ZN(e,Yh({...o,x:t,y:r,fill:i,stroke:n}))}function bI(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 TV(e,t,r,n,i){let o=wr(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=vV(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 $0({path:e=G,delimiter:t,frameAnchor:r,treeLayout:n=Uu,treeSort:i,treeSeparation:o,treeAnchor:s,treeFilter:a,...c}={}){s=SI(s),i=MV(i),a!=null&&(a=JN(a)),r===void 0&&(r=s.frameAnchor);let l=NV(t),u=CV(c,JN),[f,d]=Ur(),[h,p]=Ur();return{x:f,y:h,frameAnchor:r,...mr(c,(m,y)=>{let g=l(_t(m,e)),x=d([]),b=p([]),_=-1,v=[],w=[],S=yv().path(M=>g[M]),A=Zn(m)?M=>M.data=m[M.data]:M=>M.data=m.get(M.data),E=n();E.nodeSize&&E.nodeSize([1,1]),E.separation&&o!==void 0&&E.separation(o??Gg);for(let M of u)M[wI]=M[FV]([]);for(let M of y){let T=[],R=S(M.filter(k=>g[k]!=null)).each(A);i!=null&&R.sort(i),E(R);for(let k of R.descendants())if(!(a!=null&&!a(k))){T.push(++_),v[_]=k.data,s.position(k,_,x,b);for(let I of u)I[wI][_]=I[kV](k)}w.push(T)}return{data:v,facets:w}}),...Object.fromEntries(u)}}function vI({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=SI(l),a=MV(a),u!=null&&(u=EV(u)),f={curve:r,stroke:n,strokeWidth:i,strokeOpacity:o,...f};let d=NV(t),h=CV(f,EV),[p,m]=Ur(),[y,g]=Ur(),[x,b]=Ur(),[_,v]=Ur();return{x1:p,x2:y,y1:x,y2:_,...mr(f,(w,S)=>{let A=d(_t(w,e)),E=m([]),M=g([]),T=b([]),R=v([]),k=-1,I=[],N=[],O=yv().path(B=>A[B]),L=s();L.nodeSize&&L.nodeSize([1,1]),L.separation&&c!==void 0&&L.separation(c??Gg);for(let B of h)B[wI]=B[FV]([]);for(let B of S){let C=[],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))){C.push(++k),I[k]=$.data,l.position(U,k,E,T),l.position($,k,M,R);for(let X of h)X[wI][k]=X[kV]($,U)}N.push(C)}return{data:I,facets:N}}),...Object.fromEntries(h)}}function SI(e="left"){switch(`${e}`.trim().toLowerCase()){case"left":return jat;case"right":return qat}throw new Error(`invalid tree anchor: ${e}`)}var jat={frameAnchor:"left",dx:6,position({x:e,y:t},r,n,i){n[r]=t,i[r]=-e}},qat={frameAnchor:"right",dx:-6,position({x:e,y:t},r,n,i){n[r]=-t,i[r]=-e}};function MV(e){return e==null||typeof e=="function"?e:`${e}`.trim().toLowerCase().startsWith("node:")?AV(JN(e)):AV(Vat(e))}function AV(e){return(t,r)=>Br(e(t),e(r))}function Vat(e){return t=>t.data?.[e]}function NV(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=>Yat(n,t))}var KN=92,OV=47;function Yat(e,t){if(t===KN)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 KN: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 OV: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 Wat(e){let t=!1;for(let r=0,n=e.length;r<n;++r){switch(e.charCodeAt(r)){case KN:if(!t){t=!0;continue}case OV:t&&(e=e.slice(0,r-1)+e.slice(r),--r,--n);break}t=!1}return e}function RV(e){return Pr(e)&&typeof e.node=="function"}function Gat(e){return Pr(e)&&typeof e.link=="function"}function JN(e){if(RV(e))return e.node;if(e=`${e}`.trim().toLowerCase(),!!e.startsWith("node:")){switch(e){case"node:name":return e8;case"node:path":return t8;case"node:internal":return DV;case"node:external":return LV;case"node:depth":return r8;case"node:height":return n8}throw new Error(`invalid node value: ${e}`)}}function EV(e){if(RV(e))return e.node;if(Gat(e))return e.link;if(e=`${e}`.trim().toLowerCase(),!(!e.startsWith("node:")&&!e.startsWith("parent:"))){switch(e){case"parent:name":return _I(e8);case"parent:path":return _I(t8);case"parent:depth":return _I(r8);case"parent:height":return _I(n8);case"node:name":return e8;case"node:path":return t8;case"node:internal":return DV;case"node:external":return LV;case"node:depth":return r8;case"node:height":return n8}throw new Error(`invalid link value: ${e}`)}}function t8(e){return e.id}function e8(e){return Xat(e.id)}function r8(e){return e.depth}function n8(e){return e.height}function DV(e){return!!e.children}function LV(e){return!e.children}function _I(e){return(t,r)=>r==null?void 0:e(r)}function Xat(e){let t=e.length;for(;--t>0&&!Hat(e,t););return Wat(e.slice(t+1))}function Hat(e,t){if(e[t]==="/"){let r=0;for(;t>0&&e[--t]==="\\";)++r;if(!(r&1))return!0}return!1}var FV=2,kV=3,wI=4;function CV(e,t){let r=[];for(let n in e){let i=e[n],o=t(i);o!==void 0&&r.push([n,...Ur(i),o])}return r}function i8(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||_===pv?"mirrored":"normal",tip:w,...S}={}){if(g===void 0&&(g=SI(S.treeAnchor).dx),b!==void 0)throw new Error("textAnchor is not a configurable tree option");v=Ir(v,"textLayout",["mirrored","normal"]);function A(E){return Rs(e,$0({treeLayout:_,text:p,fill:t===void 0?"currentColor":t,stroke:m,dx:g,dy:x,title:y,...E,...S}))}return yr(sI(e,vI({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,...S})),h?to(e,$0({treeLayout:_,fill:t===void 0?"node:internal":t,title:y,tip:w,...S})):null,p!=null?v==="mirrored"?[A({textAnchor:"start",treeFilter:"node:external"}),A({textAnchor:"end",treeFilter:"node:internal",dx:-g})]:A():null)}function BV(e,t){return i8(e,{...t,treeLayout:pv})}var UV={ariaLabel:"waffle"},z0=class extends pf{constructor(t,{unit:r=1,gap:n=1,round:i,render:o,multiple:s,...a}={}){super(t,{...a,render:rc(o,$V("x"))},UV),this.unit=Math.max(0,r),this.gap=+n,this.round=zV(i),this.multiple=jV(s)}},j0=class extends mf{constructor(t,{unit:r=1,gap:n=1,round:i,render:o,multiple:s,...a}={}){super(t,{...a,render:rc(o,$V("y"))},UV),this.unit=Math.max(0,r),this.gap=+n,this.round=zV(i),this.multiple=jV(s)}};function $V(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*Qat(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"?([T,R])=>[T*x,-R*b]:([T,R])=>[R*b,T*x],v=(p-g*x)/2,w=typeof m=="function"?T=>m(T)+v:m+v,S=r[e](0),A=Gz(),E=f.createElementNS(En.svg,"pattern");E.setAttribute("width",e==="y"?x:b),E.setAttribute("height",e==="y"?b:x),E.setAttribute("patternUnits","userSpaceOnUse");let M=E.appendChild(f.createElementNS(En.svg,"rect"));return M.setAttribute("x",a/2),M.setAttribute("y",a/2),M.setAttribute("width",(e==="y"?x:b)-a),M.setAttribute("height",(e==="y"?b:x)-a),c!=null&&M.setAttribute("rx",c),l!=null&&M.setAttribute("ry",l),lt("svg:g",o).call(Ct,this,i,o).call(this._transform,this,r).call(T=>T.selectAll().data(t).enter().append(()=>E.cloneNode(!0)).attr("id",R=>`${A}-${R}`).select("rect").call(Mt,this).call(Wt,this,n)).call(T=>T.selectAll().data(t).enter().append("path").attr("transform",e==="y"?Fo`translate(${w},${S})`:Fo`translate(${S},${w})`).attr("d",R=>`M${o8(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 o8(e,t,r){if(e<0||t<0){let n=Math.ceil(-Math.min(e,t)/r);return o8(e+n*r,t+n*r,r).map(([i,o])=>[i,o-n])}return t<e?o8(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 zV(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 jV(e){return e===void 0?void 0:Math.max(1,Math.floor(e))}function Qat({domain:e,range:t}){return PV(t)/PV(e)}function PV(e){let[t,r]=ce(e);return r-t}function qV(e,t={}){return Xa(t)||(t={...t,y:Ee,x2:G}),new z0(e,vl(kh(_l(t))))}function VV(e,t={}){return Xa(t)||(t={...t,x:Ee,y2:G}),new j0(e,Sl(Ch(wl(t))))}var eY=PW(tY(),1);var ict=({marginLeft:e})=>[1,e],oct=({width:e,marginRight:t})=>[-1,e-t],sct=({width:e,marginLeft:t,marginRight:r})=>[0,(t+e-r)/2],act=({marginTop:e})=>[1,e],cct=({height:e,marginBottom:t})=>[-1,e-t],lct=({height:e,marginTop:t,marginBottom:r})=>[0,(t+e-r)/2];function rY(e){return typeof e=="string"?{anchor:e}:e}function nY(e={},t={}){arguments.length===1&&([e,t]=oY(e));let{anchor:r="left",padding:n=1,r:i=t.r}=rY(e);switch(`${r}`.toLowerCase()){case"left":r=ict;break;case"right":r=oct;break;case"middle":r=sct;break;default:throw new Error(`unknown dodge anchor: ${r}`)}return sY("x","y",r,ie(n),i,t)}function iY(e={},t={}){arguments.length===1&&([e,t]=oY(e));let{anchor:r="bottom",padding:n=1,r:i=t.r}=rY(e);switch(`${r}`.toLowerCase()){case"top":r=act;break;case"bottom":r=cct;break;case"middle":r=lct;break;default:throw new Error(`unknown dodge anchor: ${r}`)}return sY("y","x",r,ie(n),i,t)}function oY(e){let{anchor:t,padding:r,...n}=e,{r:i}=n;return[{anchor:t,padding:r,r:i},n]}function sY(e,t,r,n,i,o){if(i!=null&&typeof i!="number"){let{channels:s,sort:a,reverse:c}=o;s=Hg(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?fct:uct,x=new Float64Array(d.length),b=h?_=>h[_]:()=>p;for(let _ of a){let v=(0,eY.default)();_=_.filter(h?S=>ph(d[S])&&kn(h[S]):S=>ph(d[S]));let w=new Float64Array(2*_.length+2);for(let S of _){let A=b(S),E=m?A+n:0,M=d[S]-A,T=d[S]+A,R=2;v.queryInterval(M-n,T+n,([,,I])=>{let N=x[I]-E,O=d[S]-d[I],L=n+(h?h[S]+h[I]:2*p),B=Math.sqrt(L*L-O*O);w[R++]=N-B,w[R++]=N+B});let k=w.slice(0,R);m&&(k=k.filter(I=>I>=0));t:for(let I of k.sort(g)){for(let N=0;N<R;N+=2)if(w[N]+1e-6<I&&I<w[N+1]-1e-6)continue t;x[S]=I+E;break}v.insert([M,T,S])}}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 uct(e,t){return Math.abs(e)-Math.abs(t)}function fct(e,t){return e-t}function cY(e,t){return arguments.length===1&&({basis:e,...t}=e),Hh(AI(e),t)}function lY(e,t){return arguments.length===1&&({basis:e,...t}=e),Qh(AI(e),t)}function AI(e){if(e===void 0)return aY;if(typeof e=="function")return EI(_h(e));if(/^p\d{2}$/i.test(e))return op(bh(e));switch(`${e}`.toLowerCase()){case"deviation":return pct;case"first":return aY;case"last":return hct;case"max":return mct;case"mean":return yct;case"median":return gct;case"min":return xct;case"sum":return bct;case"extent":return dct}throw new Error(`invalid basis: ${e}`)}function EI(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 op(e){return EI((t,r)=>e(t,n=>r[n]))}var dct={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}},aY=EI((e,t)=>{for(let r=0;r<e.length;++r){let n=t[e[r]];if(Pe(n))return n}}),hct=EI((e,t)=>{for(let r=e.length-1;r>=0;--r){let n=t[e[r]];if(Pe(n))return n}}),pct={mapIndex(e,t,r){let n=Aa(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}},mct=op(Xt),yct=op(Aa),gct=op(Eo),xct=op(Qt),bct=op(wr);function uY(e,t){return dY("x",e,t)}function fY(e,t){return dY("y",e,t)}function dY(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]=nS(t.replace(/^[+-]/,"")),i*=l}t=vh(t),n=(l,u)=>t.offset(l,u)}let o=`${e}1`,s=`${e}2`,a=Kn({[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 hY(e,t={}){if(typeof e=="string")switch(e.toLowerCase()){case"first":return Y0(t);case"last":return W0(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=_ct(e[r])}if(n===void 0)throw new Error(`invalid selector: ${e}`);return Rl(r,n,t)}function _ct(e){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"min":return f8;case"max":return d8}throw new Error(`unknown selector: ${e}`)}function Y0(e){return Rl(null,wct,e)}function W0(e){return Rl(null,vct,e)}function MI(e){return Rl("x",f8,e)}function NI(e){return Rl("y",f8,e)}function OI(e){return Rl("x",d8,e)}function RI(e){return Rl("y",d8,e)}function*wct(e){yield e[0]}function*vct(e){yield e[e.length-1]}function*f8(e,t){yield K_(e,r=>t[r])}function*d8(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?Zr(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 Vh({...t,marks:[...e,this]})};var Sct=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 Ict(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 pY(e,t,r){for(let n in e){let i=Sct.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&&Ict(t,i.split("."),o)}}var Tct=new Set(["frame","hexgrid","sphere","graticule"]),Act=new Map([["first",Y0],["last",W0],["maxX",OI],["maxY",RI],["minX",MI],["minY",NI],["nearest",gl],["nearestX",xl],["nearestXY",nc]]);async function mY(e){let t={marks:[]},r=[],{attributes:n,marks:i}=e;pY(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=Act.get(f)?.(d)??d,p=Tct.has(c)?[h]:[l,h];t.marks.push(h8[c](...p)),o.push(a.index)}Mct(t,e);let s=Vh(t);Oct(s,o),Ect(e,s,n,r);for(let a of e.interactors)await a.init(s);return s}function Ect(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 Mct(e,t){let{marks:r}=t;DI("x",e,r),DI("y",e,r),DI("fx",e,r),DI("fy",e,r)}function DI(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=yY(i[s]);a!==void 0&&(o===void 0?o=a:o!==a&&(o=void 0))}o!==void 0&&(t[e]={...n,label:o})}function yY(e){if(e){switch(e.type){case"COLUMN_REF":return e.column;case"CAST":return yY(e.expr);case"FUNCTION":if(e.name==="make_date")return"date";break}return Nct(e)}}function Nct(e){let t=`${e}`.replaceAll('"',"").replaceAll("(*)","()");return t.endsWith("()")?t.slice(0,-2):t}function Oct(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 Rct={width:640,marginLeft:40,marginRight:20,marginTop:20,marginBottom:30},G0=class{constructor(t){this.attributes={...Rct},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=cM()}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=Dct(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 mY(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 sm(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 Dct(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 LI(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 Lct=new Set(["offset","order","reverse","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 gY(e){return Lct.has(e)}var Fct=new Set(["asterisk","circle","cross","diamond","diamond2","hexagon","plus","square","square2","star","times","triangle","triangle2","wye"]);function xY(e){return Fct.has(`${e}`.toLowerCase())}var bY=e=>e==="stroke"||e==="fill",kct=e=>/opacity$/i.test(e),Cct=e=>e==="symbol",Bct=(e,t)=>e!=="sort"&&e!=="tip"&&t!=null&&!Array.isArray(t),p8=(e,t)=>({channel:e,field:t,as:mc(t)&&!TT(t)?t.column:e}),m8=(e,t)=>({channel:e,value:t}),FI=e=>Array.isArray(e),Tr=class extends Pn{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;FI(r)?this.data=Hn(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[sy]){let d=u(this,l);for(let h in d)c(h,d[h])}else if(f==="string")gY(l)||bY(l)&&LI(u)||Cct(l)&&xY(u)?o.push(m8(l,u)):o.push(p8(l,Yl(u)));else if(io(u)){let d=m8(l,u.value);o.push(d),u.addEventListener("value",h=>(d.value=h,this.update()))}else Mr(u)?(OA(u).forEach(d=>a.add(d)),o.push(p8(l,u))):f==="object"&&Bct(l,u)?o.push(p8(l,u)):u!==void 0&&o.push(m8(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||FI(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:Array.from(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:X0(this.channels,this.sourceTable()).where(t)}queryPending(){return this.plot.pending(this),this}queryResult(t){return this.data=Hn(t),this}update(){return this.plot.update(this)}plotSpecs(){let{type:t,data:r,detail:n,channels:i}=this;return y8(t,n,i,r)}};function yn(e,t){let r=t?.[e.as]??e.as;return Object.hasOwn(e,"value")?e.value:bY(e.channel)?{value:r,scale:"color"}:kct(e.channel)?{value:r,scale:"opacity"}:r}function X0(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(gn(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 y8(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 nm(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[UA(h,f,d,r-i,u),p]}var g8={x:["min","max"]},x8={y:["min","max"]},kI={...g8,...x8};function _Y(e,t,r,n,i){let{plot:o}=e,s=o.getAttribute(n),a=o.getAttribute(i);if(Array.isArray(s)&&!s[Hr])return s;{let{column:c,min:l,max:u}=e.channelField(r),f=b8(t,c)||(a?Ca().domain([l,u]).nice().domain():[l,u]);return s!==es&&(f[Hr]=!0),o.setAttribute(n,f,{silent:!0}),f}}function Cs(e,t){return _Y(e,t,"x","xDomain","xNice")}function Bs(e,t){return _Y(e,t,"y","yDomain","yNice")}function b8(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 H0=class extends Tr{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]=b8(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 VA(s,b,u,c,_)}else return s.orderby(l)}};function _8(e,t=[]){return new t.constructor(e)}function wY(e,t,r,n,i){let o=t.length,s={},a=[];if(i?.length){let c=new Int32Array(o),l=i.map(d=>n[d]),u={};for(let d=0;d<o;++d){let h=l.map(p=>p[d]);c[d]=u[h]??=a.push(h)-1}for(let d=0;d<i.length;++d)s[i[d]]=a.map(h=>h[d]);let f=s._grid=a.map(()=>_8(e,r));for(let d=0;d<o;++d)f[c[d]][t[d]]=r[d]}else{a.push([]);let[c]=s._grid=[_8(e,r)];for(let l=0;l<o;++l)c[t[l]]=r[l]}return{numRows:a.length,columns:s}}function vY(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(()=>_8(c,m));for(let g=0;g<a;++g)y[d[g]][r[g]]=m[g]});return{numRows:f.length,columns:u}}function Q0(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 SY(e){let t=new Tn;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 Ge(e,t){return or(e)?(e.addEventListener("value",t),e.value):e}function Z0(e,t=!1){let r=new Float64Array(5),n=new Float64Array(4);Pct(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 Pct(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 IY(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=Uct){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 Uct(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 ko="density",Co=class extends Tr{constructor(t,r,n){let{bandwidth:i=0,interpolate:o="none",pixelSize:s=1,pad:a=1,width:c,height:l,...u}=n,f=$ct(u);super(t,r,u,kI),this.densityMap=f,this.bandwidth=Ge(i,d=>(this.bandwidth=d,this.grids?this.convolve().update():null)),this.interpolate=Ge(o,d=>(this.interpolate=d,this.requestUpdate())),this.pixelSize=Ge(s,d=>(this.pixelSize=d,this.requestUpdate())),this.pad=Ge(a,d=>(this.pad=d,this.requestUpdate())),this.width=Ge(c,d=>(this.width=d,this.requestUpdate())),this.height=Ge(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[Hr]&&!r[Hr]}query(t=[]){let{interpolate:r,pad:n,channels:i,densityMap:o}=this,[s,a]=this.extentX=Cs(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?[Vr(h,[+s,+a]),Vr(m,[+c,+l])]:[ni(+s,h),ze(h,+a),ni(+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:S,field:A}=v;gn(A)?(b[S]=A,o[S]=!0):S==="weight"?b[ko]=de(A):S!=="x"&&S!=="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(ko),b[ko]=Or()),r==="linear"){if(_.length>1)throw new Error("Linear binning not applicable to multiple aggregates.");if(!b[ko])throw new Error("Linear binning not applicable to custom aggregates.");let v=Xf(b[ko])[0];return jA(g,d,p,v,u,x)}else return $A(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=zct(this.interpolate),{columns:o}=Hn(t);return this.grids0=vY(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(ko)?ko: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=Z0(r*(u-1)/c,d),p=Z0(r*(f-1)/l,d);this.grids={numRows:i.numRows,columns:{...i.columns,[s]:a.map(m=>IY(h,p,m,n))}}}return this}};function $ct(e){let t={};for(let r in e)e[r]==="density"&&(delete e[r],t[r]=!0);return t}function zct(e="none"){if(typeof e=="function")return e;switch(e.toLowerCase()){case"none":case"linear":return;case"nearest":return R0;case"barycentric":return O0();case"random-walk":return D0()}throw new Error(`invalid interpolate: ${e}`)}var K0=class extends Co{constructor(t,r){let{thresholds:n=10,...i}=r;super("geo",t,{bandwidth:20,interpolate:"linear",pixelSize:2,...i}),this.thresholds=Ge(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[,T]=Q0(a.density);l=Array.from({length:c-1},(R,k)=>T*(k+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,_=T=>x+T*y,v=T=>b+T*g,w=Wc().size(t),S=this.contourData=Array(s*l.length),{density:A,...E}=a,M=Object.entries(E);for(let T=0,R=0;T<s;++T){let k=A[T],I=M.reduce((N,[O,L])=>(N[O]=L[T],N),{});for(let N=0;N<l.length;++N,++R)S[R]=Object.assign(jct(w.contour(k,l[N]),_,v),I)}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 jct(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 J0(e){return Array.from({length:e},(t,r)=>r)}function BI(e,t){let r=t.reduce((i,o,s)=>(i[o]=s,i),{}),n=J0(e.length);return n.sort((i,o)=>r[e[i]]-r[e[o]]),n}function PI(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 TY(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 AY(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 EY(e={}){let{r:t=0,g:r=0,b:n=0,opacity:i=1}=typeof e=="string"?vr(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 MY(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"?vr(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 NY(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"?vr(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 Co{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}=Wct(this,n,i),{alpha:u,alphaProp:f,color:d,colorProp:h}=w8(this),p=s[f]??[],m=s[h]??[],y=o>1&&h&&this.groupby?.includes(h)?BI(m,this.plot.getAttribute("colorDomain")):J0(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}]}},tx=class extends Dl{constructor(t,r){super(t,{bandwidth:20,interpolate:"linear",pixelSize:2,...r})}};function w8(e){let{aggr:t,densityMap:r,groupby:n,plot:i}=e,o=t.includes(ko),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":LI(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"?ko:null),d=c?.as??(u==="grid"?ko:null),h=l!=="grid"&&l!=="group"?EY(l):Vct(e,f),p=u!=="grid"?TY(u):qct(e,d);return{alphaProp:d,colorProp:f,alpha:p,color:h}}function qct(e,t){let{plot:r,grids:n}=e,i=r.getAttribute("opacityDomain"),o=i===es,s=i?.[Hr],a=!o&&!s&&i||Q0(n.columns[t]);(o||s||!i)&&(o||(a[Hr]=!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 AY(c)}function Vct(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?.[Hr],u=!c&&!l&&a||(o?i.slice().sort(Ft):s?SY(i):Q0(i));(c||l||!a)&&(c||(u[Hr]=!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 MY(f);{let d=dl({x:{type:Yct(f.type),domain:f.domain,reverse:f.reverse,range:[0,1],clamp:f.clamp,base:f.base,exponent:f.exponent,constant:f.constant}});return NY(1024,f,d.apply)}}function Yct(e){return e.endsWith("symlog")?"symlog":e.endsWith("log")?"log":e.endsWith("pow")?"pow":e.endsWith("sqrt")?"sqrt":e==="diverging"?"linear":e}function Wct(e,t,r){if(!e.image||e.image.w!==t||e.image.h!==r){let n=PI(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 ex=class extends Dl{constructor(t,r){let{normalize:n=!0,...i}=r;super(t,i),this.normalize=Ge(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,Cs(this,t),i),[c]=Ii(this,"y",s,Bs(this,t),i),l=ft.from(this.sourceTable()).where(Gct(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 qA(l,a,c,f,o,s,u,n)}};function Gct(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 Xct={fill:1,stroke:1,z:1},sp=class extends Tr{constructor(t,r,n){let{bins:i=1024,bandwidth:o=20,normalize:s=!1,stack:a=!1,...c}=n,l=t.endsWith("X")?"y":"x";super(t,r,c,l==="x"?g8:x8),this.dim=l,this.bins=Ge(i,u=>(this.bins=u,this.requestUpdate())),this.bandwidth=Ge(o,u=>(this.bandwidth=u,this.grids?this.convolve().update():null)),this.normalize=Ge(s,u=>(this.normalize=u,this.convolve().update())),this.stack=Ge(a,u=>(this.stack=u,this.update()))}get filterStable(){let t=this.dim==="x"?"xDomain":"yDomain",r=this.plot.getAttribute(t);return r&&!r[Hr]}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"?Cs:Bs)(this,t),[s,a]=Ii(this,i,r,o),c=X0(n,this.sourceTable(),[i]).where(t.concat(Vr(a,o))),l=this.channelField("weight")?"weight":null,u=this.groupby=n.flatMap(f=>Xct[f.channel]&&f.field?f.as:[]);return zA(c,s,l,u)}queryResult(t){let r=Hn(t).columns;return this.grids=wY(this.bins,r.index,r.density,r,this.groupby),this.convolve()}convolve(){let{bins:t,bandwidth:r,normalize:n,dim:i,grids:o,groupby:s,plot:a,extent:[c,l]}=this,u=o.columns,f=o.numRows,d=this.channelField(i).as,h=i==="x"?"y":"x",p=i==="x"?a.innerWidth():a.innerHeight(),m=u._grid.some(S=>S.some(A=>A<0)),y=Z0(r*(t-1)/p,m),g=+c,x=(l-g)/(t-1),b=t*f,_=new Float64Array(b),v=new Float64Array(b),w=s.reduce((S,A)=>(S[A]=Array(b),S),{});for(let S=0,A=0;A<f;++A){s.forEach(R=>w[R].fill(u[R][A],S,S+t));let E=u._grid[A],M=CI(y,E,t),T=1/Hct(E,M,x,n);for(let R=0;R<t;++R,++S)_[S]=g+R*x,v[S]=M[R]*T}return this.data={numRows:b,columns:{[d]:_,[h]:v,...w}},this}plotSpecs(){let{type:t,data:{numRows:r,columns:n},channels:i,dim:o,stack:s}=this,a=t.startsWith("area")&&!s?"2":"",c=o==="x"?{[`y${a}`]:n.y}:{[`x${a}`]:n.x};for(let l of i)c[l.channel]=yn(l,n);return[{type:t,data:{length:r},options:c}]}};function Hct(e,t,r,n){return(n===!0||n==="sum"?wr(e):n==="max"?Xt(t):r)||1}var rx=class extends Co{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=Qct(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 Qct(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 S in b)g[S].fill(b[S][v],_,_+d);let w=x[v];for(let S=0,A=0;A<f;++A)for(let E=0;E<u;++E,++_,++S)p[_]=s(r+(E+c)*i),m[_]=a(n+(A+c)*o),y[_]=w[S]*l}return{numRows:h,columns:g}}function Zct(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=-ap(t)-ap(r)+ap(t+r);s<10;s++){if(h===0||h===1)return h;if(d=Kct(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 Kct(e,t,r){var n=e===0||e===1?0:Math.exp(ap(t+r)-ap(t)-ap(r)+t*Math.log(e)+r*Math.log(1-e));return e<0||e>1?0:e<(t+1)/(t+r+2)?n*OY(e,t,r)/t:1-n*OY(1-e,r,t)/r}function OY(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 ap(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 RY(e,t){var r=Zct(2*Math.min(e,1-e),.5*t,.5);return r=Math.sqrt(t*(1-r)/r),e>.5?r:-r}function DY(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 cp=class extends Tr{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=Ge(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),Xs(Or(n))),as:"__se__"}]);return X0(i,this.sourceTable()).where(t)}queryResult(t){return this.data=Hn(t),this}plotSpecs(){let{type:t,dim:r,detail:n,data:i,ci:o,channels:s}=this,a=Math.SQRT2*DY(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 y8(t,n,s,i,u)}};var Jct="geom",nx=class extends Tr{constructor(t,r={},n){!FI(t)&&!r?.geometry&&(r.geometry=tm(Jct)),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 ix=class extends Tr{constructor(t,r){let{type:n="hexagon",binWidth:i=20,...o}=r;super(n,t,{r:i/2,clip:!0,...o},kI),this.binWidth=Ge(i,s=>(this.binWidth=s,this.requestUpdate()))}get filterStable(){let t=this.plot.getAttribute("xDomain"),r=this.plot.getAttribute("yDomain");return t&&r&&!t[Hr]&&!r[Hr]}query(t=[]){if(this.hasOwnData())return null;let{plot:r,binWidth:n,channels:i}=this,o,s,a=new Set,c={};for(let M of i)if(M.channel!=="orderby"){if(M.channel==="x")o=M;else if(M.channel==="y")s=M;else if(Object.hasOwn(M,"field")){let{as:T,field:R}=M;c[T]=R,gn(R)||a.add(T)}}let[l,u]=Cs(this,t),[f,d]=Bs(this,t),h=.5-r.getAttribute("marginLeft"),p=0-r.getAttribute("marginTop"),m=Xe(n),y=Xe(n*(1.5/Math.sqrt(3))),g=Xe(r.innerWidth()/(u-l)),x=Xe(r.innerHeight()/(d-f)),b="_x",_="_y",v="_px",w="_py",S="_pi",A="_pj",E="_tt";return ft.select({[o.as]:te(Xe(l),se(te(Nt(te(b,Nt(.5,Kp(_,1))),m),h),g)),[s.as]:Tt(Xe(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(Hs(w)),[v]:Tt(se(Tt(Nt(g,Tt(o.field,l)),h),m),Nt(.5,Kp(A,1))),[S]:ve(Hs(v)),[E]:on(Di(Nt(Rr(Tt(w,A)),3),1),Di(te(ir(Tt(v,S),2),ir(Tt(w,A),2)),te(ir(Tt(Tt(v,S),Nt(.5,Gs(ze(v,S),-1,1))),2),ir(Tt(Tt(w,A),Gs(ze(w,A),-1,1)),2)))),[b]:Gs(E,ve(te(te(S,Gs(ze(v,S),-.5,.5)),Gs(so(Kp(A,1),0),.5,-.5))),S),[_]:Gs(E,ve(te(A,Gs(ze(w,A),-1,1))),A)},"*").from(this.sourceTable()).where(Ri(o.field),Ri(s.field),t))}};var ox=class extends Co{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?[Vr(h,[+s,+a]),Vr(m,[+c,+l])]:[ni(+s,h),ze(h,+a),ni(+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:S,field:A}=v;A.aggregate?(b[S]=A,o[S]=!0):S==="weight"?b.density=de(A):S!=="x"&&S!=="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=Or()),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 ilt(g,d,p,b.density,u,x)}else return nlt(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]=Cs(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=(T,R)=>[[o+T*h,o+(T+1)*h],[s+R*p,s+(R+1)*p]],x=Math.floor((l-o)/h),b=n?LY((u-o)/h):x,_=Math.floor((f-s)/p),v=i?LY((d-s)/p):_,w=[];for(let T=x;T<=b;++T)for(let R=_;R<=v;++R)w.push([T,R]);let S=w.map(([T,R])=>t.query(this.tileQuery(g(T,R)))),A=[];if(n)for(let T=_;T<=v;++T)A.push([b+1,T]),A.push([x-1,T]);if(i){let T=n?x-1:x,R=n?b+1:b;for(let k=T;k<=R;++k)A.push([k,v+1]),A.push([k,_-1])}this.prefetch=A.map(([T,R])=>t.prefetch(this.tileQuery(g(T,R))));let E=await Promise.all(S),M=tlt(a,c,m,y,w,E);this.grids0={numRows:M.length,columns:{density:[M]}},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}=rlt(this,n,i),{alpha:u,alphaProp:f,color:d,colorProp:h}=w8(this),p=s[f]??[],m=s[h]??[],y=o>1&&h&&this.groupby?.includes(h)?BI(m,this.plot.getAttribute("colorDomain")):J0(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 tlt(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;elt(e,t,s,a,f,d)}),s}function elt(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 rlt(e,t,r){if(!e.image||e.image.w!==t||e.image.h!==r){let n=PI(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 nlt(e,t,r,n,i,o){return e.select({index:er`FLOOR(${t})::INTEGER + FLOOR(${r})::INTEGER * ${i}`,...n}).groupby("index",o)}function ilt(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(er`FLOOR(xp)::INTEGER + FLOOR(yp)::INTEGER * ${i}`,er`(FLOOR(xp)::INTEGER + 1 - xp) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),l=a(er`FLOOR(xp)::INTEGER + (FLOOR(yp)::INTEGER + 1) * ${i}`,er`(FLOOR(xp)::INTEGER + 1 - xp) * (yp - FLOOR(yp)::INTEGER)${s}`),u=a(er`FLOOR(xp)::INTEGER + 1 + FLOOR(yp)::INTEGER * ${i}`,er`(xp - FLOOR(xp)::INTEGER) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),f=a(er`FLOOR(xp)::INTEGER + 1 + (FLOOR(yp)::INTEGER + 1) * ${i}`,er`(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 LY(e){let t=Math.floor(e);return t===e?t-1:t}var sx=class extends Tr{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=Ge(n,a=>(this.ci=a,s())),this.precision=Ge(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:jT(n,r),slope:YT(n,r),n:Qp(n,r),ssy:VT(n,r),ssx:qT(n,r),xm:Hp(n,r),x0:Xe(jn(r).where(Ri(n))),x1:Xe(qr(r).where(Ri(n)))}).select(i).groupby(i)}queryResult(t){return this.modelFit=Hn(t),this.lineData=olt(this.modelFit),this.confidenceBand()}confidenceBand(){let{ci:t,modelFit:r,precision:n,plot:i}=this,o=i.innerWidth();return this.areaData=t?slt(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 v8(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 olt(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=v8(t,r),d=v8(t.map(u),r.map(u));for(let h in l)l[h]=v8(l[h],l[h]);return{numRows:f.length,columns:{x:f,y:d,...l}}}function slt(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=RY((1-t)/2,u[y]-2)*Math.sqrt(d[y]/(u[y]-2));rr(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 lp(e){e.tagName==="a"&&(e=e.children[0]);let t=e.__data__;return Array.isArray(t)?t[0]:t}function FY(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[FY(r)]=e[r];return t}function alt(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(gn(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 ax=class{constructor(t,{selection:r,channels:n={}}){this.mark=alt(t),this.selection=r;let i=Object.entries(Ll(n));this.channels=i.length?i:[["opacity",.2]],this.selection.addEventListener("value",dp(()=>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 clt(o,s);for(let c=0;c<r.length;++c){let l=r[c],u=i[c],f=a(lp(l));for(let d=0;d<n.length;++d){let[h,p]=n[d];l.setAttribute(h,f?u[d]:p)}}}};async function clt(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 UI(){let e=this,t=e.getScreenCTM,r;e.getScreenCTM=()=>e.isConnected?r=t.call(e):r}function S8(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 $I(){return S8(WM())}function kY(){return S8(VM())}function CY(){return S8(YM())}function zI(e,t,r,n,i){let o=Zt(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(UI)}function cx(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 BY(e){if(Mr(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 BY(e.channelField(t)?.field)}function PY(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(BY(a.field)),n.push(a.as);return}}throw new Error(`Missing channel: ${i}`)}),{fields:r,as:n}}function lx(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"?CY():kY(),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=>lx(n,this.scale,this.pixelSize)).sort((n,i)=>n-i)),cx(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([[Qt(a),Qt(c)],[Xt(a),Xt(c)]]),this.g=zI(t,r,Qt(a),Qt(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 ux=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=$I(),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=>lx(u,i,n)).sort(Ft),a=[c[1],l[1]].map(u=>lx(u,o,n)).sort(Ft)}(!cx(s,r?.[0])||!cx(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 oM([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([[Qt(a),Qt(c)],[Xt(a),Xt(c)]]),this.g=zI(t,null,Qt(a),Qt(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?va(n,t&&[t],i):Bc(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]=llt(t,n),d=this.pointer==="y"?.01:1,h=this.pointer==="x"?.01:1,p=Zt(t);p.on("pointerenter pointerdown pointermove",function(m){let[y,g]=an(m,this),x=ult(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 llt(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=Qt(o.range),d=n("fx");for(let h=0;h<d.length;++h)l[h]+=a(d[h])-f}if(c){let f=Qt(s.range),d=n("fy");for(let h=0;h<d.length;++h)u[h]+=c(d[h])-f}return[l,u]}function ult(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 UY=(e,t)=>e-t,fx=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=I8(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=flt(t,this.xscale);this.xsel.update(this.clause(r,this.xfield,this.xscale))}if(this.pany){let r=dlt(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(UY),c=this.yscale.range.slice().sort(UY),l=I8(r,[-1/0,1/0],a),u=I8(n,[-1/0,1/0],c),f=l4().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(Zt(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 I8(e,t,r){return e?Array.isArray(e)?e:t:r}function flt(e,t){return t.range.map(e.invertX,e).map(t.invert,t)}function dlt(e,t){return t.range.map(e.invertY,e).map(t.invert,t)}var hlt={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},plt=/[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi,mlt=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,ylt=/^((\s+,?\s*)|(,\s*))/,glt=/^[01]/,$Y=e=>`Invalid SVG path, incorrect parameter ${e}`;function zY(e){let t=[];return(e.match(plt)||[]).forEach(n=>{let i=n[0],o=i.toLowerCase(),s=hlt[o],a=xlt(o,s,n.slice(1).trim()),c=a.length;if(c<s||c&&c%s!==0)throw new Error($Y("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 xlt(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)?glt:mlt,a=r.slice(i).match(s);if(a===null)throw new Error($Y("type"));i+=a[0].length,n.push(+a[0]);let c=r.slice(i).match(ylt);c!==null&&(i+=c[0].length)}return n}function WY(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=GY(a)??o;for(let l of a.children)jY(r,n,i,l,c)&&s.push(l)}else jY(r,n,i,a,o)&&s.push(a);return s}function jY(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 XY(o,s,a,c,Sf(n.cx),Sf(n.cy),Sf(n.r));case"line":return HY(o,s,a,c,Sf(n.x1),Sf(n.y1),Sf(n.x2),Sf(n.y2));case"path":return blt(o,s,a,c,n)}}return!1}function Sf(e){return e.baseVal.value}function GY(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 XY(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 HY(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 blt(e,t,r,n,i){let o=i.__path__||(i.__path__=zY(i.getAttribute("d"))),s=0,a=0,c=0,l=0,u=!1,f=[0,0],d=2,h=GY(i),p=(x,b)=>{f.length=d=2,f[0]=c=s=x,f[1]=l=a=b},m=h?(x,b)=>p(qY(h,x,b),VY(h,x,b)):(x,b)=>p(x,b),y=(x,b)=>(f[d]=x,f[d+1]=b,d+=2,HY(e,t,r,n,f[d-4],f[d-3],x,b)),g=h?(x,b)=>{u=y(qY(h,c=x,l=b),VY(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(_lt(o,x))return XY(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),wlt(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 qY(e,t,r){return e.a*t+e.c*r+e.e}function VY(e,t,r){return e.b*t+e.d*r+e.f}function _lt(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 wlt(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&&YY(e,t,r,o)>0&&++n:r[o+3]<=t&&YY(e,t,r[o])<0&&--n;return n}function YY(e,t,r,n){return(r[n+2]-r[n])*(t-r[n+1])-(e-r[n])*(r[n+3]-r[n+1])}function jI(e,t){return e==null||t==null?e!=null||t!=null:e.length!==t.length||e.some((r,n)=>qI(r,t[n]))}function qI(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 dx=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=$I(),this.brush.on("brush end",c=>this.publish(c.selection)),this.extent=null,this.groups=null;let{fields:s,as:a}=PY(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 va(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;WY(o,n,t).forEach(l=>{let u=lp(l),f=r.map(d=>a[d][u]);c.set(f.join("|"),f)}),s=Array.from(c.values())}this.extent=t,jI(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=Zt(t).append("g").attr("class","region-xy").each(UI).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 va(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][lp(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(vlt(c,f)){let h=n(f);(l.shiftKey||l.metaKey)&&u?.length?(d=u.filter(p=>qI(p,h)),d.length===u.length&&d.push(h)):u?.length===1&&!qI(u[0],h)?d=null:d=[h]}this.value=d,jI(u,d)&&s.update(this.clause(d))}),t.addEventListener("pointerenter",l=>{l.buttons||this.selection.activate(this.clause([this.fields.map(()=>0)]))})}};function vlt(e,t){return e.some(r=>r.contains(t))}var ZY=":scope > div, :scope > span",VI="swatch",QY="ramp",up=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=Slt(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(ZY);for(let c of a){let l=s?s.has(c.__data__):!0;c.style.opacity=l?1:.2}}};function Slt(e,t){let{channel:r,plot:n,selection:i}=e,o=t.scale(r),s=o.type==="ordinal"?VI:QY,a={label:n.getAttribute(`${r}Label`)??null,...e.options},c=s===VI?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===QY){let f=c.width??240,d=Elt(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=Ilt(e,s);s===VI?(f.init(l,ZY,d=>[d.__data__]),e.update()):f.init(l,l.querySelector("g:last-of-type"))}return l}function Ilt(e,t){let{channel:r,handler:n,selection:i}=e;if(n)return n;let o=Tlt(e);return t===VI?(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 Tlt(e){let{channel:t,plot:r}=e,n=e.field??Alt(r.marks,t)??"value";if(n){let i={field:n};return{plot:r,channelField:o=>t===o?i:void 0}}}function Alt(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 Elt(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 YI(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 KY(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||YI(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 rW="year",JY="month",tW="day",WI="hour",GI="minute",XI="second",Mlt="millisecond",px=1e3,mx=px*60,yx=mx*60,HI=yx*24,Nlt=HI*7,eW=HI*30,nW=HI*365,hx=[[XI,1,px],[XI,5,5*px],[XI,15,15*px],[XI,30,30*px],[GI,1,mx],[GI,5,5*mx],[GI,15,15*mx],[GI,30,30*mx],[WI,1,yx],[WI,3,3*yx],[WI,6,6*yx],[WI,12,12*yx],[tW,1,HI],[tW,7,Nlt],[JY,1,eW],[JY,3,3*eW],[rW,1,nW]];function iW(e,t,r){let n=t-e,i=n/r,o=To(s=>s[2]).right(hx,i);return o===hx.length?{interval:rW,step:YI(n/nW,r)}:o?(o=hx[i/hx[o-1][2]<hx[o][2]/i?o-1:o],{interval:o[0],step:o[1]}):{interval:Mlt,step:YI(n,r,1)}}var Olt=new Set(["rectY-x","rectX-y","rect-x","rect-y","ruleY-x","ruleX-y"]);function Rlt(e,t){return Olt.has(`${e.type}-${t}`)}function E8(e,t={}){let r=(n,i)=>Rlt(n,i)?{[`${i}1`]:T8(n,i,e,t),[`${i}2`]:T8(n,i,e,{...t,offset:1})}:{[i]:T8(n,i,e,t)};return r[sy]=!0,r}function T8(e,t,r,n){return new A8(r,e,t,n)}function Dlt(e,t){let r=e.plot.getAttribute(`${t}Scale`);return r==="utc"||r==="time"}var A8=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"||Dlt(t,r)?"date":"number"),d;if(f==="number"){let{apply:h,sqlApply:p,sqlInvert:m}=wf(t,r),y=KY(h(s),h(a),i),g=p(n),x=Xe((y.max-y.min)/y.steps),b=Dr(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"?iW(s,a,l||40):i,m=JT(n,h,p);d=u?te(m,Wb(h,u*p)):m}return`${d}`}};var Llt=e=>e&&typeof e=="object"&&!Array.isArray(e);var gx=class extends Pn{constructor({element:t,filterBy:r,as:n,from:i,column:o,label:s=o,format:a=f=>f,options:c,value:l,field:u=o}={}){super(r),this.from=i,this.column=o,this.format=a,this.field=u;let f=this.selection=n;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=s||o,this.element.appendChild(d),this.select=document.createElement("select"),this.element.appendChild(this.select),c&&(this.data=c.map(h=>Llt(h)?h:{value:h}),this.selectedValue(l===void 0?"":l),this.update()),f){let h=!ii(f);l!=null&&(!h||f.value===void 0)&&this.publish(l),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(Bc(this.field,0,{source:this}))}publish(t){let{selection:r,field:n}=this;if(ii(r)){t===""&&(t=void 0);let i=Bc(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===void 0?"":o)}return this}};var Flt=0;var xx=class extends Pn{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_"+ ++Flt,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 sM(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 klt=0;var bx=class extends Pn{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_"+ ++klt,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:jn(n),max:qr(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 Bc(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 N8=oW(e=>{let t=QI(e);return r=>r==null?"":typeof r=="number"?t(r):r instanceof Date?O8(r):`${r}`}),QI=oW(e=>t=>t===0?"0":t.toLocaleString(e)),Kce=N8(),Jce=QI();function O8(e){return mh(e,"Invalid Date")}function oW(e){let t=null,r;return(n="en")=>n===t?r:r=e(t=n)}var Clt=-1;var _x=class extends Pn{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-${++Clt}`,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=Blt(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 va(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=>({column:r,table: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=Plt(this.format,t),this.style.innerText=zlt(this.id,Ult(this.align,t),$lt(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?dA(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(Hn(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 Blt(e){let t=e.parentElement;return Object.hasOwn(t,"__row__")?+t.__row__:-1}function Plt(e={},t,r){return t.map(({column:n,type:i})=>{if(n in e)return e[n];switch(i){case"number":return QI(r);case"date":return O8;default:return N8(r)}})}function Ult(e={},t){return t.map(({column:r,type:n})=>r in e?e[r]:n==="number"?"right":"left")}function $lt(e={},t){return t.map(({column:r})=>e[r])}function zlt(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 wx(e,...t){let r=e?.context?.coordinator??Li();for(let n of t)r.connect(n)}function ZI(e,t,r){let n=new t(r);return wx(e,n),n.element}function sW(e){return ZI(this,gx,e)}function aW(e){return ZI(this,xx,e)}function cW(e){return ZI(this,bx,e)}function lW(e){return ZI(this,_x,e)}function uW({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 fW(...e){return uW({direction:"vertical"},e.flat())}function dW(...e){return uW({direction:"horizontal"},e.flat())}function hW({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 pW(e){return hW({dim:"height",size:e})}function mW(e){return hW({dim:"width",size:e})}var xW={};ti(xW,{align:()=>Y8,ariaDescription:()=>J8,ariaLabel:()=>K8,aspectRatio:()=>W8,axis:()=>G8,clip:()=>Q8,colorBase:()=>CD,colorClamp:()=>ID,colorConstant:()=>PD,colorDomain:()=>vD,colorExponent:()=>BD,colorInterpolate:()=>MD,colorLabel:()=>RD,colorN:()=>TD,colorNice:()=>AD,colorPercent:()=>DD,colorPivot:()=>ND,colorRange:()=>SD,colorReverse:()=>LD,colorScale:()=>wD,colorScheme:()=>ED,colorSymmetric:()=>OD,colorTickFormat:()=>kD,colorZero:()=>FD,facetGrid:()=>wR,facetLabel:()=>vR,facetMargin:()=>yR,facetMarginBottom:()=>xR,facetMarginLeft:()=>bR,facetMarginRight:()=>_R,facetMarginTop:()=>gR,fxAlign:()=>NR,fxAriaDescription:()=>GR,fxAriaLabel:()=>WR,fxAxis:()=>LR,fxDomain:()=>SR,fxFontVariant:()=>YR,fxGrid:()=>$R,fxInset:()=>TR,fxInsetLeft:()=>AR,fxInsetRight:()=>ER,fxLabel:()=>jR,fxLabelAnchor:()=>qR,fxLabelOffset:()=>VR,fxLine:()=>zR,fxPadding:()=>OR,fxPaddingInner:()=>RR,fxPaddingOuter:()=>DR,fxRange:()=>IR,fxReverse:()=>XR,fxRound:()=>MR,fxTickFormat:()=>PR,fxTickPadding:()=>BR,fxTickRotate:()=>UR,fxTickSize:()=>kR,fxTickSpacing:()=>CR,fxTicks:()=>FR,fyAlign:()=>eD,fyAriaDescription:()=>bD,fyAriaLabel:()=>xD,fyAxis:()=>oD,fyDomain:()=>HR,fyFontVariant:()=>gD,fyGrid:()=>dD,fyInset:()=>ZR,fyInsetBottom:()=>JR,fyInsetTop:()=>KR,fyLabel:()=>pD,fyLabelAnchor:()=>mD,fyLabelOffset:()=>yD,fyLine:()=>hD,fyPadding:()=>rD,fyPaddingInner:()=>nD,fyPaddingOuter:()=>iD,fyRange:()=>QR,fyReverse:()=>_D,fyRound:()=>tD,fyTickFormat:()=>uD,fyTickPadding:()=>lD,fyTickRotate:()=>fD,fyTickSize:()=>aD,fyTickSpacing:()=>cD,fyTicks:()=>sD,grid:()=>H8,height:()=>$8,inset:()=>X8,lengthBase:()=>bL,lengthClamp:()=>mL,lengthConstant:()=>wL,lengthDomain:()=>hL,lengthExponent:()=>_L,lengthNice:()=>yL,lengthPercent:()=>gL,lengthRange:()=>pL,lengthScale:()=>dL,lengthZero:()=>xL,margin:()=>C8,marginBottom:()=>V8,marginLeft:()=>z8,marginRight:()=>j8,marginTop:()=>q8,margins:()=>k8,name:()=>L8,opacityBase:()=>HD,opacityClamp:()=>jD,opacityConstant:()=>ZD,opacityDomain:()=>$D,opacityExponent:()=>QD,opacityLabel:()=>VD,opacityNice:()=>qD,opacityPercent:()=>YD,opacityRange:()=>zD,opacityReverse:()=>WD,opacityScale:()=>UD,opacityTickFormat:()=>XD,opacityZero:()=>GD,padding:()=>Z8,projectionClip:()=>DL,projectionDomain:()=>AL,projectionInset:()=>EL,projectionInsetBottom:()=>RL,projectionInsetLeft:()=>ML,projectionInsetRight:()=>NL,projectionInsetTop:()=>OL,projectionParallels:()=>SL,projectionPrecision:()=>IL,projectionRotate:()=>TL,projectionType:()=>vL,rBase:()=>lL,rClamp:()=>iL,rConstant:()=>fL,rDomain:()=>rL,rExponent:()=>uL,rLabel:()=>sL,rNice:()=>oL,rPercent:()=>aL,rRange:()=>nL,rScale:()=>eL,rZero:()=>cL,style:()=>P8,symbolDomain:()=>JD,symbolRange:()=>tL,symbolScale:()=>KD,width:()=>U8,xAlign:()=>lO,xAriaDescription:()=>MO,xAriaLabel:()=>EO,xAxis:()=>hO,xBase:()=>DO,xClamp:()=>aO,xConstant:()=>FO,xDomain:()=>eO,xExponent:()=>LO,xFontVariant:()=>AO,xGrid:()=>_O,xInset:()=>iO,xInsetLeft:()=>oO,xInsetRight:()=>sO,xLabel:()=>vO,xLabelAnchor:()=>SO,xLabelArrow:()=>IO,xLabelOffset:()=>TO,xLine:()=>wO,xNice:()=>nO,xPadding:()=>uO,xPaddingInner:()=>fO,xPaddingOuter:()=>dO,xPercent:()=>NO,xRange:()=>rO,xReverse:()=>OO,xRound:()=>cO,xScale:()=>tO,xTickFormat:()=>xO,xTickPadding:()=>gO,xTickRotate:()=>bO,xTickSize:()=>mO,xTickSpacing:()=>yO,xTicks:()=>pO,xZero:()=>RO,xyDomain:()=>B8,yAlign:()=>VO,yAriaDescription:()=>lR,yAriaLabel:()=>cR,yAxis:()=>XO,yBase:()=>hR,yClamp:()=>jO,yConstant:()=>mR,yDomain:()=>CO,yExponent:()=>pR,yFontVariant:()=>aR,yGrid:()=>eR,yInset:()=>UO,yInsetBottom:()=>zO,yInsetTop:()=>$O,yLabel:()=>nR,yLabelAnchor:()=>iR,yLabelArrow:()=>oR,yLabelOffset:()=>sR,yLine:()=>rR,yNice:()=>PO,yPadding:()=>YO,yPaddingInner:()=>WO,yPaddingOuter:()=>GO,yPercent:()=>uR,yRange:()=>BO,yReverse:()=>fR,yRound:()=>qO,yScale:()=>kO,yTickFormat:()=>JO,yTickPadding:()=>KO,yTickRotate:()=>tR,yTickSize:()=>QO,yTickSpacing:()=>ZO,yTicks:()=>HO,yZero:()=>dR});var vx=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()}},R8=new vx;function D8(e,t,r){(e?.context?.namedPlots??R8).request(t,r)}function yW(e,t,r){(e?.context?.namedPlots??R8).set(t,r)}function L8(e){return t=>yW(this,e,t)}function gW(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 jlt(e,t){return r=>{gW(r,e,t)}}function F8(e){return t=>{for(let[r,n]of Object.entries(e))gW(t,r,n)}}function k8(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),F8(o)}function C8(e){return F8({marginTop:e,marginBottom:e,marginLeft:e,marginRight:e})}function B8(e){return F8({xDomain:e,yDomain:e})}var F=e=>t=>jlt(e,t),P8=F("style"),U8=F("width"),$8=F("height"),z8=F("marginLeft"),j8=F("marginRight"),q8=F("marginTop"),V8=F("marginBottom"),Y8=F("align"),W8=F("aspectRatio"),G8=F("axis"),X8=F("inset"),H8=F("grid"),Q8=F("clip"),Z8=F("padding"),K8=F("ariaLabel"),J8=F("ariaDescription"),tO=F("xScale"),eO=F("xDomain"),rO=F("xRange"),nO=F("xNice"),iO=F("xInset"),oO=F("xInsetLeft"),sO=F("xInsetRight"),aO=F("xClamp"),cO=F("xRound"),lO=F("xAlign"),uO=F("xPadding"),fO=F("xPaddingInner"),dO=F("xPaddingOuter"),hO=F("xAxis"),pO=F("xTicks"),mO=F("xTickSize"),yO=F("xTickSpacing"),gO=F("xTickPadding"),xO=F("xTickFormat"),bO=F("xTickRotate"),_O=F("xGrid"),wO=F("xLine"),vO=F("xLabel"),SO=F("xLabelAnchor"),IO=F("xLabelArrow"),TO=F("xLabelOffset"),AO=F("xFontVariant"),EO=F("xAriaLabel"),MO=F("xAriaDescription"),NO=F("xPercent"),OO=F("xReverse"),RO=F("xZero"),DO=F("xBase"),LO=F("xExponent"),FO=F("xConstant"),kO=F("yScale"),CO=F("yDomain"),BO=F("yRange"),PO=F("yNice"),UO=F("yInset"),$O=F("yInsetTop"),zO=F("yInsetBottom"),jO=F("yClamp"),qO=F("yRound"),VO=F("yAlign"),YO=F("yPadding"),WO=F("yPaddingInner"),GO=F("yPaddingOuter"),XO=F("yAxis"),HO=F("yTicks"),QO=F("yTickSize"),ZO=F("yTickSpacing"),KO=F("yTickPadding"),JO=F("yTickFormat"),tR=F("yTickRotate"),eR=F("yGrid"),rR=F("yLine"),nR=F("yLabel"),iR=F("yLabelAnchor"),oR=F("yLabelArrow"),sR=F("yLabelOffset"),aR=F("yFontVariant"),cR=F("yAriaLabel"),lR=F("yAriaDescription"),uR=F("yPercent"),fR=F("yReverse"),dR=F("yZero"),hR=F("yBase"),pR=F("yExponent"),mR=F("yConstant"),yR=F("facetMargin"),gR=F("facetMarginTop"),xR=F("facetMarginBottom"),bR=F("facetMarginLeft"),_R=F("facetMarginRight"),wR=F("facetGrid"),vR=F("facetLabel"),SR=F("fxDomain"),IR=F("fxRange"),TR=F("fxInset"),AR=F("fxInsetLeft"),ER=F("fxInsetRight"),MR=F("fxRound"),NR=F("fxAlign"),OR=F("fxPadding"),RR=F("fxPaddingInner"),DR=F("fxPaddingOuter"),LR=F("fxAxis"),FR=F("fxTicks"),kR=F("fxTickSize"),CR=F("fxTickSpacing"),BR=F("fxTickPadding"),PR=F("fxTickFormat"),UR=F("fxTickRotate"),$R=F("fxGrid"),zR=F("fxLine"),jR=F("fxLabel"),qR=F("fxLabelAnchor"),VR=F("fxLabelOffset"),YR=F("fxFontVariant"),WR=F("fxAriaLabel"),GR=F("fxAriaDescription"),XR=F("fxReverse"),HR=F("fyDomain"),QR=F("fyRange"),ZR=F("fyInset"),KR=F("fyInsetTop"),JR=F("fyInsetBottom"),tD=F("fyRound"),eD=F("fyAlign"),rD=F("fyPadding"),nD=F("fyPaddingInner"),iD=F("fyPaddingOuter"),oD=F("fyAxis"),sD=F("fyTicks"),aD=F("fyTickSize"),cD=F("fyTickSpacing"),lD=F("fyTickPadding"),uD=F("fyTickFormat"),fD=F("fyTickRotate"),dD=F("fyGrid"),hD=F("fyLine"),pD=F("fyLabel"),mD=F("fyLabelAnchor"),yD=F("fyLabelOffset"),gD=F("fyFontVariant"),xD=F("fyAriaLabel"),bD=F("fyAriaDescription"),_D=F("fyReverse"),wD=F("colorScale"),vD=F("colorDomain"),SD=F("colorRange"),ID=F("colorClamp"),TD=F("colorN"),AD=F("colorNice"),ED=F("colorScheme"),MD=F("colorInterpolate"),ND=F("colorPivot"),OD=F("colorSymmetric"),RD=F("colorLabel"),DD=F("colorPercent"),LD=F("colorReverse"),FD=F("colorZero"),kD=F("colorTickFormat"),CD=F("colorBase"),BD=F("colorExponent"),PD=F("colorConstant"),UD=F("opacityScale"),$D=F("opacityDomain"),zD=F("opacityRange"),jD=F("opacityClamp"),qD=F("opacityNice"),VD=F("opacityLabel"),YD=F("opacityPercent"),WD=F("opacityReverse"),GD=F("opacityZero"),XD=F("opacityTickFormat"),HD=F("opacityBase"),QD=F("opacityExponent"),ZD=F("opacityConstant"),KD=F("symbolScale"),JD=F("symbolDomain"),tL=F("symbolRange"),eL=F("rScale"),rL=F("rDomain"),nL=F("rRange"),iL=F("rClamp"),oL=F("rNice"),sL=F("rLabel"),aL=F("rPercent"),cL=F("rZero"),lL=F("rBase"),uL=F("rExponent"),fL=F("rConstant"),dL=F("lengthScale"),hL=F("lengthDomain"),pL=F("lengthRange"),mL=F("lengthClamp"),yL=F("lengthNice"),gL=F("lengthPercent"),xL=F("lengthZero"),bL=F("lengthBase"),_L=F("lengthExponent"),wL=F("lengthConstant"),vL=F("projectionType"),SL=F("projectionParallels"),IL=F("projectionPrecision"),TL=F("projectionRotate"),AL=F("projectionDomain"),EL=F("projectionInset"),ML=F("projectionInsetLeft"),NL=F("projectionInsetRight"),OL=F("projectionInsetTop"),RL=F("projectionInsetBottom"),DL=F("projectionClip");function bW(e,t){return{table:e,options:t}}var _W={};ti(_W,{area:()=>LL,areaX:()=>FL,areaY:()=>kL,arrow:()=>MF,axisFx:()=>LF,axisFy:()=>FF,axisX:()=>RF,axisY:()=>DF,barX:()=>UL,barY:()=>$L,cell:()=>zL,cellX:()=>jL,cellY:()=>qL,circle:()=>QL,contour:()=>pF,delaunayLink:()=>TF,delaunayMesh:()=>AF,denseLine:()=>hF,density:()=>dF,densityX:()=>uF,densityY:()=>fF,dot:()=>GL,dotX:()=>XL,dotY:()=>HL,errorbarX:()=>wF,errorbarY:()=>vF,frame:()=>OF,geo:()=>UF,graticule:()=>zF,gridFx:()=>BF,gridFy:()=>PF,gridX:()=>kF,gridY:()=>CF,heatmap:()=>mF,hexagon:()=>ZL,hexbin:()=>xF,hexgrid:()=>bF,hull:()=>EF,image:()=>lF,line:()=>CL,lineX:()=>BL,lineY:()=>PL,link:()=>NF,raster:()=>yF,rasterTile:()=>gF,rect:()=>VL,rectX:()=>YL,rectY:()=>WL,regressionY:()=>_F,ruleX:()=>eF,ruleY:()=>rF,sphere:()=>$F,spike:()=>cF,text:()=>KL,textX:()=>JL,textY:()=>tF,tickX:()=>nF,tickY:()=>iF,vector:()=>oF,vectorX:()=>sF,vectorY:()=>aF,voronoi:()=>SF,voronoiMesh:()=>IF,waffleX:()=>jF,waffleY:()=>qF});var qlt=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=qlt.has(e)?null:[{}]);let n=e.startsWith("area")||e.startsWith("line")?H0:Tr;return KI(n,e,t,r)}function KI(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 LL=(...e)=>St("area",...e),FL=(...e)=>St("areaX",...e),kL=(...e)=>St("areaY",...e),CL=(...e)=>St("line",...e),BL=(...e)=>St("lineX",...e),PL=(...e)=>St("lineY",...e),UL=(...e)=>St("barX",...e),$L=(...e)=>St("barY",...e),zL=(...e)=>St("cell",...e),jL=(...e)=>St("cellX",...e),qL=(...e)=>St("cellY",...e),VL=(...e)=>St("rect",...e),YL=(...e)=>St("rectX",...e),WL=(...e)=>St("rectY",...e),GL=(...e)=>St("dot",...e),XL=(...e)=>St("dotX",...e),HL=(...e)=>St("dotY",...e),QL=(...e)=>St("circle",...e),ZL=(...e)=>St("hexagon",...e),KL=(...e)=>St("text",...e),JL=(...e)=>St("textX",...e),tF=(...e)=>St("textY",...e),eF=(...e)=>St("ruleX",...e),rF=(...e)=>St("ruleY",...e),nF=(...e)=>St("tickX",...e),iF=(...e)=>St("tickY",...e),oF=(...e)=>St("vector",...e),sF=(...e)=>St("vectoX",...e),aF=(...e)=>St("vectorY",...e),cF=(...e)=>St("spike",...e),lF=(...e)=>St("image",...e),uF=(...e)=>KI(sp,"areaX",...e),fF=(...e)=>KI(sp,"areaY",...e),dF=(...e)=>Us(rx,...e),hF=(...e)=>Us(ex,...e),pF=(...e)=>Us(K0,...e),mF=(...e)=>Us(tx,...e),yF=(...e)=>Us(Dl,...e),gF=(...e)=>Us(ox,...e),xF=(...e)=>Us(ix,...e),bF=(...e)=>St("hexgrid",...e),_F=(...e)=>Us(sx,...e),wF=(...e)=>KI(cp,"ruleY",...e),vF=(...e)=>Us(cp,"ruleX",...e),SF=(...e)=>St("voronoi",...e),IF=(...e)=>St("voronoiMesh",...e),TF=(...e)=>St("delaunayLink",...e),AF=(...e)=>St("delaunayMesh",...e),EF=(...e)=>St("hull",...e),MF=(...e)=>St("arrow",...e),NF=(...e)=>St("link",...e),OF=(...e)=>St("frame",...e),RF=(...e)=>St("axisX",...e),DF=(...e)=>St("axisY",...e),LF=(...e)=>St("axisFx",...e),FF=(...e)=>St("axisFy",...e),kF=(...e)=>St("gridX",...e),CF=(...e)=>St("gridY",...e),BF=(...e)=>St("gridFx",...e),PF=(...e)=>St("gridFy",...e),UF=(...e)=>Us(nx,...e),$F=(...e)=>St("sphere",...e),zF=(...e)=>St("graticule",...e),jF=(...e)=>St("waffleX",...e),qF=(...e)=>St("waffleY",...e);var wW={};ti(wW,{highlight:()=>VF,intervalX:()=>YF,intervalXY:()=>GF,intervalY:()=>WF,nearest:()=>XF,nearestX:()=>HF,nearestY:()=>QF,pan:()=>rk,panX:()=>nk,panY:()=>ik,panZoom:()=>ok,panZoomX:()=>sk,panZoomY:()=>ak,region:()=>ZF,toggle:()=>Tf,toggleColor:()=>ek,toggleX:()=>KF,toggleY:()=>JF,toggleZ:()=>tk});function $s(e,t){return r=>{let n=r.marks[r.marks.length-1];r.addInteractor(new e(n,t))}}function VF({by:e,...t}){return $s(ax,{selection:e,channels:t})}function YF({as:e,...t}){return $s(Fl,{...t,selection:e,channel:"x"})}function WF({as:e,...t}){return $s(Fl,{...t,selection:e,channel:"y"})}function GF({as:e,...t}){return $s(ux,{...t,selection:e})}function XF({as:e,...t}){return $s(vf,{...t,selection:e,pointer:"xy"})}function HF({as:e,...t}){return $s(vf,{...t,selection:e,pointer:"x"})}function QF({as:e,...t}){return $s(vf,{...t,selection:e,pointer:"y"})}function ZF({as:e,...t}){return $s(dx,{...t,selection:e})}function Tf({as:e,...t}){return $s(If,{...t,selection:e})}function KF(e){return Tf({...e,channels:["x"]})}function JF(e){return Tf({...e,channels:["y"]})}function tk(e){return Tf({...e,channels:["z"]})}function ek(e){return Tf({...e,channels:["color"]})}function fp(e){return $s(fx,e)}function rk(e={}){return fp({...e,zoom:!1})}function nk(e={}){return fp({...e,zoom:!1,pany:!1})}function ik(e={}){return fp({...e,zoom:!1,panx:!1})}function ok(e={}){return fp(e)}function sk(e={}){return fp({...e,pany:!1})}function ak(e={}){return fp({...e,panx:!1})}var vW={};ti(vW,{colorLegend:()=>lk,opacityLegend:()=>uk,symbolLegend:()=>fk});function ck(e,t={}){if(t.for){let{for:r,...n}=t,i=new up(e,n),o=typeof r,s=a=>a.addLegend(i,!1);return o==="string"?D8(this,r,s):r.value&&s(r.value),i.element}else return r=>r.addLegend(new up(e,t))}function lk(e){return ck.call(this,"color",e)}function uk(e){return ck.call(this,"opacity",e)}function fk(e){return ck.call(this,"symbol",e)}function SW(...e){let t=new G0;return e.flat().forEach(r=>r(t)),wx(this,...t.marks),t.update(),t.element}function Vlt({coordinator:e=Li(),namedPlots:t=new vx,extensions:r=null,...n}={}){return{...dk,...r,context:{coordinator:e,namedPlots:t,...n}}}export{om as Coordinator,es as Fixed,Pn as MosaicClient,wc as Param,ft as Query,qo as Selection,Y8 as align,on as and,LL as area,FL as areaX,kL as areaY,gc as argmax,xc as argmin,J8 as ariaDescription,K8 as ariaLabel,MT as arrayAgg,MF as arrow,W8 as aspectRatio,xW as attributeDirectives,Xp as avg,G8 as axis,LF as axisFx,FF as axisFy,RF as axisX,DF as axisY,UL as barX,$L as barY,E8 as bin,Yf as cast,zL as cell,jL as cellX,qL as cellY,em as centroid,hA as centroidX,pA as centroidY,QL as circle,Q8 as clip,CD as colorBase,ID as colorClamp,PD as colorConstant,vD as colorDomain,BD as colorExponent,MD as colorInterpolate,RD as colorLabel,lk as colorLegend,TD as colorN,AD as colorNice,DD as colorPercent,ND as colorPivot,SD as colorRange,LD as colorReverse,wD as colorScale,ED as colorScheme,OD as colorSymmetric,kD as colorTickFormat,FD as colorZero,Yl as column,wx as connect,pF as contour,Li as coordinator,NT as corr,Or as count,RT as covarPop,OT as covariance,Vlt as createAPIContext,RA as createSchema,bc as createTable,SA as cume_dist,rA as dateDay,tA as dateMonth,eA as dateMonthDay,TF as delaunayLink,AF as delaunayMesh,hF as denseLine,wA as dense_rank,dF as density,uF as densityX,fF as densityY,GL as dot,XL as dotX,HL as dotY,DT as entropy,aA as eq,wF as errorbarX,vF as errorbarY,wR as facetGrid,vR as facetLabel,yR as facetMargin,xR as facetMarginBottom,bR as facetMarginLeft,_R as facetMarginRight,gR as facetMarginTop,LT as first,AA as first_value,ZT as float32,Xe as float64,OF as frame,bW as from,NR as fxAlign,GR as fxAriaDescription,WR as fxAriaLabel,LR as fxAxis,SR as fxDomain,YR as fxFontVariant,$R as fxGrid,TR as fxInset,AR as fxInsetLeft,ER as fxInsetRight,jR as fxLabel,qR as fxLabelAnchor,VR as fxLabelOffset,zR as fxLine,OR as fxPadding,RR as fxPaddingInner,DR as fxPaddingOuter,IR as fxRange,XR as fxReverse,MR as fxRound,PR as fxTickFormat,BR as fxTickPadding,UR as fxTickRotate,kR as fxTickSize,CR as fxTickSpacing,FR as fxTicks,eD as fyAlign,bD as fyAriaDescription,xD as fyAriaLabel,oD as fyAxis,HR as fyDomain,gD as fyFontVariant,dD as fyGrid,ZR as fyInset,JR as fyInsetBottom,KR as fyInsetTop,pD as fyLabel,mD as fyLabelAnchor,yD as fyLabelOffset,hD as fyLine,rD as fyPadding,nD as fyPaddingInner,iD as fyPaddingOuter,QR as fyRange,_D as fyReverse,tD as fyRound,uD as fyTickFormat,lD as fyTickPadding,fD as fyTickRotate,aD as fyTickSize,cD as fyTickSpacing,sD as fyTicks,UF as geo,tm as geojson,zF as graticule,H8 as grid,BF as gridFx,PF as gridFy,kF as gridX,CF as gridY,Di as gt,cA as gte,dW as hconcat,mF as heatmap,$8 as height,ZL as hexagon,xF as hexbin,bF as hexgrid,VF as highlight,mW as hspace,EF as hull,lF as image,X8 as inset,ve as int32,wW as interactorDirectives,YF as intervalX,GF as intervalXY,WF as intervalY,Vr as isBetween,lA as isDistinct,uA as isNotBetween,Jp as isNotDistinct,Ri as isNotNull,Jl as isNull,FT as kurtosis,TA as lag,PT as last,EA as last_value,Gf as lead,vW as legendDirectives,bL as lengthBase,mL as lengthClamp,wL as lengthConstant,hL as lengthDomain,_L as lengthExponent,yL as lengthNice,gL as lengthPercent,pL as lengthRange,dL as lengthScale,xL as lengthZero,CL as line,BL as lineX,PL as lineY,NF as link,Nr as literal,FA as loadCSV,DA as loadExtension,kA as loadJSON,PA as loadObjects,CA as loadParquet,BA as loadSpatial,ze as lt,ni as lte,kT as mad,C8 as margin,V8 as marginBottom,z8 as marginLeft,j8 as marginRight,q8 as marginTop,k8 as margins,_W as markDirectives,qr as max,CT as median,sW as menu,jn as min,BT as mode,L8 as name,R8 as namedPlots,XF as nearest,HF as nearestX,QF as nearestY,so as neq,sA as not,MA as nth_value,IA as ntile,HD as opacityBase,jD as opacityClamp,ZD as opacityConstant,$D as opacityDomain,QD as opacityExponent,VD as opacityLabel,uk as opacityLegend,qD as opacityNice,YD as opacityPercent,zD as opacityRange,WD as opacityReverse,UD as opacityScale,XD as opacityTickFormat,GD as opacityZero,Oi as or,Z8 as padding,rk as pan,nk as panX,ik as panY,ok as panZoom,sk as panZoomX,ak as panZoomY,vA as percent_rank,SW as plot,UT as product,DL as projectionClip,AL as projectionDomain,EL as projectionInset,RL as projectionInsetBottom,ML as projectionInsetLeft,NL as projectionInsetRight,OL as projectionInsetTop,SL as projectionParallels,IL as projectionPrecision,TL as projectionRotate,vL as projectionType,$T as quantile,lL as rBase,iL as rClamp,fL as rConstant,rL as rDomain,uL as rExponent,sL as rLabel,oL as rNice,aL as rPercent,nL as rRange,eL as rScale,cL as rZero,_A as rank,yF as raster,gF as rasterTile,VL as rect,YL as rectX,WL as rectY,ZF as region,_F as regressionY,D8 as requestNamedPlot,_C as restConnector,bA as row_number,eF as ruleX,rF as ruleY,aW as search,WT as skewness,cW as slider,bb as socketConnector,$F as sphere,cF as spike,er as sql,Zp as stddev,GT as stddevPop,XT as stringAgg,P8 as style,de as sum,JD as symbolDomain,fk as symbolLegend,tL as symbolRange,KD as symbolScale,lW as table,KL as text,JL as textX,tF as textY,nF as tickX,iF as tickY,Tf as toggle,ek as toggleColor,KF as toggleX,JF as toggleY,tk as toggleZ,QT as varPop,HT as variance,fW as vconcat,oF as vector,sF as vectorX,aF as vectorY,SF as voronoi,IF as voronoiMesh,pW as vspace,jF as waffleX,qF as waffleY,w5 as wasmConnector,U8 as width,lO as xAlign,MO as xAriaDescription,EO as xAriaLabel,hO as xAxis,DO as xBase,aO as xClamp,FO as xConstant,eO as xDomain,LO as xExponent,AO as xFontVariant,_O as xGrid,iO as xInset,oO as xInsetLeft,sO as xInsetRight,vO as xLabel,SO as xLabelAnchor,IO as xLabelArrow,TO as xLabelOffset,wO as xLine,nO as xNice,uO as xPadding,fO as xPaddingInner,dO as xPaddingOuter,NO as xPercent,rO as xRange,OO as xReverse,cO as xRound,tO as xScale,xO as xTickFormat,gO as xTickPadding,bO as xTickRotate,mO as xTickSize,yO as xTickSpacing,pO as xTicks,RO as xZero,B8 as xyDomain,VO as yAlign,lR as yAriaDescription,cR as yAriaLabel,XO as yAxis,hR as yBase,jO as yClamp,mR as yConstant,CO as yDomain,pR as yExponent,aR as yFontVariant,eR as yGrid,UO as yInset,zO as yInsetBottom,$O as yInsetTop,nR as yLabel,iR as yLabelAnchor,oR as yLabelArrow,sR as yLabelOffset,rR as yLine,PO as yNice,YO as yPadding,WO as yPaddingInner,GO as yPaddingOuter,uR as yPercent,BO as yRange,fR as yReverse,qO as yRound,kO as yScale,JO as yTickFormat,KO as yTickPadding,tR as yTickRotate,QO as yTickSize,ZO as yTickSpacing,HO as yTicks,dR as yZero};