@uwdata/vgplot 0.16.2 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +1 -1
- package/dist/src/api.d.ts +13 -0
- package/dist/src/api.d.ts.map +1 -0
- package/dist/src/connect.d.ts +8 -0
- package/dist/src/connect.d.ts.map +1 -0
- package/dist/src/context.d.ts +7 -0
- package/dist/src/context.d.ts.map +1 -0
- package/dist/src/index.d.ts +10 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/inputs.d.ts +5 -0
- package/dist/src/inputs.d.ts.map +1 -0
- package/dist/src/layout/concat.d.ts +7 -0
- package/dist/src/layout/concat.d.ts.map +1 -0
- package/dist/src/layout/space.d.ts +19 -0
- package/dist/src/layout/space.d.ts.map +1 -0
- package/dist/src/plot/attributes.d.ts +216 -0
- package/dist/src/plot/attributes.d.ts.map +1 -0
- package/dist/src/plot/data.d.ts +5 -0
- package/dist/src/plot/data.d.ts.map +1 -0
- package/dist/src/plot/interactors.d.ts +47 -0
- package/dist/src/plot/interactors.d.ts.map +1 -0
- package/dist/src/plot/legends.d.ts +4 -0
- package/dist/src/plot/legends.d.ts.map +1 -0
- package/dist/src/plot/marks.d.ts +66 -0
- package/dist/src/plot/marks.d.ts.map +1 -0
- package/dist/src/plot/named-plots.d.ts +28 -0
- package/dist/src/plot/named-plots.d.ts.map +1 -0
- package/dist/src/plot/plot.d.ts +2 -0
- package/dist/src/plot/plot.d.ts.map +1 -0
- package/package.json +15 -7
- package/src/api.js +2 -0
- package/src/index.js +6 -3
- package/dist/vgplot.js +0 -49644
- package/dist/vgplot.min.js +0 -69
- package/vitest.config.ts +0 -3
package/dist/vgplot.min.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
var FW=Object.create;var tT=Object.defineProperty;var kW=Object.getOwnPropertyDescriptor;var CW=Object.getOwnPropertyNames;var BW=Object.getPrototypeOf,PW=Object.prototype.hasOwnProperty;var bk=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ti=(e,t)=>{for(var r in t)tT(e,r,{get:t[r],enumerable:!0})},UW=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of CW(t))!PW.call(e,i)&&i!==r&&tT(e,i,{get:()=>t[i],enumerable:!(n=kW(t,i))||n.enumerable});return e};var $W=(e,t,r)=>(r=e!=null?FW(BW(e)):{},UW(t||!e||!e.__esModule?tT(r,"default",{value:e,enumerable:!0}):r,e));var XV=bk((Tne,GV)=>{"use strict";function ect(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 rct(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 nct(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 ict(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 oct(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 Y0(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)}GV.exports={ge:function(e,t,r,n,i){return Y0(e,t,r,n,i,ect)},gt:function(e,t,r,n,i){return Y0(e,t,r,n,i,rct)},lt:function(e,t,r,n,i){return Y0(e,t,r,n,i,nct)},le:function(e,t,r,n,i){return Y0(e,t,r,n,i,ict)},eq:function(e,t,r,n,i){return Y0(e,t,r,n,i,oct)}}});var rY=bk((Ane,eY)=>{"use strict";var AI=XV(),ip=0,vf=1,TI=2;eY.exports=act;function f8(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 W0=f8.prototype;function l8(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 ZV(e,t){var r=op(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 HV(e,t){var r=e.intervals([]);r.push(t),ZV(e,r)}function QV(e,t){var r=e.intervals([]),n=r.indexOf(t);return n<0?ip:(r.splice(n,1),ZV(e,r),vf)}W0.intervals=function(e){return e.push.apply(e,this.leftPoints),this.left&&this.left.intervals(e),this.right&&this.right.intervals(e),e};W0.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)?HV(this,e):this.left.insert(e):this.left=op([e]);else if(e[0]>this.mid)this.right?4*(this.right.count+1)>3*(t+1)?HV(this,e):this.right.insert(e):this.right=op([e]);else{var r=AI.ge(this.leftPoints,e,d8),n=AI.ge(this.rightPoints,e,h8);this.leftPoints.splice(r,0,e),this.rightPoints.splice(n,0,e)}};W0.remove=function(e){var t=this.count-this.leftPoints;if(e[1]<this.mid){if(!this.left)return ip;var r=this.right?this.right.count:0;if(4*r>3*(t-1))return QV(this,e);var n=this.left.remove(e);return n===TI?(this.left=null,this.count-=1,vf):(n===vf&&(this.count-=1),n)}else if(e[0]>this.mid){if(!this.right)return ip;var i=this.left?this.left.count:0;if(4*i>3*(t-1))return QV(this,e);var n=this.right.remove(e);return n===TI?(this.right=null,this.count-=1,vf):(n===vf&&(this.count-=1),n)}else{if(this.count===1)return this.leftPoints[0]===e?TI:ip;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}l8(this,s),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?l8(this,this.left):l8(this,this.right);return vf}for(var a=AI.ge(this.leftPoints,e,d8);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=AI.ge(this.rightPoints,e,h8);n<this.rightPoints.length&&this.rightPoints[n][1]===e[1];++n)if(this.rightPoints[n]===e)return this.rightPoints.splice(n,1),vf}return ip}};function KV(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 JV(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 tY(e,t){for(var r=0;r<e.length;++r){var n=t(e[r]);if(n)return n}}W0.queryPoint=function(e,t){if(e<this.mid){if(this.left){var r=this.left.queryPoint(e,t);if(r)return r}return KV(this.leftPoints,e,t)}else if(e>this.mid){if(this.right){var r=this.right.queryPoint(e,t);if(r)return r}return JV(this.rightPoints,e,t)}else return tY(this.leftPoints,t)};W0.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?KV(this.leftPoints,t,r):e>this.mid?JV(this.rightPoints,e,r):tY(this.leftPoints,r)};function sct(e,t){return e-t}function d8(e,t){var r=e[0]-t[0];return r||e[1]-t[1]}function h8(e,t){var r=e[1]-t[1];return r||e[0]-t[0]}function op(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(sct);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(d8),l.sort(h8),new f8(n,op(i),op(o),c,l)}function u8(e){this.root=e}var sp=u8.prototype;sp.insert=function(e){this.root?this.root.insert(e):this.root=new f8(e[0],null,null,[e],[e])};sp.remove=function(e){if(this.root){var t=this.root.remove(e);return t===TI&&(this.root=null),t!==ip}return!1};sp.queryPoint=function(e,t){if(this.root)return this.root.queryPoint(e,t)};sp.queryInterval=function(e,t,r){if(e<=t&&this.root)return this.root.queryInterval(e,t,r)};Object.defineProperty(sp,"count",{get:function(){return this.root?this.root.count:0}});Object.defineProperty(sp,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}});function act(e){return!e||e.length===0?new u8(null):new u8(op(e))}});var pp=Uint8Array.of(65,82,82,79,87,49),zW=Uint8Array.of(255,255,255,255,0,0,0,0),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},Of={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 Rf=Uint8Array,Ax=Uint16Array,Ex=Uint32Array,Mx=BigUint64Array,mp=Int8Array,_k=Int16Array,Un=Int32Array,ei=BigInt64Array,eT=Float32Array,uc=Float64Array;function wk(e,t){let r=Math.log2(e)-3;return(t?[mp,_k,Un,ei]:[Rf,Ax,Ex,Mx])[r]}var Zlt=Object.getPrototypeOf(Int8Array);function Df(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 Nx(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),Nx(e,n=>t.includes(n),r??(()=>`${e} must be one of ${t}`))}function Ox(e,t){for(let[r,n]of Object.entries(e))if(n===t)return r;return"<Unknown>"}var Vs=e=>`Unsupported data type: "${Ox(j,e)}" (id ${e})`,yp=(e,t,r=!0,n=null)=>({name:e,type:t,nullable:r,metadata:n});function vk(e){return Object.hasOwn(e,"name")&&Sk(e.type)}function Sk(e){return typeof e?.typeId=="number"}function fc(e,t="",r=!0){return vk(e)?e:yp(t,Nx(e,Sk,()=>"Data type expected."),r)}var Rx=(e,t,r=!1,n=-1)=>({typeId:j.Dictionary,id:n,dictionary:e,indices:t||Lf(),ordered:r});var Dx=(e=32,t=!0)=>({typeId:j.Int,bitWidth:$n(e,[8,16,32,64]),signed:t,values:wk(e,t)});var Lf=()=>Dx(32);var rT=(e=2)=>({typeId:j.Float,precision:$n(e,Of),values:[Ax,eT,uc][e]});var nT=()=>({typeId:j.Binary,offsets:Un}),Lx=()=>({typeId:j.Utf8,offsets:Un});var iT=(e,t,r=128)=>({typeId:j.Decimal,precision:e,scale:t,bitWidth:$n(r,[128,256]),values:Mx}),oT=e=>({typeId:j.Date,unit:$n(e,js),values:e===js.DAY?Un:ei});var sT=(e=Ar.MILLISECOND,t=32)=>({typeId:j.Time,unit:$n(e,Ar),bitWidth:$n(t,[32,64]),values:t===32?Un:ei});var Fx=(e=Ar.MILLISECOND,t=null)=>({typeId:j.Timestamp,unit:$n(e,Ar),timezone:t,values:ei}),aT=(e=Ei.MONTH_DAY_NANO)=>({typeId:j.Interval,unit:$n(e,Ei),values:e===Ei.MONTH_DAY_NANO?void 0:Un}),kx=e=>({typeId:j.List,children:[fc(e)],offsets:Un}),Cx=e=>({typeId:j.Struct,children:Array.isArray(e)&&vk(e[0])?e:Object.entries(e).map(([t,r])=>yp(t,r))}),cT=(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)=>fc(i,`_${o}`)),typeIdForValue:n,offsets:Un}),lT=e=>({typeId:j.FixedSizeBinary,stride:e}),Bx=(e,t)=>({typeId:j.FixedSizeList,stride:t,children:[fc(e)]}),Ik=(e,t)=>({typeId:j.Map,keysSorted:e,children:[t],offsets:Un});var uT=(e=Ar.MILLISECOND)=>({typeId:j.Duration,unit:$n(e,Ar),values:ei}),fT=()=>({typeId:j.LargeBinary,offsets:ei}),dT=()=>({typeId:j.LargeUtf8,offsets:ei}),hT=e=>({typeId:j.LargeList,children:[fc(e)],offsets:ei}),pT=(e,t)=>({typeId:j.RunEndEncoded,children:[Nx(fc(e,"run_ends"),r=>r.type.typeId===j.Int,()=>"Run-ends must have an integer type."),fc(t,"values")]});var mT=e=>({typeId:j.ListView,children:[fc(e,"value")],offsets:Un}),yT=e=>({typeId:j.LargeListView,children:[fc(e,"value")],offsets:ei});var jW=new uc(2),Px=jW.buffer,sut=new ei(Px),aut=new Ex(Px),cut=new Un(Px),lut=new Rf(Px);function Po(e){if(e>Number.MAX_SAFE_INTEGER||e<Number.MIN_SAFE_INTEGER)throw Error(`BigInt exceeds integer number representation: ${e}`);return Number(e)}function Ux(e,t){return Number(e/t)+Number(e%t)/Number(t)}var Ff=e=>BigInt.asUintN(64,e);function Ak(e,t){let r=t<<1,n;return BigInt.asIntN(64,e[r+1])<0?(n=Ff(~e[r])|Ff(~e[r+1])<<64n,n=-(n+1n)):n=e[r]|e[r+1]<<64n,n}function Ek(e,t){let r=t<<2,n;return BigInt.asIntN(64,e[r+3])<0?(n=Ff(~e[r])|Ff(~e[r+1])<<64n|Ff(~e[r+2])<<128n|Ff(~e[r+3])<<192n,n=-(n+1n)):n=e[r]|e[r+1]<<64n|e[r+2]<<128n|e[r+3]<<192n,n}var VW=new TextDecoder("utf-8"),put=new TextEncoder;function kf(e){return VW.decode(e)}var Bl=4;function gT(e,t){return(e[t>>3]&1<<t%8)!==0}function on(e,t){let r=t+xe(e,t),n=r-xe(e,r),i=qr(e,n);return(o,s,a=null)=>{if(o<i){let c=qr(e,n+o);if(c)return s(e,r+c)}return a}}function to(e,t){return t}function dc(e,t){return!!YW(e,t)}function YW(e,t){return gp(e,t)<<24>>24}function gp(e,t){return e[t]}function qr(e,t){return WW(e,t)<<16>>16}function WW(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 Mk(e,t){return xe(e,t)>>>0}function Er(e,t){return Po(BigInt.asIntN(64,BigInt(Mk(e,t))+(BigInt(Mk(e,t+Bl))<<32n)))}function Pl(e,t){let r=t+xe(e,t),n=xe(e,r);return r+=Bl,kf(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+Bl+s*r))}var xT=Symbol("rowIndex");function xp(e,t){class r{constructor(o){this[xT]=o}toJSON(){return Nk(e,t,this[xT])}}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[xT])},enumerable:!0})}return i=>new r(i)}function $x(e,t){return r=>Nk(e,t,r)}function Nk(e,t,r){let n={};for(let i=0;i<e.length;++i)n[e[i]]=t[i].at(r);return n}function Ok(e){return e instanceof hc}var Ul=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 gT(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 Ul{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]()}},bp=class extends Ul{static ArrayType=uc},$e=class extends Ul{static ArrayType=Array},_p=class extends $e{value(t){return null}},Uo=class extends bp{value(t){return Po(this.values[t])}},zx=class extends bp{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)}},jx=class extends $e{value(t){return gT(this.values,t)}},qx=class extends Ul{constructor(t){super(t);let{bitWidth:r,scale:n}=this.type;this.decimal=r===128?Ak:Ek,this.scale=10n**BigInt(n)}},Vx=class extends qx{static ArrayType=uc;value(t){return Ux(this.decimal(this.values,t),this.scale)}},Yx=class extends qx{static ArrayType=Array;value(t){return this.decimal(this.values,t)}},wp=class extends $e{constructor(t){super(t),this.source=t}value(t){return new Date(this.source.value(t))}},Wx=class extends bp{value(t){return 864e5*this.values[t]}},Rk=Uo,Gx=class extends Uo{value(t){return super.value(t)*1e3}},Dk=Uo,Xx=class extends Uo{value(t){return Ux(this.values[t],1000n)}},Hx=class extends Uo{value(t){return Ux(this.values[t],1000000n)}},Qx=class extends $e{value(t){return this.values.subarray(t<<1,t+1<<1)}},Zx=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))}},Lk=({values:e,offsets:t},r)=>e.subarray(t[r],t[r+1]),Fk=({values:e,offsets:t},r)=>e.subarray(Po(t[r]),Po(t[r+1])),Kx=class extends $e{value(t){return Lk(this,t)}},Jx=class extends $e{value(t){return Fk(this,t)}},tb=class extends $e{value(t){return kf(Lk(this,t))}},eb=class extends $e{value(t){return kf(Fk(this,t))}},rb=class extends $e{value(t){let r=this.offsets;return this.children[0].slice(r[t],r[t+1])}},nb=class extends $e{value(t){let r=this.offsets;return this.children[0].slice(Po(r[t]),Po(r[t+1]))}},ib=class extends $e{value(t){let r=this.offsets[t],n=r+this.sizes[t];return this.children[0].slice(r,n)}},ob=class extends $e{value(t){let r=this.offsets[t],n=r+this.sizes[t];return this.children[0].slice(Po(r),Po(n))}},sb=class extends $e{constructor(t){super(t),this.stride=this.type.stride}},ab=class extends sb{value(t){let{stride:r,values:n}=this;return n.subarray(t*r,(t+1)*r)}},cb=class extends sb{value(t){let{children:r,stride:n}=this;return r[0].slice(t*n,(t+1)*n)}};function kk({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 lb=class extends $e{value(t){return kk(this,t)}},ub=class extends $e{value(t){return new Map(kk(this,t))}},vp=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)}},fb=class extends vp{value(t){return super.value(t,this.offsets[t])}},Sp=class extends $e{constructor(t,r=$x){super(t),this.names=this.type.children.map(n=>n.name),this.factory=r(this.names,this.children)}value(t){return this.factory(t)}},db=class extends Sp{constructor(t){super(t,xp)}},hb=class extends $e{value(t){let[{values:r},n]=this.children;return n.at(Df(r,t))}},pb=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]}},mb=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)}},yb=class extends mb{value(t){return this.view(t)}},gb=class extends mb{value(t){return kf(this.view(t))}};function bT(e){let t=[];return{add(r){return t.push(r),this},clear:()=>t=[],done:()=>new $l(t,e)}}var $l=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]():GW(t)}at(t){let{data:r,offsets:n}=this,i=Df(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&&Ok(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?XW(a,n):HW(a,n)}cache(){return this._cache??(this._cache=this.toArray())}};function*GW(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 XW(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 HW(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 Cf=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?xp:$x;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)=>QW(s[a],r[c]))},t.map(a=>n[a]),i===xp)}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=Df(o,t)-1;return n(s)(t-o[s])}get(t){return this.at(t)}};function QW(e,t){return t!=null&&t!==e.name?{...e,name:t}:e}function Ip(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 _p;case j.Bool:return jx;case j.Int:case j.Time:case j.Duration:return s||n<64?hc:Uo;case j.Float:return i?hc:zx;case j.Date:return Ck(o===js.DAY?Wx:Rk,a&&wp);case j.Timestamp:return Ck(o===Ar.SECOND?Gx:o===Ar.MILLISECOND?Dk:o===Ar.MICROSECOND?Xx:Hx,a&&wp);case j.Decimal:return c?Yx:Vx;case j.Interval:return o===Ei.DAY_TIME?Qx:o===Ei.YEAR_MONTH?hc:Zx;case j.FixedSizeBinary:return ab;case j.Utf8:return tb;case j.LargeUtf8:return eb;case j.Binary:return Kx;case j.LargeBinary:return Jx;case j.BinaryView:return yb;case j.Utf8View:return gb;case j.List:return rb;case j.LargeList:return nb;case j.Map:return l?ub:lb;case j.ListView:return ib;case j.LargeListView:return ob;case j.FixedSizeList:return cb;case j.Struct:return u?db:Sp;case j.RunEndEncoded:return hb;case j.Dictionary:return pb;case j.Union:return e.mode?fb:vp}throw new Error(Vs(r))}function Ck(e,t){return t?class extends t{constructor(n){super(new e(n))}}:e}function ZW(e,t){return{offset:Er(e,t),metadataLength:xe(e,t+8),bodyLength:Er(e,t+16)}}function _T(e,t){return ri(e,t,24,ZW)}function xb(e,t,r){let n=on(e,t);if(n(10,to,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,to),16,(o,s)=>({length:Er(o,s),nullCount:Er(o,s+8)})),regions:ri(e,n(8,to),16+i,(o,s)=>({offset:Er(o,s+i),length:Er(o,s+i+8)})),variadic:ri(e,n(12,to),8,Er)}}function Bk(e,t,r){let n=on(e,t);return{id:n(4,Er,0),data:n(6,(i,o)=>xb(i,o,r)),isDelta:n(8,dc,!1)}}function wT(e,t,r,n){$n(r,j,Vs);let i=on(e,t);switch(r){case j.Binary:return nT();case j.Utf8:return Lx();case j.LargeBinary:return fT();case j.LargeUtf8:return dT();case j.List:return kx(n[0]);case j.ListView:return mT(n[0]);case j.LargeList:return hT(n[0]);case j.LargeListView:return yT(n[0]);case j.Struct:return Cx(n);case j.RunEndEncoded:return pT(n[0],n[1]);case j.Int:return Dx(i(4,xe,0),i(6,dc,!1));case j.Float:return rT(i(4,qr,Of.HALF));case j.Decimal:return iT(i(4,xe,0),i(6,xe,0),i(8,xe,128));case j.Date:return oT(i(4,qr,js.MILLISECOND));case j.Time:return sT(i(4,qr,Ar.MILLISECOND),i(6,xe,32));case j.Timestamp:return Fx(i(4,qr,Ar.SECOND),i(6,Pl));case j.Interval:return aT(i(4,qr,Ei.YEAR_MONTH));case j.Duration:return uT(i(4,qr,Ar.MILLISECOND));case j.FixedSizeBinary:return lT(i(4,xe,0));case j.FixedSizeList:return Bx(n[0],i(4,xe,0));case j.Map:return Ik(i(4,dc,!1),n[0]);case j.Union:return cT(i(4,qr,qs.Sparse),n,ri(e,i(6,to),4,xe))}return{typeId:r}}function Tp(e,t){let r=ri(e,t,4,(n,i)=>{let o=on(n,i);return[o(4,Pl),o(6,Pl)]});return r.length?new Map(r):null}function bb(e,t,r){let n=on(e,t);return{version:r,endianness:n(4,qr,0),fields:n(6,KW,[]),metadata:n(8,Tp)}}function KW(e,t){return ri(e,t,4,Pk)}function Pk(e,t){let r=on(e,t),n=r(8,gp,j.NONE),i=r(10,to,0),o=r(12,tG),s=r(14,(c,l)=>JW(c,l)),a=wT(e,i,n,s);return o&&(o.dictionary=a,a=o),{name:r(4,Pl),type:a,nullable:r(6,dc,!1),metadata:r(16,Tp)}}function JW(e,t){let r=ri(e,t,4,Pk);return r.length?r:null}function tG(e,t){if(!t)return null;let r=on(e,t);return Rx(null,r(6,eG,Lf()),r(8,dc,!1),r(4,Er,0))}function eG(e,t){return wT(e,t,j.Int)}var rG=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,nG=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,iG=e=>`Unsupported message type: ${e} (${Ox(Ai,e)})`;function _b(e,t){let r=xe(e,t)||0;if(t+=Bl,r===-1&&(r=xe(e,t)||0,t+=Bl),r===0)return null;let n=e.subarray(t,t+=r);if(n.byteLength<r)throw new Error(rG(r,n.byteLength));let i=on(n,0),o=i(4,qr,Ti.V1),s=i(6,gp,Ai.NONE),a=i(8,to,0),c=i(10,Er,0),l;if(a){let u=s===Ai.Schema?bb:s===Ai.DictionaryBatch?Bk:s===Ai.RecordBatch?xb:null;if(!u)throw new Error(iG(s));if(l=u(n,a,o),c>0){let f=e.subarray(t,t+=c);if(f.byteLength<c)throw new Error(nG(c,f.byteLength));l.body=f}}return{version:o,type:s,index:t,content:l}}function Uk(e){let t=e instanceof ArrayBuffer?new Uint8Array(e):e;return t instanceof Uint8Array&&oG(t)?aG(t):sG(t)}function oG(e){if(!e||e.length<4)return!1;for(let t=0;t<6;++t)if(pp[t]!==e[t])return!1;return!0}function sG(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=_b(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 aG(e){let t=e.byteLength-(pp.length+4),r=xe(e,t),n=on(e,t-r),i=n(4,qr,Ti.V1),o=n(8,_T,[]),s=n(10,_T,[]);return{schema:n(6,(a,c)=>bb(a,c,i)),dictionaries:o.map(({offset:a})=>_b(e,a).content),records:s.map(({offset:a})=>_b(e,a).content),metadata:n(12,Tp)}}function ST(e,t){return cG(Uk(e),t)}function cG(e,t={}){let{schema:r={fields:[]},dictionaries:n,records:i}=e,{version:o,fields:s}=r,a=new Map,c=uG(t,o,a),l=new Map;lG(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=vT(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,bT(g).add(x))}}u.forEach((d,h)=>a.set(h,d.done()));let f=s.map(d=>bT(d.type));for(let d of i){let h=c(d);s.forEach((p,m)=>f[m].add(vT(p.type,h)))}return new Cf(r,f.map(d=>d.done()),t.useProxy)}function lG(e,t){e.fields.forEach(function r(n){t(n),n.type.dictionary?.children?.forEach(r),n.type.children?.forEach(r)})}function uG(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=>vT(p.type,this))}}}}function vT(e,t){let{typeId:r}=e,{length:n,options:i,node:o,buffer:s,variadic:a,version:c}=t,l=Ip(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(mp),offsets:e.mode===qs.Sparse?null:s(e.offsets),children:t.visit(e.children)});default:throw new Error(Vs(r))}}var qft=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;function pc(e){return ST(e,{useDate:!0})}function wb(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 Bf="COLUMN_REF",Pf="COLUMN_PARAM",Wk="TABLE_REF",Gk="LITERAL",Xk="INTERVAL",vb="ORDER_BY",Sb="CAST",Ib="CASE",Tb="WHEN",Ab="UNARY",Hk="UNARY_POSTFIX",Eb="BINARY",Mb="BETWEEN",Nb="NOT_BETWEEN",Ob="LOGICAL_OPERATOR",Rb="IN",Db="FUNCTION",jl="AGGREGATE",Uf="WINDOW",Lb="WINDOW_DEF",Fb="WINDOW_FRAME",Qk="EXPRESSION",$f="FRAGMENT",kb="VERBATIM",zf="PARAM",Zk="WITH_CLAUSE",Cb="SELECT_CLAUSE",Bb="FROM_CLAUSE";var Kk="SAMPLE_CLAUSE";var Pb="WINDOW_CLAUSE";var Ub="SELECT_QUERY",$b="DESCRIBE_QUERY",zb="SET_OPERATION";function Mr(e){return e instanceof tr}var tr=class{constructor(t){this.type=t}},Bt=class extends tr{};var ql=class extends Bt{constructor(t){super(Gk),this.value=t}toString(){return IT(this.value)}};function IT(e){switch(typeof e){case"number":return Number.isFinite(e)?`${e}`:"NULL";case"string":return`'${e.replaceAll("'","''")}'`;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 eo=class extends Bt{constructor(t){super(zf),this.param=t}get value(){return this.param.value}toString(){return IT(this.value)}};function TT(e){return e.split(".")}function ro(e){return`"${e}"`}function jb(e){return e&&LG(e)?e.slice(1,-1):e}function LG(e){return e[0]==='"'&&e[e.length-1]==='"'}function mc(e){return e instanceof jf}var jf=class extends Bt{constructor(t){super(Wk),this.table=[t].flat()}get name(){return this.table[this.table.length-1]}toString(){return this.table.map(t=>ro(t)).join(".")}};var Vl=class extends Bt{constructor(t,r=[]){super(Db),this.name=t,this.args=r}toString(){let{name:t,args:r}=this;return`${t}(${r.join(", ")})`}};function we(e,...t){return new Vl(e,Ap(t).map(qt))}function te(e,...t){return new Mp(e,Ap(t).map(qt))}function Mi(e,...t){return new Yl(new Ep(e,Ap(t).map(qt)))}function zn(e,t=qt){return e.flat().filter(r=>r!=null).map(r=>t(r))}function Ap(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 Np(e){return Array.isArray(e)}function no(e){return e&&typeof e.addEventListener=="function"&&e.dynamic!==!1&&"value"in e}var Rp=class extends tr{constructor(t,r){super(Pb),this.name=t,this.def=r}toString(){return`${ro(this.name)} AS ${this.def}`}},Yl=class e extends Bt{constructor(t,r=new Wl){super(Uf),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}`}},Ep=class extends Vl{constructor(t,r){super(t,r)}},Wl=class extends tr{constructor(t,r,n,i){super(Lb),this.name=t,this.partition=r,this.order=n,this.frame=i}over(t){return Op(this,{name:t})}partitionby(...t){return Op(this,{partition:zn(t)})}orderby(...t){return Op(this,{order:zn(t)})}rows(t){return Op(this,{frame:new Dp(t)})}range(t){return Op(this,{frame:new Dp(t,!0)})}toString(){let{name:t,partition:r,order:n,frame:i}=this,o=t&&ro(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(" ")})`}},Dp=class extends tr{constructor(t,r=!1,n=void 0){super(Fb),this.extent=no(t)?new eo(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=Jk(o,"PRECEDING"),c=Jk(s,"FOLLOWING");return`${i} BETWEEN ${a} AND ${c}${r?` ${r}`:""}`}};function Op(e,t){return new Wl(t.name??e.name,t.partition??e.partition,t.order??e.order,t.frame??e.frame)}function Jk(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==="*"?"*":ro(t);return(n?n+".":"")+i}},Lp=class extends Ws{constructor(t,r){super(Bf,r),this.name=t}get column(){return this.name}};function AT(e){return e instanceof qf}var qf=class extends Ws{constructor(t,r){super(Pf,r),this.param=t}get column(){return`${this.param.value}`}};function Gl(e,t){let r=Xl(t);return no(e)?new qf(new eo(e),r):new Lp(e,r)}var Hl=class extends Bt{constructor(t){super(kb),this.value=t}toString(){return this.value}};function Nr(e){return new ql(e)}function tC(e){return new Hl(e)}function qb(...e){let t=zn(e,String);return t?.length?new jf(t):void 0}function qt(e){return Ni(e)?FG(e):Zl(e)}function Ql(e){return Ni(e)?tC(e):Zl(e)}function Zl(e){return e instanceof Bt?e:no(e)?new eo(e):Nr(e)}function Xl(e){return Ni(e)?kG(e):Np(e)?qb(e):e}function FG(e){let t=TT(e);return Gl(t.pop(),qb(t))}function kG(e){return qb(TT(e))}function ET(){return new Wl}var Mp=class e extends Bt{constructor(t,r,n,i){super(jl),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=Ql(t)),new e(this.name,this.args,this.isDistinct,t)}window(){return new Yl(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}`}},eC=["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 Vb=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]})`:""}},Kl=class extends Vb{constructor(t,r){super(Mb,t,r)}toString(){return super.toSQL("BETWEEN")}},Fp=class extends Vb{constructor(t,r){super(Nb,t,r)}toString(){return super.toSQL("NOT BETWEEN")}};var kp=class extends Bt{constructor(t,r,n){super(Eb),this.op=t,this.left=r,this.right=n}toString(){return`(${this.left} ${this.op} ${this.right})`}};var Vf=class e extends Bt{constructor(t=void 0,r=[],n=void 0){super(Ib),this.expr=t,this._when=r,this._else=n}when(t,r){return new e(this.expr,this._when.concat(new Yf(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"}},Yf=class extends tr{constructor(t,r){super(Tb),this.when=t,this.then=r}toString(){return`WHEN ${this.when} THEN ${this.then}`}};var Cp=class extends Bt{constructor(t,r){super(Sb),this.expr=t,this.cast=r}toString(){return`(${this.expr})::${this.cast}`}};var Bp=class extends Bt{constructor(t){super($f),this.spans=t}toString(){return this.spans.join("")}};var Pp=class extends tr{constructor(t,r=!1,n=void 0,i=void 0){super(Kk),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 Up=class extends tr{constructor(t,r){super(Cb),this.expr=t,this.alias=r}toString(){let{expr:t,alias:r}=this;return!r||CG(t,r)?`${t}`:`${t} AS ${ro(r)}`}};function CG(e,t){return e instanceof Ws&&e.table==null&&e.column===t}var $p=class extends tr{constructor(t,r){super(Zk),this.name=t,this.query=r}toString(){return`"${this.name}" AS (${this.query})`}};function Yb(e){return e instanceof ft}function gc(e){return e instanceof tu}function MT(e){return e instanceof zp}var ft=class extends Bt{static select(...t){return new tu().select(...t)}static from(...t){return new tu().from(...t)}static with(...t){return new tu().with(...t)}static union(...t){return new Jl("UNION",t.flat())}static unionAll(...t){return new Jl("UNION ALL",t.flat())}static intersect(...t){return new Jl("INTERSECT",t.flat())}static except(...t){return new Jl("EXCEPT",t.flat())}static describe(t){return new zp(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}},tu=class e extends ft{constructor(){super(Ub),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(Yb(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 $p(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 Up(o==null?o:qt(o),jb(s)));t.flat().forEach(o=>{if(o!=null)if(Ni(o))n(o,o);else if(yc(o))n(o,o.column);else if(Np(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 jp(Xl(i),jb(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(Mr(i))n(i);else if(Np(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 Pp(s,o,r,n)}else i=t;return this._sample=i,this}where(...t){return this._where=this._where.concat(zn(t,Ql)),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,Ql)),this}window(...t){let r=[];return t.flat().forEach(n=>{if(n!=null)for(let i in n)r.push(new Rp(jb(i),n[i]))}),this._window=this._window.concat(r),this}qualify(...t){return this._qualify=this._qualify.concat(zn(t,Ql)),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(" ")}},zp=class e extends tr{constructor(t){super($b),this.query=t}clone(){return new e(this.query.clone())}toString(){return`DESCRIBE ${this.query}`}},Jl=class e extends ft{constructor(t,r){super(zb),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 jp=class extends tr{constructor(t,r){super(Bb),this.expr=t,this.alias=r}toString(){let{expr:t,alias:r}=this,n=Yb(t)?`(${t})`:`${t}`;return r&&!(mc(t)&&t.table.join(".")===r)?`${n} AS ${ro(r)}`:`${n}`}};var qp=class extends Bt{constructor(t,r){super(Rb),this.expr=t,this.values=r}toString(){return`(${this.expr} IN (${this.values.join(", ")}))`}};var Vp=class extends Bt{constructor(t,r=1){super(Xk),this.name=t,this.steps=r}toString(){return`INTERVAL ${this.steps} ${this.name}`}};var Wb=class extends Bt{constructor(t,r){super(Ob),this.op=t,this.clauses=r}toString(){let t=this.clauses;return t.length===0?"":t.length===1?`${t[0]}`:`(${t.join(` ${this.op} `)})`}},Yp=class extends Wb{constructor(t){super("AND",t)}},Wp=class extends Wb{constructor(t){super("OR",t)}};var Wf=class extends Bt{constructor(t,r,n){super(vb),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 Gb=class extends Bt{constructor(t,r,n){super(t),this.op=r,this.expr=n}},Gp=class extends Gb{constructor(t,r){super(Ab,t,r)}toString(){return`(${this.op} ${this.expr})`}},Xp=class extends Gb{constructor(t,r){super(Hk,t,r)}toString(){return`(${this.expr} ${this.op})`}};function xc(e,t){return te("arg_max",e,t)}function bc(e,t){return te("arg_min",e,t)}function NT(e){return te("array_agg",e)}function Hp(e){return te("avg",e)}function OT(e,t){return te("corr",e,t)}function Or(e){return te("count",e)}function RT(e,t){return te("covar_samp",e,t)}function DT(e,t){return te("covar_pop",e,t)}function LT(e){return te("entropy",e)}function FT(e){return te("first",e)}function kT(e){return te("geomean",e)}function CT(e){return te("kurtosis",e)}function BT(e){return te("mad",e)}function Vr(e){return te("max",e)}function PT(e){return te("median",e)}function jn(e){return te("min",e)}function UT(e){return te("mode",e)}function $T(e){return te("last",e)}function zT(e){return te("product",e)}function jT(e,t){return te("quantile",e,t)}function Qp(e,t){return te("regr_avgx",e,t)}function qT(e,t){return te("regr_avgy",e,t)}function Zp(e,t){return te("regr_count",e,t)}function VT(e,t){return te("regr_intercept",e,t)}function YT(e,t){return te("regr_sxx",e,t)}function WT(e,t){return te("regr_syy",e,t)}function GT(e,t){return te("regr_slope",e,t)}function XT(e){return te("skewness",e)}function Kp(e){return te("stddev",e)}function HT(e){return te("stddev_pop",e)}function QT(e){return te("string_agg",e)}function oe(e){return te("sum",e)}function ZT(e){return te("var_samp",e)}function KT(e){return te("var_pop",e)}function Gs(e,t,r){return e?new Vf(void 0,[new Yf(qt(e),qt(t))],qt(r)):new Vf}function Gf(e,t){return new Cp(qt(e),t)}function ve(e){return Gf(e,"INTEGER")}function JT(e){return Gf(e,"FLOAT")}function Xe(e){return Gf(e,"DOUBLE")}function Xb(e,t){return new Vp(e,t)}function tA(e){return we("epoch_ms",e)}function eA(e,t,r=1){return we("time_bucket",Xb(t,r),e)}function rA(e){return we("make_date",2012,we("month",e),1)}function nA(e){let t=qt(e);return we("make_date",2012,we("month",t),we("day",t))}function iA(e){return we("make_date",2012,1,we("day",e))}function oA(...e){return we("greatest",...e)}function Xf(e){return we("exp",e)}function sA(e){return we("log",e)}function _c(e){return we("ln",e)}function io(e){return we("sign",e)}function Rr(e){return we("abs",e)}function Xs(e){return we("sqrt",e)}function aA(e){return we("ceil",e)}function Dr(e){return we("floor",e)}function Hs(e,t){return we("round",e,t)}function BG(e,t){return new Gp(e,qt(t))}function rC(e,t){return new Xp(e,qt(t))}function qn(e,t,r){return new kp(e,qt(t),qt(r))}function nC(e,t,r=!1){let n=r?Fp:Kl;return new n(qt(e),t?.map(qt))}function sn(...e){return new Yp(zn(e))}function Oi(...e){return new Wp(zn(e))}function cA(e){return BG("NOT",e)}function eu(e){return rC("IS NULL",e)}function Ri(e){return rC("IS NOT NULL",e)}function Jp(e,t){return qn("&",e,t)}function ee(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 lA(e,t){return qn("=",e,t)}function oo(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 uA(e,t){return qn(">=",e,t)}function fA(e,t){return qn("IS DISTINCT FROM",e,t)}function tm(e,t){return qn("IS NOT DISTINCT FROM",e,t)}function Yr(e,t){return nC(e,t,!1)}function dA(e,t){return nC(e,t,!0)}function Hb(e,t){return new qp(qt(e),t.map(qt))}function hA(e,t){return new Wf(qt(e),!1,t)}function pA(e,t){return new Wf(qt(e),!0,t)}function em(e){return we("st_asgeojson",e)}function iC(e){return we("st_x",e)}function oC(e){return we("st_y",e)}function rm(e){return we("st_centroid",e)}function mA(e){return iC(rm(e))}function yA(e){return oC(rm(e))}function er(e,...t){return new Bp(PG(e,t))}function PG(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:no(s)?r[++o]=new eo(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 Hl(i):i)}function Qb(e,t,...r){return we(e,t,...Ap(r).map(Zl))}function gA(e,t,r){return Qb("regexp_matches",e,t,r)}function xA(e,t){return Qb("contains",e,t)}function bA(e,t){return Qb("starts_with",e,t)}function _A(e,t){return Qb("ends_with",e,t)}function wA(){return Mi("row_number")}function vA(){return Mi("rank")}function SA(){return Mi("dense_rank")}function IA(){return Mi("percent_rank")}function TA(){return Mi("cume_dist")}function AA(e){return Mi("ntile",e)}function EA(e,t,r){return Mi("lag",e,t,r)}function Hf(e,t,r){return Mi("lead",e,t,r)}function MA(e){return Mi("first_value",e)}function NA(e){return Mi("last_value",e)}function OA(e,t){return Mi("nth_value",e,t)}var Zb={[jl]:["args","filter"],[Mb]:["expr","extent"],[Eb]:["left","right"],[Ib]:["expr","_when","_else"],[Sb]:["expr"],[Pf]:["param","table"],[Bf]:["table"],[$b]:["query"],[Qk]:["node"],[$f]:["spans"],[Bb]:["expr"],[Db]:["args"],[Rb]:["expr","values"],[Ob]:["clauses"],[Nb]:["expr","extent"],[vb]:["expr"],[zf]:["value"],[Cb]:["expr"],[Ub]:["_with","_select","_from","_where","_sample","_groupby","_having","_window","_qualify","_orderby"],[zb]:["subqueries","_orderby"],[Ab]:["expr"],[Tb]:["when","then"],[Uf]:["func","def"],[Pb]:["def"],[Lb]:["partition","order","frame"],[Fb]:["extent"]};function nm(e,t){if(t.has(e))return t.get(e);if(Mr(e)){let r=Zb[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]=nm(s[c],t)}else s&&(e[o]=nm(s,t))}}return e}function $o(e,t){if(!Mr(e))return;let r=t(e);if(r)return r;let n=Zb[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]&&+$o(s[c],t)<0)return r}else if(s&&+$o(s,t)<0)return-1}}var UG=new RegExp(`^(${eC.join("|")})$`),$G=/(\\'|\\"|"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\w+\()/g;function zG(e){return e.split($G).some(t=>t.endsWith("(")&&UG.test(t.slice(0,-1)))}function bn(e){let t=0;return $o(e,r=>{switch(r.type){case Uf:return-1;case jl:return t|=1,-1;case $f:case kb:{let n=`${r}`.toLowerCase(),i=n.indexOf("(select ");return i>=0&&(n=n.slice(0,i)),n.includes(") over ")?-1:zG(n)?(t|=2,-1):1}}}),t}function RA(e){let t=new Set;return $o(e,r=>{r.type===jl&&t.add(r)}),Array.from(t)}function Qf(e){let t={};return $o(e,r=>{(r.type===Bf||r.type===Pf)&&(t[r]=r)}),Object.values(t)}function DA(e){let t=new Set;return $o(e,r=>{r.type===zf&&t.add(r.param)}),Array.from(t)}function wc(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 LA(e,{strict:t=!1}={}){return"CREATE SCHEMA "+(t?"":"IF NOT EXISTS ")+e}function FA(e){return`INSTALL ${e}; LOAD ${e}`}function sC(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=>`${Zl(i[s])} AS "${t[s]}"`);n.push(`(SELECT ${o.join(", ")})`)}return n.join(" UNION ALL ")}function Kb(e,t,r,n={},i={}){let{select:o=["*"],where:s,view:a,temp:c,replace:l,...u}=n,f=jG({...i,...u}),d=`${e}('${r}'${f?", "+f:""})`,h=s?` WHERE ${s}`:"",p=`SELECT ${o.join(", ")} FROM ${d}${h}`;return wc(t,p,{view:a,temp:c,replace:l})}function CA(e,t,r){return Kb("read_csv",e,t,r,{auto_detect:!0,sample_size:-1})}function BA(e,t,r){return Kb("read_json",e,t,r,{auto_detect:!0,format:"auto"})}function PA(e,t,r){return Kb("read_parquet",e,t,r)}function UA(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 Kb("st_read",e,t,i)}function $A(e,t,r={}){let{select:n=["*"],...i}=r,o=sC(t),s=n.length===1&&n[0]==="*"?o:`SELECT ${n} FROM ${o}`;return wc(e,s,i)}function jG(e){return Object.entries(e).map(([t,r])=>`${t}=${kA(r)}`).join(", ")}function kA(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=>kA(t)).join(", ")+"]":"{"+Object.entries(e).map(([t,r])=>`'${t}': ${kA(r)}`).join(", ")+"}";default:return e}}function zA(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 jA(e,t,r,n,i,o){return e.select({index:ee(ve(Dr(t)),Nt(ve(Dr(r)),i)),...n}).groupby("index",o)}function qA(e,t,r=void 0,n=[]){let i=r?a=>Nt(a,r):a=>a,o=Dr(t),s=ee(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:oe("w")},n).groupby("index",n).having(oo("density",0))}function qG(e){return e}function VA(e,t,r,n,i,o=[]){let s=n?g=>Nt(g,n):qG,a=(g,x)=>e.clone().select({xp:t,yp:r,i:g,w:x}),c=(g,x)=>ee(g,Nt(x,i)),l=ve(Dr(t)),u=ve(Dr(r)),f=ee(l,1),d=ee(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:oe("w")},o).groupby("index",o).having(oo("density",0))}function YA(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(Hf("x").over("sw"),"x"),dy:Tt(Hf("y").over("sw"),"y")}).window({sw:ET().partitionby(c).orderby(hA("x"))}).qualify([Oi(ze("x0",i),ze(ee("x0","dx"),i)),Oi(ze("y0",o),ze(ee("y0","dy"),o)),Oi(Di("x0",0),Di(ee("x0","dx"),0)),Oi(Di("y0",0),Di(ee("y0","dy"),0))]),u=ft.select({x:oA(Vr(Rr("dx")),Vr(Rr("dy")))}).from("pairs"),f=ft.select({i:ve(er`UNNEST(range((${u})))`)}),d=ft.unionAll(ft.select(c,{x:ee("x0","i"),y:ee("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:ee("x0",ve(Hs(se(Nt(Nt(io("dy"),"i"),"dx"),"dy")))),y:ee("y0",Nt(io("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(eu("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:ee("x",Nt("y",ve(i))),density:a?oe("w"):Or()}).groupby("index",s)}function WA(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]:bc(n,r)},...i]),s([{[r]:Vr(r),[n]:xc(n,r)},...i]),s([{[r]:bc(r,n),[n]:jn(n)},...i]),s([{[r]:xc(r,n),[n]:Vr(n)},...i])).orderby(i,r)}var Jb=e=>e;function aC(){return{apply:Jb,invert:Jb,sqlApply:qt,sqlInvert:Jb}}function VG({base:e=null}={}){if(e==null||e===Math.E)return{apply:Math.log,invert:Math.exp,sqlApply:t=>_c(t),sqlInvert:t=>Xf(t)};if(e===10)return{apply:Math.log10,invert:t=>Math.pow(10,t),sqlApply:t=>sA(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(_c(r),_c(t)),sqlInvert:r=>ir(t,r)}}}function YG({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(io(r),_c(ee(t,Rr(r))))),sqlInvert:r=>Nt(io(r),Tt(Xf(Rr(r)),t))}}function WG(){return{apply:e=>Math.sign(e)*Math.sqrt(Math.abs(e)),invert:e=>Math.sign(e)*e*e,sqlApply:e=>(e=qt(e),Nt(io(e),Xs(Rr(e)))),sqlInvert:e=>Nt(io(e),ir(e,2))}}function GG({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(io(r),ir(Rr(r),t))),sqlInvert:r=>Nt(io(r),ir(Rr(r),se(1,t)))}}function cC(){return{apply:e=>+e,invert:e=>new Date(e),sqlApply:e=>e instanceof Date?Nr(+e):HG(e)?Nr(+e.value):tA(e),sqlInvert:Jb}}var XG={identity:aC,linear:aC,log:VG,symlog:YG,sqrt:WG,pow:GG,time:cC,utc:cC};function im(e){let t=XG[e.type];return t?{...e,...t(e)}:null}function HG(e){return e instanceof ql&&e.value instanceof Date}function t1(e){let t=2166136261;for(let r=0,n=e.length;r<n;++r){let i=e.charCodeAt(r),o=i&65280;o&&(t=lC(t^o>>8)),t=lC(t^i&255)}return QG(t)>>>0}function lC(e){return e+(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24)}function QG(e){return e+=e<<13,e^=e>>>7,e+=e<<3,e^=e>>>17,e+=e<<5,e&4294967295}function fC(e,t,r){switch(e.name){case"count":case"sum":return ZG(t,e);case"avg":return KG(t,e);case"geomean":return JG(t,e);case"arg_max":return tX(t,e);case"arg_min":return eX(t,e);case"variance":case"var_samp":return e1(t,e,r);case"var_pop":return e1(t,e,r,!1);case"stddev":case"stddev_samp":return Xs(e1(t,e,r));case"stddev_pop":return Xs(e1(t,e,r,!1));case"covar_samp":return r1(t,e,r);case"covar_pop":return r1(t,e,r,!1);case"corr":return uC(t,e,r);case"regr_count":return Zf(t,e).expr;case"regr_avgx":return pC(t,e);case"regr_avgy":return mC(t,e);case"regr_syy":return XA(t,0,e,r);case"regr_sxx":return XA(t,1,e,r);case"regr_sxy":return r1(t,e,r,null);case"regr_slope":return yC(t,e,r);case"regr_intercept":return rX(t,e,r);case"regr_r2":return ir(uC(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=dC(e);return t[n]=e,er`${e.name}("${n}")`}default:return null}}function dC(e){return"pre_"+t1(`${e}`).toString(16)}function an(e,t,r){let n=r?.filter;n&&(t=t.filter?t.where(sn(n,t.filter)):t.where(n));let i=dC(t);return e[i]=t,i}function HA(e,t){let r=an(e,Or(t.args[0]),t);return{expr:oe(r),name:r}}function ZG(e,t){return oe(an(e,t))}function KG(e,t){let r=an(e,t),{expr:n,name:i}=HA(e,t);return se(oe(Nt(r,i)),n)}function JG(e,t){let r=t.args[0],n=an(e,oe(_c(r)),t),{expr:i}=HA(e,t);return Xf(se(oe(n),i))}function tX(e,t){let r=an(e,t),n=an(e,Vr(t.args[1]),t);return xc(r,n)}function eX(e,t){let r=an(e,t),n=an(e,jn(t.args[1]),t);return bc(r,n)}function e1(e,t,r,n=!0){let i=t.args[0],{expr:o}=HA(e,t),s=Tt(i,r(i)),a=an(e,oe(ir(s,2)),t),c=an(e,oe(s),t),l=n?Tt(o,1):o;return se(Tt(oe(a),se(ir(oe(c),2),o)),l)}function r1(e,t,r,n=!0){let{expr:i}=Zf(e,t),o=hC(e,t,r),s=om(e,1,t,r),a=om(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 uC(e,t,r){let{expr:n}=Zf(e,t),i=hC(e,t,r),o=GA(e,1,t,r),s=GA(e,0,t,r),a=om(e,1,t,r),c=om(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 Zf(e,t){let[r,n]=t.args,i=an(e,Zp(r,n),t);return{expr:oe(i),name:i}}function om(e,t,r,n){let i=r.args,o=i[t],s=i[1-t],a=oe(Tt(o,n(o))).where(Ri(s));return oe(an(e,a,r))}function GA(e,t,r,n){let i=r.args,o=i[t],s=i[1-t],a=oe(ir(Tt(o,n(o)),2)).where(Ri(s));return oe(an(e,a,r))}function hC(e,t,r){let[n,i]=t.args,o=oe(Nt(Tt(i,r(i)),Tt(n,r(n))));return oe(an(e,o,t))}function pC(e,t){let[r,n]=t.args,{expr:i,name:o}=Zf(e,t),s=an(e,Qp(r,n),t);return se(oe(Nt(s,o)),i)}function mC(e,t){let[r,n]=t.args,{expr:i,name:o}=Zf(e,t),s=an(e,qT(r,n),t);return se(oe(Nt(s,o)),i)}function XA(e,t,r,n){let{expr:i}=Zf(e,r),o=om(e,t,r,n),s=GA(e,t,r,n);return Tt(s,se(ir(o,2),i))}function yC(e,t,r){let n=r1(e,t,r,null),i=XA(e,1,t,r);return se(n,i)}function rX(e,t,r){let n=pC(e,t),i=mC(e,t),o=yC(e,t,r);return Tt(i,Nt(o,n))}function gC(e){if(!e.filterStable)return null;let t=e.query();if(!gc(t))return null;let r=n1(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=n1(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(bn(l)>1)return null;let u=RA(l);if(u.length===0)s.push(c),i[c]=l;else{for(let f of u){if(f.isDistinct)return null;let d=fC(f,i,a);if(!d)return null;n.set(f,d)}o[c]=nm(l,n)}}return n.size?{group:s,preagg:i,output:o}:null}function n1(e,t){let r=e.subqueries;if(gc(e)&&r.length===0)return t(e);let n=n1(r[0],t);for(let i=1;i<r.length;++i){let o=n1(r[i],t);if(o!==void 0&&o!==n)return NaN}return n}var nX={skip:!0,result:null},i1=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=iX(n),c.source===null))return null;if(i.has(t))return i.get(t);let l=gC(t),u;if(!l)u=null;else if(r.skip(t,n))u=nX;else{let f=r.remove(a).predicate(t);u=aX(t.query(f),c,l,s),u.result=o.exec([`CREATE SCHEMA IF NOT EXISTS ${s}`,wc(u.table,u.create,{temp:!1})]),u.result.catch(d=>o.logger().error(d))}return i.set(t,u),u}};function iX(e){let{source:t,meta:r}=e,n=e.predicate,i=Qf(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=>sX(d,u,l));f.some(d=>!d)||(f.length===1?(o=d=>d?Yr("active0",d.extent.map(f[0])):[],s={active0:f[0](n.expr)}):(o=d=>d?sn(d.clauses.map((h,p)=>Yr(`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 oX={ceil:aA,round:Hs};function sX(e,t,r){let{type:n,domain:i,range:o,apply:s,sqlApply:a}=im(e);if(!s)return;let c=oX[`${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 aX(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=>Qf(g).map(x=>x.column));cX(l,y)}let u=c._having,f=c._orderby;c._having=[],c._orderby=[];let d=c.toString(),h=(t1(d)>>>0).toString(16),p=`${n}.preagg_${h}`,m=ft.select(i,o).from(p).groupby(i).having(u).orderby(f);return new QA({table:p,create:d,active:t,select:m})}function cX(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 QA=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 o1(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 lX="count",uX="nulls",fX="max",dX="min",hX="distinct";var pX={[lX]:Or,[hX]:e=>Or(e).distinct(),[fX]:Vr,[dX]:jn,[uX]:e=>Or().where(eu(e))};function mX({table:e,column:t,stats:r}){return ft.from(e).select(Array.from(r,n=>({[n]:pX[n](t)})))}async function ZA(e,t){return t.length===1&&t[0].column==="*"?gX(e,t[0].table):(await Promise.all(t.map(r=>yX(e,r)))).filter(r=>r)}async function yX(e,{table:t,column:r,stats:n}){let i=ft.from({source:t}).select({column:r}).groupby(Mr(r)&&bn(r)?er`ALL`:[]),[o]=Array.from(await e.query(ft.describe(i))),s={table:t,column:`${r}`,sqlType:o.column_type,type:o1(o.column_type),nullable:o.null==="YES"};if(!n?.length)return s;let[a]=await e.query(mX({table:t,column:r,stats:n}),{persist:!0});return Object.assign(s,a)}async function gX(e,t){return Array.from(await e.query(`DESCRIBE ${Xl(t)}`)).map(n=>({table:t,column:n.column_name,sqlType:n.column_type,type:o1(n.column_type),nullable:n.null==="YES"}))}var vc=Object.freeze({pending:Symbol("pending"),ready:Symbol("ready"),error:Symbol("error"),done:Symbol("done")}),ru=class extends Promise{constructor(){let t,r;super((n,i)=>{t=n,r=i}),this._resolve=t,this._reject=r,this._state=vc.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=vc.done,this}ready(t){return this._state=vc.ready,this._value=t,this}reject(t){return this._state=vc.error,this._reject(t),this}get state(){return this._state}};ru.prototype.constructor=Promise;function s1(){return{debug(...e){},info(...e){},log(...e){},warn(...e){},error(...e){}}}function xX(e){return(typeof requestAnimationFrame<"u"?requestAnimationFrame:typeof setImmediate<"u"?setImmediate:setTimeout)(e)}function xC(e,t){let r=[],n=0;function i(){let o=bX(r,t);r=[],n=0;for(let s of o)wX(s,e),IX(s,t)}return{add(o,s){o.request.type==="arrow"?(n=n||xX(()=>i()),r.push({entry:o,priority:s,index:r.length})):e(o,s)}}}function bX(e,t){let r=[],n=new Map;for(let i of e){let{entry:{request:o}}=i,s=_X(o.query,t);if(!n.has(s)){let a=[];r.push(a),n.set(s,a)}n.get(s).push(i)}return r}function _X(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=>bn(o.expr))&&n.setGroupby("ALL");return`${n}`}else return r}function wX(e,t){if(vX(e))t({request:{type:"arrow",cache:!1,query:e.query=SX(e)},result:e.result=new ru});else for(let{entry:r,priority:n}of e)t(r,n)}function vX(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 SX(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 IX(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=MT(n);e.forEach(({entry:a},c)=>{let{request:l,result:u}=a,f=r[c],d=s&&f?AX(o,f):f?TX(o,f):o;l.cache&&t.set(String(l.query),d),u.fulfill(d)})}function TX(e,t){return e.select(t.map(r=>r[0]),t.map(r=>r[1]))}function AX(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 EX=typeof requestIdleCallback<"u"?requestIdleCallback:setTimeout,bC=()=>({get:()=>{},set:(e,t)=>t,clear:()=>{}});function _C({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&&EX(n),o},clear(){r=new Map}}}var a1=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 zo=Object.freeze({High:0,Normal:1,Low:2}),c1=class{constructor(t=32){this.queue=new a1(3),this.db=null,this.clientCache=null,this._logger=s1(),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!==vc.pending;){let n=this.pendingResults.shift();n.state===vc.ready?n.fulfill():n.state===vc.done&&this._logger.warn("Found resolved query in pending results.")}t.type==="exec"&&(this.pendingExec=!1),this.next()})}enqueue(t,r=zo.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?_C():t||bC():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=xC(this.enqueue.bind(this),this.clientCache):!t&&this._consolidate&&(this._consolidate=null)}request(t,r=zo.Normal){let n=new ru,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 l1;function ii(e){return e?l1=e:l1==null&&(l1=new sm),l1}var sm=class{constructor(t=wb(),{logger:r=console,manager:n=new c1,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 i1(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||s1(),this.manager.logger(this._logger)),this._logger}cancel(t){this.manager.cancel(t)}exec(t,{priority:r=zo.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=zo.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:zo.Low})}createBundle(t,r,n=zo.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=zo.High){let n={name:t};return this.manager.request({type:"load-bundle",options:n},r)}updateClient(t,r,n=zo.Normal){return t.queryPending(),t._pending=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,t._pending=this.initializeClient(t),MX(this,t.filterBy,t)}async initializeClient(t){let r=t.fields();return r?.length&&t.fieldInfo(await ZA(this,r)),await t.prepare(),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 MX(e,t,r){if(!t)return;let n=e.filterGroups.get(t);if(!n){let i=s=>NX(e,t,s),o=()=>OX(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 NX(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 OX(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 u1=class{constructor(){this._callbacks=new Map}addEventListener(t,r){this._callbacks.has(t)||this._callbacks.set(t,{callbacks:new Set,pending:null,queue:new KA}),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())})}}}},KA=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 am(e,t){return e===t?!1:e instanceof Date&&t instanceof Date?+e!=+t:Array.isArray(e)&&Array.isArray(t)?RX(e,t):!0}function RX(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 Sc}var Sc=class e extends u1{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 am(this._value,t)||r?this.emit("value",t):this.cancel("value"),this}willEmit(t,r){return t==="value"&&(this._value=r),r}};function Lr(e){return e instanceof jo}function f1(e,t){return new jo(new d1(e),t&&[t].flat())}var jo=class e extends Sc{static intersect({cross:t=!1,empty:r=!1,include:n=[]}={}){return f1({cross:t,empty:r},n)}static union({cross:t=!1,empty:r=!1,include:n=[]}={}){return f1({cross:t,empty:r,union:!0},n)}static single({cross:t=!1,empty:r=!1,include:n=[]}={}){return f1({cross:t,empty:r,single:!0},n)}static crossfilter({empty:t=!1,include:r=[]}={}){return f1({cross:!0,empty:t},r)}constructor(t=new d1,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)}},d1=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}};var wC={};function cm(e,t=!1){let r,n,i=wC;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=wC,a(u)}),i=l}return t?c:a}var Qs=class{constructor(t){this._filterBy=t,this._requestUpdate=cm(()=>this.requestQuery(),!0),this._coordinator=null,this._pending=Promise.resolve()}get coordinator(){return this._coordinator}set coordinator(t){this._coordinator=t}get pending(){return this._pending}get filterBy(){return this._filterBy}get filterStable(){return!0}fields(){return null}fieldInfo(t){return this}async prepare(){}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}};function vC(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)}),n=await r;if(!n.ok)throw new Error(`Query failed with HTTP status ${n.status}: ${await n.text()}`);return t.type==="exec"?r:t.type==="arrow"?pc(await n.arrayBuffer()):n.json()}}}function IC(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 SC(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 Kf(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 so(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 SC=="function"?SC(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 iE={};ti(iE,{compareArrayLike:()=>nE,joinUint8Arrays:()=>si,memcpy:()=>fm,rebaseValueOffsets:()=>_1,toArrayBufferView:()=>zt,toArrayBufferViewAsyncIterator:()=>lo,toArrayBufferViewIterator:()=>Vo,toBigInt64Array:()=>b1,toBigUint64Array:()=>$X,toFloat32Array:()=>zX,toFloat32ArrayAsyncIterator:()=>nH,toFloat32ArrayIterator:()=>HX,toFloat64Array:()=>jX,toFloat64ArrayAsyncIterator:()=>iH,toFloat64ArrayIterator:()=>QX,toInt16Array:()=>BX,toInt16ArrayAsyncIterator:()=>JX,toInt16ArrayIterator:()=>YX,toInt32Array:()=>nu,toInt32ArrayAsyncIterator:()=>tH,toInt32ArrayIterator:()=>WX,toInt8Array:()=>CX,toInt8ArrayAsyncIterator:()=>KX,toInt8ArrayIterator:()=>VX,toUint16Array:()=>PX,toUint16ArrayAsyncIterator:()=>eH,toUint16ArrayIterator:()=>GX,toUint32Array:()=>UX,toUint32ArrayAsyncIterator:()=>rH,toUint32ArrayIterator:()=>XX,toUint8Array:()=>It,toUint8ArrayAsyncIterator:()=>rE,toUint8ArrayIterator:()=>eE,toUint8ClampedArray:()=>qX,toUint8ClampedArrayAsyncIterator:()=>oH,toUint8ClampedArrayIterator:()=>ZX});var DX=new TextDecoder("utf-8"),lm=e=>DX.decode(e),LX=new TextEncoder,qo=e=>LX.encode(e);var FX=e=>typeof e=="number",TC=e=>typeof e=="boolean",gr=e=>typeof e=="function",_n=e=>e!=null&&Object(e)===e,ao=e=>_n(e)&&gr(e.then);var co=e=>_n(e)&&gr(e[Symbol.iterator]),Li=e=>_n(e)&&gr(e[Symbol.asyncIterator]),h1=e=>_n(e)&&_n(e.schema);var p1=e=>_n(e)&&"done"in e&&"value"in e;var m1=e=>_n(e)&&gr(e.stat)&&FX(e.fd);var y1=e=>_n(e)&&um(e.body),g1=e=>"_getDOMStream"in e&&"_getNodeStream"in e,AC=e=>_n(e)&&gr(e.abort)&&gr(e.getWriter)&&!g1(e),um=e=>_n(e)&&gr(e.cancel)&&gr(e.getReader)&&!g1(e),EC=e=>_n(e)&&gr(e.end)&&gr(e.write)&&TC(e.writable)&&!g1(e),x1=e=>_n(e)&&gr(e.read)&&gr(e.pipe)&&TC(e.readable)&&!g1(e),MC=e=>_n(e)&&gr(e.clear)&&gr(e.bytes)&&gr(e.position)&&gr(e.setPosition)&&gr(e.capacity)&&gr(e.getBufferIdentifier)&&gr(e.createLong);var tE=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function kX(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 fm(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=kX(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?fm(s,o,a):s=o;break}fm(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=p1(t)?t.value:t;return r instanceof e?e===Uint8Array?new e(r.buffer,r.byteOffset,r.byteLength):r:r?(typeof r=="string"&&(r=qo(r)),r instanceof ArrayBuffer?new e(r):r instanceof tE?new e(r):MC(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 CX=e=>zt(Int8Array,e),BX=e=>zt(Int16Array,e),nu=e=>zt(Int32Array,e),b1=e=>zt(BigInt64Array,e),It=e=>zt(Uint8Array,e),PX=e=>zt(Uint16Array,e),UX=e=>zt(Uint32Array,e),$X=e=>zt(BigUint64Array,e),zX=e=>zt(Float32Array,e),jX=e=>zt(Float64Array,e),qX=e=>zt(Uint8ClampedArray,e),JA=e=>(e.next(),e);function*Vo(e,t){let r=function*(i){yield i},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof tE?r(t):co(t)?t:r(t);return yield*JA(function*(i){let o=null;do o=i.next(yield zt(e,o));while(!o.done)}(n[Symbol.iterator]())),new e}var VX=e=>Vo(Int8Array,e),YX=e=>Vo(Int16Array,e),WX=e=>Vo(Int32Array,e),eE=e=>Vo(Uint8Array,e),GX=e=>Vo(Uint16Array,e),XX=e=>Vo(Uint32Array,e),HX=e=>Vo(Float32Array,e),QX=e=>Vo(Float64Array,e),ZX=e=>Vo(Uint8ClampedArray,e);function lo(e,t){return oi(this,arguments,function*(){if(ao(t))return yield Ut(yield Ut(yield*Kf(so(lo(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*Kf(so(JA(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 tE?n(t):co(t)?i(t):Li(t)?t:n(t);return yield Ut(yield*Kf(so(JA(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 KX=e=>lo(Int8Array,e),JX=e=>lo(Int16Array,e),tH=e=>lo(Int32Array,e),rE=e=>lo(Uint8Array,e),eH=e=>lo(Uint16Array,e),rH=e=>lo(Uint32Array,e),nH=e=>lo(Float32Array,e),iH=e=>lo(Float64Array,e),oH=e=>lo(Uint8ClampedArray,e);function _1(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 nE(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 Wr={fromIterable(e){return w1(sH(e))},fromAsyncIterable(e){return w1(aH(e))},fromDOMStream(e){return w1(cH(e))},fromNodeStream(e){return w1(lH(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')}},w1=e=>(e.next(),e);function*sH(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=eE(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 aH(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=rE(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 cH(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 sE(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 sE=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})}},oE=(e,t)=>{let r=i=>n([t,i]),n;return[t,r,new Promise(i=>(n=i)&&e.once(t,r))]};function lH(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]=oE(e,"end"),r[1]=oE(e,"error");do{if(r[2]=oE(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 Yo=new Int32Array(2),v1=new Float32Array(Yo.buffer),S1=new Float64Array(Yo.buffer),Jf=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var dm;(function(e){e[e.UTF8_BYTES=1]="UTF8_BYTES",e[e.UTF16_STRING=2]="UTF16_STRING"})(dm||(dm={}));var 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 Yo[0]=this.readInt32(t),v1[0]}readFloat64(t){return Yo[Jf?0:1]=this.readInt32(t),Yo[Jf?1:0]=this.readInt32(t+4),S1[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){v1[0]=r,this.writeInt32(t,Yo[0])}writeFloat64(t,r){S1[0]=r,this.writeInt32(t,Yo[Jf?0:1]),this.writeInt32(t+4,Yo[Jf?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let r=0;r<4;r++)t+=String.fromCharCode(this.readInt8(this.position_+4+r));return t}__offset(t,r){let n=t-this.readInt32(t);return r<this.readInt16(n)?this.readInt16(n+r):0}__union(t,r){return t.bb_pos=r+this.readInt32(r),t.bb=this,t}__string(t,r){t+=this.readInt32(t);let n=this.readInt32(t);t+=4;let i=this.bytes_.subarray(t,t+n);return r===dm.UTF8_BYTES?i:this.text_decoder_.decode(i)}__union_with_string(t,r){return typeof t=="string"?this.__string(r):this.__union(t,r)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let r=0;r<4;r++)if(t.charCodeAt(r)!=this.readInt8(this.position()+4+r))return!1;return!0}createScalarList(t,r){let n=[];for(let i=0;i<r;++i){let o=t(i);o!==null&&n.push(o)}return n}createObjList(t,r){let n=[];for(let i=0;i<r;++i){let o=t(i);o!==null&&n.push(o.unpack())}return n}};var iu=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 hm;(function(e){e[e.BUFFER=0]="BUFFER"})(hm||(hm={}));var pm;(function(e){e[e.LZ4_FRAME=0]="LZ4_FRAME",e[e.ZSTD=1]="ZSTD"})(pm||(pm={}));var T1=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):pm.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):hm.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,r){t.addFieldInt8(0,r,pm.LZ4_FRAME)}static addMethod(t,r){t.addFieldInt8(1,r,hm.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 td=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 ed=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 ed).__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 td).__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 T1).__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 Ic;(function(e){e[e.Little=0]="Little",e[e.Big=1]="Big"})(Ic||(Ic={}));var mm;(function(e){e[e.DenseArray=0]="DenseArray"})(mm||(mm={}));var fo=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 Wo=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 fo).__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):mm.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,mm.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 ym=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 gm=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 Tc=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 Go=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 Ac=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 Ec=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 Mc=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 Nc=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 Oc=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 xm=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 bm=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 _m=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 Rc=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 wm=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 vm=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 ho=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 Sm=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 cn=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 Wo).__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):Ic.Little}fields(t,r){let n=this.bb.__offset(this.bb_pos,6);return n?(r||new cn).__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,Ic.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 AE={};ti(AE,{clampRange:()=>Em,createElementComparator:()=>kc,wrapIndex:()=>ou});var aE={};ti(aE,{valueToString:()=>po});function po(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=>po(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,r)=>typeof r=="bigint"?`${r}`:r)}var fE={};ti(fE,{BN:()=>Tm,bigNumToBigInt:()=>OC,bigNumToNumber:()=>uE,bigNumToString:()=>id,isArrowBigNumSymbol:()=>NC});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 cE(e,t){return re(e/t)+re(e%t)/re(t)}var NC=Symbol.for("isArrowBigNum");function mo(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)}mo.prototype[NC]=!0;mo.prototype.toJSON=function(){return`"${id(this)}"`};mo.prototype.valueOf=function(e){return uE(this,e)};mo.prototype.toString=function(){return id(this)};mo.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return uE(this);case"string":return id(this);case"default":return OC(this)}return id(this)};function rd(...e){return mo.apply(this,e)}function nd(...e){return mo.apply(this,e)}function Im(...e){return mo.apply(this,e)}Object.setPrototypeOf(rd.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(nd.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Im.prototype,Object.create(Uint32Array.prototype));Object.assign(rd.prototype,mo.prototype,{constructor:rd,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(nd.prototype,mo.prototype,{constructor:nd,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Im.prototype,mo.prototype,{constructor:Im,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});var uH=BigInt(4294967296)*BigInt(4294967296),fH=uH-BigInt(1);function uE(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^fH)*(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 id(e){if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return lE(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return lE(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`-${lE(t)}`}function OC(e){return e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:id(e)}function lE(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 Tm=class e{static new(t,r){switch(r){case!0:return new rd(t);case!1:return new nd(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new rd(t)}return t.byteLength===16?new Im(t):new nd(t)}static signed(t){return new rd(t)}static unsigned(t){return new nd(t)}static decimal(t){return new Im(t)}constructor(t,r){return e.new(t,r)}};var RC,DC,LC,FC,kC,CC,BC,PC,UC,$C,zC,jC,qC,VC,YC,WC,GC,XC,HC,QC,ZC,KC,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}};RC=Symbol.toStringTag;K[RC]=(e=>(e.children=null,e.ArrayType=Array,e.OffsetArrayType=Int32Array,e[Symbol.toStringTag]="DataType"))(K.prototype);var wn=class extends K{constructor(){super(D.Null)}toString(){return"Null"}};DC=Symbol.toStringTag;wn[DC]=(e=>e[Symbol.toStringTag]="Null")(wn.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}`}};LC=Symbol.toStringTag;_r[LC]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(_r.prototype);var A1=class extends _r{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},E1=class extends _r{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},Xo=class extends _r{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},M1=class extends _r{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},N1=class extends _r{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},O1=class extends _r{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},R1=class extends _r{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},D1=class extends _r{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(A1.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(E1.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(Xo.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(M1.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(N1.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(O1.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(R1.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(D1.prototype,"ArrayType",{value:BigUint64Array});var Ci=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}`}};FC=Symbol.toStringTag;Ci[FC]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(Ci.prototype);var L1=class extends Ci{constructor(){super(be.HALF)}},F1=class extends Ci{constructor(){super(be.SINGLE)}},k1=class extends Ci{constructor(){super(be.DOUBLE)}};Object.defineProperty(L1.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(F1.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(k1.prototype,"ArrayType",{value:Float64Array});var ta=class extends K{constructor(){super(D.Binary)}toString(){return"Binary"}};kC=Symbol.toStringTag;ta[kC]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(ta.prototype);var ea=class extends K{constructor(){super(D.LargeBinary)}toString(){return"LargeBinary"}};CC=Symbol.toStringTag;ea[CC]=(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"}};BC=Symbol.toStringTag;ra[BC]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(ra.prototype);var na=class extends K{constructor(){super(D.LargeUtf8)}toString(){return"LargeUtf8"}};PC=Symbol.toStringTag;na[PC]=(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"}};UC=Symbol.toStringTag;ia[UC]=(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}]`}};$C=Symbol.toStringTag;oa[$C]=(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}<${He[this.unit]}>`}get ArrayType(){return this.unit===He.DAY?Int32Array:BigInt64Array}};zC=Symbol.toStringTag;sa[zC]=(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`)}};jC=Symbol.toStringTag;aa[jC]=(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}`:""}>`}};qC=Symbol.toStringTag;ca[qC]=(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]}>`}};VC=Symbol.toStringTag;la[VC]=(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]}>`}};YC=Symbol.toStringTag;ua[YC]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Duration"))(ua.prototype);var yo=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}};WC=Symbol.toStringTag;yo[WC]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(yo.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(", ")}}>`}};GC=Symbol.toStringTag;Re[GC]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(Re.prototype);var go=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(" | ")}>`}};XC=Symbol.toStringTag;go[XC]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(go.prototype);var fa=class extends K{constructor(t){super(D.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};HC=Symbol.toStringTag;fa[HC]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(fa.prototype);var xo=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}>`}};QC=Symbol.toStringTag;xo[QC]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(xo.prototype);var bo=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(", ")}}>`}};ZC=Symbol.toStringTag;bo[ZC]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(bo.prototype);var dH=(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?dH():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}>`}};KC=Symbol.toStringTag;li[KC]=(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 hH(this,t,r)}getVisitFnByTypeId(t,r=!0){return od(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 hH(e,t,r=!0){return typeof t=="number"?od(e,t,r):typeof t=="string"&&t in D?od(e,D[t],r):t&&t instanceof K?od(e,JC(t),r):t?.type&&t.type instanceof K?od(e,JC(t.type),r):od(e,D.NONE,r)}function od(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 JC(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 dE={};ti(dE,{float64ToUint16:()=>Am,uint16ToFloat64:()=>C1});var tB=new Float64Array(1),sd=new Uint32Array(tB.buffer);function C1(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 Am(e){if(e!==e)return 32256;tB[0]=e;let t=(sd[1]&2147483648)>>16&65535,r=sd[1]&2146435072,n=0;return r>=1089470464?sd[0]>0?r=31744:(r=(r&2080374784)>>16,n=(sd[1]&1048575)>>10):r<=1056964608?(n=1048576+(sd[1]&1048575),n=1048576+(n<<(r>>20)-998)>>21,r=0):(r=r-1056964608>>10,n=(sd[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 pH=(e,t,r)=>{e[t]=Math.floor(r/864e5)},eB=(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)}},mH=({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},hE=({values:e},t,r)=>{e[t]=r},rB=({values:e},t,r)=>{e[t]=Am(r)},yH=(e,t,r)=>{switch(e.type.precision){case be.HALF:return rB(e,t,r);case be.SINGLE:case be.DOUBLE:return hE(e,t,r)}},B1=({values:e},t,r)=>{pH(e,t,r.valueOf())},P1=({values:e},t,r)=>{e[t]=BigInt(r)},pE=({stride:e,values:t},r,n)=>{t.set(n.subarray(0,e),e*r)},nB=({values:e,valueOffsets:t},r,n)=>eB(e,t,r,n),iB=({values:e,valueOffsets:t},r,n)=>eB(e,t,r,qo(n)),mE=(e,t,r)=>{e.type.unit===He.DAY?B1(e,t,r):P1(e,t,r)},U1=({values:e},t,r)=>{e[t]=BigInt(r/1e3)},$1=({values:e},t,r)=>{e[t]=BigInt(r)},z1=({values:e},t,r)=>{e[t]=BigInt(r*1e3)},j1=({values:e},t,r)=>{e[t]=BigInt(r*1e6)},yE=(e,t,r)=>{switch(e.type.unit){case ct.SECOND:return U1(e,t,r);case ct.MILLISECOND:return $1(e,t,r);case ct.MICROSECOND:return z1(e,t,r);case ct.NANOSECOND:return j1(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},W1=({values:e},t,r)=>{e[t]=r},gE=(e,t,r)=>{switch(e.type.unit){case ct.SECOND:return q1(e,t,r);case ct.MILLISECOND:return V1(e,t,r);case ct.MICROSECOND:return Y1(e,t,r);case ct.NANOSECOND:return W1(e,t,r)}},xE=({values:e,stride:t},r,n)=>{e.set(n.subarray(0,t),t*r)},gH=(e,t,r)=>{let n=e.children[0],i=e.valueOffsets,o=Gr.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))},xH=(e,t,r)=>{let n=e.children[0],{valueOffsets:i}=e,o=Gr.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},bH=(e,t)=>(r,n,i,o)=>n&&r(n,e,t[o]),_H=(e,t)=>(r,n,i,o)=>n&&r(n,e,t.get(o)),wH=(e,t)=>(r,n,i,o)=>n&&r(n,e,t.get(i.name)),vH=(e,t)=>(r,n,i,o)=>n&&r(n,e,t[i.name]),SH=(e,t,r)=>{let n=e.type.children.map(o=>Gr.getVisitFn(o.type)),i=r instanceof Map?wH(t,r):r instanceof Gt?_H(t,r):Array.isArray(r)?bH(t,r):vH(t,r);e.type.children.forEach((o,s)=>i(n[s],e.children[s],o,s))},IH=(e,t,r)=>{e.type.mode===Se.Dense?oB(e,t,r):sB(e,t,r)},oB=(e,t,r)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[n];Gr.visit(i,e.valueOffsets[t],r)},sB=(e,t,r)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[n];Gr.visit(i,t,r)},TH=(e,t,r)=>{var n;(n=e.dictionary)===null||n===void 0||n.set(e.values[t],r)},bE=(e,t,r)=>{e.type.unit===xr.DAY_TIME?G1(e,t,r):X1(e,t,r)},G1=({values:e},t,r)=>{e.set(r.subarray(0,2),2*t)},X1=({values:e},t,r)=>{e[t]=r[0]*12+r[1]%12},H1=({values:e},t,r)=>{e[t]=r},Q1=({values:e},t,r)=>{e[t]=r},Z1=({values:e},t,r)=>{e[t]=r},K1=({values:e},t,r)=>{e[t]=r},_E=(e,t,r)=>{switch(e.type.unit){case ct.SECOND:return H1(e,t,r);case ct.MILLISECOND:return Q1(e,t,r);case ct.MICROSECOND:return Z1(e,t,r);case ct.NANOSECOND:return K1(e,t,r)}},AH=(e,t,r)=>{let{stride:n}=e,i=e.children[0],o=Gr.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(mH);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(yH);wt.prototype.visitFloat16=Ot(rB);wt.prototype.visitFloat32=Ot(hE);wt.prototype.visitFloat64=Ot(hE);wt.prototype.visitUtf8=Ot(iB);wt.prototype.visitLargeUtf8=Ot(iB);wt.prototype.visitBinary=Ot(nB);wt.prototype.visitLargeBinary=Ot(nB);wt.prototype.visitFixedSizeBinary=Ot(pE);wt.prototype.visitDate=Ot(mE);wt.prototype.visitDateDay=Ot(B1);wt.prototype.visitDateMillisecond=Ot(P1);wt.prototype.visitTimestamp=Ot(yE);wt.prototype.visitTimestampSecond=Ot(U1);wt.prototype.visitTimestampMillisecond=Ot($1);wt.prototype.visitTimestampMicrosecond=Ot(z1);wt.prototype.visitTimestampNanosecond=Ot(j1);wt.prototype.visitTime=Ot(gE);wt.prototype.visitTimeSecond=Ot(q1);wt.prototype.visitTimeMillisecond=Ot(V1);wt.prototype.visitTimeMicrosecond=Ot(Y1);wt.prototype.visitTimeNanosecond=Ot(W1);wt.prototype.visitDecimal=Ot(xE);wt.prototype.visitList=Ot(gH);wt.prototype.visitStruct=Ot(SH);wt.prototype.visitUnion=Ot(IH);wt.prototype.visitDenseUnion=Ot(oB);wt.prototype.visitSparseUnion=Ot(sB);wt.prototype.visitDictionary=Ot(TH);wt.prototype.visitInterval=Ot(bE);wt.prototype.visitIntervalDayTime=Ot(G1);wt.prototype.visitIntervalYearMonth=Ot(X1);wt.prototype.visitDuration=Ot(_E);wt.prototype.visitDurationSecond=Ot(H1);wt.prototype.visitDurationMillisecond=Ot(Q1);wt.prototype.visitDurationMicrosecond=Ot(Z1);wt.prototype.visitDurationNanosecond=Ot(K1);wt.prototype.visitFixedSizeList=Ot(AH);wt.prototype.visitMap=Ot(xH);var Gr=new wt;var _o=Symbol.for("parent"),ad=Symbol.for("rowIndex"),Dc=class{constructor(t,r){return this[_o]=t,this[ad]=r,new Proxy(this,new vE)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[ad],r=this[_o],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])=>`${po(t)}: ${po(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new wE(this[_o],this[ad])}},wE=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(Dc.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[_o]:{writable:!0,enumerable:!1,configurable:!1,value:null},[ad]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var vE=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[_o].type.children.map(r=>r.name)}has(t,r){return t[_o].type.children.findIndex(n=>n.name===r)!==-1}getOwnPropertyDescriptor(t,r){if(t[_o].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[_o].type.children.findIndex(i=>i.name===r);if(n!==-1){let i=sr.visit(t[_o].children[n],t[ad]);return Reflect.set(t,r,i),i}}set(t,r,n){let i=t[_o].type.children.findIndex(o=>o.name===r);return i!==-1?(Gr.visit(t[_o].children[i],t[ad],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 EH=(e,t)=>864e5*e[t],MH=(e,t)=>null,aB=(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)},NH=({offset:e,values:t},r)=>{let n=e+r;return(t[n>>3]&1<<n%8)!==0},cB=({values:e},t)=>EH(e,t),lB=({values:e},t)=>re(e[t]),Lc=({stride:e,values:t},r)=>t[e*r],OH=({stride:e,values:t},r)=>C1(t[e*r]),uB=({values:e},t)=>e[t],RH=({stride:e,values:t},r)=>t.subarray(e*r,e*(r+1)),fB=({values:e,valueOffsets:t},r)=>aB(e,t,r),dB=({values:e,valueOffsets:t},r)=>{let n=aB(e,t,r);return n!==null?lm(n):null},DH=({values:e},t)=>e[t],LH=({type:e,values:t},r)=>e.precision!==be.HALF?t[r]:C1(t[r]),FH=(e,t)=>e.type.unit===He.DAY?cB(e,t):lB(e,t),hB=({values:e},t)=>1e3*re(e[t]),pB=({values:e},t)=>re(e[t]),mB=({values:e},t)=>cE(e[t],BigInt(1e3)),yB=({values:e},t)=>cE(e[t],BigInt(1e6)),kH=(e,t)=>{switch(e.type.unit){case ct.SECOND:return hB(e,t);case ct.MILLISECOND:return pB(e,t);case ct.MICROSECOND:return mB(e,t);case ct.NANOSECOND:return yB(e,t)}},gB=({values:e},t)=>e[t],xB=({values:e},t)=>e[t],bB=({values:e},t)=>e[t],_B=({values:e},t)=>e[t],CH=(e,t)=>{switch(e.type.unit){case ct.SECOND:return gB(e,t);case ct.MILLISECOND:return xB(e,t);case ct.MICROSECOND:return bB(e,t);case ct.NANOSECOND:return _B(e,t)}},BH=({values:e,stride:t},r)=>Tm.decimal(e.subarray(t*r,t*(r+1))),PH=(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])},UH=(e,t)=>{let{valueOffsets:r,children:n}=e,{[t]:i,[t+1]:o}=r,s=n[0];return new Ho(s.slice(i,o-i))},$H=(e,t)=>new Dc(e,t),zH=(e,t)=>e.type.mode===Se.Dense?wB(e,t):vB(e,t),wB=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],n=e.children[r];return sr.visit(n,e.valueOffsets[t])},vB=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],n=e.children[r];return sr.visit(n,t)},jH=(e,t)=>{var r;return(r=e.dictionary)===null||r===void 0?void 0:r.get(e.values[t])},qH=(e,t)=>e.type.unit===xr.DAY_TIME?SB(e,t):IB(e,t),SB=({values:e},t)=>e.subarray(2*t,2*(t+1)),IB=({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},TB=({values:e},t)=>e[t],AB=({values:e},t)=>e[t],EB=({values:e},t)=>e[t],MB=({values:e},t)=>e[t],VH=(e,t)=>{switch(e.type.unit){case ct.SECOND:return TB(e,t);case ct.MILLISECOND:return AB(e,t);case ct.MICROSECOND:return EB(e,t);case ct.NANOSECOND:return MB(e,t)}},YH=(e,t)=>{let{stride:r,children:n}=e,o=n[0].slice(t*r,r);return new Gt([o])};yt.prototype.visitNull=At(MH);yt.prototype.visitBool=At(NH);yt.prototype.visitInt=At(DH);yt.prototype.visitInt8=At(Lc);yt.prototype.visitInt16=At(Lc);yt.prototype.visitInt32=At(Lc);yt.prototype.visitInt64=At(uB);yt.prototype.visitUint8=At(Lc);yt.prototype.visitUint16=At(Lc);yt.prototype.visitUint32=At(Lc);yt.prototype.visitUint64=At(uB);yt.prototype.visitFloat=At(LH);yt.prototype.visitFloat16=At(OH);yt.prototype.visitFloat32=At(Lc);yt.prototype.visitFloat64=At(Lc);yt.prototype.visitUtf8=At(dB);yt.prototype.visitLargeUtf8=At(dB);yt.prototype.visitBinary=At(fB);yt.prototype.visitLargeBinary=At(fB);yt.prototype.visitFixedSizeBinary=At(RH);yt.prototype.visitDate=At(FH);yt.prototype.visitDateDay=At(cB);yt.prototype.visitDateMillisecond=At(lB);yt.prototype.visitTimestamp=At(kH);yt.prototype.visitTimestampSecond=At(hB);yt.prototype.visitTimestampMillisecond=At(pB);yt.prototype.visitTimestampMicrosecond=At(mB);yt.prototype.visitTimestampNanosecond=At(yB);yt.prototype.visitTime=At(CH);yt.prototype.visitTimeSecond=At(gB);yt.prototype.visitTimeMillisecond=At(xB);yt.prototype.visitTimeMicrosecond=At(bB);yt.prototype.visitTimeNanosecond=At(_B);yt.prototype.visitDecimal=At(BH);yt.prototype.visitList=At(PH);yt.prototype.visitStruct=At($H);yt.prototype.visitUnion=At(zH);yt.prototype.visitDenseUnion=At(wB);yt.prototype.visitSparseUnion=At(vB);yt.prototype.visitDictionary=At(jH);yt.prototype.visitInterval=At(qH);yt.prototype.visitIntervalDayTime=At(SB);yt.prototype.visitIntervalYearMonth=At(IB);yt.prototype.visitDuration=At(VH);yt.prototype.visitDurationSecond=At(TB);yt.prototype.visitDurationMillisecond=At(AB);yt.prototype.visitDurationMicrosecond=At(EB);yt.prototype.visitDurationNanosecond=At(MB);yt.prototype.visitFixedSizeList=At(YH);yt.prototype.visitMap=At(UH);var sr=new yt;var Fc=Symbol.for("keys"),ld=Symbol.for("vals"),cd=Symbol.for("kKeysAsStrings"),SE=Symbol.for("_kKeysAsStrings"),Ho=class{constructor(t){return this[Fc]=new Gt([t.children[0]]).memoize(),this[ld]=t.children[1],new Proxy(this,new TE)}get[cd](){return this[SE]||(this[SE]=Array.from(this[Fc].toArray(),String))}[Symbol.iterator](){return new IE(this[Fc],this[ld])}get size(){return this[Fc].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Fc],r=this[ld],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])=>`${po(t)}: ${po(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},IE=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)]})}},TE=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[cd]}has(t,r){return t[cd].includes(r)}getOwnPropertyDescriptor(t,r){if(t[cd].indexOf(r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,r){if(Reflect.has(t,r))return t[r];let n=t[cd].indexOf(r);if(n!==-1){let i=sr.visit(Reflect.get(t,ld),n);return Reflect.set(t,r,i),i}}set(t,r,n){let i=t[cd].indexOf(r);return i!==-1?(Gr.visit(Reflect.get(t,ld),i,n),Reflect.set(t,r,n)):Reflect.has(t,r)?Reflect.set(t,r,n):!1}};Object.defineProperties(Ho.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Fc]:{writable:!0,enumerable:!1,configurable:!1,value:null},[ld]:{writable:!0,enumerable:!1,configurable:!1,value:null},[SE]:{writable:!0,enumerable:!1,configurable:!1,value:null}});var NB;function Em(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&&(NB=o,o=s,s=NB),s>i&&(s=i),n?n(e,o,s):[o,s]}var ou=(e,t)=>e<0?t+e:e,OB=e=>e!==e;function kc(e){if(typeof e!=="object"||e===null)return OB(e)?OB: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?nE(e,r):!1:e instanceof Map?GH(e):Array.isArray(e)?WH(e):e instanceof Gt?XH(e):HH(e,!0)}function WH(e){let t=[];for(let r=-1,n=e.length;++r<n;)t[r]=kc(e[r]);return J1(t)}function GH(e){let t=-1,r=[];for(let n of e.values())r[++t]=kc(n);return J1(r)}function XH(e){let t=[];for(let r=-1,n=e.length;++r<n;)t[r]=kc(e.get(r));return J1(t)}function HH(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]=kc(e[r[i]]);return J1(n,r)}function J1(e,t){return r=>{if(!r||typeof r!="object")return!1;switch(r.constructor){case Array:return QH(e,r);case Map:return RB(e,r,r.keys());case Ho:case Dc:case Object:case void 0:return RB(e,r,t||Object.keys(r))}return r instanceof Gt?ZH(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 ZH(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 RB(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 EE={};ti(EE,{BitIterator:()=>su,getBit:()=>DB,getBool:()=>e_,packBools:()=>cu,popcnt_array:()=>LB,popcnt_bit_range:()=>Mm,popcnt_uint32:()=>t_,setBool:()=>KH,truncateBitmap:()=>au});function e_(e,t,r,n){return(r&1<<n)!==0}function DB(e,t,r,n){return(r&1<<n)>>n}function KH(e,t,r){return r?!!(e[t>>3]|=1<<t%8)||!0:!(e[t>>3]&=~(1<<t%8))&&!1}function au(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):cu(new su(r,e,t,null,e_)).subarray(0,n)),i}return r}function cu(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 su=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 Mm(e,t,r){if(r-t<=0)return 0;if(r-t<8){let o=0;for(let s of new su(e,t,r-t,e,DB))o+=s;return o}let n=r>>3<<3,i=t+(t%8===0?0:8-t%8);return Mm(e,t,i)+Mm(e,n,r)+LB(e,i>>3,n-i>>3)}function LB(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+=t_(o.getUint32(i)),i+=4;for(;s-i>=2;)n+=t_(o.getUint16(i)),i+=2;for(;s-i>=1;)n+=t_(o.getUint8(i)),i+=1;return n}function t_(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 JH=-1,ce=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<=JH&&(r=this.nullBitmap)&&(this._nullCount=t=r.length===0?0:this.length-Mm(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(au(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(au(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))}};ce.prototype.children=Object.freeze([]);var ME=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 ce(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 ce(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 ce(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 ce(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=nu(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ce(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=b1(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ce(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=nu(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ce(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=b1(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ce(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 ce(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 ce(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 ce(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 ce(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 ce(r,n,s,a,[void 0,o,i])}visitList(t){let{["type"]:r,["offset"]:n=0,["child"]:i}=t,o=It(t.nullBitmap),s=nu(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ce(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 ce(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 ce(r,n,s,a,[void 0,void 0,void 0,o],i);let c=nu(t.valueOffsets);return new ce(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 ce(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 ce(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 ce(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 ce(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=nu(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ce(r,n,a,c,[s,void 0,o],[i])}},tQ=new ME;function Dt(e){return tQ.visit(e)}var Nm=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 FB(e){return e.some(t=>t.nullable)}function r_(e){return e.reduce((t,r)=>t+r.nullCount,0)}function n_(e){return e.reduce((t,r,n)=>(t[n+1]=t[n]+r.length,t),new Uint32Array(e.length+1))}function i_(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 NE(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 Om(e,t){return e.getValid(t)}function ud(e){function t(r,n,i){return e(r[n],i)}return function(r){let n=this.data;return NE(n,this._offsets,r,t)}}function o_(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=NE(o,this._offsets,n,r);return t=void 0,s}}function s_(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):NE(o,this._offsets,i,r);return t=void 0,s}}var gt=class extends mt{};function eQ(e,t){return t===null&&e.length>0?0:-1}function rQ(e,t){let{nullBitmap:r}=e;if(!r||e.nullCount<=0)return-1;let n=0;for(let i of new su(r,e.offset+(t||0),e.length,r,e_)){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 rQ(e,r)}let n=sr.getVisitFn(e),i=kc(t);for(let o=(r||0)-1,s=e.length;++o<s;)if(i(n(e,o)))return o;return-1}function kB(e,t,r){let n=sr.getVisitFn(e),i=kc(t);for(let o=(r||0)-1,s=e.length;++o<s;)if(i(n(e,o)))return o;return-1}gt.prototype.visitNull=eQ;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=kB;gt.prototype.visitSparseUnion=kB;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 lu=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 Nm(e.data.length,n=>{let i=e.data[n];return i.values.subarray(0,i.length)[Symbol.iterator]()});let r=0;return new Nm(e.data.length,n=>{let o=e.data[n].length,s=e.slice(r,r+o);return r+=o,new OE(s)})}var OE=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 fd=new xt;var CB,BB={},PB={},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 ce)))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}=BB[s.typeId],u=o[0];this.isValid=f=>Om(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,PB[s.typeId]),this._offsets=n_(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 FB(this.data)}get nullCount(){return r_(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(ou(t,this.length))}set(t,r){}indexOf(t,r){return-1}includes(t,r){return this.indexOf(t,r)>-1}[Symbol.iterator](){return fd.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(Em(this,t,r,({data:n,_offsets:i},o,s)=>i_(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 a_(this.data[0].dictionary),r=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new e(r)}return new a_(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}};CB=Symbol.toStringTag;Gt[CB]=(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=Gr.getVisitFnByTypeId(r),o=lu.getVisitFnByTypeId(r);BB[r]={get:n,set:i,indexOf:o},PB[r]=Object.create(e,{isValid:{value:ud(Om)},get:{value:ud(sr.getVisitFnByTypeId(r))},set:{value:o_(Gr.getVisitFnByTypeId(r))},indexOf:{value:s_(lu.getVisitFnByTypeId(r))}})}return"Vector"})(Gt.prototype);var a_=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 UB(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
|
-
switch (x) {${r.map(n=>`
|
|
4
|
-
case ${nQ(n)}:`).join("")}
|
|
5
|
-
return false;
|
|
6
|
-
}`),e.length!==r.length&&(t=`if (x !== x) return false;
|
|
7
|
-
${t}`),new Function("x",`${t}
|
|
8
|
-
return true;`)}function nQ(e){return typeof e!="bigint"?po(e):`${po(e)}n`}function RE(e,t){let r=Math.ceil(e)*t-1;return(r-r%64+64||64)/t}function $B(e,t=0){return e.length>=t?e.subarray(0,t):fm(new e.constructor(t),e,0)}var wo=class{constructor(t,r=0,n=1){this.length=Math.ceil(r/n),this.buffer=new t(this.length),this.stride=n,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t}get byteLength(){return Math.ceil(this.length*this.stride)*this.BYTES_PER_ELEMENT}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(t,r){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;let r=this.stride,n=this.length*r,i=this.buffer.length;n>=i&&this._resize(i===0?RE(n*1,this.BYTES_PER_ELEMENT):RE(n*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=RE(t*this.stride,this.BYTES_PER_ELEMENT);let r=$B(this.buffer,t);return this.clear(),r}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(t){return this.buffer=$B(this.buffer,t)}},ha=class extends wo{last(){return this.get(this.length-1)}get(t){return this.buffer[t]}set(t,r){return this.reserve(t-this.length+1),this.buffer[t*this.stride]=r,this}},dd=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()}},hd=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 dd,r&&r.length>0&&(this._isValid=UB(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)}},Yn=class extends Le{constructor(t){super(t),this._pendingLength=0,this._offsets=new hd(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 Ho?r[Fc].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 uu=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 uu).__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 uu).__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=DE(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=c_(c_(new Map,this.metadata),r.metadata),o=r.fields.filter(a=>{let c=n.findIndex(l=>l.name===a.name);return~c?(n[c]=a.clone({metadata:c_(c_(new Map,n[c].metadata),a.metadata)}))&&!1:!0}),s=DE(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 c_(e,t){return new Map([...e||new Map,...t||new Map])}function DE(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&&DE(o.children,t)}return t}var iQ=iu,oQ=ai,pa=class{static decode(t){t=new oQ(It(t));let r=fi.getRootAsFooter(t),n=me.decode(r.schema(),new Map,r.version());return new LE(n,r)}static encode(t){let r=new iQ,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 LE=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 uu.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}),Rm=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},fu=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())}},l_=class extends fu{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 Wr.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return Wr.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 Qo=class extends l_{write(t){if((t=It(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?lm(this.toUint8Array(!0)):this.toUint8Array(!1).then(lm)}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=so(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]})}},Zo=class{constructor(t){t&&(this.source=new FE(Wr.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)}},Bi=class e{constructor(t){t instanceof e?this.source=t.source:t instanceof Qo?this.source=new ya(Wr.fromAsyncIterable(t)):x1(t)?this.source=new ya(Wr.fromNodeStream(t)):um(t)?this.source=new ya(Wr.fromDOMStream(t)):y1(t)?this.source=new ya(Wr.fromDOMStream(t.body)):co(t)?this.source=new ya(Wr.fromIterable(t)):ao(t)?this.source=new ya(Wr.fromAsyncIterable(t)):Li(t)&&(this.source=new ya(Wr.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)}},FE=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 Dm=class extends Zo{constructor(t,r){super(),this.position=0,this.buffer=It(t),this.size=r===void 0?this.buffer.byteLength:r}readInt32(t){let{buffer:r,byteOffset:n}=this.readAt(t,4);return new DataView(r,n).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){let{buffer:r,size:n,position:i}=this;return r&&i<n?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(n,i+Math.min(n-i,t)),r.subarray(i,this.position)):null}readAt(t,r){let n=this.buffer,i=Math.min(this.size,t+r);return n?n.subarray(t,i):new Uint8Array(r)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}},Cc=class extends Bi{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 CE={};ti(CE,{BaseInt64:()=>Lm,Int128:()=>Fm,Int64:()=>ga,Uint64:()=>je});function pd(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}var md=8,kE=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],Lm=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`${pd(this.buffer[1])} ${pd(this.buffer[0])}`}},je=class e extends Lm{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=md<n-o?md:n-o,a=new e(new Uint32Array([Number.parseInt(t.slice(o,o+s),10),0])),c=new e(new Uint32Array([kE[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 Lm{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=md<i-s?md:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0])),l=new e(new Uint32Array([kE[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)}},Fm=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`${pd(this.buffer[3])} ${pd(this.buffer[2])} ${pd(this.buffer[1])} ${pd(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=md<i-s?md:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0,0,0])),l=new e(new Uint32Array([kE[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 km=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)}},u_=class extends km{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):cu(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===He.MILLISECOND?zt(Uint8Array,ga.convertArray(n[r])):K.isDecimal(t)?zt(Uint8Array,Fm.convertArray(n[r])):K.isBinary(t)||K.isLargeBinary(t)||K.isFixedSizeBinary(t)?sQ(n[r]):K.isBool(t)?cu(n[r]):K.isUtf8(t)||K.isLargeUtf8(t)?qo(n[r].join("")):zt(Uint8Array,zt(t.ArrayType,n[r].map(i=>+i)))}};function sQ(e){let t=e.join(""),r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n>>1]=Number.parseInt(t.slice(n,n+2),16);return r}var yd=class extends Yn{constructor(t){super(t),this._values=new wo(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,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 gd=class extends Yn{constructor(t){super(t),this._values=new wo(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,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 f_=class extends Le{constructor(t){super(t),this._values=new dd}setValue(t,r){this._values.set(t,+r)}};var du=class extends ar{};du.prototype._setValue=mE;var Cm=class extends du{};Cm.prototype._setValue=B1;var Bm=class extends du{};Bm.prototype._setValue=P1;var Pm=class extends ar{};Pm.prototype._setValue=xE;var d_=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=hu({type:this.type.indices,nullValues:r}),this.dictionary=hu({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 Um=class extends ar{};Um.prototype._setValue=pE;var h_=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 xo(this.type.listSize,new jt(r,t.type,!0)),n}};var pu=class extends ar{setValue(t,r){this._values.set(t,r)}},p_=class extends pu{setValue(t,r){super.setValue(t,Am(r))}},m_=class extends pu{},y_=class extends pu{};var mu=class extends ar{};mu.prototype._setValue=bE;var $m=class extends mu{};$m.prototype._setValue=G1;var zm=class extends mu{};zm.prototype._setValue=X1;var xa=class extends ar{};xa.prototype._setValue=_E;var jm=class extends xa{};jm.prototype._setValue=H1;var qm=class extends xa{};qm.prototype._setValue=Q1;var Vm=class extends xa{};Vm.prototype._setValue=Z1;var Ym=class extends xa{};Ym.prototype._setValue=K1;var Pi=class extends ar{setValue(t,r){this._values.set(t,r)}},g_=class extends Pi{},x_=class extends Pi{},b_=class extends Pi{},__=class extends Pi{},w_=class extends Pi{},v_=class extends Pi{},S_=class extends Pi{},I_=class extends Pi{};var T_=class extends Yn{constructor(t){super(t),this._offsets=new hd(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 yo(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 A_=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 bo(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 E_=class extends Le{setValue(t,r){}setValid(t,r){return this.length=Math.max(t+1,this.length),r}};var M_=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=yE;var Wm=class extends ba{};Wm.prototype._setValue=U1;var Gm=class extends ba{};Gm.prototype._setValue=$1;var Xm=class extends ba{};Xm.prototype._setValue=z1;var Hm=class extends ba{};Hm.prototype._setValue=j1;var _a=class extends ar{};_a.prototype._setValue=gE;var Qm=class extends _a{};Qm.prototype._setValue=q1;var Zm=class extends _a{};Zm.prototype._setValue=V1;var Km=class extends _a{};Km.prototype._setValue=Y1;var Jm=class extends _a{};Jm.prototype._setValue=W1;var xd=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 go(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.")}},N_=class extends xd{},O_=class extends xd{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 ty=class extends Yn{constructor(t){super(t),this._values=new wo(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,qo(r))}_flushPending(t,r){}};ty.prototype._flushPending=yd.prototype._flushPending;var ey=class extends Yn{constructor(t){super(t),this._values=new wo(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,qo(r))}_flushPending(t,r){}};ey.prototype._flushPending=gd.prototype._flushPending;var BE=class extends mt{visitNull(){return E_}visitBool(){return f_}visitInt(){return Pi}visitInt8(){return g_}visitInt16(){return x_}visitInt32(){return b_}visitInt64(){return __}visitUint8(){return w_}visitUint16(){return v_}visitUint32(){return S_}visitUint64(){return I_}visitFloat(){return pu}visitFloat16(){return p_}visitFloat32(){return m_}visitFloat64(){return y_}visitUtf8(){return ty}visitLargeUtf8(){return ey}visitBinary(){return yd}visitLargeBinary(){return gd}visitFixedSizeBinary(){return Um}visitDate(){return du}visitDateDay(){return Cm}visitDateMillisecond(){return Bm}visitTimestamp(){return ba}visitTimestampSecond(){return Wm}visitTimestampMillisecond(){return Gm}visitTimestampMicrosecond(){return Xm}visitTimestampNanosecond(){return Hm}visitTime(){return _a}visitTimeSecond(){return Qm}visitTimeMillisecond(){return Zm}visitTimeMicrosecond(){return Km}visitTimeNanosecond(){return Jm}visitDecimal(){return Pm}visitList(){return T_}visitStruct(){return M_}visitUnion(){return xd}visitDenseUnion(){return O_}visitSparseUnion(){return N_}visitDictionary(){return d_}visitInterval(){return mu}visitIntervalDayTime(){return $m}visitIntervalYearMonth(){return zm}visitDuration(){return xa}visitDurationSecond(){return jm}visitDurationMillisecond(){return qm}visitDurationMicrosecond(){return Vm}visitDurationNanosecond(){return Ym}visitFixedSizeList(){return h_}visitMap(){return A_}},zB=new BE;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 vn(e,t){return t instanceof e.constructor}function yu(e,t){return e===t||vn(e,t)}function wa(e,t){return e===t||vn(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function R_(e,t){return e===t||vn(e,t)&&e.precision===t.precision}function aQ(e,t){return e===t||vn(e,t)&&e.byteWidth===t.byteWidth}function PE(e,t){return e===t||vn(e,t)&&e.unit===t.unit}function ry(e,t){return e===t||vn(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function ny(e,t){return e===t||vn(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function cQ(e,t){return e===t||vn(e,t)&&e.children.length===t.children.length&&Ko.compareManyFields(e.children,t.children)}function lQ(e,t){return e===t||vn(e,t)&&e.children.length===t.children.length&&Ko.compareManyFields(e.children,t.children)}function UE(e,t){return e===t||vn(e,t)&&e.mode===t.mode&&e.typeIds.every((r,n)=>r===t.typeIds[n])&&Ko.compareManyFields(e.children,t.children)}function uQ(e,t){return e===t||vn(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&Ko.visit(e.indices,t.indices)&&Ko.visit(e.dictionary,t.dictionary)}function $E(e,t){return e===t||vn(e,t)&&e.unit===t.unit}function iy(e,t){return e===t||vn(e,t)&&e.unit===t.unit}function fQ(e,t){return e===t||vn(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&Ko.compareManyFields(e.children,t.children)}function dQ(e,t){return e===t||vn(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&Ko.compareManyFields(e.children,t.children)}bt.prototype.visitNull=yu;bt.prototype.visitBool=yu;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=R_;bt.prototype.visitFloat16=R_;bt.prototype.visitFloat32=R_;bt.prototype.visitFloat64=R_;bt.prototype.visitUtf8=yu;bt.prototype.visitLargeUtf8=yu;bt.prototype.visitBinary=yu;bt.prototype.visitLargeBinary=yu;bt.prototype.visitFixedSizeBinary=aQ;bt.prototype.visitDate=PE;bt.prototype.visitDateDay=PE;bt.prototype.visitDateMillisecond=PE;bt.prototype.visitTimestamp=ry;bt.prototype.visitTimestampSecond=ry;bt.prototype.visitTimestampMillisecond=ry;bt.prototype.visitTimestampMicrosecond=ry;bt.prototype.visitTimestampNanosecond=ry;bt.prototype.visitTime=ny;bt.prototype.visitTimeSecond=ny;bt.prototype.visitTimeMillisecond=ny;bt.prototype.visitTimeMicrosecond=ny;bt.prototype.visitTimeNanosecond=ny;bt.prototype.visitDecimal=yu;bt.prototype.visitList=cQ;bt.prototype.visitStruct=lQ;bt.prototype.visitUnion=UE;bt.prototype.visitDenseUnion=UE;bt.prototype.visitSparseUnion=UE;bt.prototype.visitDictionary=uQ;bt.prototype.visitInterval=$E;bt.prototype.visitIntervalDayTime=$E;bt.prototype.visitIntervalYearMonth=$E;bt.prototype.visitDuration=iy;bt.prototype.visitDurationSecond=iy;bt.prototype.visitDurationMillisecond=iy;bt.prototype.visitDurationMicrosecond=iy;bt.prototype.visitDurationNanosecond=iy;bt.prototype.visitFixedSizeList=fQ;bt.prototype.visitMap=dQ;var Ko=new bt;function gu(e,t){return Ko.compareSchemas(e,t)}function jB(e,t){return Ko.compareFields(e,t)}function qB(e,t){return Ko.visit(e,t)}function hu(e){let t=e.type,r=new(zB.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(hu(Object.assign(Object.assign({},l),{type:c})))}}return r}function D_(e,t){return hQ(e,t.map(r=>r.data.concat()))}function hQ(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=pQ(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 pQ(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 VB,Sn=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 ce){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]=D_(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(!gu(i,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=o??n_(this.data)}get data(){return this.batches.map(({data:t})=>t)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((t,r)=>t+r.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=r_(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(ou(t,this.numRows))}set(t,r){}indexOf(t,r){return-1}[Symbol.iterator](){return this.batches.length>0?fd.visit(new Gt(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
|
|
9
|
-
${this.toArray().join(`,
|
|
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 Qe(r,i)))}slice(t,r){let n=this.schema;[t,r]=Em({length:this.numRows},t,r);let i=i_(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 wn,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]=D_(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(...D_(o,s))}};VB=Symbol.toStringTag;Sn[VB]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e.isValid=ud(Om),e.get=ud(sr.getVisitFn(D.Struct)),e.set=o_(Gr.getVisitFn(D.Struct)),e.indexOf=s_(lu.getVisitFn(D.Struct)),"Table"))(Sn.prototype);var WB,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 ce))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=YB(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]=YB(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=GB(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(ou(t,this.numRows))}set(t,r){return Gr.visit(this.data,t,r)}indexOf(t,r){return lu.visit(this.data,t,r)}[Symbol.iterator](){return fd.visit(new Gt([this.data]))}toArray(){return[...this]}concat(...t){return new Sn(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 wn,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)}};WB=Symbol.toStringTag;Qe[WB]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(Qe.prototype);function YB(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 GB(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)||[]])GB(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 xu=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 vo=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 zE=class extends mt{visit(t,r){return t==null||r==null?void 0:super.visit(t,r)}visitNull(t,r){return wm.startNull(r),wm.endNull(r)}visitInt(t,r){return fo.startInt(r),fo.addBitWidth(r,t.bitWidth),fo.addIsSigned(r,t.isSigned),fo.endInt(r)}visitFloat(t,r){return Nc.startFloatingPoint(r),Nc.addPrecision(r,t.precision),Nc.endFloatingPoint(r)}visitBinary(t,r){return ym.startBinary(r),ym.endBinary(r)}visitLargeBinary(t,r){return xm.startLargeBinary(r),xm.endLargeBinary(r)}visitBool(t,r){return gm.startBool(r),gm.endBool(r)}visitUtf8(t,r){return Sm.startUtf8(r),Sm.endUtf8(r)}visitLargeUtf8(t,r){return bm.startLargeUtf8(r),bm.endLargeUtf8(r)}visitDecimal(t,r){return Go.startDecimal(r),Go.addScale(r,t.scale),Go.addPrecision(r,t.precision),Go.addBitWidth(r,t.bitWidth),Go.endDecimal(r)}visitDate(t,r){return Tc.startDate(r),Tc.addUnit(r,t.unit),Tc.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 Oc.startInterval(r),Oc.addUnit(r,t.unit),Oc.endInterval(r)}visitDuration(t,r){return Ac.startDuration(r),Ac.addUnit(r,t.unit),Ac.endDuration(r)}visitList(t,r){return _m.startList(r),_m.endList(r)}visitStruct(t,r){return vm.startStruct_(r),vm.endStruct_(r)}visitUnion(t,r){ho.startTypeIdsVector(r,t.typeIds.length);let n=ho.createTypeIdsVector(r,t.typeIds);return ho.startUnion(r),ho.addMode(r,t.mode),ho.addTypeIds(r,n),ho.endUnion(r)}visitDictionary(t,r){let n=this.visit(t.indices,r);return Wo.startDictionaryEncoding(r),Wo.addId(r,BigInt(t.id)),Wo.addIsOrdered(r,t.isOrdered),n!==void 0&&Wo.addIndexType(r,n),Wo.endDictionaryEncoding(r)}visitFixedSizeBinary(t,r){return Ec.startFixedSizeBinary(r),Ec.addByteWidth(r,t.byteWidth),Ec.endFixedSizeBinary(r)}visitFixedSizeList(t,r){return Mc.startFixedSizeList(r),Mc.addListSize(r,t.listSize),Mc.endFixedSizeList(r)}visitMap(t,r){return Rc.startMap(r),Rc.addKeysSorted(r,t.keysSorted),Rc.endMap(r)}},L_=new zE;function ZB(e,t=new Map){return new me(yQ(e,t),F_(e.metadata),t)}function jE(e){return new Xr(e.count,JB(e.columns),t5(e.columns))}function KB(e){return new Gn(jE(e.data),e.id,e.isDelta)}function yQ(e,t){return(e.fields||[]).filter(Boolean).map(r=>jt.fromJSON(r,t))}function XB(e,t){return(e.children||[]).filter(Boolean).map(r=>jt.fromJSON(r,t))}function JB(e){return(e||[]).reduce((t,r)=>[...t,new Ui(r.count,gQ(r.VALIDITY)),...JB(r.children)],[])}function t5(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=t5(i.children,t)}return t}function gQ(e){return(e||[]).reduce((t,r)=>t+ +(r===0),0)}function e5(e,t){let r,n,i,o,s,a;return!t||!(o=e.dictionary)?(s=QB(e,XB(e,t)),i=new jt(e.name,s,e.nullable,F_(e.metadata))):t.has(r=o.id)?(n=(n=o.indexType)?HB(n):new Xo,a=new li(t.get(r),n,r,o.isOrdered),i=new jt(e.name,a,e.nullable,F_(e.metadata))):(n=(n=o.indexType)?HB(n):new Xo,t.set(r,s=QB(e,XB(e,t))),a=new li(s,n,r,o.isOrdered),i=new jt(e.name,a,e.nullable,F_(e.metadata))),i||null}function F_(e=[]){return new Map(e.map(({key:t,value:r})=>[t,r]))}function HB(e){return new _r(e.isSigned,e.bitWidth)}function QB(e,t){let r=e.type.name;switch(r){case"NONE":return new wn;case"null":return new wn;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 yo((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 Ci(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(He[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 go(Se[s],n.typeIds||[],t||[])}case"fixedsizebinary":{let n=e.type;return new fa(n.byteWidth)}case"fixedsizelist":{let n=e.type;return new xo(n.listSize,(t||[])[0])}case"map":{let n=e.type;return new bo((t||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${r}"`)}var xQ=iu,bQ=ai,Xn=class e{static fromJSON(t,r){let n=new e(0,he.V5,r);return n._createHeader=_Q(t,r),n}static decode(t){t=new bQ(It(t));let r=vo.getRootAsMessage(t),n=r.bodyLength(),i=r.version(),o=r.headerType(),s=new e(n,i,o);return s._createHeader=wQ(r,o),s}static encode(t){let r=new xQ,n=-1;return t.isSchema()?n=me.encode(r,t.header()):t.isRecordBatch()?n=Xr.encode(r,t.header()):t.isDictionaryBatch()&&(n=Gn.encode(r,t.header())),vo.startMessage(r),vo.addVersion(r,he.V5),vo.addHeader(r,n),vo.addHeaderType(r,t.headerType),vo.addBodyLength(r,BigInt(t.bodyLength)),vo.finishMessageBuffer(r,vo.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 Xr)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)}},Xr=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)}},Ui=class{constructor(t,r){this.length=re(t),this.nullCount=re(r)}};function _Q(e,t){return()=>{switch(t){case Vt.Schema:return me.fromJSON(e);case Vt.RecordBatch:return Xr.fromJSON(e);case Vt.DictionaryBatch:return Gn.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${Vt[t]}, type: ${t} }`)}}function wQ(e,t){return()=>{switch(t){case Vt.Schema:return me.decode(e.header(new Vn),new Map,e.version());case Vt.RecordBatch:return Xr.decode(e.header(new ci),e.version());case Vt.DictionaryBatch:return Gn.decode(e.header(new Zs),e.version())}throw new Error(`Unrecognized Message type: { name: ${Vt[t]}, type: ${t} }`)}}jt.encode=DQ;jt.decode=OQ;jt.fromJSON=e5;me.encode=RQ;me.decode=vQ;me.fromJSON=ZB;Xr.encode=LQ;Xr.decode=SQ;Xr.fromJSON=jE;Gn.encode=FQ;Gn.decode=IQ;Gn.fromJSON=KB;Ui.encode=kQ;Ui.decode=AQ;Wn.encode=CQ;Wn.decode=TQ;function vQ(e,t=new Map,r=he.V5){let n=NQ(e,t);return new me(n,k_(e),t,r)}function SQ(e,t=he.V5){if(e.compression()!==null)throw new Error("Record batch compression not implemented");return new Xr(e.length(),EQ(e),MQ(e,t))}function IQ(e,t=he.V5){return new Gn(Xr.decode(e.data(),t),e.id(),e.isDelta())}function TQ(e){return new Wn(e.offset(),e.length())}function AQ(e){return new Ui(e.length(),e.nullCount())}function EQ(e){let t=[];for(let r,n=-1,i=-1,o=e.nodesLength();++n<o;)(r=e.nodes(n))&&(t[++i]=Ui.decode(r));return t}function MQ(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 NQ(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 r5(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 OQ(e,t){let r,n,i,o,s,a;return!t||!(a=e.dictionary())?(i=i5(e,r5(e,t)),n=new jt(e.name(),i,e.nullable(),k_(e))):t.has(r=re(a.id()))?(o=(o=a.indexType())?n5(o):new Xo,s=new li(t.get(r),o,r,a.isOrdered()),n=new jt(e.name(),s,e.nullable(),k_(e))):(o=(o=a.indexType())?n5(o):new Xo,t.set(r,i=i5(e,r5(e,t))),s=new li(i,o,r,a.isOrdered()),n=new jt(e.name(),s,e.nullable(),k_(e))),n||null}function k_(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 n5(e){return new _r(e.isSigned(),e.bitWidth())}function i5(e,t){let r=e.typeType();switch(r){case Ie.NONE:return new wn;case Ie.Null:return new wn;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 yo((t||[])[0]);case Ie.Struct_:return new Re(t||[])}switch(r){case Ie.Int:{let n=e.type(new fo);return new _r(n.isSigned(),n.bitWidth())}case Ie.FloatingPoint:{let n=e.type(new Nc);return new Ci(n.precision())}case Ie.Decimal:{let n=e.type(new Go);return new oa(n.scale(),n.precision(),n.bitWidth())}case Ie.Date:{let n=e.type(new Tc);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 Oc);return new la(n.unit())}case Ie.Duration:{let n=e.type(new Ac);return new ua(n.unit())}case Ie.Union:{let n=e.type(new ho);return new go(n.mode(),n.typeIdsArray()||[],t||[])}case Ie.FixedSizeBinary:{let n=e.type(new Ec);return new fa(n.byteWidth())}case Ie.FixedSizeList:{let n=e.type(new Mc);return new xo(n.listSize(),(t||[])[0])}case Ie.Map:{let n=e.type(new Rc);return new bo((t||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${Ie[r]}" (${r})`)}function RQ(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,BQ?Ic.Little:Ic.Big),i!==-1&&Vn.addCustomMetadata(e,i),Vn.endSchema(e)}function DQ(e,t){let r=-1,n=-1,i=-1,o=t.type,s=t.typeId;K.isDictionary(o)?(s=o.dictionary.typeId,i=L_.visit(o,e),n=L_.visit(o.dictionary,e)):n=L_.visit(o,e);let a=(o.children||[]).map(u=>jt.encode(e,u)),c=cn.createChildrenVector(e,a),l=t.metadata&&t.metadata.size>0?cn.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)),cn.startField(e),cn.addType(e,n),cn.addTypeType(e,s),cn.addChildren(e,c),cn.addNullable(e,!!t.nullable),r!==-1&&cn.addName(e,r),i!==-1&&cn.addDictionary(e,i),l!==-1&&cn.addCustomMetadata(e,l),cn.endField(e)}function LQ(e,t){let r=t.nodes||[],n=t.buffers||[];ci.startNodesVector(e,r.length);for(let s of r.slice().reverse())Ui.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 FQ(e,t){let r=Xr.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 kQ(e,t){return ed.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function CQ(e,t){return td.createBuffer(e,BigInt(t.offset),BigInt(t.length))}var BQ=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})();var VE=e=>`Expected ${Vt[e]} Message in stream, but was null or length 0.`,YE=e=>`Header pointer of flatbuffer-encoded ${Vt[e]} Message is null or length 0.`,o5=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,s5=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,bd=class{constructor(t){this.source=t instanceof Zo?t:new Zo(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(VE(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(s5(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(YE(r));return i}readMetadataLength(){let t=this.source.read(C_),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(o5(t,r.byteLength));return{done:!1,value:Xn.decode(r)}}},oy=class{constructor(t,r){this.source=t instanceof Bi?t:m1(t)?new Cc(t,r):new Bi(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(VE(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(s5(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(YE(r));return i})}readMetadataLength(){return Q(this,void 0,void 0,function*(){let t=yield this.source.read(C_),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(o5(t,r.byteLength));return{done:!1,value:Xn.decode(r)}})}},sy=class extends bd{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof Rm?t:new Rm(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(VE(t));return r.value}readSchema(){let t=Vt.Schema,r=this.readMessage(t),n=r?.header();if(!r||!n)throw new Error(YE(t));return n}},C_=4,qE="ARROW1",_d=new Uint8Array(qE.length);for(let e=0;e<qE.length;e+=1)_d[e]=qE.codePointAt(e);function B_(e,t=0){for(let r=-1,n=_d.length;++r<n;)if(_d[r]!==e[t+r])return!1;return!0}var wd=_d.length,WE=wd+C_,a5=wd*2+C_;var Hr=class e extends fu{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 ao(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 Wr.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return Wr.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:h1(t)?UQ(t):m1(t)?jQ(t):ao(t)?Q(this,void 0,void 0,function*(){return yield e.from(yield t)}):y1(t)||um(t)||x1(t)||Li(t)?zQ(new Bi(t)):$Q(new Zo(t))}static readAll(t){return t instanceof e?t.isSync()?c5(t):l5(t):h1(t)||ArrayBuffer.isView(t)||co(t)||p1(t)?c5(t):l5(t)}},Jo=class extends Hr{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*Kf(so(this[Symbol.iterator]())))})}},Bc=class extends Hr{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=so(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]()}},Pc=class extends Jo{constructor(t){super(t),this._impl=t}},ay=class extends Bc{constructor(t){super(t),this._impl=t}},P_=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 km(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}},vd=class extends P_{constructor(t,r){super(r),this._reader=h1(t)?new sy(this._handle=t):new bd(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=u5(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 xu(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},Sd=class extends P_{constructor(t,r){super(r),this._reader=new oy(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=u5(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 xu(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return Q(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},U_=class extends vd{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 Dm?t:new Dm(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-WE,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}},GE=class extends Sd{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-WE,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})}},XE=class extends vd{constructor(t,r){super(t,r)}_loadVectors(t,r,n){return new u_(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}};function u5(e,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:e.autoDestroy}function*c5(e){let t=Hr.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function l5(e){return oi(this,arguments,function*(){let r=yield Ut(Hr.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 UQ(e){return new Jo(new XE(e))}function $Q(e){let t=e.peek(wd+7&-8);return t&&t.byteLength>=4?B_(t)?new Pc(new U_(e.read())):new Jo(new vd(e)):new Jo(new vd(function*(){}()))}function zQ(e){return Q(this,void 0,void 0,function*(){let t=yield e.peek(wd+7&-8);return t&&t.byteLength>=4?B_(t)?new Pc(new U_(yield e.read())):new Bc(new Sd(e)):new Bc(new Sd(function(){return oi(this,arguments,function*(){})}()))})}function jQ(e){return Q(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),r=new Cc(e,t);return t>=a5&&B_(yield r.readAt(0,wd+7&-8))?new ay(new GE(r)):new Bc(new Sd(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 Ui(n,0));else{let{nullCount:i}=t;K.isNull(r)||So.call(this,i<=0?new Uint8Array(0):au(t.offset,n,t.nullBitmap)),this.nodes.push(new Ui(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 So(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 qQ(e){var t;let{type:r,length:n,typeIds:i,valueOffsets:o}=e;if(So.call(this,i),r.mode===Se.Sparse)return HE.call(this,e);if(r.mode===Se.Dense){if(e.offset<=0)return So.call(this,o),HE.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);So.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 VQ(e){let t;return e.nullCount>=e.length?So.call(this,new Uint8Array(0)):(t=e.values)instanceof Uint8Array?So.call(this,au(e.offset,e.length,t)):So.call(this,cu(e.values))}function va(e){return So.call(this,e.values.subarray(0,e.length*e.stride))}function $_(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 So.call(this,_1(-i,t+1,n)),So.call(this,r.subarray(i,i+s)),this}function QE(e){let{length:t,valueOffsets:r}=e;if(r){let{[0]:n,[t]:i}=r;return So.call(this,_1(-n,t+1,r)),this.visit(e.children[0].slice(n,i-n))}return this.visit(e.children[0])}function HE(e){return this.visitMany(e.type.children.map((t,r)=>e.children[r]).filter(Boolean))[0]}Ce.prototype.visitBool=VQ;Ce.prototype.visitInt=va;Ce.prototype.visitFloat=va;Ce.prototype.visitUtf8=$_;Ce.prototype.visitLargeUtf8=$_;Ce.prototype.visitBinary=$_;Ce.prototype.visitLargeBinary=$_;Ce.prototype.visitFixedSizeBinary=va;Ce.prototype.visitDate=va;Ce.prototype.visitTimestamp=va;Ce.prototype.visitTime=va;Ce.prototype.visitDecimal=va;Ce.prototype.visitList=QE;Ce.prototype.visitStruct=HE;Ce.prototype.visitUnion=qQ;Ce.prototype.visitInterval=va;Ce.prototype.visitDuration=va;Ce.prototype.visitFixedSizeList=QE;Ce.prototype.visitMap=QE;var bu=class extends fu{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 Qo,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,_n(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 ao(t)?t.then(r=>this.writeAll(r)):Li(t)?KE(this,t):ZE(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 Qo?this._sink=t:(this._sink=new Qo,t&&AC(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&EC(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||!gu(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 Sn&&!(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&&!gu(r,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,r)}t instanceof Qe?t instanceof xu||this._writeRecordBatch(t):t instanceof Sn?this.writeAll(t.batches):co(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 ma(a,t.bodyLength,this._position)):t.headerType===Vt.DictionaryBatch&&this._dictionaryBlocks.push(new ma(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-s)),o>0&&this._write(i),this._writePadding(c)}_write(t){if(this._started){let r=It(t);r&&r.byteLength>0&&(this._sink.write(r),this._position+=r.byteLength)}return this}_writeSchema(t){return this._writeMessage(Xn.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(_d)}_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 Xr(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 Xr(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}},_u=class e extends bu{static writeAll(t,r){let n=new e(r);return ao(t)?t.then(i=>n.writeAll(i)):Li(t)?KE(n,t):ZE(n,t)}},wu=class e extends bu{static writeAll(t){let r=new e;return ao(t)?t.then(n=>r.writeAll(n)):Li(t)?KE(r,t):ZE(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 ZE(e,t){let r=t;t instanceof Sn&&(r=t.batches,e.reset(void 0,t.schema));for(let n of r)e.write(n);return e.finish()}function KE(e,t){return Q(this,void 0,void 0,function*(){var r,n,i,o,s,a,c;try{for(r=!0,n=so(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 f5(e,t){if(Li(e))return WQ(e,t);if(co(e))return YQ(e,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function YQ(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 WQ(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 p5(e){return new JE(e)}var JE=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:r,["writableStrategy"]:n,["queueingStrategy"]:i="count"}=t,o=IC(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=hu(o),this._getSize=i!=="bytes"?d5:h5;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"?d5:h5}),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)}},d5=e=>{var t;return(t=e?.length)!==null&&t!==void 0?t:0},h5=e=>{var t;return(t=e?.byteLength)!==null&&t!==void 0?t:0};function z_(e,t){let r=new Qo,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 Hr.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 j_(e,t){let r=new this(e),n=new Bi(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 q_(e,t="stream"){return(t==="stream"?_u:wu).writeAll(e).toUint8Array(!0)}var QQ=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},fE),CE),EE),dE),iE),AE),aE),{compareSchemas:gu,compareFields:jB,compareTypes:qB});Wr.toDOMStream=f5;Le.throughDOM=p5;Hr.throughDOM=z_;Pc.throughDOM=z_;Jo.throughDOM=z_;bu.throughDOM=j_;wu.throughDOM=j_;_u.throughDOM=j_;var ZQ=Object.create,y5=Object.defineProperty,KQ=Object.getOwnPropertyDescriptor,JQ=Object.getOwnPropertyNames,tZ=Object.getPrototypeOf,eZ=Object.prototype.hasOwnProperty,rZ=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),nZ=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of JQ(t))!eZ.call(e,i)&&i!==r&&y5(e,i,{get:()=>t[i],enumerable:!(n=KQ(t,i))||n.enumerable});return e},iZ=(e,t,r)=>(r=e!=null?ZQ(tZ(e)):{},nZ(t||!e||!e.__esModule?y5(r,"default",{value:e,enumerable:!0}):r,e)),oZ=rZ((e,t)=>{t.exports=Worker}),sZ=(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))(sZ||{}),aZ=(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))(aZ||{}),cZ=(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))(cZ||{}),lZ=(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))(lZ||{}),uZ=(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))(uZ||{}),fZ=(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))(fZ||{}),g5=class{log(e){}},x5=class{constructor(e=2){this.level=e}log(e){e.level>=this.level&&console.log(e)}};var dZ=(e=>(e[e.SUCCESS=0]="SUCCESS",e))(dZ||{}),hZ=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=Hr.from(t);return console.assert(r.isSync(),"Reader is not sync"),console.assert(r.isFile(),"Reader is not file"),new Sn(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 b5(this._bindings,this._conn,t),n=await Hr.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 pZ(this._bindings,this._conn,t)}async insertArrowTable(e,t){let r=q_(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)}},b5=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}},pZ=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=Hr.from(t);return console.assert(r.isSync()),console.assert(r.isFile()),new Sn(r)}async send(...e){let t=await this.bindings.sendPrepared(this.connectionId,this.statementId,e),r=new b5(this.bindings,this.connectionId,t),n=await Hr.from(r);return console.assert(n.isAsync()),console.assert(n.isStream()),n}},mZ=(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))(mZ||{}),yZ=(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))(yZ||{}),ae=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 V_(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:V_(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=>oM(t.name,t.type))};case D.Map:{let t=e;return{sqlType:"map",keyType:V_(t.keyType),valueType:V_(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 oM(e,t){let r=V_(t);return r.name=e,r}var gZ=new TextEncoder,_5=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 ae("RESET",null);return await this.postTask(e)}async ping(){let e=new ae("PING",null);await this.postTask(e)}async dropFile(e){let t=new ae("DROP_FILE",e);return await this.postTask(t)}async dropFiles(){let e=new ae("DROP_FILES",null);return await this.postTask(e)}async flushFiles(){let e=new ae("FLUSH_FILES",null);return await this.postTask(e)}async instantiate(e,t=null,r=n=>{}){this._onInstantiationProgress.push(r);let n=new ae("INSTANTIATE",[e,t]);return await this.postTask(n)}async getVersion(){let e=new ae("GET_VERSION",null);return await this.postTask(e)}async getFeatureFlags(){let e=new ae("GET_FEATURE_FLAGS",null);return await this.postTask(e)}async open(e){let t=new ae("OPEN",e);await this.postTask(t)}async tokenize(e){let t=new ae("TOKENIZE",e);return await this.postTask(t)}async connectInternal(){let e=new ae("CONNECT",null);return await this.postTask(e)}async connect(){let e=await this.connectInternal();return new hZ(this,e)}async disconnect(e){let t=new ae("DISCONNECT",e);await this.postTask(t)}async runQuery(e,t){let r=new ae("RUN_QUERY",[e,t]);return await this.postTask(r)}async startPendingQuery(e,t){let r=new ae("START_PENDING_QUERY",[e,t]);return await this.postTask(r)}async pollPendingQuery(e){let t=new ae("POLL_PENDING_QUERY",e);return await this.postTask(t)}async cancelPendingQuery(e){let t=new ae("CANCEL_PENDING_QUERY",e);return await this.postTask(t)}async fetchQueryResults(e){let t=new ae("FETCH_QUERY_RESULTS",e);return await this.postTask(t)}async getTableNames(e,t){let r=new ae("GET_TABLE_NAMES",[e,t]);return await this.postTask(r)}async createPrepared(e,t){let r=new ae("CREATE_PREPARED",[e,t]);return await this.postTask(r)}async closePrepared(e,t){let r=new ae("CLOSE_PREPARED",[e,t]);await this.postTask(r)}async runPrepared(e,t,r){let n=new ae("RUN_PREPARED",[e,t,r]);return await this.postTask(n)}async sendPrepared(e,t,r){let n=new ae("SEND_PREPARED",[e,t,r]);return await this.postTask(n)}async globFiles(e){let t=new ae("GLOB_FILE_INFOS",e);return await this.postTask(t)}async registerFileText(e,t){let r=gZ.encode(t);await this.registerFileBuffer(e,r)}async registerFileURL(e,t,r,n){t===void 0&&(t=e);let i=new ae("REGISTER_FILE_URL",[e,t,r,n]);await this.postTask(i)}async registerEmptyFileBuffer(e){}async registerFileBuffer(e,t){let r=new ae("REGISTER_FILE_BUFFER",[e,t]);await this.postTask(r,[t.buffer])}async registerFileHandle(e,t,r,n){let i=new ae("REGISTER_FILE_HANDLE",[e,t,r,n]);await this.postTask(i,[])}async collectFileStatistics(e,t){let r=new ae("COLLECT_FILE_STATISTICS",[e,t]);await this.postTask(r,[])}async exportFileStatistics(e){let t=new ae("EXPORT_FILE_STATISTICS",e);return await this.postTask(t,[])}async copyFileToBuffer(e){let t=new ae("COPY_FILE_TO_BUFFER",e);return await this.postTask(t)}async copyFileToPath(e,t){let r=new ae("COPY_FILE_TO_PATH",[e,t]);await this.postTask(r)}async insertArrowFromIPCStream(e,t,r){if(t.length==0)return;let n=new ae("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(oM(o,s))}r.columnsFlat=i,delete r.columns}let n=new ae("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(oM(o,s))}r.columnsFlat=i,delete r.columns}let n=new ae("IMPORT_JSON_FROM_PATH",[e,t,r]);await this.postTask(n)}};var xZ=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])),bZ=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])),_Z=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])),wZ=()=>(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])),sM={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"}}},vZ=sM.name,SZ=sM.version,aM=sM.version.split("."),u3t=aM[0],f3t=aM[1],d3t=aM[2],IZ=()=>typeof navigator>"u";function w5(){let e="https://cdn.jsdelivr.net/npm/".concat(vZ,"@").concat(SZ,"/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 tM=null,eM=null,rM=null,nM=null,iM=null;async function TZ(){return tM==null&&(tM=typeof BigInt64Array<"u"),eM==null&&(eM=await bZ()),rM==null&&(rM=await wZ()),nM==null&&(nM=await _Z()),iM==null&&(iM=await xZ()),{bigInt64Array:tM,crossOriginIsolated:IZ()||globalThis.crossOriginIsolated||!1,wasmExceptions:eM,wasmSIMD:nM,wasmThreads:rM,wasmBulkMemory:iM}}async function v5(e){let t=await TZ();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 h3t=iZ(oZ());function AZ(){let e=new TextDecoder;return t=>(typeof SharedArrayBuffer<"u"&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),e.decode(t))}var p3t=AZ(),EZ=(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))(EZ||{});function NZ(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 S5(e={}){let{duckdb:t,connection:r,...n}=e,i=t,o=r,s;function a(){return s||(s=(i?Promise.resolve(i):OZ(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 NZ(h,d);return f==="exec"?void 0:f==="arrow"?pc(p):pc(p).toArray()}}}async function OZ({log:e=!1}={}){let t=w5(),r=await v5(t),n=URL.createObjectURL(new Blob([`importScripts("${r.mainWorker}");`],{type:"text/javascript"})),i=new Worker(n),o=e?new x5:new g5,s=new _5(o,i);return await s.instantiate(r.mainModule,r.pthreadWorker),URL.revokeObjectURL(n),s}function Uc(e,t,{source:r,clients:n=r?new Set([r]):void 0}){let i=t!==void 0?Hb(e,[Nr(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?[Hb(e[0],t.map(s=>Nr(s[0])))]:t.map(s=>sn(s.map((a,c)=>tm(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 vu(e,t,{source:r,clients:n=r?new Set([r]):void 0,bin:i,scale:o,pixelSize:s=1}){let a=t!=null?Yr(e,t):null;return{meta:{type:"interval",scales:o&&[o],bin:i,pixelSize:s},source:r,clients:n,value:t,predicate:a}}function cM(e,t,{source:r,clients:n=r?new Set([r]):void 0,bin:i,scales:o=[],pixelSize:s=1}){let a=t!=null?sn(e.map((l,u)=>Yr(l,t[u]))):null;return{meta:{type:"interval",scales:o,bin:i,pixelSize:s},source:r,clients:n,value:t,predicate:a}}var RZ={contains:xA,prefix:bA,suffix:_A,regexp:gA};function lM(e,t,{source:r,clients:n=void 0,method:i="contains"}){let o=RZ[i],s=t?o(e,Nr(t)):null;return{meta:{type:"match",method:i},source:r,clients:n,value:t,predicate:s}}function uM(e){return typeof e?.getChild=="function"}function fM(){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 uM(e)?DZ(e):LZ(e)}function DZ(e){let{numRows:t}=e;return{numRows:t,columns:e.toColumns()}}function LZ(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 mk={};ti(mk,{Fixed:()=>ts,Param:()=>Sc,Query:()=>ft,Selection:()=>jo,align:()=>X8,and:()=>sn,area:()=>CL,areaX:()=>BL,areaY:()=>PL,argmax:()=>xc,argmin:()=>bc,ariaDescription:()=>rO,ariaLabel:()=>eO,arrayAgg:()=>NT,arrow:()=>RF,aspectRatio:()=>H8,avg:()=>Hp,axis:()=>Q8,axisFx:()=>CF,axisFy:()=>BF,axisX:()=>FF,axisY:()=>kF,barX:()=>jL,barY:()=>qL,bin:()=>O8,cast:()=>Gf,cell:()=>VL,cellX:()=>YL,cellY:()=>WL,centroid:()=>rm,centroidX:()=>mA,centroidY:()=>yA,circle:()=>JL,clip:()=>J8,colorBase:()=>UD,colorClamp:()=>ED,colorConstant:()=>zD,colorDomain:()=>TD,colorExponent:()=>$D,colorInterpolate:()=>RD,colorLabel:()=>FD,colorLegend:()=>dk,colorN:()=>MD,colorNice:()=>ND,colorPercent:()=>kD,colorPivot:()=>DD,colorRange:()=>AD,colorReverse:()=>CD,colorScale:()=>ID,colorScheme:()=>OD,colorSymmetric:()=>LD,colorTickFormat:()=>PD,colorZero:()=>BD,column:()=>Gl,contour:()=>gF,coordinator:()=>ii,corr:()=>OT,count:()=>Or,covarPop:()=>DT,covariance:()=>RT,createSchema:()=>LA,createTable:()=>wc,cume_dist:()=>TA,dateDay:()=>iA,dateMonth:()=>rA,dateMonthDay:()=>nA,delaunayLink:()=>MF,delaunayMesh:()=>NF,denseLine:()=>yF,dense_rank:()=>SA,density:()=>mF,densityX:()=>hF,densityY:()=>pF,dot:()=>QL,dotX:()=>ZL,dotY:()=>KL,entropy:()=>LT,eq:()=>lA,errorbarX:()=>IF,errorbarY:()=>TF,facetGrid:()=>IR,facetLabel:()=>TR,facetMargin:()=>bR,facetMarginBottom:()=>wR,facetMarginLeft:()=>vR,facetMarginRight:()=>SR,facetMarginTop:()=>_R,first:()=>FT,first_value:()=>MA,float32:()=>JT,float64:()=>Xe,frame:()=>LF,from:()=>wW,fxAlign:()=>DR,fxAriaDescription:()=>QR,fxAriaLabel:()=>HR,fxAxis:()=>CR,fxDomain:()=>AR,fxFontVariant:()=>XR,fxGrid:()=>qR,fxInset:()=>MR,fxInsetLeft:()=>NR,fxInsetRight:()=>OR,fxLabel:()=>YR,fxLabelAnchor:()=>WR,fxLabelOffset:()=>GR,fxLine:()=>VR,fxPadding:()=>LR,fxPaddingInner:()=>FR,fxPaddingOuter:()=>kR,fxRange:()=>ER,fxReverse:()=>ZR,fxRound:()=>RR,fxTickFormat:()=>zR,fxTickPadding:()=>$R,fxTickRotate:()=>jR,fxTickSize:()=>PR,fxTickSpacing:()=>UR,fxTicks:()=>BR,fyAlign:()=>iD,fyAriaDescription:()=>vD,fyAriaLabel:()=>wD,fyAxis:()=>cD,fyDomain:()=>KR,fyFontVariant:()=>_D,fyGrid:()=>mD,fyInset:()=>tD,fyInsetBottom:()=>rD,fyInsetTop:()=>eD,fyLabel:()=>gD,fyLabelAnchor:()=>xD,fyLabelOffset:()=>bD,fyLine:()=>yD,fyPadding:()=>oD,fyPaddingInner:()=>sD,fyPaddingOuter:()=>aD,fyRange:()=>JR,fyReverse:()=>SD,fyRound:()=>nD,fyTickFormat:()=>hD,fyTickPadding:()=>dD,fyTickRotate:()=>pD,fyTickSize:()=>uD,fyTickSpacing:()=>fD,fyTicks:()=>lD,geo:()=>jF,geojson:()=>em,geomean:()=>kT,graticule:()=>VF,grid:()=>K8,gridFx:()=>$F,gridFy:()=>zF,gridX:()=>PF,gridY:()=>UF,gt:()=>Di,gte:()=>uA,hconcat:()=>pW,heatmap:()=>xF,height:()=>q8,hexagon:()=>tF,hexbin:()=>wF,hexgrid:()=>vF,highlight:()=>GF,hspace:()=>gW,hull:()=>OF,image:()=>dF,inset:()=>Z8,int32:()=>ve,intervalX:()=>XF,intervalXY:()=>QF,intervalY:()=>HF,isBetween:()=>Yr,isDistinct:()=>fA,isNotBetween:()=>dA,isNotDistinct:()=>tm,isNotNull:()=>Ri,isNull:()=>eu,kurtosis:()=>CT,lag:()=>EA,last:()=>$T,last_value:()=>NA,lead:()=>Hf,lengthBase:()=>vL,lengthClamp:()=>xL,lengthConstant:()=>IL,lengthDomain:()=>yL,lengthExponent:()=>SL,lengthNice:()=>bL,lengthPercent:()=>_L,lengthRange:()=>gL,lengthScale:()=>mL,lengthZero:()=>wL,line:()=>UL,lineX:()=>$L,lineY:()=>zL,link:()=>DF,literal:()=>Nr,loadCSV:()=>CA,loadExtension:()=>FA,loadJSON:()=>BA,loadObjects:()=>$A,loadParquet:()=>PA,loadSpatial:()=>UA,lt:()=>ze,lte:()=>ni,mad:()=>BT,margin:()=>U8,marginBottom:()=>G8,marginLeft:()=>V8,marginRight:()=>Y8,marginTop:()=>W8,margins:()=>P8,max:()=>Vr,median:()=>PT,menu:()=>cW,min:()=>jn,mode:()=>UT,name:()=>C8,nearest:()=>ZF,nearestX:()=>KF,nearestY:()=>JF,neq:()=>oo,not:()=>cA,nth_value:()=>OA,ntile:()=>AA,opacityBase:()=>KD,opacityClamp:()=>YD,opacityConstant:()=>tL,opacityDomain:()=>qD,opacityExponent:()=>JD,opacityLabel:()=>GD,opacityLegend:()=>hk,opacityNice:()=>WD,opacityPercent:()=>XD,opacityRange:()=>VD,opacityReverse:()=>HD,opacityScale:()=>jD,opacityTickFormat:()=>ZD,opacityZero:()=>QD,or:()=>Oi,padding:()=>tO,pan:()=>ok,panX:()=>sk,panY:()=>ak,panZoom:()=>ck,panZoomX:()=>lk,panZoomY:()=>uk,percent_rank:()=>IA,plot:()=>TW,product:()=>zT,projectionClip:()=>kL,projectionDomain:()=>NL,projectionInset:()=>OL,projectionInsetBottom:()=>FL,projectionInsetLeft:()=>RL,projectionInsetRight:()=>DL,projectionInsetTop:()=>LL,projectionParallels:()=>AL,projectionPrecision:()=>EL,projectionRotate:()=>ML,projectionType:()=>TL,quantile:()=>jT,rBase:()=>dL,rClamp:()=>aL,rConstant:()=>pL,rDomain:()=>oL,rExponent:()=>hL,rLabel:()=>lL,rNice:()=>cL,rPercent:()=>uL,rRange:()=>sL,rScale:()=>iL,rZero:()=>fL,rank:()=>vA,raster:()=>bF,rasterTile:()=>_F,rect:()=>GL,rectX:()=>XL,rectY:()=>HL,region:()=>tk,regressionY:()=>SF,row_number:()=>wA,ruleX:()=>iF,ruleY:()=>oF,search:()=>lW,skewness:()=>XT,slider:()=>uW,sphere:()=>qF,spike:()=>fF,sql:()=>er,stddev:()=>Kp,stddevPop:()=>HT,stringAgg:()=>QT,style:()=>z8,sum:()=>oe,symbolDomain:()=>rL,symbolLegend:()=>pk,symbolRange:()=>nL,symbolScale:()=>eL,table:()=>fW,text:()=>eF,textX:()=>rF,textY:()=>nF,tickX:()=>sF,tickY:()=>aF,toggle:()=>Ef,toggleColor:()=>ik,toggleX:()=>ek,toggleY:()=>rk,toggleZ:()=>nk,varPop:()=>KT,variance:()=>ZT,vconcat:()=>hW,vector:()=>cF,vectorX:()=>lF,vectorY:()=>uF,voronoi:()=>AF,voronoiMesh:()=>EF,vspace:()=>yW,waffleX:()=>YF,waffleY:()=>WF,width:()=>j8,xAlign:()=>dO,xAriaDescription:()=>RO,xAriaLabel:()=>OO,xAxis:()=>yO,xBase:()=>kO,xClamp:()=>uO,xConstant:()=>BO,xDomain:()=>iO,xExponent:()=>CO,xFontVariant:()=>NO,xGrid:()=>SO,xInset:()=>aO,xInsetLeft:()=>cO,xInsetRight:()=>lO,xLabel:()=>TO,xLabelAnchor:()=>AO,xLabelArrow:()=>EO,xLabelOffset:()=>MO,xLine:()=>IO,xNice:()=>sO,xPadding:()=>hO,xPaddingInner:()=>pO,xPaddingOuter:()=>mO,xPercent:()=>DO,xRange:()=>oO,xReverse:()=>LO,xRound:()=>fO,xScale:()=>nO,xTickFormat:()=>wO,xTickPadding:()=>_O,xTickRotate:()=>vO,xTickSize:()=>xO,xTickSpacing:()=>bO,xTicks:()=>gO,xZero:()=>FO,xyDomain:()=>$8,yAlign:()=>GO,yAriaDescription:()=>dR,yAriaLabel:()=>fR,yAxis:()=>ZO,yBase:()=>yR,yClamp:()=>YO,yConstant:()=>xR,yDomain:()=>UO,yExponent:()=>gR,yFontVariant:()=>uR,yGrid:()=>iR,yInset:()=>jO,yInsetBottom:()=>VO,yInsetTop:()=>qO,yLabel:()=>sR,yLabelAnchor:()=>aR,yLabelArrow:()=>cR,yLabelOffset:()=>lR,yLine:()=>oR,yNice:()=>zO,yPadding:()=>XO,yPaddingInner:()=>HO,yPaddingOuter:()=>QO,yPercent:()=>hR,yRange:()=>$O,yReverse:()=>pR,yRound:()=>WO,yScale:()=>PO,yTickFormat:()=>rR,yTickPadding:()=>eR,yTickRotate:()=>nR,yTickSize:()=>JO,yTickSpacing:()=>tR,yTicks:()=>KO,yZero:()=>mR});var ts=Symbol("Fixed"),Qr=Symbol("Transient"),cy=Symbol("Transform");var y8={};ti(y8,{Area:()=>mf,Arrow:()=>I0,BarX:()=>yf,BarY:()=>gf,Cell:()=>xf,Contour:()=>k0,Density:()=>P0,Dot:()=>bf,Frame:()=>g0,Geo:()=>U0,Hexgrid:()=>$0,Image:()=>z0,Line:()=>_f,Link:()=>v0,Mark:()=>vt,Raster:()=>R0,Rect:()=>pf,RuleX:()=>c0,RuleY:()=>l0,Text:()=>ff,TickX:()=>E0,TickY:()=>M0,Tip:()=>x0,Vector:()=>hf,WaffleX:()=>q0,WaffleY:()=>V0,area:()=>w0,areaX:()=>El,areaY:()=>ac,arrow:()=>wq,auto:()=>Dq,autoSpec:()=>zN,axisFx:()=>VS,axisFy:()=>qS,axisX:()=>f0,axisY:()=>u0,barX:()=>Ls,barY:()=>Fs,bin:()=>sc,binX:()=>Rs,binY:()=>Ds,bollinger:()=>Rl,bollingerX:()=>Pq,bollingerY:()=>Uq,boxX:()=>$q,boxY:()=>zq,cell:()=>Ml,cellX:()=>Sq,cellY:()=>Iq,centroid:()=>gI,circle:()=>Eq,cluster:()=>UV,column:()=>$r,contour:()=>Qq,crosshair:()=>Jq,crosshairX:()=>tV,crosshairY:()=>eV,delaunayLink:()=>iV,delaunayMesh:()=>oV,density:()=>uV,differenceX:()=>hV,differenceY:()=>pV,dodgeX:()=>oY,dodgeY:()=>sY,dot:()=>Ji,dotX:()=>Tq,dotY:()=>Aq,filter:()=>L$,find:()=>j$,formatIsoDate:()=>dN,formatMonth:()=>Gz,formatNumber:()=>fN,formatWeekday:()=>Xz,frame:()=>Yh,geo:()=>xI,geoCentroid:()=>yV,graticule:()=>xV,gridFx:()=>XS,gridFy:()=>WS,gridX:()=>GS,gridY:()=>YS,group:()=>t0,groupX:()=>dl,groupY:()=>hl,groupZ:()=>Jg,hexagon:()=>Mq,hexbin:()=>bV,hexgrid:()=>_V,hull:()=>sV,identity:()=>G,image:()=>vV,indexOf:()=>Ee,initializer:()=>Ne,interpolateNearest:()=>L0,interpolateNone:()=>yI,interpolatorBarycentric:()=>D0,interpolatorRandomWalk:()=>F0,legend:()=>qj,line:()=>wf,lineX:()=>Nl,lineY:()=>Ol,linearRegressionX:()=>TV,linearRegressionY:()=>AV,link:()=>aI,map:()=>Kn,mapX:()=>Zh,mapY:()=>Kh,marks:()=>yr,normalize:()=>EI,normalizeX:()=>uY,normalizeY:()=>fY,numberInterval:()=>N4,plot:()=>Wh,pointer:()=>bl,pointerX:()=>_l,pointerY:()=>ic,raster:()=>Wq,rect:()=>y0,rectX:()=>qh,rectY:()=>Vh,reverse:()=>F$,ruleX:()=>vi,ruleY:()=>Si,scale:()=>pl,select:()=>mY,selectFirst:()=>G0,selectLast:()=>X0,selectMaxX:()=>RI,selectMaxY:()=>DI,selectMinX:()=>NI,selectMinY:()=>OI,shiftX:()=>dY,shiftY:()=>hY,shuffle:()=>k$,sort:()=>fS,sphere:()=>gV,spike:()=>Sj,stackX:()=>ON,stackX1:()=>Hj,stackX2:()=>Qj,stackY:()=>RN,stackY1:()=>Zj,stackY2:()=>Kj,text:()=>Os,textX:()=>CS,textY:()=>BS,tickX:()=>hI,tickY:()=>pI,timeInterval:()=>Gg,tip:()=>eI,transform:()=>mr,tree:()=>a8,treeLink:()=>SI,treeNode:()=>j0,utcInterval:()=>tf,valueof:()=>_t,vector:()=>EN,vectorX:()=>$S,vectorY:()=>zS,voronoi:()=>aV,voronoiMesh:()=>cV,waffleX:()=>YV,waffleY:()=>WV,window:()=>Jh,windowX:()=>Lq,windowY:()=>Fq});function Ft(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function In(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Io(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===In?e:FZ,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 FZ(){return 0}function ly(e){return e===null?NaN:+e}function*I5(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 T5=Io(Ft),A5=T5.right,kZ=T5.left,CZ=Io(ly).center,Ia=A5;var uy=E5(M5),dM=E5(BZ);function E5(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?(Id(a,l,i,o,s),Id(a,i,l,o,s),Id(a,l,i,o,s),Td(c,i,l,o,s),Td(c,l,i,o,s),Td(c,i,l,o,s)):a?(Id(a,i,l,o,s),Id(a,l,i,o,s),Id(a,i,l,o,s)):c&&(Td(c,i,l,o,s),Td(c,l,i,o,s),Td(c,i,l,o,s)),t}}function Id(e,t,r,n,i){for(let o=0,s=n*i;o<s;)e(t,r,o,o+=n,1)}function Td(e,t,r,n,i){for(let o=0,s=n*i;o<n;++o)e(t,r,o,o+s,n)}function BZ(e){let t=M5(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 M5(e){let t=Math.floor(e);if(t===e)return PZ(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 PZ(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 es(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 UZ(e){return e.length|0}function $Z(e){return!(e>0)}function zZ(e){return typeof e!="object"||"length"in e?e:Array.from(e)}function jZ(e){return t=>e(...t)}function Y_(...e){let t=typeof e[e.length-1]=="function"&&jZ(e.pop());e=e.map(zZ);let r=e.map(UZ),n=e.length-1,i=new Array(n+1).fill(0),o=[];if(n<0||r.some($Z))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 W_(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 $c(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 $i(e,t){let r=$c(e,t);return r&&Math.sqrt(r)}function le(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 Zr=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 Tn=class extends Map{constructor(t,r=R5){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(hM(this,t))}has(t){return super.has(hM(this,t))}set(t,r){return super.set(N5(this,t),r)}delete(t){return super.delete(O5(this,t))}},An=class extends Set{constructor(t,r=R5){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(hM(this,t))}add(t){return super.add(N5(this,t))}delete(t){return super.delete(O5(this,t))}};function hM({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):r}function N5({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function O5({_intern:e,_key:t},r){let n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function R5(e){return e!==null&&typeof e=="object"?e.valueOf():e}function fy(e){return e}function Kr(e,...t){return mM(e,fy,fy,t)}function To(e,t,...r){return mM(e,fy,t,r)}function pM(e,t,...r){return mM(e,Array.from,t,r)}function mM(e,t,r,n){return function i(o,s){if(s>=n.length)return r(o);let a=new Tn,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 yM(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=Su(s[i],s[o]);if(a)return a}})):(r=e.map(r),n.sort((i,o)=>Su(r[i],r[o]))),yM(e,n)}return e.sort(dy(r))}function dy(e=Ft){if(e===Ft)return Su;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 Su(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}function Ad(e,t,r){return(t.length!==2?Ta(To(e,t,r),([n,i],[o,s])=>Ft(i,s)||Ft(n,o)):Ta(Kr(e,r),([n,i],[o,s])=>t(i,s)||Ft(n,o))).map(([n])=>n)}var qZ=Math.sqrt(50),VZ=Math.sqrt(10),YZ=Math.sqrt(2);function G_(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>=qZ?10:o>=VZ?5:o>=YZ?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?G_(e,t,r*2):[a,c,l]}function Jr(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?G_(t,e,r):G_(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,G_(e,t,r)[2]}function Ed(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 Md(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 zc(e){return Math.max(1,Math.ceil(Math.log(es(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 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 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 H_(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 Q_(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?Su:dy(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));Q_(e,t,h,p,i)}let o=e[t],s=r,a=n;for(hy(e,r,t),i(e[n],o)>0&&hy(e,r,n);s<a;){for(hy(e,s,a),++s,--a;i(e[s],o)<0;)++s;for(;i(e[a],o)>0;)--a}i(e[r],o)===0?hy(e,r,a):(++a,hy(e,a,n)),a<=t&&(r=a+1),t<=a&&(n=a-1)}return e}function hy(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}function Iu(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 En(e,t,r){if(e=Float64Array.from(I5(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(Q_(e,o).subarray(0,o+1)),a=Qt(e.subarray(o+1));return s+(a-s)*(i-o)}}function gM(e,t,r=ly){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 Z_(e,t,r){let n=es(e),i=En(e,.75)-En(e,.25);return n&&i?Math.ceil((r-t)/(2*i*Math.pow(n,-1/3))):1}function py(e,t,r){let n=es(e),i=$i(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 Ao(e,t){return En(e,.5,t)}function*GZ(e){for(let t of e)yield*t}function Nd(e){return Array.from(GZ(e))}function Od(e,t){let r=new Tn;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 K_(e,t=XZ){let r=[],n,i=!1;for(let o of e)i&&r.push(t(n,o)),n=o,i=!0;return r}function XZ(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 my(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)=>Su(r[a],r[c]):dy(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 J_(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 jc(e){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");return Array.from(e).reverse()}function D5(e){return e}var xM=1,bM=2,_M=3,tw=4,L5=1e-6;function HZ(e){return"translate("+e+",0)"}function QZ(e){return"translate(0,"+e+")"}function ZZ(e){return t=>+e(t)}function KZ(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),r=>+e(r)+t}function JZ(){return!this.__axis}function tK(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===xM||e===tw?-1:1,u=e===tw||e===bM?"x":"y",f=e===xM||e===_M?HZ: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):D5),y=Math.max(o,0)+a,g=t.range(),x=+g[0]+c,b=+g[g.length-1]+c,_=(t.bandwidth?KZ:ZZ)(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===xM?"0em":e===_M?"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",L5).attr("transform",function(R){return isFinite(R=_(R))?f(R+c):this.getAttribute("transform")}),E.attr("opacity",L5).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===tw||e===bM?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(JZ).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===bM?"start":e===tw?"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 wM(e){return tK(_M,e)}var eK={value:()=>{}};function k5(){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 ew(r)}function ew(e){this._=e}function rK(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}})}ew.prototype=k5.prototype={constructor:ew,on:function(e,t){var r=this._,n=rK(e+"",r),i,o=-1,s=n.length;if(arguments.length<2){for(;++o<s;)if((i=(e=n[o]).type)&&(i=nK(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]=F5(r[i],e.name,t);else if(t==null)for(i in r)r[i]=F5(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 ew(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 nK(e,t){for(var r=0,n=e.length,i;r<n;++r)if((i=e[r]).name===t)return i.value}function F5(e,t,r){for(var n=0,i=e.length;n<i;++n)if(e[n].name===t){e[n]=eK,e=e.slice(0,n).concat(e.slice(n+1));break}return r!=null&&e.push({name:t,value:r}),e}var Tu=k5;var rw="http://www.w3.org/1999/xhtml",Mn={svg:"http://www.w3.org/2000/svg",xhtml:rw,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)),Mn.hasOwnProperty(t)?{space:Mn[t],local:e}:e}function iK(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===rw&&t.documentElement.namespaceURI===rw?t.createElement(e):t.createElementNS(r,e)}}function oK(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Na(e){var t=Ma(e);return(t.local?oK:iK)(t)}function sK(){}function Au(e){return e==null?sK:function(){return this.querySelector(e)}}function C5(e){typeof e!="function"&&(e=Au(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 vM(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function aK(){return[]}function yy(e){return e==null?aK:function(){return this.querySelectorAll(e)}}function cK(e){return function(){return vM(e.apply(this,arguments))}}function B5(e){typeof e=="function"?e=cK(e):e=yy(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 gy(e){return function(){return this.matches(e)}}function nw(e){return function(t){return t.matches(e)}}var lK=Array.prototype.find;function uK(e){return function(){return lK.call(this.children,e)}}function fK(){return this.firstElementChild}function P5(e){return this.select(e==null?fK:uK(typeof e=="function"?e:nw(e)))}var dK=Array.prototype.filter;function hK(){return Array.from(this.children)}function pK(e){return function(){return dK.call(this.children,e)}}function U5(e){return this.selectAll(e==null?hK:pK(typeof e=="function"?e:nw(e)))}function $5(e){typeof e!="function"&&(e=gy(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 iw(e){return new Array(e.length)}function z5(){return new Ze(this._enter||this._groups.map(iw),this._parents)}function xy(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}xy.prototype={constructor:xy,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 j5(e){return function(){return e}}function mK(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 xy(e,o[s]);for(;s<c;++s)(a=t[s])&&(i[s]=a)}function yK(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 xy(e,o[a]);for(a=0;a<u;++a)(c=t[a])&&l.get(d[a])===c&&(i[a]=c)}function gK(e){return e.__data__}function q5(e,t){if(!arguments.length)return Array.from(this,gK);var r=t?yK:mK,n=this._parents,i=this._groups;typeof e!="function"&&(e=j5(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=xK(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 xK(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function V5(){return new Ze(this._exit||this._groups.map(iw),this._parents)}function Y5(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 W5(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 G5(){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 X5(e){e||(e=bK);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 bK(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function H5(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Q5(){return Array.from(this)}function Z5(){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 K5(){let e=0;for(let t of this)++e;return e}function J5(){return!this.node()}function t7(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 _K(e){return function(){this.removeAttribute(e)}}function wK(e){return function(){this.removeAttributeNS(e.space,e.local)}}function vK(e,t){return function(){this.setAttribute(e,t)}}function SK(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function IK(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function TK(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 e7(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?wK:_K:typeof t=="function"?r.local?TK:IK:r.local?SK:vK)(r,t))}function ow(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function AK(e){return function(){this.style.removeProperty(e)}}function EK(e,t,r){return function(){this.style.setProperty(e,t,r)}}function MK(e,t,r){return function(){var n=t.apply(this,arguments);n==null?this.style.removeProperty(e):this.style.setProperty(e,n,r)}}function r7(e,t,r){return arguments.length>1?this.each((t==null?AK:typeof t=="function"?MK:EK)(e,t,r??"")):qc(this.node(),e)}function qc(e,t){return e.style.getPropertyValue(t)||ow(e).getComputedStyle(e,null).getPropertyValue(t)}function NK(e){return function(){delete this[e]}}function OK(e,t){return function(){this[e]=t}}function RK(e,t){return function(){var r=t.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function n7(e,t){return arguments.length>1?this.each((t==null?NK:typeof t=="function"?RK:OK)(e,t)):this.node()[e]}function i7(e){return e.trim().split(/^|\s+/)}function SM(e){return e.classList||new o7(e)}function o7(e){this._node=e,this._names=i7(e.getAttribute("class")||"")}o7.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 s7(e,t){for(var r=SM(e),n=-1,i=t.length;++n<i;)r.add(t[n])}function a7(e,t){for(var r=SM(e),n=-1,i=t.length;++n<i;)r.remove(t[n])}function DK(e){return function(){s7(this,e)}}function LK(e){return function(){a7(this,e)}}function FK(e,t){return function(){(t.apply(this,arguments)?s7:a7)(this,e)}}function c7(e,t){var r=i7(e+"");if(arguments.length<2){for(var n=SM(this.node()),i=-1,o=r.length;++i<o;)if(!n.contains(r[i]))return!1;return!0}return this.each((typeof t=="function"?FK:t?DK:LK)(r,t))}function kK(){this.textContent=""}function CK(e){return function(){this.textContent=e}}function BK(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function l7(e){return arguments.length?this.each(e==null?kK:(typeof e=="function"?BK:CK)(e)):this.node().textContent}function PK(){this.innerHTML=""}function UK(e){return function(){this.innerHTML=e}}function $K(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function u7(e){return arguments.length?this.each(e==null?PK:(typeof e=="function"?$K:UK)(e)):this.node().innerHTML}function zK(){this.nextSibling&&this.parentNode.appendChild(this)}function f7(){return this.each(zK)}function jK(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function d7(){return this.each(jK)}function h7(e){var t=typeof e=="function"?e:Na(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function qK(){return null}function p7(e,t){var r=typeof e=="function"?e:Na(e),n=t==null?qK:typeof t=="function"?t:Au(t);return this.select(function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)})}function VK(){var e=this.parentNode;e&&e.removeChild(this)}function m7(){return this.each(VK)}function YK(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function WK(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function y7(e){return this.select(e?WK:YK)}function g7(e){return arguments.length?this.property("__data__",e):this.node().__data__}function GK(e){return function(t){e.call(this,t,this.__data__)}}function XK(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 HK(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=GK(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 x7(e,t,r){var n=XK(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:HK,i=0;i<o;++i)this.each(a(n[i],t,r));return this}function b7(e,t,r){var n=ow(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 ZK(e,t){return function(){return b7(this,e,t)}}function KK(e,t){return function(){return b7(this,e,t.apply(this,arguments))}}function _7(e,t){return this.each((typeof t=="function"?KK:ZK)(e,t))}function*w7(){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 IM=[null];function Ze(e,t){this._groups=e,this._parents=t}function v7(){return new Ze([[document.documentElement]],IM)}function JK(){return this}Ze.prototype=v7.prototype={constructor:Ze,select:C5,selectAll:B5,selectChild:P5,selectChildren:U5,filter:$5,data:q5,enter:z5,exit:V5,join:Y5,merge:W5,selection:JK,order:G5,sort:X5,call:H5,nodes:Q5,node:Z5,size:K5,empty:J5,each:t7,attr:e7,style:r7,property:n7,classed:c7,text:l7,html:u7,raise:f7,lower:d7,append:h7,insert:p7,remove:m7,clone:y7,datum:g7,on:x7,dispatch:_7,[Symbol.iterator]:w7};var Oa=v7;function Zt(e){return typeof e=="string"?new Ze([[document.querySelector(e)]],[document.documentElement]):new Ze([[e]],IM)}function S7(e){let t;for(;t=e.sourceEvent;)e=t;return e}function ln(e,t){if(e=S7(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 sw={capture:!0,passive:!1};function aw(e){e.preventDefault(),e.stopImmediatePropagation()}function by(e){var t=e.document.documentElement,r=Zt(e).on("dragstart.drag",aw,sw);"onselectstart"in t?r.on("selectstart.drag",aw,sw):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function _y(e,t){var r=e.document.documentElement,n=Zt(e).on("dragstart.drag",null);t&&(n.on("click.drag",aw,sw),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 Vc(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}function ns(){}var Yc=.7,Nu=1/Yc,Rd="\\s*([+-]?\\d+)\\s*",wy="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",rs="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",tJ=/^#([0-9a-f]{3,8})$/,eJ=new RegExp(`^rgb\\(${Rd},${Rd},${Rd}\\)$`),rJ=new RegExp(`^rgb\\(${rs},${rs},${rs}\\)$`),nJ=new RegExp(`^rgba\\(${Rd},${Rd},${Rd},${wy}\\)$`),iJ=new RegExp(`^rgba\\(${rs},${rs},${rs},${wy}\\)$`),oJ=new RegExp(`^hsl\\(${wy},${rs},${rs}\\)$`),sJ=new RegExp(`^hsla\\(${wy},${rs},${rs},${wy}\\)$`),I7={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(ns,di,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:T7,formatHex:T7,formatHex8:aJ,formatHsl:cJ,formatRgb:A7,toString:A7});function T7(){return this.rgb().formatHex()}function aJ(){return this.rgb().formatHex8()}function cJ(){return D7(this).formatHsl()}function A7(){return this.rgb().formatRgb()}function di(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=tJ.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?E7(t):r===3?new cr(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?cw(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?cw(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=eJ.exec(e))?new cr(t[1],t[2],t[3],1):(t=rJ.exec(e))?new cr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=nJ.exec(e))?cw(t[1],t[2],t[3],t[4]):(t=iJ.exec(e))?cw(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=oJ.exec(e))?O7(t[1],t[2]/100,t[3]/100,1):(t=sJ.exec(e))?O7(t[1],t[2]/100,t[3]/100,t[4]):I7.hasOwnProperty(e)?E7(I7[e]):e==="transparent"?new cr(NaN,NaN,NaN,0):null}function E7(e){return new cr(e>>16&255,e>>8&255,e&255,1)}function cw(e,t,r,n){return n<=0&&(e=t=r=NaN),new cr(e,t,r,n)}function vy(e){return e instanceof ns||(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?vy(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,vr,Vc(ns,{brighter(e){return e=e==null?Nu:Math.pow(Nu,e),new cr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Yc:Math.pow(Yc,e),new cr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new cr(Mu(this.r),Mu(this.g),Mu(this.b),uw(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:M7,formatHex:M7,formatHex8:lJ,formatRgb:N7,toString:N7}));function M7(){return`#${Eu(this.r)}${Eu(this.g)}${Eu(this.b)}`}function lJ(){return`#${Eu(this.r)}${Eu(this.g)}${Eu(this.b)}${Eu((isNaN(this.opacity)?1:this.opacity)*255)}`}function N7(){let e=uw(this.opacity);return`${e===1?"rgb(":"rgba("}${Mu(this.r)}, ${Mu(this.g)}, ${Mu(this.b)}${e===1?")":`, ${e})`}`}function uw(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Mu(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Eu(e){return e=Mu(e),(e<16?"0":"")+e.toString(16)}function O7(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new Eo(e,t,r,n)}function D7(e){if(e instanceof Eo)return new Eo(e.h,e.s,e.l,e.opacity);if(e instanceof ns||(e=di(e)),!e)return new Eo;if(e instanceof Eo)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 Eo(s,a,c,e.opacity)}function Sy(e,t,r,n){return arguments.length===1?D7(e):new Eo(e,t,r,n??1)}function Eo(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}Ra(Eo,Sy,Vc(ns,{brighter(e){return e=e==null?Nu:Math.pow(Nu,e),new Eo(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Yc:Math.pow(Yc,e),new Eo(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(TM(e>=240?e-240:e+120,i,n),TM(e,i,n),TM(e<120?e+240:e-120,i,n),this.opacity)},clamp(){return new Eo(R7(this.h),lw(this.s),lw(this.l),uw(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=uw(this.opacity);return`${e===1?"hsl(":"hsla("}${R7(this.h)}, ${lw(this.s)*100}%, ${lw(this.l)*100}%${e===1?")":`, ${e})`}`}}));function R7(e){return e=(e||0)%360,e<0?e+360:e}function lw(e){return Math.max(0,Math.min(1,e||0))}function TM(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 fw=Math.PI/180,dw=180/Math.PI;var hw=18,L7=.96422,F7=1,k7=.82521,C7=4/29,Dd=6/29,B7=3*Dd*Dd,uJ=Dd*Dd*Dd;function P7(e){if(e instanceof is)return new is(e.l,e.a,e.b,e.opacity);if(e instanceof Da)return U7(e);e instanceof cr||(e=vy(e));var t=NM(e.r),r=NM(e.g),n=NM(e.b),i=AM((.2225045*t+.7168786*r+.0606169*n)/F7),o,s;return t===r&&r===n?o=s=i:(o=AM((.4360747*t+.3850649*r+.1430804*n)/L7),s=AM((.0139322*t+.0971045*r+.7141733*n)/k7)),new is(116*i-16,500*(o-i),200*(i-s),e.opacity)}function Ld(e,t,r,n){return arguments.length===1?P7(e):new is(e,t,r,n??1)}function is(e,t,r,n){this.l=+e,this.a=+t,this.b=+r,this.opacity=+n}Ra(is,Ld,Vc(ns,{brighter(e){return new is(this.l+hw*(e??1),this.a,this.b,this.opacity)},darker(e){return new is(this.l-hw*(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=L7*EM(t),e=F7*EM(e),r=k7*EM(r),new cr(MM(3.1338561*t-1.6168667*e-.4906146*r),MM(-.9787684*t+1.9161415*e+.033454*r),MM(.0719453*t-.2289914*e+1.4052427*r),this.opacity)}}));function AM(e){return e>uJ?Math.pow(e,1/3):e/B7+C7}function EM(e){return e>Dd?e*e*e:B7*(e-C7)}function MM(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function NM(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function fJ(e){if(e instanceof Da)return new Da(e.h,e.c,e.l,e.opacity);if(e instanceof is||(e=P7(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)*dw;return new Da(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function Iy(e,t,r,n){return arguments.length===1?fJ(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 U7(e){if(isNaN(e.h))return new is(e.l,0,0,e.opacity);var t=e.h*fw;return new is(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}Ra(Da,Iy,Vc(ns,{brighter(e){return new Da(this.h,this.c,this.l+hw*(e??1),this.opacity)},darker(e){return new Da(this.h,this.c,this.l-hw*(e??1),this.opacity)},rgb(){return U7(this).rgb()}}));var q7=-.14861,OM=1.78277,RM=-.29227,pw=-.90649,Ty=1.97294,$7=Ty*pw,z7=Ty*OM,j7=OM*RM-pw*q7;function dJ(e){if(e instanceof Ou)return new Ou(e.h,e.s,e.l,e.opacity);e instanceof cr||(e=vy(e));var t=e.r/255,r=e.g/255,n=e.b/255,i=(j7*n+$7*t-z7*r)/(j7+$7-z7),o=n-i,s=(Ty*(r-i)-RM*o)/pw,a=Math.sqrt(s*s+o*o)/(Ty*i*(1-i)),c=a?Math.atan2(s,o)*dw-120:NaN;return new Ou(c<0?c+360:c,a,i,e.opacity)}function Nn(e,t,r,n){return arguments.length===1?dJ(e):new Ou(e,t,r,n??1)}function Ou(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}Ra(Ou,Nn,Vc(ns,{brighter(e){return e=e==null?Nu:Math.pow(Nu,e),new Ou(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Yc:Math.pow(Yc,e),new Ou(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*fw,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*(q7*n+OM*i)),255*(t+r*(RM*n+pw*i)),255*(t+r*(Ty*n)),this.opacity)}}));function DM(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 V7(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 DM((r-n/t)*t,s,i,o,a)}}function Y7(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 DM((r-n/t)*t,i,o,s,a)}}var Fd=e=>()=>e;function W7(e,t){return function(r){return e+r*t}}function hJ(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 kd(e,t){var r=t-e;return r?W7(e,r>180||r<-180?r-360*Math.round(r/360):r):Fd(isNaN(e)?t:e)}function G7(e){return(e=+e)==1?Be:function(t,r){return r-t?hJ(t,r,e):Fd(isNaN(t)?r:t)}}function Be(e,t){var r=t-e;return r?W7(e,r):Fd(isNaN(e)?t:e)}var zi=function e(t){var r=G7(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 X7(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 LM=X7(V7),pJ=X7(Y7);function H7(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,n=t.slice(),i;return function(o){for(i=0;i<r;++i)n[i]=e[i]*(1-o)+t[i]*o;return n}}function Q7(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Z7(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 K7(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 J7(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 kM=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,FM=new RegExp(kM.source,"g");function mJ(e){return function(){return e}}function yJ(e){return function(t){return e(t)+""}}function Ay(e,t){var r=kM.lastIndex=FM.lastIndex=0,n,i,o,s=-1,a=[],c=[];for(e=e+"",t=t+"";(n=kM.exec(e))&&(i=FM.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=FM.lastIndex;return r<t.length&&(o=t.slice(r),a[s]?a[s]+=o:a[++s]=o),a.length<2?c[0]?yJ(c[0].x):mJ(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"?Fd(t):(r==="number"?Fe:r==="string"?(n=di(t))?(t=n,zi):Ay:t instanceof di?zi:t instanceof Date?K7:Q7(t)?H7:Array.isArray(t)?Z7:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?J7:Fe)(e,t)}function Ru(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}var tP=180/Math.PI,mw={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function CM(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)*tP,skewX:Math.atan(c)*tP,scaleX:s,scaleY:a}}var yw;function eP(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?mw:CM(t.a,t.b,t.c,t.d,t.e,t.f)}function rP(e){return e==null?mw:(yw||(yw=document.createElementNS("http://www.w3.org/2000/svg","g")),yw.setAttribute("transform",e),(e=yw.transform.baseVal.consolidate())?(e=e.matrix,CM(e.a,e.b,e.c,e.d,e.e,e.f)):mw)}function nP(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 BM=nP(eP,"px, ","px)","deg)"),PM=nP(rP,", ",")",")");var gJ=1e-12;function iP(e){return((e=Math.exp(e))+1/e)/2}function xJ(e){return((e=Math.exp(e))-1/e)/2}function bJ(e){return((e=Math.exp(2*e))-1)/(e+1)}var UM=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<gJ)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=iP(v),M=l/(r*x)*(E*bJ(t*A+v)-xJ(v));return[a+M*h,c+M*p,l*E/iP(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 oP(e){return function(t,r){var n=e((t=Sy(t)).h,(r=Sy(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 $M=oP(kd),_J=oP(Be);function gw(e,t){var r=Be((e=Ld(e)).l,(t=Ld(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 sP(e){return function(t,r){var n=e((t=Iy(t)).h,(r=Iy(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 zM=sP(kd),wJ=sP(Be);function aP(e){return function t(r){r=+r;function n(i,o){var s=e((i=Nn(i)).h,(o=Nn(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 vJ=aP(kd),Cd=aP(Be);function os(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 un(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e(n/(t-1));return r}var Bd=0,My=0,Ey=0,lP=1e3,xw,Ny,bw=0,Du=0,_w=0,Oy=typeof performance=="object"&&performance.now?performance:Date,uP=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Dy(){return Du||(uP(SJ),Du=Oy.now()+_w)}function SJ(){Du=0}function Ry(){this._call=this._time=this._next=null}Ry.prototype=ww.prototype={constructor:Ry,restart:function(e,t,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?Dy():+r)+(t==null?0:+t),!this._next&&Ny!==this&&(Ny?Ny._next=this:xw=this,Ny=this),this._call=e,this._time=r,jM()},stop:function(){this._call&&(this._call=null,this._time=1/0,jM())}};function ww(e,t,r){var n=new Ry;return n.restart(e,t,r),n}function fP(){Dy(),++Bd;for(var e=xw,t;e;)(t=Du-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Bd}function cP(){Du=(bw=Oy.now())+_w,Bd=My=0;try{fP()}finally{Bd=0,TJ(),Du=0}}function IJ(){var e=Oy.now(),t=e-bw;t>lP&&(_w-=t,bw=e)}function TJ(){for(var e,t=xw,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:xw=r);Ny=e,jM(n)}function jM(e){if(!Bd){My&&(My=clearTimeout(My));var t=e-Du;t>24?(e<1/0&&(My=setTimeout(cP,e-Oy.now()-_w)),Ey&&(Ey=clearInterval(Ey))):(Ey||(bw=Oy.now(),Ey=setInterval(IJ,lP)),Bd=1,uP(cP))}}function vw(e,t,r){var n=new Ry;return t=t==null?0:+t,n.restart(i=>{n.stop(),e(i+t)},t,r),n}var AJ=Tu("start","end","cancel","interrupt"),EJ=[],pP=0,dP=1,Iw=2,Sw=3,hP=4,Tw=5,Ly=6;function Wc(e,t,r,n,i,o){var s=e.__transition;if(!s)e.__transition={};else if(r in s)return;MJ(e,r,{name:t,index:n,group:i,on:AJ,tween:EJ,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:pP})}function Fy(e,t){var r=Sr(e,t);if(r.state>pP)throw new Error("too late; already scheduled");return r}function tn(e,t){var r=Sr(e,t);if(r.state>Sw)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 MJ(e,t,r){var n=e.__transition,i;n[t]=r,r.timer=ww(o,0,r.time);function o(l){r.state=dP,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!==dP)return c();for(u in n)if(h=n[u],h.name===r.name){if(h.state===Sw)return vw(s);h.state===hP?(h.state=Ly,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete n[u]):+u<t&&(h.state=Ly,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete n[u])}if(vw(function(){r.state===Sw&&(r.state=hP,r.timer.restart(a,r.delay,r.time),a(l))}),r.state=Iw,r.on.call("start",e,e.__data__,r.index,r.group),r.state===Iw){for(r.state=Sw,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=Tw,1),f=-1,d=i.length;++f<d;)i[f].call(e,u);r.state===Tw&&(r.on.call("end",e,e.__data__,r.index,r.group),c())}function c(){r.state=Ly,r.timer.stop(),delete n[t];for(var l in n)return;delete e.__transition}}function ss(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>Iw&&n.state<Tw,n.state=Ly,n.timer.stop(),n.on.call(i?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete r[s]}o&&delete e.__transition}}function mP(e){return this.each(function(){ss(this,e)})}function NJ(e,t){var r,n;return function(){var i=tn(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 OJ(e,t,r){var n,i;if(typeof r!="function")throw new Error;return function(){var o=tn(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 yP(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?NJ:OJ)(r,e,t))}function Pd(e,t,r){var n=e._id;return e.each(function(){var i=tn(this,n);(i.value||(i.value={}))[t]=r.apply(this,arguments)}),function(i){return Sr(i,n).value[t]}}function Aw(e,t){var r;return(typeof t=="number"?Fe:t instanceof di?zi:(r=di(t))?(t=r,zi):Ay)(e,t)}function RJ(e){return function(){this.removeAttribute(e)}}function DJ(e){return function(){this.removeAttributeNS(e.space,e.local)}}function LJ(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 FJ(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 kJ(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 CJ(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 gP(e,t){var r=Ma(e),n=r==="transform"?PM:Aw;return this.attrTween(e,typeof t=="function"?(r.local?CJ:kJ)(r,n,Pd(this,"attr."+e,t)):t==null?(r.local?DJ:RJ)(r):(r.local?FJ:LJ)(r,n,t))}function BJ(e,t){return function(r){this.setAttribute(e,t.call(this,r))}}function PJ(e,t){return function(r){this.setAttributeNS(e.space,e.local,t.call(this,r))}}function UJ(e,t){var r,n;function i(){var o=t.apply(this,arguments);return o!==n&&(r=(n=o)&&PJ(e,o)),r}return i._value=t,i}function $J(e,t){var r,n;function i(){var o=t.apply(this,arguments);return o!==n&&(r=(n=o)&&BJ(e,o)),r}return i._value=t,i}function xP(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?UJ:$J)(n,t))}function zJ(e,t){return function(){Fy(this,e).delay=+t.apply(this,arguments)}}function jJ(e,t){return t=+t,function(){Fy(this,e).delay=t}}function bP(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?zJ:jJ)(t,e)):Sr(this.node(),t).delay}function qJ(e,t){return function(){tn(this,e).duration=+t.apply(this,arguments)}}function VJ(e,t){return t=+t,function(){tn(this,e).duration=t}}function _P(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?qJ:VJ)(t,e)):Sr(this.node(),t).duration}function YJ(e,t){if(typeof t!="function")throw new Error;return function(){tn(this,e).ease=t}}function wP(e){var t=this._id;return arguments.length?this.each(YJ(t,e)):Sr(this.node(),t).ease}function WJ(e,t){return function(){var r=t.apply(this,arguments);if(typeof r!="function")throw new Error;tn(this,e).ease=r}}function vP(e){if(typeof e!="function")throw new Error;return this.each(WJ(this._id,e))}function SP(e){typeof e!="function"&&(e=gy(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 On(n,this._parents,this._name,this._id)}function IP(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 On(s,this._parents,this._name,this._id)}function GJ(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 XJ(e,t,r){var n,i,o=GJ(t)?Fy:tn;return function(){var s=o(this,e),a=s.on;a!==n&&(i=(n=a).copy()).on(t,r),s.on=i}}function TP(e,t){var r=this._id;return arguments.length<2?Sr(this.node(),r).on.on(e):this.each(XJ(r,e,t))}function HJ(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}function AP(){return this.on("end.remove",HJ(this._id))}function EP(e){var t=this._name,r=this._id;typeof e!="function"&&(e=Au(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,Wc(l[d],t,r,d,l,Sr(u,r)));return new On(o,this._parents,t,r)}function MP(e){var t=this._name,r=this._id;typeof e!="function"&&(e=yy(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])&&Wc(h,t,r,m,d,p);o.push(d),s.push(u)}return new On(o,s,t,r)}var QJ=Oa.prototype.constructor;function NP(){return new QJ(this._groups,this._parents)}function ZJ(e,t){var r,n,i;return function(){var o=qc(this,e),s=(this.style.removeProperty(e),qc(this,e));return o===s?null:o===r&&s===n?i:i=t(r=o,n=s)}}function OP(e){return function(){this.style.removeProperty(e)}}function KJ(e,t,r){var n,i=r+"",o;return function(){var s=qc(this,e);return s===i?null:s===n?o:o=t(n=s,r)}}function JJ(e,t,r){var n,i,o;return function(){var s=qc(this,e),a=r(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),qc(this,e))),s===c?null:s===n&&c===i?o:(i=c,o=t(n=s,a))}}function ttt(e,t){var r,n,i,o="style."+t,s="end."+o,a;return function(){var c=tn(this,e),l=c.on,u=c.value[o]==null?a||(a=OP(t)):void 0;(l!==r||i!==u)&&(n=(r=l).copy()).on(s,i=u),c.on=n}}function RP(e,t,r){var n=(e+="")=="transform"?BM:Aw;return t==null?this.styleTween(e,ZJ(e,n)).on("end.style."+e,OP(e)):typeof t=="function"?this.styleTween(e,JJ(e,n,Pd(this,"style."+e,t))).each(ttt(this._id,e)):this.styleTween(e,KJ(e,n,t),r).on("end.style."+e,null)}function ett(e,t,r){return function(n){this.style.setProperty(e,t.call(this,n),r)}}function rtt(e,t,r){var n,i;function o(){var s=t.apply(this,arguments);return s!==i&&(n=(i=s)&&ett(e,s,r)),n}return o._value=t,o}function DP(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,rtt(e,t,r??""))}function ntt(e){return function(){this.textContent=e}}function itt(e){return function(){var t=e(this);this.textContent=t??""}}function LP(e){return this.tween("text",typeof e=="function"?itt(Pd(this,"text",e)):ntt(e==null?"":e+""))}function ott(e){return function(t){this.textContent=e.call(this,t)}}function stt(e){var t,r;function n(){var i=e.apply(this,arguments);return i!==r&&(t=(r=i)&&ott(i)),t}return n._value=e,n}function FP(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,stt(e))}function kP(){for(var e=this._name,t=this._id,r=Ew(),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);Wc(c,e,r,l,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new On(n,this._parents,e,r)}function CP(){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=tn(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 att=0;function On(e,t,r,n){this._groups=e,this._parents=t,this._name=r,this._id=n}function BP(e){return Oa().transition(e)}function Ew(){return++att}var La=Oa.prototype;On.prototype=BP.prototype={constructor:On,select:EP,selectAll:MP,selectChild:La.selectChild,selectChildren:La.selectChildren,filter:SP,merge:IP,selection:NP,transition:kP,call:La.call,nodes:La.nodes,node:La.node,size:La.size,empty:La.empty,each:La.each,on:TP,attr:gP,attrTween:xP,style:RP,styleTween:DP,text:LP,textTween:FP,remove:AP,tween:yP,delay:bP,duration:_P,ease:wP,easeVarying:vP,end:CP,[Symbol.iterator]:La[Symbol.iterator]};function Mw(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var ctt={time:null,delay:0,duration:250,ease:Mw};function ltt(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 PP(e){var t,r;e instanceof On?(t=e._id,e=e._name):(t=Ew(),(r=ctt).time=Dy(),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])&&Wc(c,e,t,l,s,r||ltt(c,t));return new On(n,this._parents,e,t)}Oa.prototype.interrupt=mP;Oa.prototype.transition=PP;var Nw=e=>()=>e;function qM(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 UP(e){e.stopImmediatePropagation()}function Ow(e){e.preventDefault(),e.stopImmediatePropagation()}var $P={name:"drag"},VM={name:"space"},Ud={name:"handle"},$d={name:"center"},{abs:zP,max:fn,min:dn}=Math;function jP(e){return[+e[0],+e[1]]}function WM(e){return[jP(e[0]),jP(e[1])]}var Rw={name:"x",handles:["w","e"].map(ky),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]]}},Dw={name:"y",handles:["n","s"].map(ky),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]]}},utt={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(ky),input:function(e){return e==null?null:WM(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"},qP={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},VP={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},ftt={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},dtt={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function ky(e){return{type:e}}function htt(e){return!e.ctrlKey&&!e.button}function ptt(){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 mtt(){return navigator.maxTouchPoints||"ontouchstart"in this}function YM(e){for(;!e.__brush;)if(!(e=e.parentNode))return;return e.__brush}function ytt(e){return e[0][0]===e[1][0]||e[0][1]===e[1][1]}function GM(){return QM(Rw)}function XM(){return QM(Dw)}function HM(){return QM(utt)}function QM(e){var t=ptt,r=htt,n=mtt,i=!0,o=Tu("start","brush","end"),s=6,a;function c(y){var g=y.property("__brush",m).selectAll(".overlay").data([ky("overlay")]);g.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",Fa.overlay).merge(g).each(function(){var b=YM(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([ky("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,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();ss(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=YM(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 qM(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"?$P:i&&y.altKey?$d:Ud,_=e===Dw?null:ftt[x],v=e===Rw?null:dtt[x],w=YM(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=ln(tt,g),tt.point0=tt.slice(),tt.identifier=ge,tt});ss(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===Dw?E:dn(tt[0][0],tt[1][0]),k=e===Rw?R:dn(tt[0][1],tt[1][1])],[O=e===Dw?N:fn(tt[0][0],tt[1][0]),C=e===Rw?B:fn(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",Fa[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),by(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=ln(ge,g));if(rt&&!ot&&!at&&Y.length===1){let ge=Y[0];zP(ge.cur[0]-ge[0])>zP(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,Ow(tt),Pt(tt)}function Pt(tt){let ge=Y[0],Jn=ge.point0;var Co;switch(U=ge[0]-Jn[0],$=ge[1]-Jn[1],b){case VM:case $P:{_&&(U=fn(E-M,dn(N-O,U)),T=M+U,L=O+U),v&&($=fn(R-k,dn(B-C,$)),I=k+$,P=C+$);break}case Ud:{Y[1]?(_&&(T=fn(E,dn(N,Y[0][0])),L=fn(E,dn(N,Y[1][0])),_=1),v&&(I=fn(R,dn(B,Y[0][1])),P=fn(R,dn(B,Y[1][1])),v=1)):(_<0?(U=fn(E-M,dn(N-M,U)),T=M+U,L=O):_>0&&(U=fn(E-O,dn(N-O,U)),T=M,L=O+U),v<0?($=fn(R-k,dn(B-k,$)),I=k+$,P=C):v>0&&($=fn(R-C,dn(B-C,$)),I=k,P=C+$));break}case $d:{_&&(T=fn(E,dn(N,M-U*_)),L=fn(E,dn(N,O+U*_))),v&&(I=fn(R,dn(B,k-$*v)),P=fn(R,dn(B,C+$*v)));break}}L<T&&(_*=-1,Co=M,M=O,O=Co,Co=T,T=L,L=Co,x in qP&&H.attr("cursor",Fa[x=qP[x]])),P<I&&(v*=-1,Co=k,k=C,C=Co,Co=I,I=P,P=Co,x in VP&&H.attr("cursor",Fa[x=VP[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(UP(tt),tt.touches){if(tt.touches.length)return;a&&clearTimeout(a),a=setTimeout(function(){a=null},500)}else _y(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),ytt(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===Ud&&(_&&(O=L-U*_,M=T+U*_),v&&(C=P-$*v,k=I+$*v),b=$d,Pt(tt));break}case 32:{(b===Ud||b===$d)&&(_<0?O=L-U:_>0&&(M=T-U),v<0?C=P-$:v>0&&(k=I-$),b=VM,H.attr("cursor",Fa.selection),Pt(tt));break}default:return}Ow(tt)}function Jt(tt){switch(tt.keyCode){case 16:{rt&&(ot=at=rt=!1,Pt(tt));break}case 18:{b===$d&&(_<0?O=L:_>0&&(M=T),v<0?C=P:v>0&&(k=I),b=Ud,Pt(tt));break}case 32:{b===VM&&(tt.altKey?(_&&(O=L-U*_,M=T+U*_),v&&(C=P-$*v,k=I+$*v),b=$d):(_<0?O=L:_>0&&(M=T),v<0?C=P:v>0&&(k=I),b=Ud),H.attr("cursor",Fa[x]),Pt(tt));break}default:return}Ow(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=WM(t.apply(this,arguments)),y.dim=e,y}return c.extent=function(y){return arguments.length?(t=typeof y=="function"?y:Nw(WM(y)),c):t},c.filter=function(y){return arguments.length?(r=typeof y=="function"?y:Nw(!!y),c):r},c.touchable=function(y){return arguments.length?(n=typeof y=="function"?y:Nw(!!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 ZM=Math.PI,KM=2*ZM,Lu=1e-6,gtt=KM-Lu;function YP(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=arguments[t]+e[t]}function xtt(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return YP;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 Gc=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?YP:xtt(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>Lu)if(!(Math.abs(f*c-l*u)>Lu)||!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((ZM-Math.acos((m+d-y)/(2*g*x)))/2),_=b/x,v=b/g;Math.abs(_-1)>Lu&&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)>Lu||Math.abs(this._y1-u)>Lu)&&this._append`L${l},${u}`,n&&(d<0&&(d=d%KM+KM),d>gtt?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>Lu&&this._append`A${n},${n},0,${+(d>=ZM)},${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 WP(){return new Gc}WP.prototype=Gc.prototype;function Rn(e=3){return new Gc(+e)}var btt=Array.prototype,Lw=btt.slice;function GP(e,t){return e-t}function XP(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 as=e=>()=>e;function HP(e,t){for(var r=-1,n=t.length,i;++r<n;)if(i=_tt(e,t[r]))return i;return 0}function _tt(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(wtt(c,f,t))return 0;u>n!=h>n&&r<(d-l)*(n-u)/(h-u)+l&&(i=-i)}return i}function wtt(e,t,r){var n;return vtt(e,t,r)&&Stt(e[n=+(e[0]===t[0])],r[n],t[n])}function vtt(e,t,r){return(t[0]-e[0])*(r[1]-e[1])===(r[0]-e[0])*(t[1]-e[1])}function Stt(e,t,r){return e<=t&&t<=r||r<=t&&t<=e}function QP(){}var ka=[[],[[[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 Xc(){var e=1,t=1,r=zc,n=c;function i(l){var u=r(l);if(Array.isArray(u))u=u.slice().sort(GP);else{let f=le(l,Itt);for(u=Jr(...Md(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),XP(p)>0?d.push([p]):h.push(p)}),h.forEach(function(p){for(var m=0,y=d.length,g;m<y;++m)if(HP((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=Fu(l[0],u),ka[g<<1].forEach(_);++p<e-1;)y=g,g=Fu(l[p+1],u),ka[y|g<<1].forEach(_);for(ka[g<<0].forEach(_);++m<t-1;){for(p=-1,g=Fu(l[m*e+e],u),x=Fu(l[m*e],u),ka[g<<1|x<<2].forEach(_);++p<e-1;)y=g,g=Fu(l[m*e+e+p+1],u),b=x,x=Fu(l[m*e+p+1],u),ka[y|g<<1|x<<2|b<<3].forEach(_);ka[g|x<<3].forEach(_)}for(p=-1,x=l[m*e]>=u,ka[x<<2].forEach(_);++p<e-1;)b=x,x=Fu(l[m*e+p+1],u),ka[x<<2|b<<3].forEach(_);ka[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=JM(u[y*e+m]);h>0&&h<e&&m===h&&(d[0]=ZP(h,JM(u[y*e+m-1]),g,f)),p>0&&p<t&&y===p&&(d[1]=ZP(p,JM(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)?as(Lw.call(l)):as(l),i):r},i.smooth=function(l){return arguments.length?(n=l?c:QP,i):n===c},i}function Itt(e){return isFinite(e)?e:NaN}function Fu(e,t){return e==null?!1:+e>=t}function JM(e){return e==null||isNaN(e=+e)?-1/0:e}function ZP(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 Ttt(e){return e[0]}function Att(e){return e[1]}function Ett(){return 1}function t3(){var e=Ttt,t=Att,r=Ett,n=960,i=500,o=20,s=2,a=o*3,c=n+a*2>>s,l=i+a*2>>s,u=as(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 uy({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(_)||(_=Jr(Number.MIN_VALUE,Xt(b)/v,_)),Xc().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),_=Xc().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:as(+x),d):e},d.y=function(x){return arguments.length?(t=typeof x=="function"?x:as(+x),d):t},d.weight=function(x){return arguments.length?(r=typeof x=="function"?x:as(+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)?as(Lw.call(x)):as(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,Cy=(3+8*ne)*ne;function ku(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 By(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 Mtt=(3+16*ne)*ne,Ntt=(2+12*ne)*ne,Ott=(9+64*ne)*ne*ne,zd=V(4),KP=V(8),JP=V(12),t9=V(16),Dn=V(4);function Rtt(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,zd[0]=v-(g+f)+(f-S),x=_+g,f=x-_,b=_-(x-f)+(g-f),g=b-w,f=b-g,zd[1]=b-(g+f)+(f-w),A=x+g,f=A-x,zd[2]=x-(A-f)+(g-f),zd[3]=A;let k=By(4,zd),I=Ntt*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=Ott*s+Cy*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,Dn[0]=v-(g+f)+(f-S),x=_+g,f=x-_,b=_-(x-f)+(g-f),g=b-w,f=b-g,Dn[1]=b-(g+f)+(f-w),A=x+g,f=A-x,Dn[2]=x-(A-f)+(g-f),Dn[3]=A;let N=ku(4,zd,4,Dn,KP);_=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,Dn[0]=v-(g+f)+(f-S),x=_+g,f=x-_,b=_-(x-f)+(g-f),g=b-w,f=b-g,Dn[1]=b-(g+f)+(f-w),A=x+g,f=A-x,Dn[2]=x-(A-f)+(g-f),Dn[3]=A;let O=ku(N,KP,4,Dn,JP);_=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,Dn[0]=v-(g+f)+(f-S),x=_+g,f=x-_,b=_-(x-f)+(g-f),g=b-w,f=b-g,Dn[1]=b-(g+f)+(f-w),A=x+g,f=A-x,Dn[2]=x-(A-f)+(g-f),Dn[3]=A;let L=ku(O,JP,4,Dn,t9);return t9[L-1]}function jd(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)>=Mtt*l?c:-Rtt(e,t,r,n,i,o,l)}var akt=(7+56*ne)*ne,ckt=(3+28*ne)*ne,lkt=(26+288*ne)*ne*ne,ukt=V(4),fkt=V(4),dkt=V(4),hkt=V(4),pkt=V(4),mkt=V(4),ykt=V(4),gkt=V(4),xkt=V(4),bkt=V(8),_kt=V(8),wkt=V(8),vkt=V(4),Skt=V(8),Ikt=V(8),Tkt=V(8),Akt=V(12),Ekt=V(192),Mkt=V(192);var Rkt=(10+96*ne)*ne,Dkt=(4+48*ne)*ne,Lkt=(44+576*ne)*ne*ne,Fkt=V(4),kkt=V(4),Ckt=V(4),Bkt=V(4),Pkt=V(4),Ukt=V(4),$kt=V(4),zkt=V(4),jkt=V(8),qkt=V(8),Vkt=V(8),Ykt=V(8),Wkt=V(8),Gkt=V(8),Xkt=V(8),Hkt=V(8),Qkt=V(8),Zkt=V(4),Kkt=V(4),Jkt=V(4),tCt=V(8),eCt=V(16),rCt=V(16),nCt=V(16),iCt=V(32),oCt=V(32),sCt=V(48),aCt=V(64),cCt=V(1152),lCt=V(1152);var hCt=(16+224*ne)*ne,pCt=(5+72*ne)*ne,mCt=(71+1408*ne)*ne*ne,yCt=V(4),gCt=V(4),xCt=V(4),bCt=V(4),_Ct=V(4),wCt=V(4),vCt=V(4),SCt=V(4),ICt=V(4),TCt=V(4),ACt=V(24),ECt=V(24),MCt=V(24),NCt=V(24),OCt=V(24),RCt=V(24),DCt=V(24),LCt=V(24),FCt=V(24),kCt=V(24),CCt=V(1152),BCt=V(1152),PCt=V(1152),UCt=V(1152),$Ct=V(1152),zCt=V(2304),jCt=V(2304),qCt=V(3456),VCt=V(5760),YCt=V(8),WCt=V(8),GCt=V(8),XCt=V(16),HCt=V(24),QCt=V(48),ZCt=V(48),KCt=V(96),JCt=V(192),tBt=V(384),eBt=V(384),rBt=V(384),nBt=V(768);var iBt=V(96),oBt=V(96),sBt=V(96),aBt=V(1152);var r9=Math.pow(2,-52),Fw=new Uint32Array(512),Vd=class e{static from(t,r=Btt,n=Ptt){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=e3(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=e3(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=ktt(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];qd(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(jd(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=Ctt(y,g,x,b,v,w);this._cx=S.x,this._cy=S.y;for(let E=0;E<s;E++)this._dists[E]=e3(t[2*E],t[2*E+1],S.x,S.y);qd(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)<=r9&&Math.abs(I-T)<=r9||(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],jd(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],jd(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],jd(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(Ltt(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=Fw[--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(Ftt(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<Fw.length&&(Fw[o++]=x)}else{if(o===0)break;t=Fw[--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 Ltt(e,t){let r=e/(Math.abs(e)+Math.abs(t));return(t>0?3-r:1+r)/4}function e3(e,t,r,n){let i=e-r,o=t-n;return i*i+o*o}function Ftt(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 ktt(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 Ctt(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 qd(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;Py(e,i,o),t[e[r]]>t[e[n]]&&Py(e,r,n),t[e[o]]>t[e[n]]&&Py(e,o,n),t[e[r]]>t[e[o]]&&Py(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;Py(e,o,s)}e[r+1]=e[s],e[s]=a,n-o+1>=s-r?(qd(e,t,o,n),qd(e,t,r,s-1)):(qd(e,t,r,s-1),qd(e,t,o,n))}}function Py(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}function Btt(e){return e[0]}function Ptt(e){return e[1]}var ji=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 Hc=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 Uy=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 ji: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 ji: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 ji: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 Hc;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 Utt=2*Math.PI,Yd=Math.pow;function $tt(e){return e[0]}function ztt(e){return e[1]}function jtt(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 qtt(e,t,r){return[e+Math.sin(e+t)*r,t+Math.cos(e-t)*r]}var qi=class e{static from(t,r=$tt,n=ztt,i){return new e("length"in t?Vtt(t,r,n,i):Float64Array.from(Ytt(t,r,n,i)))}constructor(t){this._delaunator=new Vd(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&&jtt(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=qtt(r[2*d],r[2*d+1],f);r[2*d]=p[0],r[2*d+1]=p[1]}this._delaunator=new Vd(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 Uy(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=Yd(r-l[t*2],2)+Yd(n-l[t*2+1],2),d=i[t],h=d;do{let p=c[h],m=Yd(r-l[p*2],2)+Yd(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&&Yd(r-l[h*2],2)+Yd(n-l[h*2+1],2)<f)return h;break}}while(h!==d);return u}render(t){let r=t==null?t=new ji: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 ji: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,Utt)}return n&&n.value()}renderHull(t){let r=t==null?t=new ji: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 Hc;return this.renderHull(t),t.value()}renderTriangle(t,r){let n=r==null?r=new ji: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 Hc;return this.renderTriangle(t,r),r.value()}};function Vtt(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*Ytt(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 n9(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Cu(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 cs(e){return e=Cu(Math.abs(e)),e?e[1]:NaN}function i9(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 o9(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var Wtt=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ls(e){if(!(t=Wtt.exec(e)))throw new Error("invalid format: "+e);var t;return new kw({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]})}ls.prototype=kw.prototype;function kw(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+""}kw.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 s9(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 r3;function a9(e,t){var r=Cu(e,t);if(!r)return e+"";var n=r[0],i=r[1],o=i-(r3=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")+Cu(e,Math.max(0,t+o-1))[0]}function n3(e,t){var r=Cu(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 i3={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:n9,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)=>n3(e*100,t),r:n3,s:a9,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function o3(e){return e}var c9=Array.prototype.map,l9=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function u9(e){var t=e.grouping===void 0||e.thousands===void 0?o3:i9(c9.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?o3:o9(c9.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=ls(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"):i3[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=i3[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=s9(T)),L&&+T==0&&p!=="+"&&(L=!1),R=(L?p==="("?p:a:p==="-"||p==="("?"":p)+R,k=(v==="s"?l9[8+r3/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=ls(f),f.type="f",f)),p=Math.max(-8,Math.min(8,Math.floor(cs(d)/3)))*3,m=Math.pow(10,-p),y=l9[8+p/3];return function(g){return h(m*g)+y}}return{format:l,formatPrefix:u}}var Cw,Vi,Bw;s3({thousands:",",grouping:[3],currency:["$",""]});function s3(e){return Cw=u9(e),Vi=Cw.format,Bw=Cw.formatPrefix,Cw}function a3(e){return Math.max(0,-cs(Math.abs(e)))}function c3(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(cs(t)/3)))*3-cs(Math.abs(e)))}function l3(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,cs(t)-cs(e))+1}var et=1e-6,Bu=1e-12,kt=Math.PI,Te=kt/2,u3=kt/4,Fr=kt*2,Ke=180/kt,Yt=kt/180,$t=Math.abs,Yi=Math.atan,ur=Math.atan2,J=Math.cos,$y=Math.ceil,Pw=Math.exp;var Uw=Math.hypot,Pu=Math.log,$w=Math.pow,Z=Math.sin,hn=Math.sign||function(e){return e>0?1:e<0?-1:0},Ae=Math.sqrt,Wd=Math.tan;function zw(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 jw(e,t){e&&d9.hasOwnProperty(e.type)&&d9[e.type](e,t)}var f9={Feature:function(e,t){jw(e.geometry,t)},FeatureCollection:function(e,t){for(var r=e.features,n=-1,i=r.length;++n<i;)jw(r[n].geometry,t)}},d9={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){f3(e.coordinates,t,0)},MultiLineString:function(e,t){for(var r=e.coordinates,n=-1,i=r.length;++n<i;)f3(r[n],t,0)},Polygon:function(e,t){h9(e.coordinates,t)},MultiPolygon:function(e,t){for(var r=e.coordinates,n=-1,i=r.length;++n<i;)h9(r[n],t)},GeometryCollection:function(e,t){for(var r=e.geometries,n=-1,i=r.length;++n<i;)jw(r[n],t)}};function f3(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 h9(e,t){var r=-1,n=e.length;for(t.polygonStart();++r<n;)f3(e[r],t,1);t.polygonEnd()}function pi(e,t){e&&f9.hasOwnProperty(e.type)?f9[e.type](e,t):jw(e,t)}function zy(e){return[ur(e[1],e[0]),ke(e[2])]}function us(e){var t=e[0],r=e[1],n=J(r);return[n*J(t),n*Z(t),Z(r)]}function jy(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Gd(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 qw(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function qy(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Vy(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 Yy,Vw,Yw,Ww,Gw,Xw,Hw,Qw,d3,h3,p3,y9,g9,Ln,Fn,kn,Mo={sphere:fr,point:m3,lineStart:p9,lineEnd:m9,polygonStart:function(){Mo.lineStart=Htt,Mo.lineEnd=Qtt},polygonEnd:function(){Mo.lineStart=p9,Mo.lineEnd=m9}};function m3(e,t){e*=Yt,t*=Yt;var r=J(t);Wy(r*J(e),r*Z(e),Z(t))}function Wy(e,t,r){++Yy,Yw+=(e-Yw)/Yy,Ww+=(t-Ww)/Yy,Gw+=(r-Gw)/Yy}function p9(){Mo.point=Gtt}function Gtt(e,t){e*=Yt,t*=Yt;var r=J(t);Ln=r*J(e),Fn=r*Z(e),kn=Z(t),Mo.point=Xtt,Wy(Ln,Fn,kn)}function Xtt(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=Fn*o-kn*i)*s+(s=kn*n-Ln*o)*s+(s=Ln*i-Fn*n)*s),Ln*n+Fn*i+kn*o);Vw+=s,Xw+=s*(Ln+(Ln=n)),Hw+=s*(Fn+(Fn=i)),Qw+=s*(kn+(kn=o)),Wy(Ln,Fn,kn)}function m9(){Mo.point=m3}function Htt(){Mo.point=Ztt}function Qtt(){x9(y9,g9),Mo.point=m3}function Ztt(e,t){y9=e,g9=t,e*=Yt,t*=Yt,Mo.point=x9;var r=J(t);Ln=r*J(e),Fn=r*Z(e),kn=Z(t),Wy(Ln,Fn,kn)}function x9(e,t){e*=Yt,t*=Yt;var r=J(t),n=r*J(e),i=r*Z(e),o=Z(t),s=Fn*o-kn*i,a=kn*n-Ln*o,c=Ln*i-Fn*n,l=Uw(s,a,c),u=ke(l),f=l&&-u/l;d3.add(f*s),h3.add(f*a),p3.add(f*c),Vw+=u,Xw+=u*(Ln+(Ln=n)),Hw+=u*(Fn+(Fn=i)),Qw+=u*(kn+(kn=o)),Wy(Ln,Fn,kn)}function y3(e){Yy=Vw=Yw=Ww=Gw=Xw=Hw=Qw=0,d3=new Zr,h3=new Zr,p3=new Zr,pi(e,Mo);var t=+d3,r=+h3,n=+p3,i=Uw(t,r,n);return i<Bu&&(t=Xw,r=Hw,n=Qw,Vw<et&&(t=Yw,r=Ww,n=Gw),i=Uw(t,r,n),i<Bu)?[NaN,NaN]:[ur(r,t)*Ke,ke(n/i)*Ke]}function Gy(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 g3(e,t){return $t(e)>kt&&(e-=Math.round(e/Fr)*Fr),[e,t]}g3.invert=g3;function x3(e,t,r){return(e%=Fr)?t||r?Gy(_9(e),w9(t,r)):_9(e):t||r?w9(t,r):g3}function b9(e){return function(t,r){return t+=e,$t(t)>kt&&(t-=Math.round(t/Fr)*Fr),[t,r]}}function _9(e){var t=b9(e);return t.invert=b9(-e),t}function w9(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 v9(e){e=x3(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 I9(e,t,r,n,i,o){if(r){var s=J(t),a=Z(t),c=n*r;i==null?(i=t+n*Fr,o=t-c/2):(i=S9(s,i),o=S9(s,o),(n>0?i<o:i>o)&&(i+=n*Fr));for(var l,u=i;n>0?u>o:u<o;u-=c)l=zy([s,-a*J(u),-a*Z(u)]),e.point(l[0],l[1])}}function S9(e,t){t=us(t),t[0]-=e,Vy(t);var r=zw(-t[1]);return((-t[2]<0?-r:r)+Fr-et)%Fr}function Zw(){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 Xd(e,t){return $t(e[0]-t[0])<et&&$t(e[1]-t[1])<et}function Kw(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 Jw(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(Xd(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 Kw(y,p,null,!0)),s.push(x.o=new Kw(y,null,x,!1)),o.push(x=new Kw(g,p,null,!1)),s.push(x.o=new Kw(g,null,x,!0))}}),!!o.length){for(s.sort(t),T9(o),T9(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 T9(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 b3(e){return $t(e[0])<=kt?e[0]:hn(e[0])*(($t(e[0])+kt)%Fr-kt)}function A9(e,t){var r=b3(t),n=t[1],i=Z(n),o=[Z(r),-J(r),0],s=0,a=0,c=new Zr;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=b3(h),m=h[1]/2+u3,y=Z(m),g=J(m),x=0;x<d;++x,p=_,y=w,g=S,h=b){var b=f[x],_=b3(b),v=b[1]/2+u3,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*Fr:A,T^p>=r^_>=r){var k=Gd(us(h),us(b));Vy(k);var I=Gd(o,k);Vy(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<-Bu)^a&1}function tv(e,t,r,n){return function(i){var o=t(i),s=Zw(),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=Nd(u);var _=A9(l,n);u.length?(c||(i.polygonStart(),c=!0),Jw(u,Jtt,_,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(Ktt))}}return d}}function Ktt(e){return e.length>1}function Jtt(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 _3=tv(function(){return!0},tet,ret,[-kt,-Te]);function tet(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=eet(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 eet(e,t,r,n){var i,o,s=Z(e-r);return $t(s)>et?Yi((Z(t)*(o=J(n))*Z(r)-Z(n)*(i=J(t))*Z(e))/(i*o*s)):(t+n)/2}function ret(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 E9(e){var t=J(e),r=2*Yt,n=t>0,i=$t(t)>et;function o(u,f,d,h){I9(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||Xd(f,b)||Xd(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||!Xd(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=us(u),p=us(f),m=[1,0,0],y=Gd(h,p),g=jy(y,y),x=y[0],b=g-x*x;if(!b)return!d&&u;var _=t*g/b,v=-t*x/b,w=Gd(m,y),S=qy(m,_),A=qy(y,v);qw(S,A);var E=w,M=jy(S,E),T=jy(E,E),R=M*M-T*(jy(S,S)-1);if(!(R<0)){var k=Ae(R),I=qy(E,(-M-k)/T);if(qw(I,S),I=zy(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=qy(E,(-M+k)/T);return qw(X,S),[I,zy(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 tv(s,a,o,n?[0,-e]:[-kt,e-kt])}function M9(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 Xy=1e9,ev=-Xy;function Hd(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=Zw(),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=Nd(d)).length;(O||L)&&(l.polygonStart(),O&&(l.lineStart(),o(null,null,1,l),l.lineEnd()),L&&Jw(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(ev,Math.min(Xy,x)),b=Math.max(ev,Math.min(Xy,b))],C=[N=Math.max(ev,Math.min(Xy,N)),O=Math.max(ev,Math.min(Xy,O))];M9(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 N9(e,t,r){var n=rr(e,t-et,r).concat(t);return function(i){return n.map(function(o){return[i,o]})}}function O9(e,t,r){var n=rr(e,t-et,r).concat(t);return function(i){return n.map(function(o){return[o,i]})}}function w3(){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($y(n/u)*u,r,u).map(p).concat(rr($y(a/f)*f,s,f).map(m)).concat(rr($y(t/c)*c,e,c).filter(function(b){return $t(b%u)>et}).map(d)).concat(rr($y(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=N9(o,i,90),h=O9(t,e,y),p=N9(a,s,90),m=O9(n,r,y),g):y},g.extentMajor([[-180,-90+et],[180,90-et]]).extentMinor([[-180,-80-et],[180,80+et]])}function v3(){return w3()()}var Hy=e=>e;var S3=new Zr,I3=new Zr,R9,D9,T3,A3,Qc={point:fr,lineStart:fr,lineEnd:fr,polygonStart:function(){Qc.lineStart=net,Qc.lineEnd=oet},polygonEnd:function(){Qc.lineStart=Qc.lineEnd=Qc.point=fr,S3.add($t(I3)),I3=new Zr},result:function(){var e=S3/2;return S3=new Zr,e}};function net(){Qc.point=iet}function iet(e,t){Qc.point=L9,R9=T3=e,D9=A3=t}function L9(e,t){I3.add(A3*e-T3*t),T3=e,A3=t}function oet(){L9(R9,D9)}var E3=Qc;var Qd=1/0,rv=Qd,Qy=-Qd,nv=Qy,set={point:aet,lineStart:fr,lineEnd:fr,polygonStart:fr,polygonEnd:fr,result:function(){var e=[[Qd,rv],[Qy,nv]];return Qy=nv=-(rv=Qd=1/0),e}};function aet(e,t){e<Qd&&(Qd=e),e>Qy&&(Qy=e),t<rv&&(rv=t),t>nv&&(nv=t)}var Zd=set;var M3=0,N3=0,Zy=0,iv=0,ov=0,Kd=0,O3=0,R3=0,Ky=0,C9,B9,fs,ds,No={point:Uu,lineStart:F9,lineEnd:k9,polygonStart:function(){No.lineStart=fet,No.lineEnd=det},polygonEnd:function(){No.point=Uu,No.lineStart=F9,No.lineEnd=k9},result:function(){var e=Ky?[O3/Ky,R3/Ky]:Kd?[iv/Kd,ov/Kd]:Zy?[M3/Zy,N3/Zy]:[NaN,NaN];return M3=N3=Zy=iv=ov=Kd=O3=R3=Ky=0,e}};function Uu(e,t){M3+=e,N3+=t,++Zy}function F9(){No.point=cet}function cet(e,t){No.point=uet,Uu(fs=e,ds=t)}function uet(e,t){var r=e-fs,n=t-ds,i=Ae(r*r+n*n);iv+=i*(fs+e)/2,ov+=i*(ds+t)/2,Kd+=i,Uu(fs=e,ds=t)}function k9(){No.point=Uu}function fet(){No.point=het}function det(){P9(C9,B9)}function het(e,t){No.point=P9,Uu(C9=fs=e,B9=ds=t)}function P9(e,t){var r=e-fs,n=t-ds,i=Ae(r*r+n*n);iv+=i*(fs+e)/2,ov+=i*(ds+t)/2,Kd+=i,i=ds*e-fs*t,O3+=i*(fs+e),R3+=i*(ds+t),Ky+=i*3,Uu(fs=e,ds=t)}var D3=No;function sv(e){this._context=e}sv.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,Fr);break}}},result:fr};var F3=new Zr,L3,U9,$9,Jy,tg,av={point:fr,lineStart:function(){av.point=pet},lineEnd:function(){L3&&z9(U9,$9),av.point=fr},polygonStart:function(){L3=!0},polygonEnd:function(){L3=null},result:function(){var e=+F3;return F3=new Zr,e}};function pet(e,t){av.point=z9,U9=Jy=e,$9=tg=t}function z9(e,t){Jy-=e,tg-=t,F3.add(Ae(Jy*Jy+tg*tg)),Jy=e,tg=t}var k3=av;var j9,cv,q9,V9,Jd=class{constructor(t){this._append=t==null?Y9:met(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!==q9||this._append!==cv){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`,q9=n,cv=this._append,V9=this._,this._=i}this._+=V9;break}}}result(){let t=this._;return this._="",t.length?t:null}};function Y9(e){let t=1;this._+=e[0];for(let r=e.length;t<r;++t)this._+=arguments[t]+e[t]}function met(e){let t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return Y9;if(t!==j9){let r=10**t;j9=t,cv=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 cv}function kr(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(E3)),E3.result()},s.measure=function(a){return pi(a,i(k3)),k3.result()},s.bounds=function(a){return pi(a,i(Zd)),Zd.result()},s.centroid=function(a){return pi(a,i(D3)),D3.result()},s.projection=function(a){return arguments.length?(i=a==null?(e=null,Hy):(e=a).stream,s):e},s.context=function(a){return arguments.length?(o=a==null?(t=null,new Jd(r)):new sv(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 Jd(r)),s},s.projection(e).digits(r).context(t)}function $u(e){return{stream:th(e)}}function th(e){return function(t){var r=new C3;for(var n in e)r[n]=e[n];return r.stream=t,r}}function C3(){}C3.prototype={constructor:C3,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 B3(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(Zd)),t(Zd.result()),n!=null&&e.clipExtent(n),e}function eg(e,t,r){return B3(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 lv(e,t,r){return eg(e,[[0,0],t],r)}function uv(e,t,r){return B3(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 fv(e,t,r){return B3(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 W9=16,yet=J(30*Yt);function P3(e,t){return+t?xet(e,t):get(e)}function get(e){return th({point:function(t,r){t=e(t,r),this.stream.point(t[0],t[1])}})}function xet(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<yet)&&(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=us([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],W9,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,W9,n),y.lineEnd=_,_()}return y}}var bet=th({point:function(e,t){this.stream.point(e*Yt,t*Yt)}});function _et(e){return th({point:function(t,r){var n=e(t,r);return this.stream.point(n[0],n[1])}})}function wet(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 G9(e,t,r,n,i,o){if(!o)return wet(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 en(e){return U3(function(){return e})()}function U3(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=_3,y=null,g,x,b,_=Hy,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=bet(_et(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?E9(p=N*Yt):(p=null,_3),I()):p*Ke},T.clipExtent=function(N){return arguments.length?(_=N==null?(y=g=x=b=null,Hy):Hd(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=P3(S,v=N*N),I()):Ae(v)},T.fitExtent=function(N,O){return eg(T,N,O)},T.fitSize=function(N,O){return lv(T,N,O)},T.fitWidth=function(N,O){return uv(T,N,O)},T.fitHeight=function(N,O){return fv(T,N,O)};function k(){var N=G9(r,0,0,d,h,f).apply(null,t(o,s)),O=G9(r,n-N[0],i-N[1],d,h,f);return u=x3(a,c,l),S=Gy(t,O),A=Gy(u,S),w=P3(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 eh(e){var t=0,r=kt/3,n=U3(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 X9(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 H9(e,t){var r=Z(e),n=(r+Z(t))/2;if($t(n)<et)return X9(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))*hn(l);return l*n<0&&(u-=kt*hn(a)*hn(l)),[u/n,ke((i-(a*a+l*l)*n*n)/(2*n))]},s}function Zc(){return eh(H9).scale(155.424).center([0,33.6442])}function rg(){return Zc().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function vet(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 $3(){var e,t,r=rg(),n,i=Zc().rotate([154,0]).center([-2,58.5]).parallels([55,65]),o,s=Zc().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=vet([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 eg(u,d,h)},u.fitSize=function(d,h){return lv(u,d,h)},u.fitWidth=function(d,h){return uv(u,d,h)},u.fitHeight=function(d,h){return fv(u,d,h)};function f(){return e=t=null,u}return u.scale(1070)}function dv(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 hs(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 z3=dv(function(e){return Ae(2/(1+e))});z3.invert=hs(function(e){return 2*ke(e/2)});function j3(){return en(z3).scale(124.75).clipAngle(180-.001)}var q3=dv(function(e){return(e=zw(e))&&e/Z(e)});q3.invert=hs(function(e){return e});function V3(){return en(q3).scale(79.4188).clipAngle(180-.001)}function rh(e,t){return[e,Pu(Wd((Te+t)/2))]}rh.invert=function(e,t){return[e,2*Yi(Pw(t))-Te]};function Y3(){return W3(rh).scale(961/Fr)}function W3(e){var t=en(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(v9(t.rotate()).invert([0,0]));return o(s==null?[[d[0]-f,d[1]-f],[d[0]+f,d[1]+f]]:e===rh?[[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 hv(e){return Wd((Te+e)/2)}function Q9(e,t){var r=J(e),n=e===t?Z(e):Pu(r/J(t))/Pu(hv(t)/hv(e)),i=r*$w(hv(e),n)/n;if(!n)return rh;function o(s,a){i>0?a<-Te+et&&(a=-Te+et):a>Te-et&&(a=Te-et);var c=i/$w(hv(a),n);return[c*Z(n*s),i-c*J(n*s)]}return o.invert=function(s,a){var c=i-a,l=hn(n)*Ae(s*s+c*c),u=ur(s,$t(c))*hn(c);return c*n<0&&(u-=kt*hn(s)*hn(c)),[u/n,2*Yi($w(i/l,1/n))-Te]},o}function G3(){return eh(Q9).scale(109.5).parallels([30,30])}function nh(e,t){return[e,t]}nh.invert=nh;function X3(){return en(nh).scale(152.63)}function Z9(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 nh;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))*hn(c);return c*n<0&&(l-=kt*hn(s)*hn(c)),[l/n,i-hn(n)*Ae(s*s+c*c)]},o}function H3(){return eh(Z9).scale(131.154).center([0,13.9389])}var ng=1.340264,ig=-.081106,og=893e-6,sg=.003796,pv=Ae(3)/2,Iet=12;function Q3(e,t){var r=ke(pv*Z(t)),n=r*r,i=n*n*n;return[e*J(r)/(pv*(ng+3*ig*n+i*(7*og+9*sg*n))),r*(ng+ig*n+i*(og+sg*n))]}Q3.invert=function(e,t){for(var r=t,n=r*r,i=n*n*n,o=0,s,a,c;o<Iet&&(a=r*(ng+ig*n+i*(og+sg*n))-t,c=ng+3*ig*n+i*(7*og+9*sg*n),r-=s=a/c,n=r*r,i=n*n*n,!($t(s)<Bu));++o);return[pv*e*(ng+3*ig*n+i*(7*og+9*sg*n))/J(r),ke(Z(r)/pv)]};function Z3(){return en(Q3).scale(177.158)}function K3(e,t){var r=J(t),n=J(e)*r;return[r*Z(e)/n,Z(t)/n]}K3.invert=hs(Yi);function J3(){return en(K3).scale(144.049).clipAngle(60)}function t6(e,t){return[J(t)*Z(e),Z(t)]}t6.invert=hs(ke);function e6(){return en(t6).scale(249.5).clipAngle(90+et)}function r6(e,t){var r=J(t),n=1+J(e)*r;return[r*Z(e)/n,Z(t)/n]}r6.invert=hs(function(e){return 2*Yi(e)});function n6(){return en(r6).scale(250).clipAngle(142)}function i6(e,t){return[Pu(Wd((Te+t)/2)),-e]}i6.invert=function(e,t){return[-t,2*Yi(Pw(e))-Te]};function o6(){var e=W3(i6),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 Tet(e,t){return e.parent===t.parent?1:2}function Aet(e){return e.reduce(Eet,0)/e.length}function Eet(e,t){return e+t.x}function Met(e){return 1+e.reduce(Net,0)}function Net(e,t){return Math.max(e,t.y)}function Oet(e){for(var t;t=e.children;)e=t[0];return e}function Ret(e){for(var t;t=e.children;)e=t[t.length-1];return e}function mv(){var e=Tet,t=1,r=1,n=!1;function i(o){var s,a=0;o.eachAfter(function(d){var h=d.children;h?(d.x=Aet(h),d.y=Met(h)):(d.x=s?a+=e(d,s):0,d.y=0,s=d)});var c=Oet(o),l=Ret(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 Det(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 K9(){return this.eachAfter(Det)}function J9(e,t){let r=-1;for(let n of this)e.call(t,n,++r,this);return this}function tU(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 eU(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 rU(e,t){let r=-1;for(let n of this)if(e.call(t,n,++r,this))return n}function nU(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 iU(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function oU(e){for(var t=this,r=Let(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 Let(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 sU(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function aU(){return Array.from(this)}function cU(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function lU(){var e=this,t=[];return e.each(function(r){r!==e&&t.push({source:r.parent,target:r})}),t}function*uU(){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 s6(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=Cet)):t===void 0&&(t=ket);for(var r=new Kc(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 Kc(s[a])),o.parent=n,o.depth=n.depth+1;return r.eachBefore(a6)}function Fet(){return s6(this).eachBefore(Bet)}function ket(e){return e.children}function Cet(e){return Array.isArray(e)?e[1]:null}function Bet(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function a6(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function Kc(e){this.data=e,this.depth=this.height=0,this.parent=null}Kc.prototype=s6.prototype={constructor:Kc,count:K9,each:J9,eachAfter:eU,eachBefore:tU,find:rU,sum:nU,sort:iU,path:oU,ancestors:sU,descendants:aU,leaves:cU,links:lU,copy:Fet,[Symbol.iterator]:uU};function yv(e){return e==null?null:Pet(e)}function Pet(e){if(typeof e!="function")throw new Error;return e}var Uet={depth:-1},fU={},c6={};function $et(e){return e.id}function zet(e){return e.parentId}function gv(){var e=$et,t=zet,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)=>jet(r(_,v,i))),x=g.map(dU),b=new Set(g).add("");for(let _ of x)b.has(_)||(b.add(_),g.push(_),x.push(dU(_)),o.push(c6));s=(_,v)=>g[v],a=(_,v)=>x[v]}for(u=0,c=o.length;u<c;++u)l=o[u],h=o[u]=new Kc(l),(p=s(l,u,i))!=null&&(p+="")&&(m=h.id=p,y.set(m,y.has(m)?fU: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===fU)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===c6&&f.children.length===1;)f=f.children[0],--c;for(let g=o.length-1;g>=0&&(h=o[g],h.data===c6);--g)h.data=null}if(f.parent=Uet,f.eachBefore(function(g){g.depth=g.parent.depth+1,--c}).eachBefore(a6),f.parent=null,c>0)throw new Error("cycle");return f}return n.id=function(i){return arguments.length?(e=yv(i),n):e},n.parentId=function(i){return arguments.length?(t=yv(i),n):t},n.path=function(i){return arguments.length?(r=yv(i),n):r},n}function jet(e){e=`${e}`;let t=e.length;return l6(e,t-1)&&!l6(e,t-2)&&(e=e.slice(0,-1)),e[0]==="/"?e:`/${e}`}function dU(e){let t=e.length;if(t<2)return"";for(;--t>1&&!l6(e,t););return e.slice(0,t)}function l6(e,t){if(e[t]==="/"){let r=0;for(;t>0&&e[--t]==="\\";)++r;if(!(r&1))return!0}return!1}function qet(e,t){return e.parent===t.parent?1:2}function u6(e){var t=e.children;return t?t[0]:e.t}function f6(e){var t=e.children;return t?t[t.length-1]:e.t}function Vet(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 Yet(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 Wet(e,t,r){return e.a.parent===t.parent?e.a:r}function xv(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}xv.prototype=Object.create(Kc.prototype);function Get(e){for(var t=new xv(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 xv(o[s],s)),i.parent=r;return(t.parent=new xv(null,0)).children=[t],t}function zu(){var e=qet,t=1,r=1,n=null;function i(l){var u=Get(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){Yet(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=f6(p),d=u6(d),p&&d;)m=u6(m),h=f6(h),h.a=l,_=p.z+x-d.z-y+e(p._,d._),_>0&&(Vet(Wet(p,l,f),l,_),y+=_,g+=_),x+=p.m,y+=d.m,b+=m.m,g+=h.m;p&&!f6(h)&&(h.t=p,h.m+=x-g),d&&!u6(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 hU=23283064365386963e-26;function ju(e=Math.random()){let t=(0<=e&&e<1?e/hU:Math.abs(e))|0;return()=>(t=1664525*t+1013904223|0,hU*(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 ag(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 cg=Symbol("implicit");function qu(){var e=new Tn,t=[],r=[],n=cg;function i(o){let s=e.get(o);if(s===void 0){if(n!==cg)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 Tn;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 qu(t,r).unknown(n)},dr.apply(i,arguments),i}function Jc(){var e=qu().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 Jc(t(),[n,i]).round(a).paddingInner(c).paddingOuter(l).align(u)},dr.apply(f(),arguments)}function pU(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return pU(t())},e}function d6(){return pU(Jc.apply(null,arguments).paddingInner(1))}function h6(e){return function(){return e}}function ih(e){return+e}var mU=[0,1];function Qn(e){return e}function p6(e,t){return(t-=e=+e)?function(r){return(r-e)/t}:h6(isNaN(t)?NaN:.5)}function Xet(e,t){var r;return e>t&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function Het(e,t,r){var n=e[0],i=e[1],o=t[0],s=t[1];return i<n?(n=p6(i,n),o=r(s,o)):(n=p6(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]=p6(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 ps(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function Vu(){var e=mU,t=mU,r=hi,n,i,o,s=Qn,a,c,l;function u(){var d=Math.min(e.length,t.length);return s!==Qn&&(s=Xet(e[0],e[d-1])),a=d>2?Qet:Het,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,ih),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=Ru,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 lg(){return Vu()(Qn,Qn)}function m6(e,t,r,n){var i=Ed(e,t,r),o;switch(n=ls(n??",f"),n.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(o=c3(i,s))&&(n.precision=o),Bw(n,s)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(o=l3(i,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=o-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(o=a3(i))&&(n.precision=o-(n.type==="%")*2);break}}return Vi(n)}function Ca(e){var t=e.domain;return e.ticks=function(r){var n=t();return Jr(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var i=t();return m6(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=lg();return e.copy=function(){return ps(e,Ba())},dr.apply(e,arguments),Ca(e)}function ug(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,ih),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return ug(e).unknown(t)},e=arguments.length?Array.from(e,ih):[0,1],Ca(r)}function fg(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 yU(e){return Math.log(e)}function gU(e){return Math.exp(e)}function Zet(e){return-Math.log(-e)}function Ket(e){return-Math.exp(-e)}function Jet(e){return isFinite(e)?+("1e"+e):e<0?0:e}function trt(e){return e===10?Jet:e===Math.E?Math.exp:t=>Math.pow(e,t)}function ert(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 xU(e){return(t,r)=>-e(-t,r)}function y6(e){let t=e(yU,gU),r=t.domain,n=10,i,o;function s(){return i=ert(n),o=trt(n),r()[0]<0?(i=xU(i),o=xU(o),e(Zet,Ket)):e(yU,gU),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=Jr(l,u,y))}else g=Jr(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=ls(c)).precision==null&&(c.trim=!0),c=Vi(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(fg(r(),{floor:a=>o(Math.floor(i(a))),ceil:a=>o(Math.ceil(i(a)))})),t}function dg(){let e=y6(Vu()).domain([1,10]);return e.copy=()=>ps(e,dg()).base(e.base()),dr.apply(e,arguments),e}function bU(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function _U(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function g6(e){var t=1,r=e(bU(t),_U(t));return r.constant=function(n){return arguments.length?e(bU(t=+n),_U(t)):t},Ca(r)}function hg(){var e=g6(Vu());return e.copy=function(){return ps(e,hg()).constant(e.constant())},dr.apply(e,arguments)}function wU(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function rrt(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function nrt(e){return e<0?-e*e:e*e}function x6(e){var t=e(Qn,Qn),r=1;function n(){return r===1?e(Qn,Qn):r===.5?e(rrt,nrt):e(wU(r),wU(1/r))}return t.exponent=function(i){return arguments.length?(r=+i,n()):r},Ca(t)}function pg(){var e=x6(Vu());return e.copy=function(){return ps(e,pg()).exponent(e.exponent())},dr.apply(e,arguments),e}function mg(){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]=gM(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 mg().domain(e).range(t).unknown(n)},dr.apply(o,arguments)}function yg(){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 yg().domain(e).range(t).unknown(r)},dr.apply(i,arguments)}var b6=new Date,_6=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)=>(b6.setTime(+o),_6.setTime(+s),e(b6),e(_6),Math.floor(r(b6,_6))),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 gg=Me(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);gg.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):gg);var g$t=gg.range;var Cr=Me(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*1e3)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds()),vU=Cr.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()),irt=Pa.range,Ua=Me(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes()),ort=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()),srt=$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()),art=za.range;var Wi=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),crt=Wi.range,Gu=Me(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1),lrt=Gu.range,Xu=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)),urt=Xu.range;function Hu(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=Hu(0),tl=Hu(1),bv=Hu(2),_v=Hu(3),ys=Hu(4),wv=Hu(5),vv=Hu(6),IU=mi.range,frt=tl.range,drt=bv.range,hrt=_v.range,prt=ys.range,mrt=wv.range,yrt=vv.range;function Qu(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=Qu(0),el=Qu(1),Sv=Qu(2),Iv=Qu(3),gs=Qu(4),Tv=Qu(5),Av=Qu(6),TU=yi.range,grt=el.range,xrt=Sv.range,brt=Iv.range,_rt=gs.range,wrt=Tv.range,vrt=Av.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()),Srt=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()),Irt=qa.range;var pn=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());pn.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 Trt=pn.range,mn=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());mn.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 Art=mn.range;function EU(e,t,r,n,i,o){let s=[[Cr,1,1e3],[Cr,5,5*1e3],[Cr,15,15*1e3],[Cr,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=Io(([,,y])=>y).right(s,d);if(h===s.length)return e.every(Ed(l/31536e6,u/31536e6,f));if(h===0)return gg.every(Math.max(Ed(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[w6,bg]=EU(mn,qa,yi,Xu,za,Ua),[v6,S6]=EU(pn,ja,mi,Wi,$a,Pa);function I6(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 T6(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 _g(e,t,r){return{y:e,m:t,d:r,H:0,M:0,S:0,L:0}}function A6(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=wg(i),u=vg(i),f=wg(o),d=vg(o),h=wg(s),p=vg(s),m=wg(a),y=vg(a),g=wg(c),x=vg(c),b={a:L,A:B,b:C,B:P,c:null,d:LU,e:LU,f:Qrt,g:snt,G:cnt,H:Grt,I:Xrt,j:Hrt,L:PU,m:Zrt,M:Krt,p:U,q:$,Q:CU,s:BU,S:Jrt,u:tnt,U:ent,V:rnt,w:nnt,W:int,x:null,X:null,y:ont,Y:ant,Z:lnt,"%":kU},_={a:X,A:rt,b:ot,B:at,c:null,d:FU,e:FU,f:hnt,g:Snt,G:Tnt,H:unt,I:fnt,j:dnt,L:$U,m:pnt,M:mnt,p:Y,q:st,Q:CU,s:BU,S:ynt,u:gnt,U:xnt,V:bnt,w:_nt,W:wnt,x:null,X:null,y:vnt,Y:Int,Z:Ant,"%":kU},v={a:M,A:T,b:R,B:k,c:I,d:RU,e:RU,f:qrt,g:OU,G:NU,H:DU,I:DU,j:Urt,L:jrt,m:Prt,M:$rt,p:E,q:Brt,Q:Yrt,s:Wrt,S:zrt,u:Drt,U:Lrt,V:Frt,w:Rrt,W:krt,x:N,X:O,y:OU,Y:NU,Z:Crt,"%":Vrt};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=MU[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=_g(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=T6(_g(z.y,0,1)),Kt=ht.getUTCDay(),ht=Kt>4||Kt===0?el.ceil(ht):el(ht),ht=Gu.offset(ht,(z.V-1)*7),z.y=ht.getUTCFullYear(),z.m=ht.getUTCMonth(),z.d=ht.getUTCDate()+(z.w+6)%7):(ht=I6(_g(z.y,0,1)),Kt=ht.getDay(),ht=Kt>4||Kt===0?tl.ceil(ht):tl(ht),ht=Wi.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?T6(_g(z.y,0,1)).getUTCDay():I6(_g(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,T6(z)):I6(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 MU?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 MU={"-":"",_:" ",0:"0"},Br=/^\s*\d+/,Mrt=/^%/,Nrt=/[\\^$*+?|[\]().{}]/g;function ue(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 Ort(e){return e.replace(Nrt,"\\$&")}function wg(e){return new RegExp("^(?:"+e.map(Ort).join("|")+")","i")}function vg(e){return new Map(e.map((t,r)=>[t.toLowerCase(),r]))}function Rrt(e,t,r){var n=Br.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function Drt(e,t,r){var n=Br.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function Lrt(e,t,r){var n=Br.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function Frt(e,t,r){var n=Br.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function krt(e,t,r){var n=Br.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function NU(e,t,r){var n=Br.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function OU(e,t,r){var n=Br.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function Crt(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 Brt(e,t,r){var n=Br.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function Prt(e,t,r){var n=Br.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function RU(e,t,r){var n=Br.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function Urt(e,t,r){var n=Br.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function DU(e,t,r){var n=Br.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function $rt(e,t,r){var n=Br.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function zrt(e,t,r){var n=Br.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function jrt(e,t,r){var n=Br.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function qrt(e,t,r){var n=Br.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function Vrt(e,t,r){var n=Mrt.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function Yrt(e,t,r){var n=Br.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function Wrt(e,t,r){var n=Br.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function LU(e,t){return ue(e.getDate(),t,2)}function Grt(e,t){return ue(e.getHours(),t,2)}function Xrt(e,t){return ue(e.getHours()%12||12,t,2)}function Hrt(e,t){return ue(1+Wi.count(pn(e),e),t,3)}function PU(e,t){return ue(e.getMilliseconds(),t,3)}function Qrt(e,t){return PU(e,t)+"000"}function Zrt(e,t){return ue(e.getMonth()+1,t,2)}function Krt(e,t){return ue(e.getMinutes(),t,2)}function Jrt(e,t){return ue(e.getSeconds(),t,2)}function tnt(e){var t=e.getDay();return t===0?7:t}function ent(e,t){return ue(mi.count(pn(e)-1,e),t,2)}function UU(e){var t=e.getDay();return t>=4||t===0?ys(e):ys.ceil(e)}function rnt(e,t){return e=UU(e),ue(ys.count(pn(e),e)+(pn(e).getDay()===4),t,2)}function nnt(e){return e.getDay()}function int(e,t){return ue(tl.count(pn(e)-1,e),t,2)}function ont(e,t){return ue(e.getFullYear()%100,t,2)}function snt(e,t){return e=UU(e),ue(e.getFullYear()%100,t,2)}function ant(e,t){return ue(e.getFullYear()%1e4,t,4)}function cnt(e,t){var r=e.getDay();return e=r>=4||r===0?ys(e):ys.ceil(e),ue(e.getFullYear()%1e4,t,4)}function lnt(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+ue(t/60|0,"0",2)+ue(t%60,"0",2)}function FU(e,t){return ue(e.getUTCDate(),t,2)}function unt(e,t){return ue(e.getUTCHours(),t,2)}function fnt(e,t){return ue(e.getUTCHours()%12||12,t,2)}function dnt(e,t){return ue(1+Gu.count(mn(e),e),t,3)}function $U(e,t){return ue(e.getUTCMilliseconds(),t,3)}function hnt(e,t){return $U(e,t)+"000"}function pnt(e,t){return ue(e.getUTCMonth()+1,t,2)}function mnt(e,t){return ue(e.getUTCMinutes(),t,2)}function ynt(e,t){return ue(e.getUTCSeconds(),t,2)}function gnt(e){var t=e.getUTCDay();return t===0?7:t}function xnt(e,t){return ue(yi.count(mn(e)-1,e),t,2)}function zU(e){var t=e.getUTCDay();return t>=4||t===0?gs(e):gs.ceil(e)}function bnt(e,t){return e=zU(e),ue(gs.count(mn(e),e)+(mn(e).getUTCDay()===4),t,2)}function _nt(e){return e.getUTCDay()}function wnt(e,t){return ue(el.count(mn(e)-1,e),t,2)}function vnt(e,t){return ue(e.getUTCFullYear()%100,t,2)}function Snt(e,t){return e=zU(e),ue(e.getUTCFullYear()%100,t,2)}function Int(e,t){return ue(e.getUTCFullYear()%1e4,t,4)}function Tnt(e,t){var r=e.getUTCDay();return e=r>=4||r===0?gs(e):gs.ceil(e),ue(e.getUTCFullYear()%1e4,t,4)}function Ant(){return"+0000"}function kU(){return"%"}function CU(e){return+e}function BU(e){return Math.floor(+e/1e3)}var oh,sh,jU,xs,qU;E6({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 E6(e){return oh=A6(e),sh=oh.format,jU=oh.parse,xs=oh.utcFormat,qU=oh.utcParse,oh}function Ent(e){return new Date(e)}function Mnt(e){return e instanceof Date?+e:+new Date(+e)}function Ev(e,t,r,n,i,o,s,a,c,l){var u=lg(),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,Mnt)):d().map(Ent)},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(fg(S,w)):u},u.copy=function(){return ps(u,Ev(e,t,r,n,i,o,s,a,c,l))},u}function Mv(){return dr.apply(Ev(v6,S6,pn,ja,mi,Wi,$a,Pa,Cr,sh).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function Nv(){return dr.apply(Ev(w6,bg,mn,qa,yi,Gu,za,Ua,Cr,xs).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function Sg(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function Ov(){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=os(m,[g,x,b]),h):[l(0),l(.5),l(1)]}}return h.range=p(hi),h.rangeRound=p(Ru),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 Ig(){var e=Ca(Ov()(Qn));return e.copy=function(){return Sg(e,Ig())},ag.apply(e,arguments)}function Rv(){var e=y6(Ov()).domain([.1,1,10]);return e.copy=function(){return Sg(e,Rv()).base(e.base())},ag.apply(e,arguments)}function Dv(){var e=g6(Ov());return e.copy=function(){return Sg(e,Dv()).constant(e.constant())},ag.apply(e,arguments)}function Lv(){var e=x6(Ov());return e.copy=function(){return Sg(e,Lv()).exponent(e.exponent())},ag.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 M6=W("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");var N6=W("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666");var O6=W("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666");var R6=W("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0");var D6=W("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");var L6=W("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2");var F6=W("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc");var k6=W("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999");var C6=W("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3");var B6=W("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");var P6=W("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");var pt=e=>LM(e[e.length-1]);var Fv=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(W),kv=pt(Fv);var Cv=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(W),Bv=pt(Cv);var Pv=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(W),Uv=pt(Pv);var $v=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(W),zv=pt($v);var Tg=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(W),ah=pt(Tg);var jv=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(W),qv=pt(jv);var Ag=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(W),ch=pt(Ag);var Vv=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(W),Yv=pt(Vv);var Wv=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(W),Gv=pt(Wv);var Xv=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(W),Hv=pt(Xv);var Qv=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(W),Zv=pt(Qv);var Kv=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(W),Jv=pt(Kv);var t2=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(W),e2=pt(t2);var r2=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(W),n2=pt(r2);var i2=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(W),o2=pt(i2);var s2=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(W),a2=pt(s2);var c2=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(W),l2=pt(c2);var u2=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(W),f2=pt(u2);var d2=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(W),h2=pt(d2);var p2=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(W),m2=pt(p2);var y2=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(W),g2=pt(y2);var x2=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(W),b2=pt(x2);var _2=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(W),w2=pt(_2);var v2=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(W),S2=pt(v2);var I2=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(W),T2=pt(I2);var A2=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(W),E2=pt(A2);var M2=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(W),N2=pt(M2);function O2(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 R2=Cd(Nn(300,.5,0),Nn(-240,.5,1));var L2=Cd(Nn(-100,.75,.35),Nn(80,1.5,.8)),F2=Cd(Nn(260,.75,.35),Nn(80,1.5,.8)),D2=Nn();function k2(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return D2.h=360*e-100,D2.s=1.5-1.5*t,D2.l=.8-.9*t,D2+""}var C2=vr(),Nnt=Math.PI/3,Ont=Math.PI*2/3;function B2(e){var t;return e=(.5-e)*Math.PI,C2.r=255*(t=Math.sin(e))*t,C2.g=255*(t=Math.sin(e+Nnt))*t,C2.b=255*(t=Math.sin(e+Ont))*t,C2+""}function P2(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 U2(e){var t=e.length;return function(r){return e[Math.max(0,Math.min(t-1,Math.floor(r*t)))]}}var $2=U2(W("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),z2=U2(W("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),j2=U2(W("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),q2=U2(W("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function hr(e){return function(){return e}}var U6=Math.cos;var lh=Math.min,Eg=Math.sin,fe=Math.sqrt,$6=1e-12,Zu=Math.PI,jVt=Zu/2,uh=2*Zu;function V2(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 Gc(t)}var WVt=Array.prototype.slice;function Y2(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function VU(e){this._context=e}VU.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 VU(e)}function W2(e){return e[0]}function G2(e){return e[1]}function Mg(e,t){var r=hr(!0),n=null,i=Va,o=null,s=V2(a);e=typeof e=="function"?e:e===void 0?W2:hr(e),t=typeof t=="function"?t:t===void 0?G2:hr(t);function a(c){var l,u=(c=Y2(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 fh(e,t,r){var n=null,i=hr(!0),o=null,s=Va,a=null,c=V2(l);e=typeof e=="function"?e:e===void 0?W2:hr(+e),t=typeof t=="function"?t:t===void 0?hr(0):hr(+t),r=typeof r=="function"?r:r===void 0?G2:hr(+r);function l(f){var d,h,p,m=(f=Y2(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 Mg().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 X2=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 z6(e){return new X2(e,!0)}function j6(e){return new X2(e,!1)}var Rnt=fe(3),Ng={draw(e,t){let r=fe(t+lh(t/28,.75))*.59436,n=r/2,i=n*Rnt;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=fe(t/Zu);e.moveTo(r,0),e.arc(0,0,r,0,uh)}};var Og={draw(e,t){let r=fe(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 YU=fe(1/3),Dnt=YU*2,Rg={draw(e,t){let r=fe(t/Dnt),n=r*YU;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}};var Dg={draw(e,t){let r=fe(t)*.62625;e.moveTo(0,-r),e.lineTo(r,0),e.lineTo(0,r),e.lineTo(-r,0),e.closePath()}};var Lg={draw(e,t){let r=fe(t-lh(t/7,2))*.87559;e.moveTo(-r,0),e.lineTo(r,0),e.moveTo(0,r),e.lineTo(0,-r)}};var Fg={draw(e,t){let r=fe(t),n=-r/2;e.rect(n,n,r,r)}};var kg={draw(e,t){let r=fe(t)*.4431;e.moveTo(r,r),e.lineTo(r,-r),e.lineTo(-r,-r),e.lineTo(-r,r),e.closePath()}};var Lnt=.8908130915292852,WU=Eg(Zu/10)/Eg(7*Zu/10),Fnt=Eg(uh/10)*WU,knt=-U6(uh/10)*WU,Cg={draw(e,t){let r=fe(t*Lnt),n=Fnt*r,i=knt*r;e.moveTo(0,-r),e.lineTo(n,i);for(let o=1;o<5;++o){let s=uh*o/5,a=U6(s),c=Eg(s);e.lineTo(c*r,-a*r),e.lineTo(a*n-c*i,c*n+a*i)}e.closePath()}};var q6=fe(3),Bg={draw(e,t){let r=-fe(t/(q6*3));e.moveTo(0,r*2),e.lineTo(-q6*r,-r),e.lineTo(q6*r,-r),e.closePath()}};var Cnt=fe(3),Pg={draw(e,t){let r=fe(t)*.6824,n=r/2,i=r*Cnt/2;e.moveTo(0,-r),e.lineTo(i,n),e.lineTo(-i,n),e.closePath()}};var Gi=-.5,Xi=fe(3)/2,V6=1/fe(12),Bnt=(V6/2+1)*3,Ug={draw(e,t){let r=fe(t/Bnt),n=r/2,i=r*V6,o=n,s=r*V6+r,a=-o,c=s;e.moveTo(n,i),e.lineTo(o,s),e.lineTo(a,c),e.lineTo(Gi*n-Xi*i,Xi*n+Gi*i),e.lineTo(Gi*o-Xi*s,Xi*o+Gi*s),e.lineTo(Gi*a-Xi*c,Xi*a+Gi*c),e.lineTo(Gi*n+Xi*i,Gi*i-Xi*n),e.lineTo(Gi*o+Xi*s,Gi*s-Xi*o),e.lineTo(Gi*a+Xi*c,Gi*c-Xi*a),e.closePath()}};var dh={draw(e,t){let r=fe(t-lh(t/6,1.7))*.6189;e.moveTo(-r,-r),e.lineTo(r,r),e.moveTo(-r,r),e.lineTo(r,-r)}};var H2=[Ya,Og,Rg,Fg,Cg,Bg,Ug],Y6=[Ya,Lg,dh,Pg,Ng,kg,Dg];function Hi(){}function hh(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 $g(e){this._context=e}$g.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:hh(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:hh(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function W6(e){return new $g(e)}function GU(e){this._context=e}GU.prototype={areaStart:Hi,areaEnd:Hi,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:hh(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function G6(e){return new GU(e)}function XU(e){this._context=e}XU.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:hh(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function X6(e){return new XU(e)}function HU(e,t){this._basis=new $g(e),this._beta=t}HU.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 H6=function e(t){function r(n){return t===1?new $g(n):new HU(n,t)}return r.beta=function(n){return e(+n)},r}(.85);function ph(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 Q2(e,t){this._context=e,this._k=(1-t)/6}Q2.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:ph(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:ph(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 Q6=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:Hi,areaEnd:Hi,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:ph(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 Z6=function e(t){function r(n){return new Z2(n,t)}return r.tension=function(n){return e(+n)},r}(0);function K2(e,t){this._context=e,this._k=(1-t)/6}K2.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:ph(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 K6=function e(t){function r(n){return new K2(n,t)}return r.tension=function(n){return e(+n)},r}(0);function zg(e,t,r){var n=e._x1,i=e._y1,o=e._x2,s=e._y2;if(e._l01_a>$6){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>$6){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 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(){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:zg(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 J6=function e(t){function r(n){return t?new QU(n,t):new Q2(n,0)}return r.alpha=function(n){return e(+n)},r}(.5);function ZU(e,t){this._context=e,this._alpha=t}ZU.prototype={areaStart:Hi,areaEnd:Hi,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){if(e=+e,t=+t,this._point){var 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:zg(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 t4=function e(t){function r(n){return t?new ZU(n,t):new Z2(n,0)}return r.alpha=function(n){return e(+n)},r}(.5);function KU(e,t){this._context=e,this._alpha=t}KU.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:zg(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 e4=function e(t){function r(n){return t?new KU(n,t):new K2(n,0)}return r.alpha=function(n){return e(+n)},r}(.5);function JU(e){this._context=e}JU.prototype={areaStart:Hi,areaEnd:Hi,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function r4(e){return new JU(e)}function t$(e){return e<0?-1:1}function e$(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(t$(o)+t$(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(a))||0}function r$(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function n4(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 J2(e){this._context=e}J2.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:n4(this,this._t0,r$(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,n4(this,r$(this,r=e$(this,e,t)),r);break;default:n4(this,this._t0,r=e$(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function n$(e){this._context=new i$(e)}(n$.prototype=Object.create(J2.prototype)).point=function(e,t){J2.prototype.point.call(this,t,e)};function i$(e){this._context=e}i$.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 i4(e){return new J2(e)}function o4(e){return new n$(e)}function s$(e){this._context=e}s$.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=o$(e),i=o$(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 o$(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 s4(e){return new s$(e)}function tS(e,t){this._context=e,this._t=t}tS.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 a4(e){return new tS(e,.5)}function c4(e){return new tS(e,0)}function l4(e){return new tS(e,1)}var jg=e=>()=>e;function u4(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 qg=new gi(1,0,0);f4.prototype=gi.prototype;function f4(e){for(;!e.__zoom;)if(!(e=e.parentNode))return qg;return e.__zoom}function eS(e){e.stopImmediatePropagation()}function mh(e){e.preventDefault(),e.stopImmediatePropagation()}function Pnt(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Unt(){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 a$(){return this.__zoom||qg}function $nt(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function znt(){return navigator.maxTouchPoints||"ontouchstart"in this}function jnt(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 d4(){var e=Pnt,t=Unt,r=jnt,n=$nt,i=znt,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=UM,l=Tu("start","zoom","end"),u,f,d,h=500,p=150,m=0,y=10;function g(I){I.property("__zoom",a$).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",a$),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(qg.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 u4(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=ln(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)],ss(this),O.start()}mh(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=ln(I,O),P=I.clientX,U=I.clientY;by(I.view),eS(I),L.mouse=[C,this.__zoom.invert(C)],ss(this),L.start();function $(rt){if(mh(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]=ln(rt,O),L.mouse[1]),L.extent,s))}function X(rt){B.on("mousemove.zoom mouseup.zoom",null),_y(rt.view,L.moved),mh(rt),L.event(rt).end()}}function M(I,...N){if(e.apply(this,arguments)){var O=this.__zoom,L=ln(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);mh(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(eS(I),P=0;P<L;++P)U=O[P],$=ln(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)),ss(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(mh(I),C=0;C<B;++C)P=L[C],U=ln(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(eS(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=ln(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:jg(+I),g):n},g.filter=function(I){return arguments.length?(e=typeof I=="function"?I:jg(!!I),g):e},g.touchable=function(I){return arguments.length?(i=typeof I=="function"?I:jg(!!I),g):i},g.extent=function(I){return arguments.length?(t=typeof I=="function"?I:jg([[+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 Pr(e,t){return+Pe(t)-+Pe(e)||Ft(e,t)}function Ku(e,t){return+Pe(t)-+Pe(e)||In(e,t)}function Vg(e){return e!=null&&`${e}`!=""}function yh(e){return isFinite(e)?e:NaN}function Cn(e){return e>0&&isFinite(e)?e:NaN}function rl(e){return e<0&&isFinite(e)?e:NaN}function gh(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`${qnt(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 qnt(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 Vnt=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function Yg(e,t){return Vnt.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 In(t,r)}var bh=1e3,il=bh*60,ol=il*60,_s=ol*24,bs=_s*7,Ju=_s*30,nl=_s*365,h4=[["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",bh],["5 seconds",5*bh],["15 seconds",15*bh],["30 seconds",30*bh],["minute",il],["5 minutes",5*il],["15 minutes",15*il],["30 minutes",30*il],["hour",ol],["3 hours",3*ol],["6 hours",6*ol],["12 hours",12*ol],["day",_s],["2 days",2*_s],["week",bs],["2 weeks",2*bs],["month",Ju],["3 months",3*Ju],["6 months",6*Ju],["year",nl],["2 years",2*nl],["5 years",5*nl],["10 years",10*nl],["20 years",20*nl],["50 years",50*nl],["100 years",100*nl]],p4=new Map([["second",bh],["minute",il],["hour",ol],["day",_s],["monday",bs],["tuesday",bs],["wednesday",bs],["thursday",bs],["friday",bs],["saturday",bs],["sunday",bs],["week",bs],["month",Ju],["year",nl]]),l$=new Map([["second",Cr],["minute",Pa],["hour",$a],["day",Wi],["monday",tl],["tuesday",bv],["wednesday",_v],["thursday",ys],["friday",wv],["saturday",vv],["sunday",mi],["week",mi],["month",ja],["year",pn]]),m4=new Map([["second",Cr],["minute",Ua],["hour",za],["day",Xu],["monday",el],["tuesday",Sv],["wednesday",Iv],["thursday",gs],["friday",Tv],["saturday",Av],["sunday",yi],["week",yi],["month",qa],["year",mn]]),_h=Symbol("intervalDuration"),nS=Symbol("intervalType");for(let[e,t]of l$)t[_h]=p4.get(e),t[nS]="time";for(let[e,t]of m4)t[_h]=p4.get(e),t[nS]="utc";var Wg=[["year",mn,"utc"],["month",qa,"utc"],["day",Xu,"utc",6*Ju],["hour",za,"utc",3*_s],["minute",Ua,"utc",6*ol],["second",Cr,"utc",30*il]],rS=[["year",pn,"time"],["month",ja,"time"],["day",Wi,"time",6*Ju],["hour",$a,"time",3*_s],["minute",Pa,"time",6*ol],["second",Cr,"time",30*il]],Ynt=[Wg[0],rS[0],Wg[1],rS[1],Wg[2],rS[2],...Wg.slice(3)];function iS(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=m4.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 Gg(e){return u$(iS(e),"time")}function tf(e){return u$(iS(e),"utc")}function u$([e,t],r){let n=(r==="time"?l$:m4).get(e);return t>1&&(n=n.every(t),n[_h]=p4.get(e)*t,n[nS]=r),n}function y4(e,t){if(!(t>1))return;let r=e[_h];if(!h4.some(([,i])=>i===r)||r%_s===0&&_s<r&&r<Ju)return;let[n]=h4[Io(([,i])=>Math.log(i)).center(h4,Math.log(r*t))];return(e[nS]==="time"?Gg:tf)(n)}function c$(e,t,r){let n=t==="time"?sh:xs;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=Wnt(r);switch(e){case"millisecond":return xh(n(".%L"),n(":%M:%S"),i);case"second":return xh(n(":%S"),n("%-I:%M"),i);case"minute":return xh(n("%-I:%M"),n("%p"),i);case"hour":return xh(n("%-I %p"),n("%b %-d"),i);case"day":return xh(n("%-d"),n("%b"),i);case"month":return xh(n("%b"),n("%Y"),i);case"year":return n("%Y")}throw new Error("unable to format time ticks")}function Wnt(e){return e==="left"||e==="right"?(t,r)=>`
|
|
12
|
-
${t}
|
|
13
|
-
${r}`:e==="top"?(t,r)=>`${r}
|
|
14
|
-
${t}`:(t,r)=>`${t}
|
|
15
|
-
${r}`}function Gnt(e){return e==="time"?rS:e==="utc"?Wg:Ynt}function f$(e,t,r){let n=Xt(K_(t,(i,o)=>Math.abs(o-i)));if(n<1e3)return c$("millisecond","utc",r);for(let[i,o,s,a]of Gnt(e)){if(n>a||i==="hour"&&!n)break;if(t.every(c=>o.floor(c)>=c))return c$(i,s,r)}}function xh(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 Xg=Object.getPrototypeOf(Uint8Array),Xnt=Object.prototype.toString;function Zn(e){return e instanceof Array||e instanceof Xg}function h$(e){return e instanceof Xg&&!Hnt(e)}function p$(e){return e?.prototype instanceof Xg&&!Qnt(e)}function Hnt(e){return e instanceof BigInt64Array||e instanceof BigUint64Array}function Qnt(e){return e===BigInt64Array||e===BigUint64Array}var x4=Symbol("reindex");function _t(e,t,r){let n=typeof t;return n==="string"?A$(e)?b4(e.getChild(t),r):d$(e,_4(t),r):n==="function"?d$(e,t,r):n==="number"||t instanceof Date||n==="boolean"?Ht(e,Ye(t),r):typeof t?.transform=="function"?g4(t.transform(e),r):Znt(g4(t,r),e?.[x4])}function Znt(e,t){return e!=null&&t?Qg(e,t):e}function d$(e,t,r){return Ht(e,p$(r)?(n,i)=>w4(t(n,i)):t,r)}function g4(e,t){return t===void 0?xi(e):E$(e)?b4(e,t):e instanceof t?e:t.from(e,p$(t)&&!h$(e)?w4:void 0)}function b4(e,t){return e==null?e:(t===void 0||t===Array)&&tit(e.type)?v4(e.toArray()):g4(e.toArray(),t)}var sl=[null],_4=e=>t=>{let r=t[e];return r===void 0&&t.type==="Feature"?t.properties?.[e]:r},Ee={transform:Bn},G={transform:e=>e};var Hg=()=>1,m$=()=>!0,nr=e=>e==null?e:`${e}`,ie=e=>e==null?e:+e;var ef=e=>e?e[0]:void 0,al=e=>e?e[1]:void 0,y$=e=>e?e[2]:void 0,Ye=e=>()=>e;function wh(e){let t=+`${e}`.slice(1)/100;return(r,n)=>En(r,t,n)}function pr(e){return h$(e)?e:Ht(e,w4,Float64Array)}function w4(e){return e==null?NaN:Number(e)}function v4(e){return Ht(e,S4)}function S4(e){return e instanceof Date&&!isNaN(e)?e:typeof e=="string"?Yg(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"]:fl(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 I4(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 Xa(e){return A$(e)?e:xi(e)}function xi(e){if(e==null||Zn(e))return e;if(E$(e))return b4(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 cl(e,t=Array){return e instanceof t?e.slice():t.from(e)}function T4({x:e,x1:t,x2:r}){return e!==void 0||t!==void 0||r!==void 0}function A4({y:e,y1:t,y2:r}){return e!==void 0||t!==void 0||r!==void 0}function Ha(e){return T4(e)||A4(e)||e.interval!==void 0}function Ur(e){return e?.toString===Xnt}function ws(e){return Ur(e)&&(e.type!==void 0||e.domain!==void 0)}function bi(e){return Ur(e)&&typeof e.transform!="function"}function vs(e){return bi(e)&&e.value===void 0&&e.channel===void 0}function E4(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?[ef,al]:[e,t]}function yn({z:e,fill:t,stroke:r}={}){return e===void 0&&([e]=qe(t)),e===void 0&&([e]=qe(r)),e}function ll(e){return Zn(e)?e.length:e?.numRows}function Bn(e){let t=ll(e),r=new Uint32Array(t);for(let n=0;n<t;++n)r[n]=n;return r}function Qg(e,t){return Zn(e)?Ht(t,r=>e[r],e.constructor):Ht(t,r=>e.at(r))}function vh(e){return e.length===1?(t,r)=>e(Qg(r,t)):e}function Qa(e,t,r){return e.subarray?e.subarray(t,r):e.slice(t,r)}function Qi(e){return e!==null&&typeof e=="object"?e.valueOf():e}function oS(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 $r(e){let t;return[{transform:()=>t,label:nn(e)},r=>t=r]}function rn(e){return e==null?[e]:$r(e)}function nn(e,t){return typeof e=="string"?e:e&&e.label!==void 0?e.label:t}function Sh(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 rf(e,t){let r=M4(t?.interval,t?.type);return r?Ht(e,r):e}function M4(e,t){let r=Ih(e,t);return r&&(n=>Pe(n)?r.floor(n):n)}function Ih(e,t){if(e!=null){if(typeof e=="number")return N4(e);if(typeof e=="string")return(t==="time"?Gg:tf)(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 N4(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 Ss(e,t){if(e=Ih(e,t),e&&typeof e.range!="function")throw new Error("invalid interval: missing range method");return e}function g$(e,t){if(e=Ss(e,t),e&&typeof e.ceil!="function")throw new Error("invalid interval: missing ceil method");return e}function x$(e){return ul(e)&&typeof e?.floor=="function"&&e.floor()instanceof Date}function ul(e){return typeof e?.range=="function"}function Zi(e){return e===void 0||bi(e)?e:{value:e}}function b$(e){return e==null?null:{transform:t=>_t(t,e,Float64Array),label:nn(e)}}function _$(e){if(!Pn(e))return!1;for(let t of e)if(t!=null)return typeof t=="object"&&"0"in t&&"1"in t}function Pn(e){return e&&typeof e[Symbol.iterator]=="function"}function sS(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 w$(e){for(let t of e)if(t!=null)return typeof t=="string"&&isNaN(t)&&Yg(t)}function v$(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 aS(e,t){let r;for(let n of e)if(n!=null){if(!t(n))return!1;r=!0}return r}var Knt=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 fl(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)||Knt.has(e))}function S$(e){return typeof e=="number"&&(0<=e&&e<=1||isNaN(e))}function de(e){return e==null||Ka(e)}function Ka(e){return/^\s*none\s*$/i.test(e)}function I$(e){return/^\s*round\s*$/i.test(e)}function cS(e,t){return I4(e,t,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function Is(e="middle"){return cS(e,"frameAnchor")}function T$(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 Jnt(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 Zg(e){return Pn(e)?Jnt(e):e}function lS(e){return e===!0?e="frame":e===!1?e=null:e!=null&&(e=Ir(e,"clip",["frame","sphere"])),e}function A$(e){return e&&typeof e.getChild=="function"&&typeof e.toArray=="function"&&e.schema&&Array.isArray(e.schema.fields)}function E$(e){return e&&typeof e.toArray=="function"&&e.type}function tit(e){return e&&(e.typeId===8||e.typeId===10)&&e.unit===1}var Ki=Symbol("position"),_i=Symbol("color"),nf=Symbol("radius"),of=Symbol("length"),sf=Symbol("opacity"),Th=Symbol("symbol"),M$=Symbol("projection"),_e=new Map([["x",Ki],["y",Ki],["fx",Ki],["fy",Ki],["r",nf],["color",_i],["opacity",sf],["symbol",Th],["length",of],["projection",M$]]);function N$(e){return e===Ki||e===M$}function O$(e){return e===Ki||e===nf||e===of||e===sf}var O4=Math.sqrt(3),R4=2/O4,eit={draw(e,t){let r=Math.sqrt(t/Math.PI),n=r*R4,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()}},D4=new Map([["asterisk",Ng],["circle",Ya],["cross",Og],["diamond",Rg],["diamond2",Dg],["hexagon",eit],["plus",Lg],["square",Fg],["square2",kg],["star",Cg],["times",dh],["triangle",Bg],["triangle2",Pg],["wye",Ug]]);function L4(e){return e&&typeof e.draw=="function"}function R$(e){return L4(e)?!0:typeof e!="string"?!1:D4.has(e.toLowerCase())}function Ah(e){if(e==null||L4(e))return e;let t=D4.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid symbol: ${e}`)}function D$(e){if(e==null||L4(e))return[void 0,e];if(typeof e=="string"){let t=D4.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=C4(e)),t!=null&&!vs(t)&&(n=F4(n,P4(t))),r&&(n=F4(n,B4))),s!=null&&i!=null)throw new Error("transforms cannot be applied after initializers");return{...o,...(t===null||vs(t))&&{sort:t},transform:F4(n,s)}}function Ne({filter:e,sort:t,reverse:r,initializer:n,...i}={},o){return n===void 0&&(e!=null&&(n=C4(e)),t!=null&&!vs(t)&&(n=k4(n,P4(t))),r&&(n=k4(n,B4))),{...i,...(t===null||vs(t))&&{sort:t},initializer:k4(n,o)}}function F4(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 k4(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 uS(e,t){return(e.initializer!=null?Ne:mr)(e,t)}function L$(e,t){return uS(t,C4(e))}function C4(e){return(t,r)=>{let n=_t(t,e);return{data:t,facets:r.map(i=>i.filter(o=>n[o]))}}}function F$({sort:e,...t}={}){return{...uS(t,B4),sort:vs(e)?e:null}}function B4(e,t){return{data:e,facets:t.map(r=>r.slice().reverse())}}function k$({seed:e,sort:t,...r}={}){return{...uS(r,C$(e==null?Math.random:ju(e))),sort:vs(t)?t:null}}function fS(e,{sort:t,...r}={}){return{...(bi(e)&&e.channel!==void 0?Ne:uS)(r,P4(e)),sort:vs(t)?t:null}}function P4(e){return(typeof e=="function"&&e.length!==1?rit:C$)(e)}function rit(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 C$(e){let t,r;({channel:t,value:e,order:r}={...Zi(e)});let n=t?.startsWith("-");if(n&&(t=t.slice(1)),r===void 0&&(r=n?Ku:Pr),typeof r!="function")switch(`${r}`.toLowerCase()){case"ascending":r=Pr;break;case"descending":r=Ku;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 Jg(e,t){return dS(null,null,e,t)}function dl(e={y:"count"},t={}){let{x:r=G}=t;if(r==null)throw new Error("missing channel: x");return dS(r,null,e,t)}function hl(e={x:"count"},t={}){let{y:r=G}=t;if(r==null)throw new Error("missing channel: y");return dS(null,r,e,t)}function t0(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 dS(r,n,e,t)}function dS(e,t,{data:r=mS,filter:n,sort:i,reverse:o,...s}={},a={}){s=$4(s,a),r=z$(r,G),i=i==null?void 0:U$("sort",i,a),n=n==null?void 0:$$("filter",n,a);let[c,l]=rn(e),[u,f]=rn(t),{z:d,fill:h,stroke:p,x1:m,x2:y,y1:g,y2:x,...b}=a,[_,v]=rn(d),[w]=qe(h),[S]=qe(p),[A,E]=rn(w),[M,T]=rn(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=rf(_t(R,e),I?.x),O=rf(_t(R,t),I?.y),L=_t(R,d),B=_t(R,w),C=_t(R,S),P=e0(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 Ts(q,P))for(let[Pt,ht]of Ts(z,O))for(let[Kt,Jt]of Ts(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 z4(U,i,o),{data:$,facets:U}}),...!As(s,"x")&&(c?{x:c}:{x1:m,x2:y}),...!As(s,"y")&&(u?{y:u}:{y1:g,y2:x}),...Object.fromEntries(s.map(({name:R,output:k})=>[R,k]))}}function As(e,...t){for(let{name:r}of e)if(t.includes(r))return!0;return!1}function U4(e,t,r=hS){let n=Object.entries(e);return t.title!=null&&e.title===void 0&&n.push(["title",cit]),t.href!=null&&e.href===void 0&&n.push(["href",yS]),n.filter(([,i])=>i!==void 0).map(([i,o])=>o===null?nit(i):r(i,o,t))}function hS(e,t,r,n=pS){let i;Ur(t)&&"reduce"in t&&(i=t.scale,t=t.reduce);let o=n(e,t,r),[s,a]=$r(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 nit(e){return{name:e,initialize(){},scope(){},reduce(){}}}function pS(e,t,r,n=Eh){let i=oS(e,r),o=n(t,i),s,a;return{label:nn(o===Kg?null:i,o.label),initialize(c){s=i===void 0?c:_t(c,i),o.scope==="data"&&(a=o.reduceIndex(Bn(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 Ts(e,t){return t?Kr(e,r=>t[r]):[[,e]]}function Eh(e,t,r=iit){if(e==null)return r(e);if(typeof e.reduceIndex=="function")return e;if(typeof e.reduce=="function"&&Ur(e))return sit(e);if(typeof e=="function")return ait(e);if(/^p\d{2}$/i.test(e))return Ja(wh(e));switch(`${e}`.toLowerCase()){case"first":return yS;case"last":return lit;case"identity":return mS;case"count":return Kg;case"distinct":return uit;case"sum":return t==null?Kg:fit;case"proportion":return P$(t,"data");case"proportion-facet":return P$(t,"facet");case"deviation":return Ja($i);case"min":return Ja(Qt);case"min-index":return Ja(H_);case"max":return Ja(Xt);case"max-index":return Ja(X_);case"mean":return B$(Ea);case"median":return B$(Ao);case"variance":return Ja($c);case"mode":return Ja(Od)}return r(e)}function iit(e){throw new Error(`invalid reduce: ${e}`)}function $4(e,t){return U4(e,t,U$)}function U$(e,t,r){return hS(e,t,r,$$)}function $$(e,t,r){return pS(e,t,r,z$)}function z$(e,t){return Eh(e,t,oit)}function oit(e){switch(`${e}`.toLowerCase()){case"x":return dit;case"y":return hit;case"z":return j4}throw new Error(`invalid group reduce: ${e}`)}function e0(e,t){for(let r in t){let n=t[r];if(n!==void 0&&!e.some(i=>i.name===r))return n}}function z4(e,t,r){if(t){let n=t.output.transform(),i=(o,s)=>Pr(n[o],n[s]);e.forEach(o=>o.sort(i))}r&&e.forEach(n=>n.reverse())}function sit(e){return console.warn("deprecated reduce interface; implement reduceIndex instead."),{...e,reduceIndex:e.reduce.bind(e)}}function ait(e){return{reduceIndex(t,r,n){return e(Qg(r,t),n)}}}function Ja(e){return{reduceIndex(t,r){return e(t,n=>r[n])}}}function B$(e){return{reduceIndex(t,r){let n=e(t,i=>r[i]);return Ve(r)?new Date(n):n}}}var mS={reduceIndex(e,t){return Qg(t,e)}},yS={reduceIndex(e,t){return t[e[0]]}},cit={reduceIndex(e,t){let n=Ta(To(e,o=>o.length,o=>t[o]),al),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,al)]}return i.map(([o,s])=>`${o} (${s.toLocaleString("en-US")})`).join(`
|
|
16
|
-
`)}},lit={reduceIndex(e,t){return t[e[e.length-1]]}},Kg={label:"Frequency",reduceIndex(e){return e.length}},uit={label:"Distinct",reduceIndex(e,t){let r=new An;for(let n of e)r.add(t[n]);return r.size}},fit=Ja(wr);function P$(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 dit={reduceIndex(e,t,{x:r}){return r}},hit={reduceIndex(e,t,{y:r}){return r}},j4={reduceIndex(e,t,{z:r}){return r}};function j$(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 Mh(e,{scale:t,type:r,value:n,filter:i,hint:o,label:s=nn(n)},a){return o===void 0&&typeof n?.transform=="function"&&(o=n.hint),V4(a,{scale:t,type:r,value:_t(e,n),label:s,filter:i,hint:o})}function gS(e,t){return Object.fromEntries(Object.entries(e).map(([r,n])=>[r,Mh(t,n,r)]))}function Nh(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 V4(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&&aS(n,fl)?null:"color",t.defaultScale="color";break;case"fillOpacity":case"strokeOpacity":case"opacity":t.scale=r!==!0&&aS(n,S$)?null:"opacity",t.defaultScale="opacity";break;case"symbol":r!==!0&&aS(n,R$)?(t.scale=null,t.value=Ht(n,Ah)):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 V$(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}=Zi(i[l]),m=u?.startsWith("-");if(m&&(u=u.slice(1)),f=f===void 0?m!==(u==="width"||u==="height")?W$:Y$:yit(f),h==null||h===!1)continue;let y=l==="fx"||l==="fy"?mit(t,n[l]):pit(r,l);if(!y)throw new Error(`missing channel for scale: ${l}`);let g=y.value,[x=0,b=1/0]=Pn(p)?p:p<0?[p]:[0,p];if(u==null)y.domain=()=>{let _=Array.from(new An(g));return d&&(_=_.reverse()),(x!==0||b!==1/0)&&(_=_.slice(x,b)),_};else{let _=u==="data"?e:u==="height"?q$(r,"y1","y2"):u==="width"?q$(r,"x1","x2"):q4(r,u,u==="y"?"y2":u==="x"?"x2":void 0),v=Eh(h===!0?"max":h,_);y.domain=()=>{let w=pM(Bn(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(ef)}}}}function pit(e,t){for(let r in e){let n=e[r];if(n.scale===t)return n}}function mit(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 q$(e,t,r){let n=q4(e,t),i=q4(e,r);return Ht(i,(o,s)=>Math.abs(o-n[s]),Float64Array)}function q4(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 yit(e){if(e==null||typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"ascending":return Y$;case"descending":return W$}throw new Error(`invalid order: ${e}`)}function Y$([e,t],[r,n]){return Pr(t,n)||Pr(e,r)}function W$([e,t],[r,n]){return Ku(t,n)||Pr(e,r)}function r0(e,t){let r=e[t];if(r){for(;r.source;)r=r.source;return r.source===null?null:r}}var Z$=new Map([["accent",N6],["category10",M6],["dark2",O6],["observable10",R6],["paired",D6],["pastel1",L6],["pastel2",F6],["set1",k6],["set2",C6],["set3",B6],["tableau10",P6]]);function K$(e){return e!=null&&Z$.has(`${e}`.toLowerCase())}var G$=new Map([...Z$,["brbg",tc(Fv,kv)],["prgn",tc(Cv,Bv)],["piyg",tc(Pv,Uv)],["puor",tc($v,zv)],["rdbu",tc(Tg,ah)],["rdgy",tc(jv,qv)],["rdylbu",tc(Ag,ch)],["rdylgn",tc(Vv,Yv)],["spectral",tc(Wv,Gv)],["burd",X$(Tg,ah)],["buylrd",X$(Ag,ch)],["blues",zr(x2,b2)],["greens",zr(_2,w2)],["greys",zr(v2,S2)],["oranges",zr(M2,N2)],["purples",zr(I2,T2)],["reds",zr(A2,E2)],["turbo",ec(P2)],["viridis",ec($2)],["magma",ec(z2)],["inferno",ec(j2)],["plasma",ec(q2)],["cividis",ec(O2)],["cubehelix",ec(R2)],["warm",ec(L2)],["cool",ec(F2)],["bugn",zr(Xv,Hv)],["bupu",zr(Qv,Zv)],["gnbu",zr(Kv,Jv)],["orrd",zr(t2,e2)],["pubu",zr(i2,o2)],["pubugn",zr(r2,n2)],["purd",zr(s2,a2)],["rdpu",zr(c2,l2)],["ylgn",zr(d2,h2)],["ylgnbu",zr(u2,f2)],["ylorbr",zr(p2,m2)],["ylorrd",zr(y2,g2)],["rainbow",H$(k2)],["sinebow",H$(B2)]]);function zr(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?un(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?un(t,r):e[r])}function X$(e,t){return({length:r})=>r===2?[e[3][2],e[3][0]]:(r=Math.max(3,Math.floor(r)),r>11?un(n=>t(1-n),r):e[r].slice().reverse())}function ec(e){return({length:t})=>un(e,Math.max(2,Math.floor(t)))}function H$(e){return({length:t})=>un(e,Math.floor(t)+1).slice(0,-1)}function Y4(e){let t=`${e}`.toLowerCase();if(!G$.has(t))throw new Error(`unknown ordinal scheme: ${t}`);return G$.get(t)}function n0(e,t){let r=Y4(e),n=typeof r=="function"?r({length:t}):r;return n.length!==t?n.slice(0,t):n}function J$(e,t="greys"){let r=new Set,[n,i]=n0(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 Q$=new Map([["brbg",kv],["prgn",Bv],["piyg",Uv],["puor",zv],["rdbu",ah],["rdgy",qv],["rdylbu",ch],["rdylgn",Yv],["spectral",Gv],["burd",e=>ah(1-e)],["buylrd",e=>ch(1-e)],["blues",b2],["greens",w2],["greys",S2],["purples",T2],["reds",E2],["oranges",N2],["turbo",P2],["viridis",$2],["magma",z2],["inferno",j2],["plasma",q2],["cividis",O2],["cubehelix",R2],["warm",L2],["cool",F2],["bugn",Hv],["bupu",Zv],["gnbu",Jv],["orrd",e2],["pubugn",n2],["pubu",o2],["purd",a2],["rdpu",l2],["ylgnbu",f2],["ylgn",h2],["ylorbr",m2],["ylorrd",g2],["rainbow",k2],["sinebow",B2]]);function Oh(e){let t=`${e}`.toLowerCase();if(!Q$.has(t))throw new Error(`unknown quantitative scheme: ${t}`);return Q$.get(t)}var git=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function tz(e){return e!=null&&git.has(`${e}`.toLowerCase())}var G4=e=>t=>e(1-t),W4=[0,1],ez=new Map([["number",Fe],["rgb",zi],["hsl",$M],["hcl",zM],["lab",gw]]);function X4(e){let t=`${e}`.toLowerCase();if(!ez.has(t))throw new Error(`unknown interpolator: ${t}`);return ez.get(t)}function Dh(e,t,r,{type:n,nice:i,clamp:o,zero:s,domain:a=lz(e,r),unknown:c,round:l,scheme:u,interval:f,range:d=_e.get(e)===nf?wit(r,a):_e.get(e)===of?vit(r,a):_e.get(e)===sf?W4:void 0,interpolate:h=_e.get(e)===_i?u==null&&d!==void 0?zi:Oh(u!==void 0?u:n==="cyclical"?"rainbow":"turbo"):l?Ru:Fe,reverse:p}){if(f=Ss(f,n),(n==="cyclical"||n==="sequential")&&(n="linear"),typeof h!="function"&&(h=X4(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=os(h,d),d=void 0}}if(h.length===1?(p&&(h=G4(h),p=!1),d===void 0&&(d=Float64Array.from(a,(m,y)=>y/(a.length-1)),d.length===2&&(d=W4)),t.interpolate((d===W4?Ye:i0)(h))):t.interpolate(h),s){let[m,y]=le(a);(m>0||y<0)&&(a=cl(a),(Ga(a)||1)===Math.sign(m)?a[0]=0:a[a.length-1]=0)}return p&&(a=jc(a)),t.domain(a).unknown(c),i&&(t.nice(xit(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 xit(e,t){return e===!0?void 0:typeof e=="number"?e:g$(e,t)}function rz(e,t,r){return Dh(e,Ba(),t,r)}function nz(e,t,r){return H4(e,t,{...r,exponent:.5})}function H4(e,t,{exponent:r=1,...n}){return Dh(e,pg().exponent(r),t,{...n,type:"pow"})}function iz(e,t,{base:r=10,domain:n=Sit(t),...i}){return Dh(e,dg().base(r),t,{...i,domain:n})}function oz(e,t,{constant:r=1,...n}){return Dh(e,hg().constant(r),t,n)}function sz(e,t,{range:r,quantiles:n=r===void 0?5:(r=[...r]).length,n:i=n,scheme:o="rdylbu",domain:s=Iit(t),unknown:a,interpolate:c,reverse:l}){return r===void 0&&(r=c!==void 0?un(c,i):_e.get(e)===_i?n0(o,i):void 0),s.length>0&&(s=mg(s,r===void 0?{length:i}:r).quantiles()),xS(e,t,{domain:s,range:r,reverse:l,unknown:a})}function az(e,t,{range:r,n=r===void 0?5:(r=[...r]).length,scheme:i="rdylbu",domain:o=lz(e,t),unknown:s,interpolate:a,reverse:c}){let[l,u]=le(o),f;return r===void 0?(f=Jr(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?un(a,n):_e.get(e)===_i?n0(i,n):void 0):(f=un(Fe(l,u),n+1).slice(1,-1),l instanceof Date&&(f=f.map(d=>new Date(d)))),Ga(xi(o))<0&&f.reverse(),xS(e,t,{domain:f,range:r,reverse:c,unknown:s})}function xS(e,t,{domain:r=[0],unknown:n,scheme:i="rdylbu",interpolate:o,range:s=o!==void 0?un(o,r.length+1):_e.get(e)===_i?n0(i,r.length+1):void 0,reverse:a}){r=xi(r);let c=Ga(r);if(!isNaN(c)&&!bit(r,c))throw new Error(`the ${e} scale has a non-monotonic domain`);return a&&(s=jc(s)),{type:"threshold",scale:yg(c<0?jc(r):r,s===void 0?[]:s).unknown(n),domain:r,range:s}}function bit(e,t){for(let r=1,n=e.length,i=e[0];r<n;++r){let o=In(i,i=e[r]);if(o!==0&&o!==t)return!1}return!0}function cz(e){return{type:"identity",scale:O$(_e.get(e))?ug():t=>t}}function Rh(e,t=yh){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 lz(e,t){let r=_e.get(e);return(r===nf||r===sf||r===of?_it:Rh)(t)}function _it(e){return[0,e.length?Xt(e,({value:t})=>t===void 0?t:Xt(t,yh)):1]}function wit(e,t){let r=e.find(({radius:s})=>s!==void 0);if(r!==void 0)return[0,r.radius];let n=En(e,.5,({value:s})=>s===void 0?NaN:En(s,.25,Cn)),i=t.map(s=>3*Math.sqrt(s/n)),o=30/Xt(i);return o<1?i.map(s=>s*o):i}function vit(e,t){let r=Ao(e,({value:o})=>o===void 0?NaN:Ao(o,Math.abs)),n=t.map(o=>12*o/r),i=60/Xt(n);return i<1?n.map(o=>o*i):n}function Sit(e){for(let{value:t}of e)if(t!==void 0)for(let r of t){if(r>0)return Rh(e,Cn);if(r<0)return Rh(e,rl)}return[1,10]}function Iit(e){let t=[];for(let{value:r}of e)if(r!==void 0)for(let n of r)t.push(n);return t}function i0(e){return(t,r)=>n=>e(t+n*(r-t))}var Q4=0,Z4;function uz(){let e=Q4;return Q4=0,Z4=void 0,e}function gn(e){e!==Z4&&(Z4=e,console.warn(e),++Q4)}function bS(e,t,r,n,{type:i,nice:o,clamp:s,domain:a=Rh(n),unknown:c,pivot:l=0,scheme:u,range:f,symmetric:d=!0,interpolate:h=_e.get(e)===_i?u==null&&f!==void 0?zi:Oh(u!==void 0?u:"rdbu"):Fe,reverse:p}){l=+l,a=xi(a);let[m,y]=a;if(a.length>2&&gn(`Warning: the diverging ${e} scale domain contains extra elements.`),In(m,y)<0&&([m,y]=[y,m],p=!p),m=Math.min(m,l),y=Math.max(y,l),typeof h!="function"&&(h=X4(h)),f!==void 0&&(h=h.length===1?i0(h)(...f):os(h,f)),p&&(h=G4(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 fz(e,t,r){return bS(e,Ig(),Tit,t,r)}function dz(e,t,r){return K4(e,t,{...r,exponent:.5})}function K4(e,t,{exponent:r=1,...n}){return bS(e,Lv().exponent(r=+r),Mit(r),t,{...n,type:"diverging-pow"})}function hz(e,t,{base:r=10,pivot:n=1,domain:i=Rh(t,n<0?rl:Cn),...o}){return bS(e,Rv().base(r=+r),Ait,t,{domain:i,pivot:n,...o})}function pz(e,t,{constant:r=1,...n}){return bS(e,Dv().constant(r=+r),Nit(r),t,n)}var Tit={apply(e){return e},invert(e){return e}},Ait={apply:Math.log,invert:Math.exp},Eit={apply(e){return Math.sign(e)*Math.sqrt(Math.abs(e))},invert(e){return Math.sign(e)*(e*e)}};function Mit(e){return e===.5?Eit:{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 Nit(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 mz(e,t,r,n){return Dh(e,t,r,n)}function yz(e,t,r){return mz(e,Mv(),t,r)}function gz(e,t,r){return mz(e,Nv(),t,r)}var Lh=Symbol("ordinal");function bz(e,t,r,{type:n,interval:i,domain:o,range:s,reverse:a,hint:c}){return i=Ss(i,n),o===void 0&&(o=Iz(r,i,e)),(n==="categorical"||n===Lh)&&(n="ordinal"),a&&(o=jc(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 _z(e,t,{type:r,interval:n,domain:i,range:o,scheme:s,unknown:a,...c}){n=Ss(n,r),i===void 0&&(i=Iz(t,n,e));let l;if(_e.get(e)===Th)l=Oit(t),o=o===void 0?Rit(l):Ht(o,Ah);else if(_e.get(e)===_i&&(o===void 0&&(r==="ordinal"||r===Lh)&&(o=J$(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=Oh(s),f=o[0],d=o[1]-o[0];o=({length:h})=>un(p=>u(f+d*p),h)}else o=Y4(s);if(a===cg)throw new Error(`implicit unknown on ${e} scale is not supported`);return bz(e,qu().unknown(a),t,{...c,type:r,domain:i,range:o,hint:l})}function wz(e,t,{align:r=.5,padding:n=.5,...i}){return Sz(d6().align(r).padding(n),t,i,e)}function vz(e,t,{align:r=.5,padding:n=.1,paddingInner:i=n,paddingOuter:o=e==="fx"||e==="fy"?0:n,...s}){return Sz(Jc().align(r).paddingInner(i).paddingOuter(o),t,s,e)}function Sz(e,t,r,n){let{round:i}=r;return i!==void 0&&e.round(i=!!i),e=bz(n,e,t,r),e.round=i,e}function Iz(e,t,r){let n=new An;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]=le(n).map(t.floor,t);return t.range(i,t.offset(o))}if(n.size>1e4&&_e.get(r)===Ki)throw new Error(`implicit ordinal domain of ${r} scale has more than 10,000 values`);return Ta(n,Pr)}function xz(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 Oit(e){return{fill:xz(e,"fill"),stroke:xz(e,"stroke")}}function Rit(e){return de(e.fill)?Y6:H2}function o0(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],_=Dz(g,x,{round:_e.get(g)===Ki?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?Dit(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 tN(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]=Fz(i),r[n]=o,o.type=s,a!=null&&(o.interval=a),c!=null&&(o.label=c)}return r}function Nz(e,t){let{x:r,y:n,fx:i,fy:o}=e,s=i||o?vS(t):t;i&&Tz(i,s),o&&Az(o,s);let a=i||o?eN(e,t):t;r&&Tz(r,a),n&&Az(n,a)}function Dit(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!Es(t)&&t.percent&&(r=`${r} (%)`),{inferred:!0,toString:()=>r}}function wS(e){return Math.sign(Ga(e.domain()))*Math.sign(Ga(e.range()))}function vS(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 eN({fx:e,fy:t},r){let{marginTop:n,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=vS(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 Tz(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)],Es(e)||(e.range=Rz(e)),e.scale.range(e.range)}Oz(e)}function Az(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],Es(e)?e.range.reverse():e.range=Rz(e),e.scale.range(e.range)}Oz(e)}function Oz(e){e.round===void 0&&kit(e)&&Lit(e)<=30&&e.scale.round(!0)}function Lit({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 Rz(e){let t=e.scale.domain().length+rN(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 SS(e,t,r){return Dz(e,r===void 0?void 0:[{hint:r}],{...t})}function Dz(e,t=[],r={}){let n=Fit(e,t,r);if(r.type===void 0&&r.domain===void 0&&r.range===void 0&&r.interval==null&&e!=="fx"&&e!=="fy"&&Es({type:n})){let i=t.map(({value:o})=>o).filter(o=>o!==void 0);i.some(Ve)?gn(`Warning: some data associated with the ${e} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${Fh(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 "${Fh(n)}".`):i.some(w$)?gn(`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 "${Fh(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 "${Fh(n)}".`):i.some(v$)&&gn(`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 "${Fh(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 "${Fh(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=_S(t,r,pr);break;case"identity":switch(_e.get(e)){case Ki:r=_S(t,r,pr);break;case Th:r=_S(t,r,Cit);break}break;case"utc":case"time":r=_S(t,r,v4);break}switch(n){case"diverging":return fz(e,t,r);case"diverging-sqrt":return dz(e,t,r);case"diverging-pow":return K4(e,t,r);case"diverging-log":return hz(e,t,r);case"diverging-symlog":return pz(e,t,r);case"categorical":case"ordinal":case Lh:return _z(e,t,r);case"cyclical":case"sequential":case"linear":return rz(e,t,r);case"sqrt":return nz(e,t,r);case"threshold":return xS(e,t,r);case"quantile":return sz(e,t,r);case"quantize":return az(e,t,r);case"pow":return H4(e,t,r);case"log":return iz(e,t,r);case"symlog":return oz(e,t,r);case"utc":return gz(e,t,r);case"time":return yz(e,t,r);case"point":return wz(e,t,r);case"band":return vz(e,t,r);case"identity":return cz(e);case void 0:return;default:throw new Error(`unknown scale type: ${n}`)}}function Fh(e){return typeof e=="symbol"?e.description:e}function Ez(e){return typeof e=="string"?`${e}`.toLowerCase():e}var Mz={toString:()=>"projection"};function Fit(e,t,{type:r,domain:n,range:i,scheme:o,pivot:s,projection:a}){if(r=Ez(r),e==="fx"||e==="fy")return"band";(e==="x"||e==="y")&&a!=null&&(r=Mz);for(let l of t){let u=Ez(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===Mz)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===nf)return"sqrt";if(c===sf||c===of)return"linear";if(c===Th)return"ordinal";if((n||i||[]).length>2)return J4(c);if(n!==void 0){if(Ue(n))return J4(c);if(Ve(n))return"utc"}else{let l=t.map(({value:u})=>u).filter(u=>u!==void 0);if(l.some(Ue))return J4(c);if(l.some(Ve))return"utc"}if(c===_i){if(s!=null||tz(o))return"diverging";if(K$(o))return"categorical"}return"linear"}function J4(e){switch(e){case Ki:return"point";case _i:return Lh;default:return"ordinal"}}function Es({type:e}){return e==="ordinal"||e==="point"||e==="band"||e===Lh}function rN({type:e}){return e==="threshold"}function kit({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 _S(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 Cit(e){return Ht(e,Ah)}function pl(e={}){let t;for(let r in e)if(_e.has(r)&&ws(e[r])){if(t!==void 0)throw new Error("ambiguous scale definition; multiple scales found");t=Fz(SS(r,e[r]))}if(t===void 0)throw new Error("invalid scale definition; no scale found");return t}function Lz(e){return t=>{if(!_e.has(t=`${t}`))throw new Error(`unknown scale: ${t}`);return e[t]}}function Fz({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:cl(r),...n!==void 0&&{range:cl(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 Cz(e,t){let{fx:r,fy:n}=o0(e,t),i=r?.scale.domain(),o=n?.scale.domain();return i&&o?Y_(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 Bz(e,{x:t,y:r}){return t&&=aN(t),r&&=aN(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 TS(e,{fx:t,fy:r}){let n=Bn(e),i=t?.value,o=r?.value;return t&&r?To(n,s=>(s.fx=i[s[0]],s.fy=o[s[0]],s),s=>i[s],s=>o[s]):t?To(n,s=>(s.fx=i[s[0]],s),s=>i[s]):To(n,s=>(s.fy=o[s[0]],s),s=>o[s])}function Pz(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 Uz(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 Bit=new Map([["top",nN],["right",sN],["bottom",iN],["left",oN],["top-left",IS(nN,oN)],["top-right",IS(nN,sN)],["bottom-left",IS(iN,oN)],["bottom-right",IS(iN,sN)],["top-empty",Uit],["right-empty",jit],["bottom-empty",$it],["left-empty",zit],["empty",qit]]);function $z(e){if(e==null)return null;let t=Bit.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid facet anchor: ${e}`)}var kz=new WeakMap;function aN(e){let t=kz.get(e);return t||kz.set(e,t=new Tn(Ht(e,(r,n)=>[r,n]))),t}function ml(e,t){return aN(e).get(t)}function Pit(e,t,r){return t=Qi(t),r=Qi(r),e.find(n=>Object.is(Qi(n.x),t)&&Object.is(Qi(n.y),r))}function AS(e,t,r){return Pit(e,t,r)?.empty}function nN(e,{y:t},{y:r}){return t?ml(t,r)===0:!0}function iN(e,{y:t},{y:r}){return t?ml(t,r)===t.length-1:!0}function oN(e,{x:t},{x:r}){return t?ml(t,r)===0:!0}function sN(e,{x:t},{x:r}){return t?ml(t,r)===t.length-1:!0}function Uit(e,{y:t},{x:r,y:n,empty:i}){if(i)return!1;if(!t)return;let o=ml(t,n);if(o>0)return AS(e,r,t[o-1])}function $it(e,{y:t},{x:r,y:n,empty:i}){if(i)return!1;if(!t)return;let o=ml(t,n);if(o<t.length-1)return AS(e,r,t[o+1])}function zit(e,{x:t},{x:r,y:n,empty:i}){if(i)return!1;if(!t)return;let o=ml(t,r);if(o>0)return AS(e,t[o-1],n)}function jit(e,{x:t},{x:r,y:n,empty:i}){if(i)return!1;if(!t)return;let o=ml(t,r);if(o<t.length-1)return AS(e,t[o+1],n)}function qit(e,t,{empty:r}){return r}function IS(e,t){return function(){return e.apply(null,arguments)&&t.apply(null,arguments)}}function ES(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 zz=Math.PI,rc=2*zz,cN=.618;function jz({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(Ur(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}=lN(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=Vit(l,d,p,u-h,f-m);let x=d+o,b=p+r,_;if(c!=null){let[[v,w],[S,A]]=kr(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,_=$u({point(M,T){this.stream.point(M*E+x,T*E+b)}})):gn("Warning: the projection could not be fit to the specified domain; using the default scale.")}return _??=x===0&&b===0?qz():$u({point(v,w){this.stream.point(v+x,w+b)}}),{stream:v=>e.stream(_.stream(l(v)))}}function lN(e){switch(`${e}`.toLowerCase()){case"albers-usa":return Oo($3,.7463,.4673);case"albers":return MS(rg,.7463,.4673);case"azimuthal-equal-area":return Oo(j3,4,4);case"azimuthal-equidistant":return Oo(V3,rc,rc);case"conic-conformal":return MS(G3,rc,rc);case"conic-equal-area":return MS(Zc,6.1702,2.9781);case"conic-equidistant":return MS(H3,7.312,3.6282);case"equal-earth":return Oo(Z3,5.4133,2.6347);case"equirectangular":return Oo(X3,rc,zz);case"gnomonic":return Oo(J3,3.4641,3.4641);case"identity":return{type:qz};case"reflect-y":return{type:Yit};case"mercator":return Oo(Y3,rc,rc);case"orthographic":return Oo(e6,2,2);case"stereographic":return Oo(n6,2,2);case"transverse-mercator":return Oo(o6,rc,rc);default:throw new Error(`unknown projection type: ${e}`)}}function Vit(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 Hd(t,r,n,i);default:throw new Error(`unknown projection clip type: ${e}`)}}function Oo(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 MS(e,t,r){let{type:n,aspectRatio:i}=Oo(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 qz=Ye({stream:e=>e}),Yit=Ye($u({point(e,t){this.stream.point(e,-t)}}));function uN(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 Vz({projection:e}={}){return e==null?!1:typeof e.stream=="function"?!0:(Ur(e)&&(e=e.type),e!=null)}function Yz(e){if(typeof e?.stream=="function")return cN;if(Ur(e)){let t,r;if({domain:t,type:e,...r}=e,t!=null&&e!=null){let n=typeof e=="string"?lN(e).type:e,[[i,o],[s,a]]=kr(n({...r,width:100,height:100})).bounds(t),c=(a-o)/(s-i);return c&&isFinite(c)?c<.2?.2:c>5?5:c:cN}}if(e!=null){if(typeof e!="function"){let{aspectRatio:t}=lN(e);if(t)return t}return cN}}function Ms(e,t,{projection:r}){let{x:n,y:i}=e,o={};return n&&(o.x=n),i&&(o.y=i),o=Nh(o,t),r&&n?.scale==="x"&&i?.scale==="y"&&uN("x","y",o,r),n&&(o.x=pr(o.x)),i&&(o.y=pr(o.y)),o}function Wz(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 yl(e={}){let{document:t=typeof window<"u"?window.document:void 0,clip:r}=e;return{document:t,clip:lS(r)}}function lt(e,{document:t}){return Zt(Na(e).call(t.documentElement))}var NS=Symbol("unset");function gl(e){return(e.length===1?Wit:Git)(e)}function Wit(e){let t,r=NS;return n=>(Object.is(r,n)||(r=n,t=e(n)),t)}function Git(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 Xit=gl(e=>new Intl.NumberFormat(e)),Hit=gl((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{month:t}})),Qit=gl((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{weekday:t}}));function fN(e="en-US"){let t=Xit(e);return r=>r!=null&&!isNaN(r)?t.format(r):void 0}function Gz(e="en-US",t="short"){let r=Hit(e,t);return n=>n!=null&&!isNaN(n=+new Date(Date.UTC(2e3,+n)))?r.format(n):void 0}function Xz(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 dN(e){return gh(e,"Invalid Date")}function Zit(e="en-US"){let t=fN(e);return r=>(r instanceof Date?dN:typeof r=="number"?t:nr)(r)}var Ns=Zit();var We=(typeof window<"u"?window.devicePixelRatio>1:typeof it>"u")?0:.5,Kit=0,Jit=0;function hN(){return`plot-clip-${++Kit}`}function Hz(){return`plot-pattern-${++Jit}`}function OS(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),de(E)?!de(T)&&(!de(a)||S?.fill)&&(T="none"):de(T)&&(!de(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);Ka(X)||(u===void 0&&(u=k),h===void 0&&(h=I),d===void 0&&(d=N),p===void 0&&!I$(d)&&(p=O),!Ka(C)&&_===void 0&&(_=L));let[st,q]=ye(u);return E!==null&&(e.fill=Oe(C,"currentColor"),e.fillOpacity=s0(U,1)),T!==null&&(e.stroke=Oe(X,"none"),e.strokeWidth=s0(q,1),e.strokeOpacity=s0(ot,1),e.strokeLinejoin=Oe(d,"miter"),e.strokeLinecap=Oe(h,"butt"),e.strokeMiterlimit=s0(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=s0(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 tot(e,t){t&&e.filter(r=>Vg(t[r])).append("title").call(rot,t)}function eot(e,t){t&&e.filter(([r])=>Vg(t[r])).append("title").call(not,t)}function rot(e,t){t&&e.text(r=>Ns(t[r]))}function not(e,t){t&&e.text(([r])=>Ns(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&&Zz(e,d=>f[d],t),r||tot(e,i)}function af(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&&Zz(e,([d])=>f[d],t),r||eot(e,i)}function iot({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 a0(e,t,r){let n=Kr(e,i=>t[i]);return r===void 0&&n.size>1+e.length>>1&&gn("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*RS(e,t,r,n){let{z:i}=r,{z:o}=n,s=iot(n,r),a=[...t,...s];for(let c of o?a0(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=>Qi(d[f])),u=[f];continue}u.push(f);for(let d=0;d<s.length;++d)if(Qi(s[d][f])!==l[d]){yield u,l=s.map(p=>Qi(p[f])),u=[f];continue t}}u&&(yield u)}}function oot(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=sot(n,r);break}case"sphere":{i=aot(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 Qz(e){let t=new WeakMap;return(r,n)=>{let i=t.get(r);if(!i){let o=hN();Zt(r.ownerSVGElement).append("clipPath").attr("id",o).call(e,r,n),t.set(r,i=`url(#${o})`)}return i}}var sot=Qz((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)}),aot=Qz((e,t)=>{let{projection:r}=t;if(!r)throw new Error('the "sphere" clip option requires a projection');e.append("path").attr("d",kr(r)({type:"Sphere"}))});function Ct(e,t,r,n){oot(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){cot(e,"mix-blend-mode",t.mixBlendMode),dt(e,"opacity",t.opacity)}function Zz(e,t,r){e.each(function(n){let i=t(n);if(i!=null){let o=this.ownerDocument.createElementNS(Mn.svg,"a");o.setAttribute("fill","inherit"),o.setAttributeNS(Mn.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 cot(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 s0(e,t){if((e=ie(e))!==t)return e}var lot=/^-?([_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 xl(e){if(e===void 0)return"plot-d6a7b5";if(e=`${e}`,!lot.test(e))throw new Error(`invalid class name: ${e}`);return e}function kh(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 jr({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=vs(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===sl&&typeof a=="string"?[a]:a,this.fy=t===sl&&typeof c=="string"?[c]:c),this.facetAnchor=$z(s),r=Zg(r),b!==void 0&&(r={...uot(b),...r}),i!==void 0&&(r={...OS(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===sl&&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=lS(x),this.tip=fot(_),this.className=g?xl(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=nc(v,this.render))}initialize(t,r,n){let i=Xa(this.data);t===void 0&&i!=null&&(t=[Bn(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=gS(this.channels,i);return this.sort!=null&&V$(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"&&uN(i,o,r,n.projection)}}scale(t,r,n){let i=Nh(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 uot(e){return Object.fromEntries(Object.entries(Zg(e)).map(([t,r])=>(r=typeof r=="string"?{value:r,label:t}:Zi(r),r.filter===void 0&&r.scale==null&&(r={...r,filter:null}),[t,r])))}function fot(e){return e===!0?"xy":e===!1||e==null?null:typeof e=="string"?Ir(e,"tip",["x","y","xy"]):e}function Ro(e,t){return e?.tip===!0?{...e,tip:t}:Ur(e?.tip)&&e.tip.pointer===void 0?{...e,tip:{...e.tip,pointer:t}}:e}function Jz(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=dot(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 dot({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=Yz(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?Es(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=Kz("y",t)/(Kz("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 Kz(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]=le(n);return Math.abs(i(s)-i(o))}var tj=new WeakMap;function pN(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=tj.get(y);x||tj.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]=jr(this,h),{px:I,py:N}=d,O=I?Y=>I[Y]:mN(d,R),L=N?Y=>N[Y]:yN(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]=ln(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 bl(e){return pN(1,1,e)}function _l(e){return pN(1,.01,e)}function ic(e){return pN(.01,1,e)}function mN({x1:e,x2:t,x:r=e},n){return e&&t?i=>(e[i]+t[i])/2:r?i=>r[i]:()=>n}function yN({y1:e,y2:t,y:r=e},n){return e&&t?i=>(e[i]+t[i])/2:r?i=>r[i]:()=>n}function DS(e){return Es(e)&&e.interval===void 0?void 0:"tabular-nums"}function ej(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=DS(e),round:p=!0,opacity:m,className:y}=t,g=yl(t);y=xl(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
|
-
display: block;
|
|
18
|
-
height: auto;
|
|
19
|
-
height: intrinsic;
|
|
20
|
-
max-width: 100%;
|
|
21
|
-
overflow: visible;
|
|
22
|
-
}
|
|
23
|
-
:where(.${y}-ramp text) {
|
|
24
|
-
white-space: pre;
|
|
25
|
-
}`)).call(kh,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:os(E.length===1?i0(E):E,A);_=v(M.copy(),un(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"?Vi(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",(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(Jc().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(wM(_).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 Ch=Math.PI/180;function Do(e,{marker:t,markerStart:r=t,markerMid:n=t,markerEnd:i=t}={}){e.markerStart=gN(r),e.markerMid=gN(n),e.markerEnd=gN(i)}function gN(e){if(e==null||e===!1)return null;if(e===!0)return nj;if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"none":return null;case"arrow":return rj("auto");case"arrow-reverse":return rj("auto-start-reverse");case"dot":return hot;case"circle":case"circle-fill":return nj;case"circle-stroke":return pot;case"tick":return xN("auto");case"tick-x":return xN(90);case"tick-y":return xN(0)}throw new Error(`invalid marker: ${e}`)}function rj(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 hot(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 nj(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 pot(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 xN(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 mot=0;function oc(e,t,{stroke:r},n){return sj(e,t,r&&(i=>r[i]),null,n)}function ij(e,t,{stroke:r,z:n},i){return sj(e,t,r&&(([o])=>r[o]),n,i)}var bN=1,oj=2;function yot(e,t){let r=new Uint8Array(t.length),n=e.data().filter(o=>o.length>1),i=n.length;for(let o=0,s=NS;o<i;++o){let a=n[o];if(a.length>1){let c=a[0];s!==(s=Qi(t[c]))&&(r[c]|=bN)}}for(let o=i-1,s=NS;o>=0;--o){let a=n[o];if(a.length>1){let c=a[0];s!==(s=Qi(t[c]))&&(r[c]|=oj)}}return([o])=>r[o]}function sj(e,{markerStart:t,markerMid:r,markerEnd:n,stroke:i},o=()=>i,s,a){if(!t&&!r&&!n)return;let c=new Map,l=s&&yot(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-${++mot}`;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)&bN))),r&&l&&e.each(u("marker-start",r,f=>!(l(f)&bN))),r&&e.each(u("marker-mid",r)),n&&e.each(u("marker-end",n,l&&(f=>l(f)&oj)))}function cf({inset:e,insetLeft:t,insetRight:r,...n}={}){return[t,r]=aj(e,t,r),{inset:e,insetLeft:t,insetRight:r,...n}}function lf({inset:e,insetTop:t,insetBottom:r,...n}={}){return[t,r]=aj(e,t,r),{inset:e,insetTop:t,insetBottom:r,...n}}function aj(e,t,r){return e===void 0&&t===void 0&&r===void 0?We?[1,0]:[.5,.5]:[t,r]}function cj(e,{interval:t}){return e={...Zi(e)},e.interval=Ih(e.interval===void 0?t:e.interval),e}function LS(e,t,r,n){let{[e]:i,[`${e}1`]:o,[`${e}2`]:s}=r,{value:a,interval:c}=cj(i,r);if(a==null||c==null&&!n)return r;let l=nn(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 lj(e,t,r){let{[e]:n}=r,{value:i,interval:o}=cj(n,r);return i==null||o==null?r:t({...r,[e]:{label:nn(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 _N(e={}){return LS("x",cf,e,!0)}function wN(e={}){return LS("y",lf,e,!0)}function Bh(e={}){return LS("x",cf,e)}function Ph(e={}){return LS("y",lf,e)}function FS(e={}){return lj("x",cf,e)}function kS(e={}){return lj("y",lf,e)}var uj={ariaLabel:"rule",fill:null,stroke:"currentColor"},c0=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}},Ro(r,"x"),uj),this.insetTop=ie(a),this.insetBottom=ie(c),Do(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(oc,this,n,o)).node()}},l0=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}},Ro(r,"y"),uj),this.insetRight=ie(a),this.insetLeft=ie(c),Do(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(oc,this,n,o)).node()}};function vi(e,t){let{x:r=G,y:n,y1:i,y2:o,...s}=Ph(t);return[i,o]=fj(n,i,o),new c0(e,{...s,x:r,y1:i,y2:o})}function Si(e,t){let{y:r=G,x:n,x1:i,x2:o,...s}=Bh(t);return[i,o]=fj(n,i,o),new l0(e,{...s,y:r,x1:i,x2:o})}function fj(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 Lo(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 got={ariaLabel:"text",strokeLinejoin:"round",strokeWidth:3,paintOrder:"stroke"},yj="\xAD",ff=class extends vt{constructor(t,r={}){let{x:n,y:i,text:o=Pn(t)&&sS(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]=wot(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:b$(b),optional:!0},text:{value:o,filter:Vg,optional:!0}},r,got),this.rotate=_,this.textAnchor=Oe(a,"middle"),this.lineAnchor=Ir(c,"lineAnchor",["top","middle","bottom"]),this.lineHeight=+l,this.lineWidth=+u,this.textOverflow=SN(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=Is(s),!(this.lineWidth>=0))throw new Error(`invalid lineWidth: ${u}`);this.splitLines=TN(this),this.clipLine=AN(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]=jr(this,i);return lt("svg:g",o).call(Ct,this,i,o).call(IN,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(xot,this,f,d).attr("transform",Lo`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 SN(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 xot(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(Ns(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(Mn.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(Mn.svg,"title");h.textContent=r[l],this.appendChild(h)}})}function Os(e,{x:t,y:r,...n}={}){return n.frameAnchor===void 0&&([t,r]=Je(t,r)),new ff(e,{...n,x:t,y:r})}function CS(e,{x:t=G,...r}={}){return new ff(e,kS({...r,x:t}))}function BS(e,{y:t=G,...r}={}){return new ff(e,FS({...r,y:t}))}function IN(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?bot(r):t.fontVariant),dt(e,"font-weight",t.fontWeight)}function bot(e){return e&&(Za(e)||Ve(e))?"tabular-nums":void 0}var _ot=new Set(["inherit","initial","revert","unset","xx-small","x-small","small","medium","large","x-large","xx-large","xxx-large","larger","smaller"]);function wot(e){return e==null||typeof e=="number"?[void 0,e]:typeof e!="string"?[e,void 0]:(e=e.trim().toLowerCase(),_ot.has(e)||/^[+-]?\d*\.?\d+(e[+-]?\d+)?(\w*|%)$/.test(e)?[void 0,e]:[e,void 0])}function vot(e,t,r){let n=[],i,o=0;for(let[s,a,c]of Sot(e)){if(i===void 0&&(i=s),o>i&&r(e,i,a)>t&&(n.push(e.slice(i,o)+(e[o-1]===yj?"-":"")),i=s),c){n.push(e.slice(i,a)),i=void 0;continue}o=a}return n}function*Sot(e){let t=0,r=0,n=e.length;for(;r<n;){let i=1;switch(e[r]){case yj: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
|
-
`&&++i;case`
|
|
27
|
-
`:yield[t,r,!0],r+=i,t=r;break;default:++r;break}}yield[t,r,!0]}var dj={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 PS(e,t=0,r=e.length){let n=0;for(let i=t;i<r;i=Uh(e,i))n+=dj[e[i]]??(xj(e,i)?120:dj.e);return n}function US(e,t=0,r=e.length){let n=0;for(let i=t;i<r;i=Uh(e,i))n+=xj(e,i)?126:63;return n}function TN({monospace:e,lineWidth:t,textOverflow:r}){if(r!=null||t==1/0)return o=>o.split(/\r\n?|\n/g);let n=e?US:PS,i=t*100;return o=>vot(o,i,n)}function AN({monospace:e,lineWidth:t,textOverflow:r}){if(r==null||t==1/0)return o=>o;let n=e?US:PS,i=t*100;switch(r){case"clip-start":return o=>pj(o,i,n,"");case"clip-end":return o=>hj(o,i,n,"");case"ellipsis-start":return o=>pj(o,i,n,uf);case"ellipsis-middle":return o=>Iot(o,i,n,uf);case"ellipsis-end":return o=>hj(o,i,n,uf)}}var uf="\u2026";function df(e,t,r,n){let i=[],o=0;for(let s=0,a=0,c=e.length;s<c;s=a){a=Uh(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 hj(e,t,r,n){e=e.trim();let i=r(n),[o]=df(e,t,r,i);return o<0?e:e.slice(0,o).trimEnd()+n}function Iot(e,t,r,n){e=e.trim();let i=r(e);if(i<=t)return e;let o=r(n)/2,[s,a]=df(e,t/2,r,o),[c]=df(e,i-t/2-a+o,r,-o);return c<0?n:e.slice(0,s).trimEnd()+n+e.slice(Uh(e,c)).trimStart()}function pj(e,t,r,n){e=e.trim();let i=r(e);if(i<=t)return e;let o=r(n),[s]=df(e,i-t+o,r,-o);return s<0?n:n+e.slice(Uh(e,s)).trimStart()}var vN=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,mj=/\p{Extended_Pictographic}/uy;function Uh(e,t){return t+=Tot(e,t)?2:1,Eot(e,t)&&(t=vN.lastIndex),Aot(e,t)?Uh(e,t+1):t}function gj(e,t){return e.charCodeAt(t)<128}function Tot(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 Aot(e,t){return e.charCodeAt(t)===8205}function Eot(e,t){return gj(e,t)?!1:(vN.lastIndex=t,vN.test(e))}function xj(e,t){return gj(e,t)?!1:(mj.lastIndex=t,mj.test(e))}var bj={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},_j=3.5,Mot=_j*5,wj={draw(e,t,r){let n=t*r/Mot;e.moveTo(0,0),e.lineTo(0,-t),e.moveTo(-n,n-t),e.lineTo(0,-t),e.lineTo(n,n-t)}},vj={draw(e,t,r){e.moveTo(-r,0),e.lineTo(0,-t),e.lineTo(r,0)}},Not=new Map([["arrow",wj],["spike",vj]]);function Oot(e){return e&&typeof e.draw=="function"}function Rot(e){if(Oot(e))return e;let t=Not.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid shape: ${e}`)}var hf=class extends vt{constructor(t,r={}){let{x:n,y:i,r:o=_j,length:s,rotate:a,shape:c=wj,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,bj),this.r=+o,this.length=d,this.rotate=p,this.shape=Rot(c),this.anchor=Ir(l,"anchor",["start","middle","end"]),this.frameAnchor=Is(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]=jr(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",Lo`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=Rn();return m.draw(v,u[_],y),v}:(()=>{let _=Rn();return m.draw(_,d,y),_})()).call(Wt,this,n)).node()}};function EN(e,t={}){let{x:r,y:n,...i}=t;return t.frameAnchor===void 0&&([r,n]=Je(r,n)),new hf(e,{...i,x:r,y:n})}function $S(e,t={}){let{x:r=G,...n}=t;return new hf(e,{...n,x:r})}function zS(e,t={}){let{y:r=G,...n}=t;return new hf(e,{...n,y:r})}function Sj(e,t={}){let{shape:r=vj,stroke:n=bj.stroke,strokeWidth:i=1,fill:o=n,fillOpacity:s=.3,anchor:a="start",...c}=t;return EN(e,{...c,shape:r,stroke:n,strokeWidth:i,fill:o,fillOpacity:s,anchor:a})}function wl(e,t){return arguments.length<2&&!Pn(e)&&(t=e,e=null),t===void 0&&(t={}),[e,t]}function jS({anchor:e}={},t){return e===void 0?t[0]:Ir(e,"anchor",t)}function Ij(e){return jS(e,["left","right"])}function Tj(e){return jS(e,["right","left"])}function Aj(e){return jS(e,["bottom","top"])}function Ej(e){return jS(e,["top","bottom"])}function u0(){let[e,t]=wl(...arguments);return Mj("y",Ij(t),e,t)}function qS(){let[e,t]=wl(...arguments);return Mj("fy",Tj(t),e,t)}function f0(){let[e,t]=wl(...arguments);return Nj("x",Aj(t),e,t)}function VS(){let[e,t]=wl(...arguments);return Nj("fx",Ej(t),e,t)}function Mj(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=Bj(E),yr(p&&!de(o)?Dot(e,t,r,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:m,tickRotate:y,x:g,...T}):null,de(c)?null:Fot(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}),!de(c)&&S!==null?Os([],Lj({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:[Cj(e,L,{anchor:t,label:S,labelAnchor:$,labelArrow:E})]}}}})):null)}function Nj(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=Bj(E),yr(p&&!de(o)?Lot(e,t,r,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:m,tickRotate:y,y:g,...T}):null,de(c)?null:kot(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}),!de(c)&&S!==null?Os([],Lj({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:[Cj(e,L,{anchor:t,label:S,labelAnchor:$,labelArrow:E})]}}}})):null)}function Dot(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 $h(zS,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"?Uot:$ot})}function Lot(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 $h($S,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"?Bot:Pot})}function Fot(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*Ch):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 $h(BS,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=kj(x)),c===void 0&&(w.text=Fj(x,b,_,v,t))})}function kot(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*Ch):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 $h(CS,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=kj(x)),c===void 0&&(w.text=Fj(x,b,_,v,t))})}function YS(){let[e,t]=wl(...arguments);return Oj("y",Ij(t),e,t)}function WS(){let[e,t]=wl(...arguments);return Oj("fy",Tj(t),e,t)}function GS(){let[e,t]=wl(...arguments);return Rj("x",Aj(t),e,t)}function XS(){let[e,t]=wl(...arguments);return Rj("fx",Ej(t),e,t)}function Oj(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 $h(Si,e,r,{ariaLabel:`${e}-grid`,ariaHidden:!0},{y:n,x1:o,x2:s,...Dj(a)})}function Rj(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 $h(vi,e,r,{ariaLabel:`${e}-grid`,ariaHidden:!0},{x:n,y1:o,y2:s,...Dj(a)})}function Dj({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 Lj({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 $h(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"&&Pj(g)&&(b=_,_=void 0),_===void 0&&(_=Ss(b,g.type)??Cot(g,w)),u==null){if(Pn(_))u=xi(_);else if(ul(_))u=MN(_,...le(x));else if(g.interval){let A=g.interval;if(g.ticks){let[E,M]=le(x),T=(M-E)/A[_h];A=y4(A,T/_)??A,u=MN(A,E,M)}else{u=x;let E=u.length;A=y4(A,E/_)??A,A!==g.interval&&(u=MN(A,...le(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 An(x);u=u.filter(E=>A.has(E)),u.length||gn(`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=[Bn(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 Cot(e,t){let[r,n]=le(e.range());return(n-r)/t}function Fj(e,t,r,n,i){return{value:d0(e,t,r,n,i)}}function d0(e,t,r,n,i){return typeof n=="function"&&!(e.type==="log"&&e.tickFormat)?n:n===void 0&&t&&Ve(t)?f$(e.type,t,i)??Ns:e.tickFormat?e.tickFormat(typeof r=="number"?r:null,n):n===void 0?Ns:typeof n=="string"?(Ve(e.domain())?xs:Vi)(n):Ye(n)}function MN(e,t,r){return e.range(t,e.offset(e.floor(r)))}var Bot={draw(e,t){e.moveTo(0,0),e.lineTo(0,t)}},Pot={draw(e,t){e.moveTo(0,0),e.lineTo(0,-t)}},Uot={draw(e,t){e.moveTo(0,0),e.lineTo(-t,0)}},$ot={draw(e,t){e.moveTo(0,0),e.lineTo(t,0)}};function kj(e){return e.bandwidth&&!e.interval?void 0:"tabular-nums"}function Cj(e,t,{anchor:r,label:n=t.label,labelAnchor:i,labelArrow:o}={}){if(!(n==null||n.inferred&&Pj(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=wS(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 Bj(e="auto"){return de(e)?!1:typeof e=="boolean"?e:Ir(e,"labelArrow",["auto","up","right","down","left"])}function Pj(e){return Ve(e.domain())}function Uj(e,t){if(t==null)return t;let r=e(t);if(!r)throw new Error(`scale not found: ${t}`);return r}function $j(e,{opacity:t,...r}={}){if(!Es(e)&&!rN(e))throw new Error(`swatches legend requires ordinal or threshold color scale (not ${e.type})`);return jj(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 zj(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:de(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=Uj(c,l),p=Uj(c,f),m=s*s*Math.PI;return r=ye(r)[1],i=ye(i)[1],o=ye(o)[1],jj(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=Rn();return e.scale(_).draw(v,m),v}))}function jj(e,t={},r){let{columns:n,tickFormat:i,fontVariant:o=DS(e),swatchSize:s=15,swatchWidth:a=s,swatchHeight:c=s,marginLeft:l=0,className:u,style:f,width:d}=t,h=yl(t);u=xl(u),i=d0(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
|
-
display: flex;
|
|
29
|
-
align-items: center;
|
|
30
|
-
break-inside: avoid;
|
|
31
|
-
padding-bottom: 1px;
|
|
32
|
-
}
|
|
33
|
-
:where(.${u}-swatches-columns .${u}-swatch::before) {
|
|
34
|
-
flex-shrink: 0;
|
|
35
|
-
}
|
|
36
|
-
:where(.${u}-swatches-columns .${u}-swatch-label) {
|
|
37
|
-
white-space: nowrap;
|
|
38
|
-
overflow: hidden;
|
|
39
|
-
text-overflow: ellipsis;
|
|
40
|
-
}`,p.style("columns",n).selectAll().data(e.domain).enter().append("div").attr("class",`${u}-swatch`).call(r,e,a,c).call(y=>y.append("div").attr("class",`${u}-swatch-label`).attr("title",i).text(i))):(m=`:where(.${u}-swatches-wrap) {
|
|
41
|
-
display: flex;
|
|
42
|
-
align-items: center;
|
|
43
|
-
min-height: 33px;
|
|
44
|
-
flex-wrap: wrap;
|
|
45
|
-
}
|
|
46
|
-
:where(.${u}-swatches-wrap .${u}-swatch) {
|
|
47
|
-
display: inline-flex;
|
|
48
|
-
align-items: center;
|
|
49
|
-
margin-right: 1em;
|
|
50
|
-
}`,p.selectAll().data(e.domain).enter().append("span").attr("class",`${u}-swatch`).call(r,e,a,c).append(function(){return this.ownerDocument.createTextNode(i.apply(this,arguments))})),p.call(y=>y.insert("style","*").text(`:where(.${u}-swatches) {
|
|
51
|
-
font-family: system-ui, sans-serif;
|
|
52
|
-
font-size: 10px;
|
|
53
|
-
margin-bottom: 0.5em;
|
|
54
|
-
}
|
|
55
|
-
:where(.${u}-swatch > svg) {
|
|
56
|
-
margin-right: 0.5em;
|
|
57
|
-
overflow: visible;
|
|
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(kh,f).node()}var HS=new Map([["symbol",zj],["color",Yj],["opacity",zot]]);function qj(e={}){for(let[t,r]of HS){let n=e[t];if(ws(n)){let i=yl(e),o;if(t==="symbol"){let{fill:s,stroke:a=s===void 0&&ws(e.color)?"color":void 0}=e;o={fill:s,stroke:a}}return r(SS(t,n,o),NN(i,n,e),s=>ws(e[s])?SS(s,e[s]):null)}}throw new Error("unknown legend type; no scale found")}function Vj(e,t,r={}){return(n,i)=>{if(!HS.has(n))throw new Error(`unknown legend type: ${n}`);if(n in e)return HS.get(n)(e[n],NN(t,r[n],i),o=>e[o])}}function NN({className:e,...t},{label:r,ticks:n,tickFormat:i}={},o){return T$(o,{className:e,...t},{label:r,ticks:n,tickFormat:i})}function Yj(e,{legend:t=!0,...r}){if(t===!0&&(t=e.type==="ordinal"?"swatches":"ramp"),e.domain!==void 0)switch(`${t}`.toLowerCase()){case"swatches":return $j(e,r);case"ramp":return ej(e,r);default:throw new Error(`unknown legend type: ${t}`)}}function zot({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 Yj({type:e,...r,interpolate:jot(i)},{legend:n,...o})}function jot(e){let{r:t,g:r,b:n}=vr(e)||vr(0,0,0);return i=>`rgba(${t},${r},${n},${i})`}function Wj(e,t,r){let n=[];for(let[i,o]of HS){let s=r[i];if(s?.legend&&i in e){let a=o(e[i],NN(t,e[i],s),c=>e[c]);a!=null&&n.push(a)}}return n}function vl(e={}){return T4(e)?e:{...e,x:G}}function Sl(e={}){return A4(e)?e:{...e,y:G}}function QS(e,t){if(t.length===1)return{data:e,facets:t};let r=ll(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=cl(e);let o=e[x4]=new Uint32Array(r+i);t=t.map(a=>cl(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 ON(e={},t={}){arguments.length===1&&([e,t]=zh(e));let{y1:r,y:n=r,x:i,...o}=t,[s,a,c,l]=jh(n,i,"y","x",e,o);return{...s,y1:r,y:a,x1:c,x2:l,x:Sh(c,l)}}function Hj(e={},t={}){arguments.length===1&&([e,t]=zh(e));let{y1:r,y:n=r,x:i}=t,[o,s,a]=jh(n,i,"y","x",e,t);return{...o,y1:r,y:s,x:a}}function Qj(e={},t={}){arguments.length===1&&([e,t]=zh(e));let{y1:r,y:n=r,x:i}=t,[o,s,,a]=jh(n,i,"y","x",e,t);return{...o,y1:r,y:s,x:a}}function RN(e={},t={}){arguments.length===1&&([e,t]=zh(e));let{x1:r,x:n=r,y:i,...o}=t,[s,a,c,l]=jh(n,i,"x","y",e,o);return{...s,x1:r,x:a,y1:c,y2:l,y:Sh(c,l)}}function Zj(e={},t={}){arguments.length===1&&([e,t]=zh(e));let{x1:r,x:n=r,y:i}=t,[o,s,a]=jh(n,i,"x","y",e,t);return{...o,x1:r,x:s,y:a}}function Kj(e={},t={}){arguments.length===1&&([e,t]=zh(e));let{x1:r,x:n=r,y:i}=t,[o,s,,a]=jh(n,i,"x","y",e,t);return{...o,x1:r,x:s,y:a}}function Il({x:e,x1:t,x2:r,...n}={}){return n=Ro(n,"y"),t===void 0&&r===void 0?ON({x:e,...n}):([t,r]=E4(e,t,r),{...n,x1:t,x2:r})}function Tl({y:e,y1:t,y2:r,...n}={}){return n=Ro(n,"x"),t===void 0&&r===void 0?RN({y:e,...n}):([t,r]=E4(e,t,r),{...n,y1:t,y2:r})}function zh(e){let{offset:t,order:r,reverse:n,...i}=e;return[{offset:t,order:r,reverse:n},i]}var qot={length:!0};function jh(e,t=Hg,r,n,{offset:i,order:o,reverse:s},a){if(t===null)throw new Error(`stack requires ${n}`);let c=yn(a),[l,u]=rn(e),[f,d]=$r(t),[h,p]=$r(t);return f.hint=h.hint=qot,i=Vot(i),o=Got(o,i,n),[mr(a,(m,y,g)=>{({data:m,facets:y}=QS(m,y));let x=e==null?void 0:u(rf(_t(m,e),g?.[r])),b=_t(m,t,Float64Array),_=_t(m,c),v=o&&o(m,x,b,_),w=ll(m),S=d(new Float64Array(w)),A=p(new Float64Array(w)),E=[];for(let M of y){let T=x?Array.from(Kr(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 Vot(e){if(e!=null){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"expand":case"normalize":return Yot;case"center":case"silhouette":return Wot;case"wiggle":return tq}throw new Error(`unknown offset: ${e}`)}}function Jj(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 Yot(e,t,r){for(let n of e)for(let i of n){let[o,s]=Jj(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 Wot(e,t,r){for(let n of e){for(let i of n){let[o,s]=Jj(i,r);for(let a of i){let c=(s+o)/2;t[a]-=c,r[a]-=c}}eq(n,t,r)}rq(e,t,r)}function tq(e,t,r,n){for(let i of e){let o=new Tn,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,...W_(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)}eq(i,t,r)}rq(e,t,r)}function eq(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 rq(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 Got(e,t,r){if(e===void 0&&t===tq)return Gj(Pr);if(e!=null){if(typeof e=="string"){let n=e.startsWith("-"),i=n?Ku:Pr;switch((n?e.slice(1):e).toLowerCase()){case"value":case r:return Xot(i);case"z":return Hot(i);case"sum":return Qot(i);case"appearance":return Zot(i);case"inside-out":return Gj(i)}return Xj(_4(e))}if(typeof e=="function")return(e.length===1?Xj:Kot)(e);if(Zn(e))return Jot(e);throw new Error(`invalid order: ${e}`)}}function Xot(e){return(t,r,n)=>(i,o)=>e(n[i],n[o])}function Hot(e){return(t,r,n,i)=>(o,s)=>e(i[o],i[s])}function Qot(e){return ZS(e,(t,r,n,i)=>Ad(Bn(t),o=>wr(o,s=>n[s]),o=>i[o]))}function Zot(e){return ZS(e,(t,r,n,i)=>Ad(Bn(t),o=>r[Iu(o,s=>n[s])],o=>i[o]))}function Gj(e){return ZS(e,(t,r,n,i)=>{let o=Bn(t),s=Ad(o,f=>r[Iu(f,d=>n[d])],f=>i[f]),a=To(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 Xj(e){return t=>{let r=_t(t,e);return(n,i)=>Pr(r[n],r[i])}}function Kot(e){return t=>Zn(t)?(r,n)=>e(t[r],t[n]):(r,n)=>e(t.get(r),t.get(n))}function Jot(e){return ZS(Pr,()=>e)}function ZS(e,t){return(r,n,i,o)=>{if(!o)throw new Error("missing channel: z");let s=new Tn(t(r,n,i,o).map((a,c)=>[a,c]));return(a,c)=>e(s.get(o[a]),s.get(o[c]))}}var tst={ariaLabel:"rect"},pf=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,tst),h0(this,r),p0(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(m0,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 h0(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 p0(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 m0(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+JS(A,T)}A${A},${A} 0 0 ${A<0?0:1} ${b+KS(A,T)},${v}H${_-KS(E,M)}A${E},${E} 0 0 ${E<0?0:1} ${_},${v+JS(E,M)}V${w-JS(M,E)}A${M},${M} 0 0 ${M<0?0:1} ${_-KS(M,E)},${w}H${b+KS(T,A)}A${T},${T} 0 0 ${T<0?0:1} ${b},${w-JS(T,A)}Z`})}function KS(e,t){return t<0?e:Math.abs(e)}function JS(e,t){return t<0?Math.abs(e):e}function y0(e,t){return new pf(e,_N(wN(t)))}function qh(e,t={}){return Ha(t)||(t={...t,y:Ee,x2:G,interval:1}),new pf(e,Il(wN(vl(t))))}function Vh(e,t={}){return Ha(t)||(t={...t,x:Ee,y2:G,interval:1}),new pf(e,Tl(_N(Sl(t))))}var est={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},rst={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1},g0=class extends vt{constructor(t={}){let{anchor:r=null}=t;super(sl,void 0,t,r==null?est:rst),this.anchor=I4(r,"anchor",["top","right","bottom","left"]),h0(this,t),r||p0(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(m0,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 Yh(e){return new g0(e)}var DN={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},nst=new Set(["geometry","href","src","ariaLabel","scales"]),x0=class extends vt{constructor(t,r={}){r.tip&&(r={...r,tip:!1}),r.title===void 0&&Pn(t)&&sS(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,DN),this.anchor=cS(l,"anchor"),this.preferredAnchor=cS(u,"preferredAnchor"),this.frameAnchor=Is(b),this.textAnchor=Oe(v,"middle"),this.textPadding=+S,this.pointerSize=+E,this.pathFilter=nr(M),this.lineHeight=+g,this.lineWidth=+x,this.textOverflow=SN(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 DN)T in this.channels&&(this[T]=DN[T]);this.splitLines=TN(this),this.clipLine=AN(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]=jr(this,i),O=mN(n,I),L=yN(n,N),B=p?US:PS,C=B(uf),P,U;"title"in n?(P=nq.call(this,{title:n.channels.title},r),U=ast):(P=nq.call(this,n.channels,r),U=cst);let $=lt("svg:g",o).call(Ct,this,i,o).call(IN,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]=df(at,z,B,C);if(Pt>=0)at=at.slice(0,Pt).trimEnd()+uf,nt=Y.trim(),Y="";else{(at||!Y&&!H)&&(Y=" "+Y);let[Kt]=df(Y,z-B(at),B,C);Kt>=0&&(nt=Y.trim(),Y=Y.slice(0,Kt).trimEnd()+uf)}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",sst(nt,x,g,q,H)),st)for(let ht of Pt.childNodes)ht.setAttribute("x",-st);Pt.setAttribute("y",`${+ist(nt,Pt.childNodes.length,m).toFixed(6)}em`),Pt.setAttribute("transform",`translate(${ost(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 eI(e,{x:t,y:r,...n}={}){return n.frameAnchor===void 0&&([t,r]=Je(t,r)),new x0(e,{...n,x:t,y:r})}function ist(e,t,r){return/^top(?:-|$)/.test(e)?.94-r:-.29-t*r}function ost(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 sst(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 nq(e,t){let r={},n=this.format;n=iq(n,e,"x"),n=iq(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=r0(e,i);s&&(r[i]=s)}}for(let i in e){if(i in r||i in n||nst.has(i)||(i==="x"||i==="y")&&e.geometry)continue;let o=r0(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)?xs:Vi)(o)}else if(o===void 0||o===!0){let s=t[i];this.format[i]=s?.bandwidth?d0(s,s.domain()):Ns}}return r}function iq(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 ast(e,t,{title:r}){return this.format.title(r.value[e],e)}function*cst(e,t,r,n,i){for(let o in r){if(o==="fx"||o==="fy"){yield{label:tI(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:sq(n,r,"x"),value:oq(this.format.x2,r.x1,s,e)};else if(o==="y2"&&"y1"in r)yield{label:sq(n,r,"y"),value:oq(this.format.y2,r.y1,s,e)};else{let a=s.value[e],c=s.scale;if(!Pe(a)&&c==null)continue;yield{label:tI(n,r,o),value:this.format[o](a,e),color:c==="color"?i[o][e]:null,opacity:c==="opacity"?i[o][e]:null}}}}function oq(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 sq(e,t,r){let n=tI(e,t,`${r}1`,r),i=tI(e,t,`${r}2`,r);return n===i?n:`${n}\u2013${i}`}function tI(e,t,r,n=r){let i=t[r],o=e[i?.scale??r];return String(o?.label??i?.label??n)}function Wh(e={}){let{facet:t,style:r,title:n,subtitle:i,caption:o,ariaLabel:s,ariaDescription:a}=e,c=xl(e.className),l=e.marks===void 0?[]:cq(e.marks);l.push(...pst(l));let u=dst(t,e),f=new Map;for(let C of l){let P=lq(C,u,e);P&&f.set(C,P)}let d=new Map;u&&b0(d,[u],e),b0(d,f,e);let h=cq(mst(l,d,e));for(let C of h){let P=lq(C,u,e);P&&f.set(C,P)}l.unshift(...h);let p=Cz(d,e);if(p!==void 0){let C=u?ES(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?ES(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=Uz($.facetsIndex))}}for(let C of _e.keys())ws(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);kN(rt,e),m.set(C,{data:$,facets:X,channels:rt})}let y=o0(b0(d,m,e),e),g=Jz(y,l,e);Nz(y,g);let x=tN(y),{fx:b,fy:_}=x,v=b||_?eN(y,g):g,w=b||_?vst(x,g):g,S=yl(e),A=S.document,E=Na("svg").call(A.documentElement),M=E;S.ownerSVGElement=E,S.className=c,S.projection=jz(e,v),S.filterFacets=(C,P)=>ES(p,{channels:P,groups:TS(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;fst(ot),Object.assign(P.channels,ot);for(let at of Object.values(ot)){let{scale:Y}=at;Y!=null&&!N$(_e.get(Y))&&(dq(at,e),T.add(Y))}(X!=null||rt!=null)&&f.set(C,!0)}}if(T.size){let C=new Map;b0(C,m,e,X=>T.has(X)),b0(d,m,e,X=>T.has(X));let P=wst(o0(C,e),y),{scales:U,...$}=tN(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=Bz(p,R),k=Pz(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
|
-
--plot-background: white;
|
|
61
|
-
display: block;
|
|
62
|
-
height: auto;
|
|
63
|
-
height: intrinsic;
|
|
64
|
-
max-width: 100%;
|
|
65
|
-
}
|
|
66
|
-
:where(.${c} text),
|
|
67
|
-
:where(.${c} tspan) {
|
|
68
|
-
white-space: pre;
|
|
69
|
-
}`)).call(kh,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=Qa(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=Wj(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(aq(A,n,"h2")),i!=null&&M.append(aq(A,i,"h3")),M.append(...O,E),o!=null&&M.append(lst(A,o)),"value"in E&&(M.value=E.value,delete E.value)),M.scale=Lz(x.scales),M.legend=Vj(y,S,e);let B=uz();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 aq(e,t,r){if(t.ownerDocument)return t;let n=e.createElement(r);return n.append(t),n}function lst(e,t){let r=e.createElement("figcaption");return r.append(t),r}function cq(e){return e.flat(1/0).filter(t=>t!=null).map(ust)}function ust(e){return typeof e.render=="function"?e:new FN(e)}var FN=class extends vt{constructor(t){if(typeof t!="function")throw new TypeError("invalid mark; missing render function");super(),this.render=t}render(){}};function kN(e,t){for(let r in e)dq(e[r],t);return e}function dq(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:M4(s,i)}=t[r]??{};a!=null&&(e.value=Ht(e.value,a),e.transform=!1)}function fst(e){for(let t in e)V4(t,e[t])}function b0(e,t,r,n=m$){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(!Vz(r)){let c=r.x?.domain===void 0,l=r.y?.domain===void 0;if(c||l){let[u,f]=Wz(s);c&&LN(e,"x",u),l&&LN(e,"y",f)}}}else LN(e,a,s)}return e}function LN(e,t,r){let n=e.get(t);n!==void 0?n.push(r):e.set(t,[r])}function dst(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=Mh(i,{value:r,scale:"fx"})),n!=null&&(o.fy=Mh(i,{value:n,scale:"fy"})),kN(o,t);let s=TS(i,o);return{channels:o,groups:s,data:e.data}}function lq(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=Mh(c,{value:n,scale:"fx"})),i!=null&&(l.fy=Mh(c,{value:i,scale:"fy"})),kN(l,r),{channels:l,groups:TS(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)&&ll(Xa(e.data))===ll(a)&&gn(`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 hst(e,t={}){return Ne({...t,x:null,y:null},(r,n,i,o,s,a)=>a.getMarkState(e))}function pst(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)?_l:/^y$/i.test(i)?ic:bl,n=i(hst(r,n)),n.title=null,o===void 0&&(n.preferredAnchor=i===ic?"left":"bottom");let s=eI(r.data,n);s.facet=r.facet,s.facetAnchor=r.facetAnchor,t.push(s)}}return t}function mst(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||!ws(i)&&!uq("x",e))&&(h=p=null),(n||!ws(o)&&!uq("y",e))&&(m=y=null),t.has("fx")||(g=x=null),t.has("fy")||(b=_=null),h===void 0&&(h=!iI(e,"x")),m===void 0&&(m=!iI(e,"y")),g===void 0&&(g=!iI(e,"fx")),b===void 0&&(b=!iI(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 nI(v,_,WS,a),rI(v,b,qS,"right","left",u,a),nI(v,x,XS,s),rI(v,g,VS,"top","bottom",u,s),nI(v,y,YS,o),rI(v,m,u0,"left","right",r,o),nI(v,p,GS,i),rI(v,h,f0,"bottom","top",r,i),v}function rI(e,t,r,n,i,o,s){if(!t)return;let a=yst(t);s=gst(a?n:t,o,s);let{line:c}=s;(r===u0||r===f0)&&c&&!Ka(c)&&e.push(Yh(xst(s))),e.push(r(s)),a&&e.push(r({...s,anchor:i,label:null}))}function nI(e,t,r,n){!t||Ka(t)||e.push(r(bst(t,n)))}function yst(e){return/^\s*both\s*$/i.test(e)}function gst(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 xst(e){let{anchor:t,line:r}=e;return{anchor:t,facetAnchor:t+"-empty",stroke:r===!0?void 0:r}}function bst(e,{stroke:t=fl(e)?e:void 0,ticks:r=_st(e)?e:void 0,tickSpacing:n,ariaLabel:i,ariaDescription:o}){return{stroke:t,ticks:r,tickSpacing:n,ariaLabel:i,ariaDescription:o}}function _st(e){switch(typeof e){case"number":return!0;case"string":return!fl(e)}return Pn(e)||typeof e?.range=="function"}function iI(e,t){let r=`${t}-axis `;return e.some(n=>n.ariaLabel?.startsWith(r))}function uq(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 wst(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 vst({fx:e,fy:t},r){let{marginTop:n,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=vS(r),l=e&&fq(e),u=t&&fq(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 fq(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 Sst=new Map([["basis",W6],["basis-closed",G6],["basis-open",X6],["bundle",H6],["bump-x",z6],["bump-y",j6],["cardinal",Q6],["cardinal-closed",Z6],["cardinal-open",K6],["catmull-rom",J6],["catmull-rom-closed",t4],["catmull-rom-open",e4],["linear",Va],["linear-closed",r4],["monotone-x",i4],["monotone-y",o4],["natural",s4],["step",a4],["step-after",l4],["step-before",c4]]);function _0(e=Va,t){if(typeof e=="function")return e;let r=Sst.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 oI(e=Al,t){return typeof e!="function"&&`${e}`.toLowerCase()==="auto"?Al:_0(e,t)}function Al(e){return Va(e)}function Rs(e={y:"count"},t={}){[e,t]=BN(e,t);let{x:r,y:n}=t;return CN(sI(r,t,G),null,null,n,e,cf(t))}function Ds(e={x:"count"},t={}){[e,t]=BN(e,t);let{x:r,y:n}=t;return CN(null,sI(n,t,G),r,null,e,lf(t))}function sc(e={fill:"count"},t={}){[e,t]=BN(e,t);let{x:r,y:n}=Ist(t);return CN(r,n,null,null,e,cf(lf(t)))}function mq(e,t,r={}){if(r?.interval==null)return r;let{reduce:n=yS}=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 Gh(e={}){return mq(Rs,"y",Ro(e,"x"))}function Xh(e={}){return mq(Ds,"x",Ro(e,"y"))}function CN(e,t,r,n,{data:i=mS,filter:o=Kg,sort:s,reverse:a,...c}={},l={}){e=hq(e),t=hq(t),c=Tst(c,l),i=xq(i,G),s=s==null?void 0:yq("sort",s,l),o=o==null?void 0:gq("filter",o,l),r!=null&&As(c,"x","x1","x2")&&(r=null),n!=null&&As(c,"y","y1","y2")&&(n=null);let[u,f]=rn(e),[d,h]=rn(e),[p,m]=rn(t),[y,g]=rn(t),[x,b]=r!=null?[r,"x"]:n!=null?[n,"y"]:[],[_,v]=rn(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]=rn(A),[$]=qe(E),[X]=qe(M),[rt,ot]=rn($),[at,Y]=rn(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=rf(_t(st,x),H?.[b]),z=_t(st,A),Pt=_t(st,$),ht=_t(st,X),Kt=e0(c,{z,fill:Pt,stroke:ht}),Jt=[],tt=[],ge=nt&&v([]),Jn=z&&U([]),Co=Pt&&ot([]),AW=ht&&Y([]),yk=e&&f([]),EW=e&&h([]),gk=t&&m([]),MW=t&&g([]),NW=Mst(e,t,st),OW=0;for(let Mf of c)Mf.initialize(st);s&&s.initialize(st),o&&o.initialize(st);for(let Mf of q){let xk=[];for(let Nf of c)Nf.scope("facet",Mf);s&&s.scope("facet",Mf),o&&o.scope("facet",Mf);for(let[Nf,RW]of Ts(Mf,Kt))for(let[DW,Tx]of Ts(RW,nt))for(let[Bo,zs]of NW(Tx))if(Kt&&(zs.z=Nf),!(o&&!o.reduce(Bo,zs))){xk.push(OW++),tt.push(i.reduceIndex(Bo,st,zs)),nt&&ge.push(DW),z&&Jn.push(Kt===z?Nf:z[(Bo.length>0?Bo:Tx)[0]]),Pt&&Co.push(Kt===Pt?Nf:Pt[(Bo.length>0?Bo:Tx)[0]]),ht&&AW.push(Kt===ht?Nf:ht[(Bo.length>0?Bo:Tx)[0]]),yk&&(yk.push(zs.x1),EW.push(zs.x2)),gk&&(gk.push(zs.y1),MW.push(zs.y2));for(let LW of c)LW.reduce(Bo,zs);s&&s.reduce(Bo,zs)}Jt.push(xk)}return z4(Jt,s,a),{data:tt,facets:Jt}}),...!As(c,"x")&&(u?{x1:u,x2:d,x:Sh(u,d)}:{x:w,x1:T,x2:R}),...!As(c,"y")&&(p?{y1:p,y2:y,y:Sh(p,y)}:{y:S,y1:k,y2:I}),..._&&{[b]:_},...Object.fromEntries(c.map(({name:st,output:q})=>[st,q]))}}function BN({cumulative:e,domain:t,thresholds:r,interval:n,...i},o){return[i,{cumulative:e,domain:t,thresholds:r,interval:n,...o}]}function sI(e,{cumulative:t,domain:r,thresholds:n,interval:i},o){return e={...Zi(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=PN(e.thresholds,e.interval),e}function Ist(e){let{x:t,y:r}=e;return t=sI(t,e),r=sI(r,e),[t.value,r.value]=Je(t.value,r.value),{x:t,y:r}}function hq(e){if(e==null)return;let{value:t,cumulative:r,domain:n=le,thresholds:i}=e,o=s=>{let a=_t(s,t),c;if(Ve(a)||Est(i)){a=Ht(a,S4,Float64Array);let[u,f]=typeof n=="function"?n(a):n,d=typeof i=="function"&&!ul(i)?i(a,u,f):i;typeof d=="number"&&(d=bg(u,f,d)),ul(d)&&(n===le&&(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"&&!ul(i)?i(a,u,f):i;if(typeof d=="number")if(n===le){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=Jr(u,f,d);else ul(d)&&(n===le&&(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?Ost:r>0?Nst:UN)(l,c,a),l};return o.label=nn(t),o}function PN(e,t,r=pq){if(e===void 0)return t===void 0?r:Ss(t);if(typeof e=="string"){switch(e.toLowerCase()){case"freedman-diaconis":return Z_;case"scott":return py;case"sturges":return zc;case"auto":return pq}return tf(e)}return e}function Tst(e,t){return U4(e,t,yq)}function yq(e,t,r){return hS(e,t,r,gq)}function gq(e,t,r){return pS(e,t,r,xq)}function xq(e,t){return Eh(e,t,Ast)}function Ast(e){switch(`${e}`.toLowerCase()){case"x":return Rst;case"x1":return Lst;case"x2":return Fst;case"y":return Dst;case"y1":return kst;case"y2":return Cst;case"z":return j4}throw new Error(`invalid bin reduce: ${e}`)}function pq(e,t,r){return Math.min(200,py(e,t,r))}function Est(e){return x$(e)||Pn(e)&&Ve(e)}function Mst(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 UN(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 Nst(e,t,r){let n=UN(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 Ost(e,t,r){let n=UN(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 bq(e,t){let r=(+e+ +t)/2;return e instanceof Date?new Date(r):r}var Rst={reduceIndex(e,t,{x1:r,x2:n}){return bq(r,n)}},Dst={reduceIndex(e,t,{y1:r,y2:n}){return bq(r,n)}},Lst={reduceIndex(e,t,{x1:r}){return r}},Fst={reduceIndex(e,t,{x2:r}){return r}},kst={reduceIndex(e,t,{y1:r}){return r}},Cst={reduceIndex(e,t,{y2:r}){return r}};var Bst={ariaLabel:"area",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},mf=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:yn(r),optional:!0}},r,Bst),this.z=a,this.curve=_0(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(RS(t,[s,a,c,l],this,n)).enter().append("path").call(Mt,this).call(af,this,n).attr("d",fh().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 w0(e,t){return t===void 0?ac(e,{x:ef,y:al}):new mf(e,t)}function El(e,t){let{y:r=Ee,...n}=Xh(t);return new mf(e,Il(vl({...n,y1:r,y2:void 0})))}function ac(e,t){let{x:r=Ee,...n}=Gh(t);return new mf(e,Tl(Sl({...n,x1:r,x2:void 0})))}var Pst={ariaLabel:"link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},v0=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,Pst),this.curve=oI(a,c),Do(this,r)}project(t,r,n){this.curve!==Al&&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===Al&&o.projection?Ust(o.projection,s,a,c,l):d=>{let h=Rn(),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 Ust(e,t,r,n,i){let o=kr(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 aI(e,{x:t,x1:r,x2:n,y:i,y1:o,y2:s,...a}={}){return[r,n]=S0(t,r,n),[o,s]=S0(i,o,s),new v0(e,{...a,x1:r,x2:n,y1:o,y2:s})}function S0(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 $st={ariaLabel:"arrow",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:1,strokeWidth:1.5},I0=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,$st),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=zst(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*Ch/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*Ch,I=Math.hypot(M/Math.tan(k),M)/2;if(m||y)if(I<1e5){let rt=Math.sign(k),[ot,at]=jst([w,S],[A,E],I,rt);if(m&&([w,S]=_q([ot,at,I],[w,S,m],-rt*Math.sign(m))),y){let[Y,st]=_q([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 zst(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)=>In(t,n);case"+y":return(t,r,n,i)=>Ft(r,i);case"-y":return(t,r,n,i)=>In(r,i)}}function jst([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 _q([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 wq(e,{x:t,x1:r,x2:n,y:i,y1:o,y2:s,...a}={}){return[r,n]=S0(t,r,n),[o,s]=S0(i,o,s),new I0(e,{...a,x1:r,x2:n,y1:o,y2:s})}var qst={ariaLabel:"bar"},Hh=class extends vt{constructor(t,r,n={},i=qst){super(t,r,n,i),h0(this,n),p0(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(m0,d,h,vq(d,p),vq(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 vq(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 yf=class extends Hh{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)}},gf=class extends Hh{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 Ls(e,t={}){return Ha(t)||(t={...t,y:Ee,x2:G}),new yf(e,Il(Bh(vl(t))))}function Fs(e,t={}){return Ha(t)||(t={...t,x:Ee,y2:G}),new gf(e,Tl(Ph(Sl(t))))}var Vst={ariaLabel:"cell"},xf=class extends Hh{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,Vst)}_transform(t,r){t.call(Rt,r,{},0,0)}};function Ml(e,{x:t,y:r,...n}={}){return[t,r]=Je(t,r),new xf(e,{...n,x:t,y:r})}function Sq(e,{x:t=Ee,fill:r,stroke:n,...i}={}){return r===void 0&&qe(n)[0]===void 0&&(r=G),new xf(e,{...i,x:t,fill:r,stroke:n})}function Iq(e,{y:t=Ee,fill:r,stroke:n,...i}={}){return r===void 0&&qe(n)[0]===void 0&&(r=G),new xf(e,{...i,y:t,fill:r,stroke:n})}var Yst={ariaLabel:"dot",fill:"none",stroke:"currentColor",strokeWidth:1.5};function T0(e){return e.sort===void 0&&e.reverse===void 0?fS({channel:"-r"},e):e}var bf=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]=D$(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:Cn,optional:!0},rotate:{value:l,optional:!0},symbol:{value:f,scale:"auto",optional:!0}},T0(r),Yst),this.r=p,this.rotate=u,this.symbol=d,this.frameAnchor=Is(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]=jr(this,i),x=m===Ya,b=u?void 0:h*h*Math.PI;return rl(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",Lo`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=Rn();return d[w].draw(S,u[w]*u[w]*Math.PI),S}:u?w=>{let S=Rn();return m.draw(S,u[w]*u[w]*Math.PI),S}:d?w=>{let S=Rn();return d[w].draw(S,b),S}:(()=>{let w=Rn();return m.draw(w,b),w})())}).call(Wt,this,n)).node()}};function Ji(e,{x:t,y:r,...n}={}){return n.frameAnchor===void 0&&([t,r]=Je(t,r)),new bf(e,{...n,x:t,y:r})}function Tq(e,{x:t=G,...r}={}){return new bf(e,kS({...r,x:t}))}function Aq(e,{y:t=G,...r}={}){return new bf(e,FS({...r,y:t}))}function Eq(e,t){return Ji(e,{...t,symbol:"circle"})}function Mq(e,t){return Ji(e,{...t,symbol:"hexagon"})}var Wst={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},_f=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:yn(r),optional:!0}},r,Wst),this.z=o,this.curve=oI(s,a),Do(this,r)}filter(t){return t}project(t,r,n){this.curve!==Al&&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(RS(t,[s,a],this,n)).enter().append("path").call(Mt,this).call(af,this,n).call(ij,this,n,o).attr("d",c===Al&&o.projection?Gst(o.projection,s,a):Mg().curve(c).defined(u=>u>=0).x(u=>s[u]).y(u=>a[u]))).node()}};function Gst(e,t,r){let n=kr(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 wf(e,{x:t,y:r,...n}={}){return[t,r]=Je(t,r),new _f(e,{...n,x:t,y:r})}function Nl(e,{x:t=G,y:r=Ee,...n}={}){return new _f(e,Xh({...n,x:t,y:r}))}function Ol(e,{x:t=Ee,y:r=G,...n}={}){return new _f(e,Gh({...n,x:t,y:r}))}function zN(e,t){t=Xst(t);let{x:r,y:n,color:i,size:o}=t,s=cI(e,r),a=cI(e,n),c=cI(e,i),l=cI(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=lI(h)?!0:void 0),x===void 0&&(x=lI(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":lI(h)||lI(g)||w!=null?"bar":d!=null&&y!=null?Ue(s)||Ue(a)||h==null&&g==null&&!A0(s)&&!A0(a)?"dot":"line":d!=null||y!=null?"rule":null);let M,T,R;switch(E){case"dot":R=Ji,T="stroke";break;case"line":R=s&&a||h!=null||g!=null?x||g!=null||s&&A0(s)?Ol:p||h!=null||a&&A0(a)?Nl:wf:s?Nl:Ol,T="stroke",Oq(c)&&(M=null);break;case"area":R=!(x||g!=null)&&(p||h!=null||a&&A0(a))?El:ac,T="fill",Oq(c)&&(M=null);break;case"rule":R=s?vi:Si,T="stroke";break;case"bar":R=h!=null?Ue(a)?Nq(h)&&s&&Ue(s)?Ml:Ls:qh:g!=null?Ue(s)?Nq(g)&&a&&Ue(a)?Ml:Fs:Vh:w!=null||A!=null?s&&Ue(s)&&a&&Ue(a)?Ml:s&&Ue(s)?Fs:a&&Ue(a)?Ls:y0:s&&Za(s)&&!(a&&Za(a))?Ls:a&&Za(a)&&!(s&&Za(s))?Fs:Ml,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)?dl:Rs):h!=null?(N.x=h,I=Ue(a)?hl:Ds):(w!=null||A!=null)&&(s&&a?I=Ue(s)&&Ue(a)?t0:Ue(s)?Ds:Ue(a)?Rs:sc:s?I=Ue(s)?dl:Rs:a&&(I=Ue(a)?hl:Ds)),(I===sc||I===Rs)&&(k.x={value:s,...m}),(I===sc||I===Ds)&&(k.y={value:a,...b}),p===void 0&&(p=s&&!(I===sc||I===Rs)&&(R===Ls||R===El||R===qh||R===Si)),x===void 0&&(x=a&&!(I===sc||I===Ds)&&(R===Fs||R===ac||R===Vh||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:Rq[R],markOptions:k,transformImpl:Rq[I],transformOptions:N,colorMode:T}}function Dq(e,t){let r=zN(e,t),{fx:n,fy:i,x:{zero:o},y:{zero:s},markOptions:a,transformOptions:c,colorMode:l}=r,u=$N[r.markImpl],f=$N[r.transformImpl],d=n!=null||i!=null?Yh({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 A0(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 Xst({x:e,y:t,color:r,size:n,fx:i,fy:o,mark:s}={}){return bi(e)||(e=Qh(e)),bi(t)||(t=Qh(t)),bi(r)||(r=fl(r)?{color:r}:Qh(r)),bi(n)||(n=Qh(n)),bi(i)&&({value:i}=Qh(i)),bi(o)&&({value:o}=Qh(o)),s!=null&&(s=`${s}`.toLowerCase()),{x:e,y:t,color:r,size:n,fx:i,fy:o,mark:s}}function cI(e,t){let r=_t(e,t.value);return r&&(r.label=nn(t.value)),r}function Qh(e){return Hst(e)?{reduce:e}:{value:e}}function lI(e){return/^(?:distinct|count|sum|proportion)$/i.test(e)}function Nq(e){return/^(?:first|last|mode)$/i.test(e)}function Hst(e){if(e==null)return!1;if(typeof e.reduceIndex=="function"||typeof e.reduce=="function"&&Ur(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 Oq(e){return e?new An(e).size>e.length>>1:!1}var $N={dot:Ji,line:wf,lineX:Nl,lineY:Ol,areaX:El,areaY:ac,ruleX:vi,ruleY:Si,barX:Ls,barY:Fs,rect:y0,rectX:qh,rectY:Vh,cell:Ml,bin:sc,binX:Rs,binY:Ds,group:t0,groupX:dl,groupY:hl},Rq=Object.fromEntries(Object.entries($N).map(([e,t])=>[t,e]));function Zh(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 Kh(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=yn(t),n=Object.entries(e).map(([i,o])=>{let s=oS(i,t);if(s==null)throw new Error(`missing channel: ${i}`);let[a,c]=$r(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?Kr(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"&&Ur(e))return Zst(e);if(typeof e=="function")return jN(vh(e));switch(`${e}`.toLowerCase()){case"cumsum":return Jst;case"rank":return jN((t,r)=>my(t,n=>r[n]));case"quantile":return jN((t,r)=>Kst(t,n=>r[n]))}throw new Error(`invalid map: ${e}`)}function Zst(e){return console.warn("deprecated map interface; implement mapIndex instead."),{mapIndex:e.map.bind(e)}}function Kst(e,t){let r=es(e,t)-1;return my(e,t).map(n=>n/r)}function jN(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 Jst={mapIndex(e,t,r){let n=0;for(let i of e)r[i]=n+=t[i]}};function Lq(e={},t){return arguments.length===1&&(t=e),Zh(Jh(e),t)}function Fq(e={},t){return arguments.length===1&&(t=e),Kh(Jh(e),t)}function Jh(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=eat(n),gn(`Warning: the shift option is deprecated; please use anchor "${i}" instead.`)),!((t=Math.floor(t))>0))throw new Error(`invalid k: ${t}`);return rat(r)(t,tat(i,t),o)}function tat(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 eat(e){switch(`${e}`.toLowerCase()){case"centered":return"middle";case"leading":return"start";case"trailing":return"end"}throw new Error(`invalid shift: ${e}`)}function rat(e="mean"){if(typeof e=="string"){if(/^p\d{2}$/i.test(e))return uI(wh(e));switch(e.toLowerCase()){case"deviation":return uI($i);case"max":return fI((t,r)=>Xt(t,n=>r[n]));case"mean":return nat;case"median":return uI(Ao);case"min":return fI((t,r)=>Qt(t,n=>r[n]));case"mode":return fI((t,r)=>Od(t,n=>r[n]));case"sum":return kq;case"variance":return uI($c);case"difference":return sat;case"ratio":return aat;case"first":return cat;case"last":return lat}}if(typeof e!="function")throw new Error(`invalid reduce: ${e}`);return fI(vh(e))}function uI(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 fI(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 kq(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 nat(e,t,r){if(r){let n=kq(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 iat(e,t,r,n){for(let i=r+n;r<i;++r){let o=e[t[r]];if(Pe(o))return o}}function oat(e,t,r,n){for(let i=r+n-1;i>=r;--i){let o=e[t[i]];if(Pe(o))return o}}function Cq(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 Bq(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 sat(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]]=Bq(i,n,s,e)-Cq(i,n,s,e)}}}function aat(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]]=Bq(i,n,s,e)/Cq(i,n,s,e)}}}function cat(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]]=iat(i,n,s,e)}}}function lat(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]]=oat(i,n,s,e)}}}var cc={n:20,k:2,color:"currentColor",opacity:.2,strict:!0,anchor:"end"};function Pq(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(de(s)?null:El(e,Kn({x1:Rl({k:-n,...f}),x2:Rl({k:n,...f})},{x1:t,x2:t,y:r,fill:s,fillOpacity:a,...f})),de(c)?null:Nl(e,Kn({x:Rl(f)},{x:t,y:r,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function Uq(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(de(s)?null:ac(e,Kn({y1:Rl({k:-n,...f}),y2:Rl({k:n,...f})},{x:t,y1:r,y2:r,fill:s,fillOpacity:a,...f})),de(c)?null:Ol(e,Kn({y:Rl(f)},{x:t,y:r,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function Rl({n:e=cc.n,k:t=0,strict:r=cc.strict,anchor:n=cc.anchor}={}){return Jh({k:e,reduce:i=>Ea(i)+t*($i(i)||0),strict:r,anchor:n})}var uat={ariaLabel:"tick",fill:null,stroke:"currentColor"},dI=class extends vt{constructor(t,r,n){super(t,r,n,uat),Do(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(oc,this,n,o)).node()}},E0=class extends dI{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}},M0=class extends dI{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 hI(e,{x:t=G,...r}={}){return new E0(e,{...r,x:t})}function pI(e,{y:t=G,...r}={}){return new M0(e,{...r,y:t})}function $q(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?hl:Jg;return yr(Si(e,f({x1:qN,x2:VN},{x:t,y:r,stroke:s,strokeOpacity:a,...u})),Ls(e,f({x1:"p25",x2:"p75"},{x:t,y:r,fill:i,fillOpacity:o,...u})),hI(e,f({x:"p50"},{x:t,y:r,stroke:s,strokeOpacity:a,strokeWidth:c,sort:l,...u})),Ji(e,Kn({x:jq},{x:t,y:r,z:r,r:n,stroke:s,strokeOpacity:a,...u})))}function zq(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?dl:Jg;return yr(vi(e,f({y1:qN,y2:VN},{x:r,y:t,stroke:s,strokeOpacity:a,...u})),Fs(e,f({y1:"p25",y2:"p75"},{x:r,y:t,fill:i,fillOpacity:o,...u})),pI(e,f({y:"p50"},{x:r,y:t,stroke:s,strokeOpacity:a,strokeWidth:c,sort:l,...u})),Ji(e,Kn({y:jq},{x:r,y:t,z:r,r:n,stroke:s,strokeOpacity:a,...u})))}function jq(e){let t=qN(e),r=VN(e);return e.map(n=>n<t||n>r?n:NaN)}function qN(e){let t=qq(e)*2.5-Vq(e)*1.5;return Qt(e,r=>r>=t?r:NaN)}function VN(e){let t=Vq(e)*2.5-qq(e)*1.5;return Xt(e,r=>r<=t?r:NaN)}function qq(e){return En(e,.25)}function Vq(e){return En(e,.75)}var fat={ariaLabel:"raster",stroke:null,pixelSize:1};function tp(e,t){let r=+e;if(isNaN(r))throw new Error(`invalid ${t}: ${e}`);return r}function Yq(e,t){let r=Math.floor(e);if(isNaN(r))throw new Error(`invalid ${t}: ${e}`);return r}var O0=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=Yq(o,"width")),s!=null&&(s=Yq(s,"height")),l!=null&&(l=tp(l,"x1")),u!=null&&(u=tp(u,"y1")),f!=null&&(f=tp(f,"x2")),d!=null&&(d=tp(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=bat(l,f,o,s)),c===void 0&&u!=null&&d!=null&&(c=_at(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=tp(h,"pixelSize"),this.blur=tp(p,"blur"),this.interpolate=a==null||c==null?null:dat(m)}},R0=class extends O0{constructor(t,r={}){let{imageRendering:n}=r;if(t==null){let{fill:i,fillOpacity:o}=r;ye(o)[0]!==void 0&&(r=mI("fillOpacity",r)),qe(i)[0]!==void 0&&(r=mI("fill",r))}super(t,void 0,r,fat),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]=Gq(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&&dM(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 YN(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&&_$(t)&&(n=ef,i=al,o===void 0&&(o=y$)),[t,{...s,x:n,y:i,[e]:o}]}function Wq(){let[e,t]=YN("fill",...arguments);return new R0(e,e==null||t.fill!==void 0||t.fillOpacity!==void 0?t:{...t,fill:G})}function Gq({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 WN({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),Gq(Nh(a,i),o,s)}function mI(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]=WN(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 dat(e){if(typeof e=="function")return e;if(e==null)return yI;switch(`${e}`.toLowerCase()){case"none":return yI;case"nearest":return L0;case"barycentric":return D0();case"random-walk":return F0()}throw new Error(`invalid interpolate: ${e}`)}function yI(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 D0({random:e=ju(42)}={}){return(t,r,n,i,o,s)=>{let{points:a,triangles:c,hull:l}=qi.from(t,h=>i[h],h=>o[h]),u=new s.constructor(r*n).fill(NaN),f=new Uint8Array(r*n),d=xat(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 hat(u,f,i,o,s,r,n,l,t,d),u}}function hat(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)=>mat(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 _=pat(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 pat(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 N0(e,t,r,n){return e*n-r*t}function mat(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 N0(S,A,E,M)>-1e-6&&N0(S,A,d,h)*b-N0(S,A,p,m)*x>-1e-6&&N0(E,M,y,g)*x-N0(E,M,d,h)*_<=0}}function L0(e,t,r,n,i,o){let s=new o.constructor(t*r),a=qi.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 F0({random:e=ju(42),minDistance:t=.5,maxSteps:r=2}={}){return(n,i,o,s,a,c)=>{let l=new c.constructor(i*o),u=qi.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 yat(e,t,r,n,i,o){return t*e+n*r+o*i}function gat(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 xat(e,t){return Za(e)||Ve(e)?yat:gat(t)}function bat(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 _at(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 Xq={ariaLabel:"contour",fill:"none",stroke:"currentColor",strokeMiterlimit:1,pixelSize:2},k0=class extends O0{constructor(t,{smooth:r=!0,value:n,...i}={}){let o=OS({},i,Xq);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:nn(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=mI("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}},wat(i),Xq);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=kr();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 wat({thresholds:e,interval:t,...r}){return e=PN(e,t,zc),Ne(r,function(n,i,o,s,a,c){let[l,u,f,d]=WN(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}=Ms(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)uy({data:M,width:y,height:g},this.blur);let w=vat(e,_,...Sat(v));if(w===null)throw new Error(`unsupported thresholds: ${e}`);let{contour:S}=Xc().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:gS(this.contourChannels,A)}})}function vat(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=Jr(...Md(r,n,e),e);for(;i[i.length-1]>=n;)i.pop();for(;i[1]<r;)i.shift();return i}function Qq(){return new k0(...YN("value",...arguments))}function Sat(e){return[Qt(e,t=>Qt(t,Hq)),Xt(e,t=>Xt(t,Hq))]}function Hq(e){return isFinite(e)?e:NaN}function Jq(e,t){return GN(bl,e,t)}function tV(e,t={}){return GN(_l,e,t)}function eV(e,t={}){return GN(ic,e,t)}function GN(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,Zq("x",{...s,inset:-6},r))),i!=null&&a.push(Si(t,Zq("y",{...s,inset:-6},r))),n!=null&&a.push(Os(t,Kq("x",{...s,dy:9,frameAnchor:"bottom",lineAnchor:"top"},r))),i!=null&&a.push(Os(t,Kq("y",{...s,dx:-9,frameAnchor:"left",textAnchor:"end"},r)));for(let c of a)c.ariaLabel=`crosshair ${c.ariaLabel}`;return yr(...a)}function rV(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:Iat(e,u)}}function Iat(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 Zq(e,t,r){let{color:n="currentColor",opacity:i=.2,ruleStroke:o=n,ruleStrokeOpacity:s=i,ruleStrokeWidth:a}=r;return{...rV(e,t,r),stroke:o,strokeOpacity:s,strokeWidth:a}}function Kq(e,t,r){let{color:n="currentColor",textFill:i=n,textFillOpacity:o,textStroke:s="var(--plot-background)",textStrokeOpacity:a,textStrokeWidth:c=5}=r;return{...rV(e,t,Tat(e,r)),fill:i,fillOpacity:o,stroke:s,strokeOpacity:a,strokeWidth:c}}function Tat(e,t){return Ne(t,(r,n,i)=>({channels:{text:{value:r0(i,e)?.value}}}))}var Aat={ariaLabel:"delaunay link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},Eat={ariaLabel:"delaunay mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},Mat={ariaLabel:"hull",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:1},Nat={ariaLabel:"voronoi",fill:"none",stroke:"currentColor",strokeMiterlimit:1},Oat={ariaLabel:"voronoi mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},XN=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,Aat),this.curve=_0(s,a),Do(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]=jr(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}=qi.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=Rn(),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(oc,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(Kr(t,b=>u[b]).values()).enter().append("g").each(g):x=>x.datum(t).each(g)).node()}},C0=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]=jr(this,i),h=c?g=>c[g]:Ye(f),p=l?g=>l[g]:Ye(d),m=this;function y(g){let x=qi.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(Kr(t,x=>u[x]).values()).enter().append("g").each(y):g=>g.datum(t).each(y)).node()}},HN=class extends C0{constructor(t,r={}){super(t,r,Eat),this.fill="none"}_render(t){return t.render()}},QN=class extends C0{constructor(t,r={}){super(t,r,Mat,yn)}_render(t){return t.renderHull()}},ZN=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}=Ms(c,l,f)),p=p?.value;let m=new Array((d??h).length).fill(null),[y,g]=jr(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 Ts(_,p)){let w=qi.from(v,x,b),S=nV(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}}}}),Nat)}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()}},KN=class extends C0{constructor(t,r){super(t,r,Oat),this.fill="none"}_render(t,r){return nV(t,r).render()}};function nV(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 B0(e,t,{x:r,y:n,...i}={}){return[r,n]=Je(r,n),new e(t,{...i,x:r,y:n})}function iV(e,t){return B0(XN,e,t)}function oV(e,t){return B0(HN,e,t)}function sV(e,t){return B0(QN,e,t)}function aV(e,{x:t,y:r,initializer:n,...i}={}){return B0(ZN,e,{...mr({...i,x:t,y:r},QS),initializer:n})}function cV(e,t){return B0(KN,e,t)}var Rat={ariaLabel:"density",fill:"none",stroke:"currentColor",strokeMiterlimit:1},P0=class extends vt{constructor(t,{x:r,y:n,z:i,weight:o,fill:s,stroke:a,...c}={}){let l=lV(s)&&(s="currentColor",!0),u=lV(a)&&(a="currentColor",!0);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:n,scale:"y",optional:!0},z:{value:yn({z:i,fill:s,stroke:a}),optional:!0},weight:{value:o,optional:!0}},Lat({...c,fill:s,stroke:a},l,u),Rat),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=kr();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 uV(e,{x:t,y:r,...n}={}){return[t,r]=Je(t,r),new P0(e,{...n,x:t,y:r})}var Dat=new Set(["x","y","z","weight"]);function Lat(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]=jr(this,u),{width:g,height:x}=u,{x:b,y:_}=Ms(c,l,f),v=Object.fromEntries(Object.entries(c).filter(([k])=>!Dat.has(k)).map(([k,I])=>[k,{...I,value:[]}])),w=t&&[],S=r&&[],A=t3().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?a0(k,h,p):[k]){let O=A.contours(N);I.push([N,O])}}let M=o;if(!(M instanceof Xg)){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 lV(e){return/^density$/i.test(e)}function hV(e,t){return mV("x",e,t)}function pV(e,t){return mV("y",e,t)}function mV(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]=fV(s,r,n),[i,o]=fV(a,i,o),r===n&&i===o&&(e==="y"?i=lc(0):r=lc(0)),{tip:x}=Ro({tip:x},e==="y"?"x":"y"),yr(de(l)?null:Object.assign(w0(t,{x1:r,x2:n,y1:i,y2:o,z:y,fill:l,fillOpacity:d,render:nc(b,dV(e,!0)),clip:g,..._}),{ariaLabel:"positive difference"}),de(u)?null:Object.assign(w0(t,{x1:r,x2:n,y1:i,y2:o,z:y,fill:u,fillOpacity:h,render:nc(b,dV(e,!1)),clip:g,..._}),{ariaLabel:"negative difference"}),wf(t,{x:n,y:o,z:y,stroke:p,strokeOpacity:m,tip:x,clip:!0,..._}))}function fV(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=nn(r)}=Zi(e);return{transform:i=>t||(t=_t(i,r)),label:n}}function dV(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===wS(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=hN(),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 gI({geometry:e=G,...t}={}){let r=gl(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=kr(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 yV({geometry:e=G,...t}={}){let r=gl(i=>_t(i,e)),n=gl(i=>_t(r(i),y3));return{...t,x:{transform:i=>Float64Array.from(n(i),([o])=>o)},y:{transform:i=>Float64Array.from(n(i),([,o])=>o)},geometry:{transform:r}}}var Fat={ariaLabel:"geo",fill:"none",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},U0=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:Cn,optional:!0},geometry:{value:r.geometry,scale:"projection"}},T0(r),Fat),this.r=i}render(t,r,n,i,o){let{geometry:s,r:a}=n,c=kr(o.projection??kat(r)),{r:l}=this;return rl(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 kat({x:e,y:t}){if(e||t)return e??=r=>r,t??=r=>r,$u({point(r,n){this.stream.point(e(r),t(n))}})}function xI(e,t={}){return t.tip&&t.x===void 0&&t.y===void 0?t=gI(t):t.geometry===void 0&&(t={...t,geometry:G}),new U0(e,t)}function gV({strokeWidth:e=1.5,...t}={}){return xI({type:"Sphere"},{strokeWidth:e,...t})}function xV({strokeOpacity:e=.1,...t}={}){return xI(v3(),{strokeOpacity:e,...t})}var ep=.5,rp=0;function bV(e={fill:"count"},{binWidth:t,...r}={}){let{z:n}=r;return t=t===void 0?20:ie(t),e=$4(e,r),As(e,"fill")&&(r.channels={...r.channels,fill:{value:[]}}),r.symbol===void 0&&(r.symbol="hexagon"),r.r===void 0&&!As(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}=Ms(s,a,l)),d=d?d.value:_t(i,n),h=h?.value,p=p?.value,m=m?.value;let y=e0(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 Ts(R,y))for(let{index:O,extent:L}of Cat(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 Cat(e,t,r,n,i){let o=i*(1.5/O4),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-rp)/o),f=Math.round(c=(c-ep)/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+ep,y:u*o+rp}},s.set(h,p)),p.index.push(a)}return s.values()}var Bat={ariaLabel:"hexgrid",fill:"none",stroke:"currentColor",strokeOpacity:.1};function _V(e){return new $0(e)}var $0=class extends vt{constructor({binWidth:t=20,clip:r=!0,...n}={}){super(sl,void 0,{clip:r,...n},Bat),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-ep,p=f-c-ep,m=a-rp,y=d-l-rp,g=s/2,x=g*R4,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,${Dl(-x)}l${Dl(g)},${Dl(b)}v${Dl(x)}l${Dl(-g)},${Dl(b)}`,T=M;for(let R=A;R<E;++R)for(let k=w;k<S;++k)T+=`M${Dl(k*_+(R&1)*g)},${Dl(R*v)}${M}`;return lt("svg:g",o).datum(0).call(Ct,this,i,o).call(Rt,this,{},We+ep,We+rp).call(R=>R.append("path").call(Mt,this).call(Wt,this,n).attr("d",T)).node()}};function Dl(e){return Math.round(e*1e3)/1e3}var Pat={ariaLabel:"image",fill:null,stroke:null};function Uat(e){return/^\.*\//.test(e)}function $at(e){return/^(blob|data|file|http|https):/i.test(e)}function zat(e){return typeof e=="string"&&(Uat(e)||$at(e))?[void 0,e]:[e,void 0]}var z0=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]=zat(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:Cn,optional:!0},width:{value:x,filter:Cn,optional:!0},height:{value:_,filter:Cn,optional:!0},rotate:{value:w,optional:!0},src:{value:p,optional:!0}},T0(r),Pat),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=Is(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,_]=jr(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",wV(c,u,d,b,y,m)).attr("y",wV(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?Lo`${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 wV(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 vV(e,{x:t,y:r,...n}={}){return n.frameAnchor===void 0&&([t,r]=Je(t,r)),new z0(e,{...n,x:t,y:r})}function jat(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=-np(t)-np(r)+np(t+r);s<10;s++){if(h===0||h===1)return h;if(d=qat(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 qat(e,t,r){var n=e===0||e===1?0:Math.exp(np(t+r)-np(t)-np(r)+t*Math.log(e)+r*Math.log(1-e));return e<0||e>1?!1:e<(t+1)/(t+r+2)?n*SV(e,t,r)/t:1-n*SV(1-e,r,t)/r}function SV(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 np(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 IV(e,t){var r=jat(2*Math.min(e,1-e),.5*t,.5);return r=Math.sqrt(t*(1-r)/r),e>.5?r:-r}var Vat={ariaLabel:"linear-regression",fill:"currentColor",fillOpacity:.1,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},bI=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:yn(r),optional:!0}},r,Vat),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?a0(t,c,this.z):[t]).enter().call(f=>f.append("path").attr("fill","none").call(Mt,this).call(af,this,{...n,fill:null,fillOpacity:null}).attr("d",d=>this._renderLine(d,s,a)).call(l&&!Ka(this.fill)?d=>d.select(Yat).attr("stroke","none").call(Mt,this).call(af,this,{...n,stroke:null,strokeOpacity:null,strokeWidth:null}).attr("d",h=>this._renderBand(h,s,a)):()=>{}))).node()}};function Yat(){return this.parentNode.insertBefore(this.ownerDocument.createElementNS(Mn.svg,"path"),this)}var JN=class extends bI{constructor(t,r){super(t,r)}_renderBand(t,r,n){let{ci:i,precision:o}=this,[s,a]=le(t,u=>n[u]),c=_I(t,n,r),l=EV(t,n,r,(1-i)/2,c);return fh().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]=le(t,a=>n[a]),s=_I(t,n,r);return`M${s(i)},${i}L${s(o)},${o}`}},t8=class extends bI{constructor(t,r){super(t,r)}_renderBand(t,r,n){let{ci:i,precision:o}=this,[s,a]=le(t,u=>r[u]),c=_I(t,r,n),l=EV(t,r,n,(1-i)/2,c);return fh().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]=le(t,a=>r[a]),s=_I(t,r,n);return`M${i},${s(i)}L${o},${s(o)}`}};function TV(e,{y:t=Ee,x:r=G,stroke:n,fill:i=de(n)?"currentColor":n,...o}={}){return new JN(e,Xh({...o,x:r,y:t,fill:i,stroke:n}))}function AV(e,{x:t=Ee,y:r=G,stroke:n,fill:i=de(n)?"currentColor":n,...o}={}){return new t8(e,Gh({...o,x:t,y:r,fill:i,stroke:n}))}function _I(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 EV(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=IV(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 j0({path:e=G,delimiter:t,frameAnchor:r,treeLayout:n=zu,treeSort:i,treeSeparation:o,treeAnchor:s,treeFilter:a,...c}={}){s=II(s),i=OV(i),a!=null&&(a=r8(a)),r===void 0&&(r=s.frameAnchor);let l=RV(t),u=PV(c,r8),[f,d]=$r(),[h,p]=$r();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=gv().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??Hg);for(let M of u)M[vI]=M[CV]([]);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[vI][_]=I[BV](k)}w.push(T)}return{data:v,facets:w}}),...Object.fromEntries(u)}}function SI({path:e=G,delimiter:t,curve:r="bump-x",stroke:n="#555",strokeWidth:i=1.5,strokeOpacity:o=.5,treeLayout:s=zu,treeSort:a,treeSeparation:c,treeAnchor:l,treeFilter:u,...f}={}){l=II(l),a=OV(a),u!=null&&(u=NV(u)),f={curve:r,stroke:n,strokeWidth:i,strokeOpacity:o,...f};let d=RV(t),h=PV(f,NV),[p,m]=$r(),[y,g]=$r(),[x,b]=$r(),[_,v]=$r();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=gv().path(B=>A[B]),L=s();L.nodeSize&&L.nodeSize([1,1]),L.separation&&c!==void 0&&L.separation(c??Hg);for(let B of h)B[vI]=B[CV]([]);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[vI][k]=X[BV]($,U)}N.push(C)}return{data:I,facets:N}}),...Object.fromEntries(h)}}function II(e="left"){switch(`${e}`.trim().toLowerCase()){case"left":return Wat;case"right":return Gat}throw new Error(`invalid tree anchor: ${e}`)}var Wat={frameAnchor:"left",dx:6,position({x:e,y:t},r,n,i){n[r]=t,i[r]=-e}},Gat={frameAnchor:"right",dx:-6,position({x:e,y:t},r,n,i){n[r]=-t,i[r]=-e}};function OV(e){return e==null||typeof e=="function"?e:`${e}`.trim().toLowerCase().startsWith("node:")?MV(r8(e)):MV(Xat(e))}function MV(e){return(t,r)=>Pr(e(t),e(r))}function Xat(e){return t=>t.data?.[e]}function RV(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=>Hat(n,t))}var e8=92,DV=47;function Hat(e,t){if(t===e8)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 e8: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 DV: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 e8:if(!t){t=!0;continue}case DV:t&&(e=e.slice(0,r-1)+e.slice(r),--r,--n);break}t=!1}return e}function LV(e){return Ur(e)&&typeof e.node=="function"}function Zat(e){return Ur(e)&&typeof e.link=="function"}function r8(e){if(LV(e))return e.node;if(e=`${e}`.trim().toLowerCase(),!!e.startsWith("node:")){switch(e){case"node:name":return i8;case"node:path":return n8;case"node:internal":return FV;case"node:external":return kV;case"node:depth":return o8;case"node:height":return s8}throw new Error(`invalid node value: ${e}`)}}function NV(e){if(LV(e))return e.node;if(Zat(e))return e.link;if(e=`${e}`.trim().toLowerCase(),!(!e.startsWith("node:")&&!e.startsWith("parent:"))){switch(e){case"parent:name":return wI(i8);case"parent:path":return wI(n8);case"parent:depth":return wI(o8);case"parent:height":return wI(s8);case"node:name":return i8;case"node:path":return n8;case"node:internal":return FV;case"node:external":return kV;case"node:depth":return o8;case"node:height":return s8}throw new Error(`invalid link value: ${e}`)}}function n8(e){return e.id}function i8(e){return Kat(e.id)}function o8(e){return e.depth}function s8(e){return e.height}function FV(e){return!!e.children}function kV(e){return!e.children}function wI(e){return(t,r)=>r==null?void 0:e(r)}function Kat(e){let t=e.length;for(;--t>0&&!Jat(e,t););return Qat(e.slice(t+1))}function Jat(e,t){if(e[t]==="/"){let r=0;for(;t>0&&e[--t]==="\\";)++r;if(!(r&1))return!0}return!1}var CV=2,BV=3,vI=4;function PV(e,t){let r=[];for(let n in e){let i=e[n],o=t(i);o!==void 0&&r.push([n,...$r(i),o])}return r}function a8(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=de(f)&&de(d),text:p="node:name",textStroke:m="var(--plot-background)",title:y="node:path",dx:g,dy:x,textAnchor:b,treeLayout:_=zu,textLayout:v=_===zu||_===mv?"mirrored":"normal",tip:w,...S}={}){if(g===void 0&&(g=II(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 Os(e,j0({treeLayout:_,text:p,fill:t===void 0?"currentColor":t,stroke:m,dx:g,dy:x,title:y,...E,...S}))}return yr(aI(e,SI({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?Ji(e,j0({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 UV(e,t){return a8(e,{...t,treeLayout:mv})}var zV={ariaLabel:"waffle"},q0=class extends yf{constructor(t,{unit:r=1,gap:n=1,round:i,render:o,multiple:s,...a}={}){super(t,{...a,render:nc(o,jV("x"))},zV),this.unit=Math.max(0,r),this.gap=+n,this.round=qV(i),this.multiple=VV(s)}},V0=class extends gf{constructor(t,{unit:r=1,gap:n=1,round:i,render:o,multiple:s,...a}={}){super(t,{...a,render:nc(o,jV("y"))},zV),this.unit=Math.max(0,r),this.gap=+n,this.round=qV(i),this.multiple=VV(s)}};function jV(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*tct(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=Hz(),E=f.createElementNS(Mn.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(Mn.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"?Lo`translate(${w},${S})`:Lo`translate(${S},${w})`).attr("d",R=>`M${c8(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 c8(e,t,r){if(e<0||t<0){let n=Math.ceil(-Math.min(e,t)/r);return c8(e+n*r,t+n*r,r).map(([i,o])=>[i,o-n])}return t<e?c8(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 qV(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 VV(e){return e===void 0?void 0:Math.max(1,Math.floor(e))}function tct({domain:e,range:t}){return $V(t)/$V(e)}function $V(e){let[t,r]=le(e);return r-t}function YV(e,t={}){return Ha(t)||(t={...t,y:Ee,x2:G}),new q0(e,Il(Bh(vl(t))))}function WV(e,t={}){return Ha(t)||(t={...t,x:Ee,y2:G}),new V0(e,Tl(Ph(Sl(t))))}var nY=$W(rY(),1);var cct=({marginLeft:e})=>[1,e],lct=({width:e,marginRight:t})=>[-1,e-t],uct=({width:e,marginLeft:t,marginRight:r})=>[0,(t+e-r)/2],fct=({marginTop:e})=>[1,e],dct=({height:e,marginBottom:t})=>[-1,e-t],hct=({height:e,marginTop:t,marginBottom:r})=>[0,(t+e-r)/2];function iY(e){return typeof e=="string"?{anchor:e}:e}function oY(e={},t={}){arguments.length===1&&([e,t]=aY(e));let{anchor:r="left",padding:n=1,r:i=t.r}=iY(e);switch(`${r}`.toLowerCase()){case"left":r=cct;break;case"right":r=lct;break;case"middle":r=uct;break;default:throw new Error(`unknown dodge anchor: ${r}`)}return cY("x","y",r,ie(n),i,t)}function sY(e={},t={}){arguments.length===1&&([e,t]=aY(e));let{anchor:r="bottom",padding:n=1,r:i=t.r}=iY(e);switch(`${r}`.toLowerCase()){case"top":r=fct;break;case"bottom":r=dct;break;case"middle":r=hct;break;default:throw new Error(`unknown dodge anchor: ${r}`)}return cY("y","x",r,ie(n),i,t)}function aY(e){let{anchor:t,padding:r,...n}=e,{r:i}=n;return[{anchor:t,padding:r,r:i},n]}function cY(e,t,r,n,i,o){if(i!=null&&typeof i!="number"){let{channels:s,sort:a,reverse:c}=o;s=Zg(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}=Ms(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?mct:pct,x=new Float64Array(d.length),b=h?_=>h[_]:()=>p;for(let _ of a){let v=(0,nY.default)();_=_.filter(h?S=>yh(d[S])&&Cn(h[S]):S=>yh(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 pct(e,t){return Math.abs(e)-Math.abs(t)}function mct(e,t){return e-t}function uY(e,t){return arguments.length===1&&({basis:e,...t}=e),Zh(EI(e),t)}function fY(e,t){return arguments.length===1&&({basis:e,...t}=e),Kh(EI(e),t)}function EI(e){if(e===void 0)return lY;if(typeof e=="function")return MI(vh(e));if(/^p\d{2}$/i.test(e))return ap(wh(e));switch(`${e}`.toLowerCase()){case"deviation":return xct;case"first":return lY;case"last":return gct;case"max":return bct;case"mean":return _ct;case"median":return wct;case"min":return vct;case"sum":return Sct;case"extent":return yct}throw new Error(`invalid basis: ${e}`)}function MI(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 ap(e){return MI((t,r)=>e(t,n=>r[n]))}var yct={mapIndex(e,t,r){let[n,i]=le(e,s=>t[s]),o=i-n;for(let s of e)r[s]=t[s]===null?NaN:(t[s]-n)/o}},lY=MI((e,t)=>{for(let r=0;r<e.length;++r){let n=t[e[r]];if(Pe(n))return n}}),gct=MI((e,t)=>{for(let r=e.length-1;r>=0;--r){let n=t[e[r]];if(Pe(n))return n}}),xct={mapIndex(e,t,r){let n=Ea(e,o=>t[o]),i=$i(e,o=>t[o]);for(let o of e)r[o]=t[o]===null?NaN:i?(t[o]-n)/i:0}},bct=ap(Xt),_ct=ap(Ea),wct=ap(Ao),vct=ap(Qt),Sct=ap(wr);function dY(e,t){return pY("x",e,t)}function hY(e,t){return pY("y",e,t)}function pY(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]=iS(t.replace(/^[+-]/,"")),i*=l}t=Ih(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]=le(l);return l.domain=i<0?[u,n(f,i)]:[n(u,i),f],l},a}function mY(e,t={}){if(typeof e=="string")switch(e.toLowerCase()){case"first":return G0(t);case"last":return X0(t)}if(typeof e=="function")return Ll(null,e,t);let r,n;for(r in e){if(n!==void 0)throw new Error("ambiguous selector; multiple inputs");n=Ict(e[r])}if(n===void 0)throw new Error(`invalid selector: ${e}`);return Ll(r,n,t)}function Ict(e){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"min":return p8;case"max":return m8}throw new Error(`unknown selector: ${e}`)}function G0(e){return Ll(null,Tct,e)}function X0(e){return Ll(null,Act,e)}function NI(e){return Ll("x",p8,e)}function OI(e){return Ll("y",p8,e)}function RI(e){return Ll("x",m8,e)}function DI(e){return Ll("y",m8,e)}function*Tct(e){yield e[0]}function*Act(e){yield e[e.length-1]}function*p8(e,t){yield J_(e,r=>t[r])}function*m8(e,t){yield Iu(e,r=>t[r])}function Ll(e,t,r){if(e!=null){if(r[e]==null)throw new Error(`missing channel: ${e}`);e=r[e]}let n=yn(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?Kr(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 Wh({...t,marks:[...e,this]})};var Ect=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 Mct(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 yY(e,t,r){for(let n in e){let i=Ect.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&&Mct(t,i.split("."),o)}}var Nct=new Set(["frame","hexgrid","sphere","graticule"]),Oct=new Map([["first",G0],["last",X0],["maxX",RI],["maxY",DI],["minX",NI],["minY",OI],["nearest",bl],["nearestX",_l],["nearestXY",ic]]);async function gY(e){let t={marks:[]},r=[],{attributes:n,marks:i}=e;yY(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=Oct.get(f)?.(d)??d,p=Nct.has(c)?[h]:[l,h];t.marks.push(y8[c](...p)),o.push(a.index)}Dct(t,e);let s=Wh(t);Fct(s,o),Rct(e,s,n,r);for(let a of e.interactors)await a.init(s);return s}function Rct(e,t,r,n){n.forEach(i=>{let o=r[i];if(o===ts){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 Dct(e,t){let{marks:r}=t;LI("x",e,r),LI("y",e,r),LI("fx",e,r),LI("fy",e,r)}function LI(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=xY(i[s]);a!==void 0&&(o===void 0?o=a:o!==a&&(o=void 0))}o!==void 0&&(t[e]={...n,label:o})}function xY(e){if(e){switch(e.type){case"COLUMN_REF":return e.column;case"CAST":return xY(e.expr);case"FUNCTION":if(e.name==="make_date")return"date";break}return Lct(e)}}function Lct(e){let t=`${e}`.replaceAll('"',"").replaceAll("(*)","()");return t.endsWith("()")?t.slice(0,-2):t}function Fct(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 kct={width:640,marginLeft:40,marginRight:20,marginTop:20,marginBottom:30},H0=class{constructor(t){this.attributes={...kct},this.listeners=null,this.interactors=[],this.legends=[],this.marks=[],this.markset=null,this.params=new Map,this.synch=fM(),this.element=t||document.createElement("div"),this.element.setAttribute("class","plot"),this.element.style.display="flex",Object.assign(this.element,{value:this})}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=Cct(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 gY(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 am(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 Cct(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 FI(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 Bct=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 bY(e){return Bct.has(e)}var Pct=new Set(["asterisk","circle","cross","diamond","diamond2","hexagon","plus","square","square2","star","times","triangle","triangle2","wye"]);function _Y(e){return Pct.has(`${e}`.toLowerCase())}var wY=e=>e==="stroke"||e==="fill",Uct=e=>/opacity$/i.test(e),$ct=e=>e==="symbol",zct=(e,t)=>e!=="sort"&&e!=="tip"&&t!=null&&!Array.isArray(t),g8=(e,t)=>({channel:e,field:t,as:yc(t)&&!AT(t)?t.column:e}),x8=(e,t)=>({channel:e,value:t}),kI=e=>Array.isArray(e),Tr=class extends Qs{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;kI(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[cy]){let d=u(this,l);for(let h in d)c(h,d[h])}else if(f==="string")bY(l)||wY(l)&&FI(u)||$ct(l)&&_Y(u)?o.push(x8(l,u)):o.push(g8(l,Gl(u)));else if(no(u)){let d=x8(l,u.value);o.push(d),u.addEventListener("value",h=>(d.value=h,this.update()))}else Mr(u)?(DA(u).forEach(d=>a.add(d)),o.push(g8(l,u))):f==="object"&&zct(l,u)?o.push(g8(l,u)):u!==void 0&&o.push(x8(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||kI(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:Q0(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 b8(t,n,i,r)}};function xn(e,t){let r=t?.[e.as]??e.as;return Object.hasOwn(e,"value")?e.value:wY(e.channel)?{value:r,scale:"color"}:Uct(e.channel)?{value:r,scale:"opacity"}:r}function Q0(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??c);else if(c){if(bn(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 b8(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]=xn(f,a)}return t.size&&(i.channels=c),[{type:e,data:s??(n?{length:o}:null),options:i}]}function Sf(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 im(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}=Sf(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[zA(h,f,d,r-i,u),p]}var _8={x:["min","max"]},w8={y:["min","max"]},CI={..._8,...w8};function vY(e,t,r,n,i){let{plot:o}=e,s=o.getAttribute(n),a=o.getAttribute(i);if(Array.isArray(s)&&!s[Qr])return s;{let{column:c,min:l,max:u}=e.channelField(r),f=v8(t,c)||(a?Ba().domain([l,u]).nice().domain():[l,u]);return s!==ts&&(f[Qr]=!0),o.setAttribute(n,f,{silent:!0}),f}}function ks(e,t){return vY(e,t,"x","xDomain","xNice")}function Cs(e,t){return vY(e,t,"y","yDomain","yNice")}function v8(e,t){if(!e)return;let r,n;return[e].flat().forEach(i=>$o(i,o=>{if(o instanceof Kl&&`${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 Z0=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]=v8(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 WA(s,b,u,c,_)}else return s.orderby(u)}};function S8(e,t=[]){return new t.constructor(e)}function SY(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(()=>S8(e,r));for(let d=0;d<o;++d)f[c[d]][t[d]]=r[d]}else{a.push([]);let[c]=s._grid=[S8(e,r)];for(let l=0;l<o;++l)c[t[l]]=r[l]}return{numRows:a.length,columns:s}}function IY(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(()=>S8(c,m));for(let g=0;g<a;++g)y[d[g]][r[g]]=m[g]});return{numRows:f.length,columns:u}}function K0(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 TY(e){let t=new An;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 J0(e,t=!1){let r=new Float64Array(5),n=new Float64Array(4);jct(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 jct(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 AY(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);BI(e,r.subarray(u),n,1,o,s,a,f)}for(let l=0;l<n;++l){let u=c.subarray(l);BI(t,u,i,n,o,s,a,u)}return c}function BI(e,t,r,n=1,i=new Float64Array(r),o=new Float64Array(r),s=new Float64Array(5),a=i,c=qct){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 qct(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 Fo="density",ko=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=Vct(u);super(t,r,u,CI),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[Qr]&&!r[Qr]}query(t=[]){let{interpolate:r,pad:n,channels:i,densityMap:o}=this,[s,a]=this.extentX=ks(this,t),[c,l]=this.extentY=Cs(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?[Yr(h,[+s,+a]),Yr(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;bn(A)?(b[S]=A,o[S]=!0):S==="weight"?b[Fo]=oe(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(Fo),b[Fo]=Or()),r==="linear"){if(_.length>1)throw new Error("Linear binning not applicable to multiple aggregates.");if(!b[Fo])throw new Error("Linear binning not applicable to custom aggregates.");let v=Qf(b[Fo])[0];return VA(g,d,p,v,u,x)}else return jA(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=Yct(this.interpolate),{columns:o}=Hn(t);return this.grids0=IY(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(Fo)?Fo: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=J0(r*(u-1)/c,d),p=J0(r*(f-1)/l,d);this.grids={numRows:i.numRows,columns:{...i.columns,[s]:a.map(m=>AY(h,p,m,n))}}}return this}};function Vct(e){let t={};for(let r in e)e[r]==="density"&&(delete e[r],t[r]=!0);return t}function Yct(e="none"){if(typeof e=="function")return e;switch(e.toLowerCase()){case"none":case"linear":return;case"nearest":return L0;case"barycentric":return D0();case"random-walk":return F0()}throw new Error(`invalid interpolate: ${e}`)}var tx=class extends ko{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]=K0(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=Xc().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(Wct(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]=xn(s))}for(let s in n)n[s]&&(o[s]=xn({channel:s,as:"value"}));return[{type:t,data:i,options:o}]}};function Wct(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 ex(e){return Array.from({length:e},(t,r)=>r)}function PI(e,t){let r=t.reduce((i,o,s)=>(i[o]=s,i),{}),n=ex(e.length);return n.sort((i,o)=>r[e[i]]-r[e[o]]),n}function UI(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 EY(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 MY(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 NY(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 OY(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 RY(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 Fl=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}=I8(this),p=s[f]??[],m=s[h]??[],y=o>1&&h&&this.groupby?.includes(h)?PI(m,this.plot.getAttribute("colorDomain")):ex(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}]}},rx=class extends Fl{constructor(t,r){super(t,{bandwidth:20,interpolate:"linear",pixelSize:2,...r})}};function I8(e){let{aggr:t,densityMap:r,groupby:n,plot:i}=e,o=t.includes(Fo),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":FI(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"?Fo:null),d=c?.as??(u==="grid"?Fo:null),h=l!=="grid"&&l!=="group"?NY(l):Xct(e,f),p=u!=="grid"?EY(u):Gct(e,d);return{alphaProp:d,colorProp:f,alpha:p,color:h}}function Gct(e,t){let{plot:r,grids:n}=e,i=r.getAttribute("opacityDomain"),o=i===ts,s=i?.[Qr],a=!o&&!s&&i||K0(n.columns[t]);(o||s||!i)&&(o||(a[Qr]=!0),r.setAttribute("opacityDomain",a));let c=pl({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 MY(c)}function Xct(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===ts,l=a?.[Qr],u=!c&&!l&&a||(o?i.slice().sort(Ft):s?TY(i):K0(i));(c||l||!a)&&(c||(u[Qr]=!0),r.setAttribute("colorDomain",u));let f=pl({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 OY(f);{let d=pl({x:{type:Hct(f.type),domain:f.domain,reverse:f.reverse,range:[0,1],clamp:f.clamp,base:f.base,exponent:f.exponent,constant:f.constant}});return RY(1024,f,d.apply)}}function Hct(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=UI(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 nx=class extends Fl{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,ks(this,t),i),[c]=Ii(this,"y",s,Cs(this,t),i),l=ft.from(this.sourceTable()).where(Zct(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 YA(l,a,c,f,o,s,u,n)}};function Zct(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"?sn(s.clauses.filter(a=>i(a))):s;return Array.isArray(t)?t.filter(s=>i(s)).map(s=>o(s)):o(t)}var Kct={fill:1,stroke:1,z:1},cp=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"?_8:w8),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[Qr]}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:Cs)(this,t),[s,a]=Ii(this,i,r,o),c=Q0(n,this.sourceTable(),[i]).where(t.concat(Yr(a,o))),l=this.channelField("weight")?"weight":null,u=this.groupby=n.flatMap(f=>Kct[f.channel]&&f.field?f.as:[]);return qA(c,s,l,u)}queryResult(t){let r=Hn(t).columns;return this.grids=SY(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=J0(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=BI(y,E,t),T=1/Jct(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]=xn(l,n);return[{type:t,data:{length:r},options:c}]}};function Jct(e,t,r,n){return(n===!0||n==="sum"?wr(e):n==="max"?Xt(t):r)||1}var ix=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=Sf(this,"x"),c=Sf(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=tlt(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]:xn(a,o)}for(let a in n)n[a]&&(s[a]=o.density);return[{type:t,data:{length:i},options:s}]}};function tlt(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 elt(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=-lp(t)-lp(r)+lp(t+r);s<10;s++){if(h===0||h===1)return h;if(d=rlt(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 rlt(e,t,r){var n=e===0||e===1?0:Math.exp(lp(t+r)-lp(t)-lp(r)+t*Math.log(e)+r*Math.log(1-e));return e<0||e>1?0:e<(t+1)/(t+r+2)?n*DY(e,t,r)/t:1-n*DY(1-e,r,t)/r}function DY(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 lp(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 LY(e,t){var r=elt(2*Math.min(e,1-e),.5*t,.5);return r=Math.sqrt(t*(1-r)/r),e>.5?r:-r}function FY(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 up=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:Hp(n),as:"__avg__"},{field:se(Kp(n),Xs(Or(n))),as:"__se__"}]);return Q0(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*FY(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 b8(t,n,s,i,u)}};var nlt="geom",ox=class extends Tr{constructor(t,r={},n){!kI(t)&&!r?.geometry&&(r.geometry=em(nlt)),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 sx=class extends Tr{constructor(t,r){let{type:n="hexagon",binWidth:i=20,...o}=r;super(n,t,{r:i/2,clip:!0,...o},CI),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[Qr]&&!r[Qr]}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,bn(R)||a.add(T)}}let[l,u]=ks(this,t),[f,d]=Cs(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]:ee(Xe(l),se(ee(Nt(ee(b,Nt(.5,Jp(_,1))),m),h),g)),[s.as]:Tt(Xe(d),se(ee(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,Jp(A,1))),[S]:ve(Hs(v)),[E]:sn(Di(Nt(Rr(Tt(w,A)),3),1),Di(ee(ir(Tt(v,S),2),ir(Tt(w,A),2)),ee(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(ee(ee(S,Gs(ze(v,S),-.5,.5)),Gs(oo(Jp(A,1),0),.5,-.5))),S),[_]:Gs(E,ve(ee(A,Gs(ze(w,A),-1,1))),A)},"*").from(this.sourceTable()).where(Ri(o.field),Ri(s.field),t))}};var ax=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?[Yr(h,[+s,+a]),Yr(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=oe(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 clt(g,d,p,b.density,u,x)}else return alt(g,d,p,b,u,x)}async requestTiles(){let t=ii();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]=Cs(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?kY((u-o)/h):x,_=Math.floor((f-s)/p),v=i?kY((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=ilt(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}=slt(this,n,i),{alpha:u,alphaProp:f,color:d,colorProp:h}=I8(this),p=s[f]??[],m=s[h]??[],y=o>1&&h&&this.groupby?.includes(h)?PI(m,this.plot.getAttribute("colorDomain")):ex(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 ilt(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;olt(e,t,s,a,f,d)}),s}function olt(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 slt(e,t,r){if(!e.image||e.image.w!==t||e.image.h!==r){let n=UI(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 alt(e,t,r,n,i,o){return e.select({index:er`FLOOR(${t})::INTEGER + FLOOR(${r})::INTEGER * ${i}`,...n}).groupby("index",o)}function clt(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:oe("w")},o).groupby("index",o).having(oo("density",0))}function kY(e){let t=Math.floor(e);return t===e?t-1:t}var cx=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:VT(n,r),slope:GT(n,r),n:Zp(n,r),ssy:WT(n,r),ssx:YT(n,r),xm:Qp(n,r),x0:Xe(jn(r).where(Ri(n))),x1:Xe(Vr(r).where(Ri(n)))}).select(i).groupby(i)}queryResult(t){return this.modelFit=Hn(t),this.lineData=llt(this.modelFit),this.confidenceBand()}confidenceBand(){let{ci:t,modelFit:r,precision:n,plot:i}=this,o=i.innerWidth();return this.areaData=t?ult(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=xn(l,s);break;case"stroke":a.stroke=xn(l,o),c.fill=xn(l,s);break;case"strokeOpacity":a.strokeOpacity=xn(l,o);break;case"fillOpacity":c.fillOpacity=xn(l,s);break;default:a[l.channel]=xn(l,o),c[l.channel]=xn(l,s);break}return[...i?[{type:"areaY",data:{length:r.numRows},options:c}]:[],{type:"line",data:{length:t.numRows},options:a}]}};function T8(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 llt(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=T8(t,r),d=T8(t.map(u),r.map(u));for(let h in l)l[h]=T8(l[h],l[h]);return{numRows:f.length,columns:{x:f,y:d,...l}}}function ult(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=LY((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 fp(e){e.tagName==="a"&&(e=e.children[0]);let t=e.__data__;return Array.isArray(t)?t[0]:t}function CY(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 kl(e){let t={};for(let r in e)t[CY(r)]=e[r];return t}function flt(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(bn(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 lx=class{constructor(t,{selection:r,channels:n={}}){this.mark=flt(t),this.selection=r;let i=Object.entries(kl(n));this.channels=i.length?i:[["opacity",.2]],this.selection.addEventListener("value",cm(()=>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 dlt(o,s);for(let c=0;c<r.length;++c){let l=r[c],u=i[c],f=a(fp(l));for(let d=0;d<n.length;++d){let[h,p]=n[d];l.setAttribute(h,f?u[d]:p)}}}};async function dlt(e,t){let r=t?.predicate(e);if(!r||r.length===0)return()=>!0;let n=e.filterBy?.predicate(e,!0),i={__:sn(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 $I(){let e=this,t=e.getScreenCTM,r;e.getScreenCTM=()=>e.isConnected?r=t.call(e):r}function A8(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 zI(){return A8(HM())}function BY(){return A8(GM())}function PY(){return A8(XM())}function jI(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($I)}function ux(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 UY(e){if(Mr(e)){if(e.type==="COLUMN_REF")return e.column;if(e.type==="AGGREGATE")return e.args[0]??e}return e}function Bs(e,t){return UY(e.channelField(t)?.field)}function $Y(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(UY(a.field)),n.push(a.as);return}}throw new Error(`Missing channel: ${i}`)}),{fields:r,as:n}}function fx(e,t,r=1){return t.invert(r*Math.floor(e/r))}var Cl=class{constructor(t,{channel:r,selection:n,field:i=void 0,pixelSize:o=1,peers:s=!0,brush:a}){this.mark=t,this.channel=r,this.pixelSize=o||1,this.selection=n,this.peers=s,this.field=i||Bs(t,r),this.style=a&&kl(a),this.brush=r==="y"?PY():BY(),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=>fx(n,this.scale,this.pixelSize)).sort((n,i)=>n-i)),ux(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 vu(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=jI(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 dx=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||Bs(t,"x"),this.yfield=i||Bs(t,"y"),this.style=a&&kl(a),this.brush=zI(),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=>fx(u,i,n)).sort(Ft),a=[c[1],l[1]].map(u=>fx(u,o,n)).sort(Ft)}(!ux(s,r?.[0])||!ux(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 cM([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=jI(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 If=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=>Bs(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):Uc(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=!Lr(o),[u,f]=hlt(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]=ln(m,this),x=plt(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=>{m.buttons||this.activate()}))}activate(){let t=this.channels.map(()=>0);this.selection.activate(this.clause(t))}};function hlt(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 plt(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 zY=(e,t)=>e-t,hx=class{constructor(t,{x:r=new jo,y:n=new jo,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||Bs(t,"x"),this.yfield=o||Bs(t,"y"),this.zoom=E8(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=mlt(t,this.xscale);this.xsel.update(this.clause(r,this.xfield,this.xscale))}if(this.pany){let r=ylt(t,this.yscale);this.ysel.update(this.clause(r,this.yfield,this.yscale))}}clause(t,r,n){return vu(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}}}=this;this.xscale=t.scale("x"),this.yscale=t.scale("y");let o=this.xscale.range.slice().sort(zY),s=this.yscale.range.slice().sort(zY),a=E8(r,[-1/0,1/0],o),c=E8(n,[-1/0,1/0],s),l=d4().extent([[o[0],s[0]],[o[1],s[1]]]).scaleExtent(this.zoom).translateExtent([[a[0],c[0]],[a[1],c[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:u})=>this.publish(u));if(Zt(i).call(l),r||n){let u=!1;i.addEventListener("pointerenter",f=>{u||(u=!0,f.buttons||this.activate())}),i.addEventListener("pointerleave",()=>u=!1)}}activate(){if(this.panx){let{xscale:t,xfield:r}=this;this.xsel.activate(this.clause(t.domain,r,t))}if(this.pany){let{yscale:t,yfield:r}=this;this.ysel.activate(this.clause(t.domain,r,t))}}};function E8(e,t,r){return e?Array.isArray(e)?e:t:r}function mlt(e,t){return t.range.map(e.invertX,e).map(t.invert,t)}function ylt(e,t){return t.range.map(e.invertY,e).map(t.invert,t)}var glt={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},xlt=/[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi,blt=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,_lt=/^((\s+,?\s*)|(,\s*))/,wlt=/^[01]/,jY=e=>`Invalid SVG path, incorrect parameter ${e}`;function qY(e){let t=[];return(e.match(xlt)||[]).forEach(n=>{let i=n[0],o=i.toLowerCase(),s=glt[o],a=vlt(o,s,n.slice(1).trim()),c=a.length;if(c<s||c&&c%s!==0)throw new Error(jY("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 vlt(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)?wlt:blt,a=r.slice(i).match(s);if(a===null)throw new Error(jY("type"));i+=a[0].length,n.push(+a[0]);let c=r.slice(i).match(_lt);c!==null&&(i+=c[0].length)}return n}function XY(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=HY(a)??o;for(let l of a.children)VY(r,n,i,l,c)&&s.push(l)}else VY(r,n,i,a,o)&&s.push(a);return s}function VY(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 QY(o,s,a,c,Tf(n.cx),Tf(n.cy),Tf(n.r));case"line":return ZY(o,s,a,c,Tf(n.x1),Tf(n.y1),Tf(n.x2),Tf(n.y2));case"path":return Slt(o,s,a,c,n)}}return!1}function Tf(e){return e.baseVal.value}function HY(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 QY(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 ZY(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 Slt(e,t,r,n,i){let o=i.__path__||(i.__path__=qY(i.getAttribute("d"))),s=0,a=0,c=0,l=0,u=!1,f=[0,0],d=2,h=HY(i),p=(x,b)=>{f.length=d=2,f[0]=c=s=x,f[1]=l=a=b},m=h?(x,b)=>p(YY(h,x,b),WY(h,x,b)):(x,b)=>p(x,b),y=(x,b)=>(f[d]=x,f[d+1]=b,d+=2,ZY(e,t,r,n,f[d-4],f[d-3],x,b)),g=h?(x,b)=>{u=y(YY(h,c=x,l=b),WY(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(Ilt(o,x))return QY(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),Tlt(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 YY(e,t,r){return e.a*t+e.c*r+e.e}function WY(e,t,r){return e.b*t+e.d*r+e.f}function Ilt(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 Tlt(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&&GY(e,t,r,o)>0&&++n:r[o+3]<=t&&GY(e,t,r[o])<0&&--n;return n}function GY(e,t,r,n){return(r[n+2]-r[n])*(t-r[n+1])-(e-r[n])*(r[n+3]-r[n+1])}function qI(e,t){return e==null||t==null?e!=null||t!=null:e.length!==t.length||e.some((r,n)=>VI(r,t[n]))}function VI(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 px=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&&kl(o),this.brush=zI(),this.brush.on("brush end",c=>this.publish(c.selection)),this.extent=null,this.groups=null;let{fields:s,as:a}=$Y(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;XY(o,n,t).forEach(l=>{let u=fp(l),f=r.map(d=>a[d][u]);c.set(f.join("|"),f)}),s=Array.from(c.values())}this.extent=t,qI(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($I).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 Af=class{constructor(t,{selection:r,channels:n,peers:i=!0}){this.mark=t,this.value=null,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][fp(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(Alt(c,f)){let h=n(f);(l.shiftKey||l.metaKey)&&u?.length?(d=u.filter(p=>VI(p,h)),d.length===u.length&&d.push(h)):u?.length===1&&!VI(u[0],h)?d=null:d=[h]}this.value=d,qI(u,d)&&s.update(this.clause(d))}),t.addEventListener("pointerenter",l=>{l.buttons||this.activate()})}activate(){this.selection.activate(this.clause([this.fields.map(()=>0)]))}};function Alt(e,t){return e.some(r=>r.contains(t))}var JY=":scope > div, :scope > span",YI="swatch",KY="ramp",dp=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=Elt(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(JY);for(let c of a){let l=s?s.has(c.__data__):!0;c.style.opacity=l?1:.2}}};function Elt(e,t){let{channel:r,plot:n,selection:i}=e,o=t.scale(r),s=o.type==="ordinal"?YI:KY,a={label:n.getAttribute(`${r}Label`)??null,...e.options},c=s===YI?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===KY){let f=c.width??240,d=Rlt(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=Mlt(e,s);s===YI?(f.init(l,JY,d=>[d.__data__]),e.update()):f.init(l,l.querySelector("g:last-of-type"))}return l}function Mlt(e,t){let{channel:r,handler:n,selection:i}=e;if(n)return n;let o=Nlt(e);return t===YI?(e.handler=new Af(o,{selection:i,channels:[r],peers:!1}),i.addEventListener("value",()=>e.update())):e.handler=new Cl(o,{selection:i,channel:r,brush:{fill:"none",stroke:"currentColor"},peers:!1}),e.handler}function Nlt(e){let{channel:t,plot:r}=e,n=e.field??Olt(r.marks,t)??"value";if(n){let i={field:n};return{plot:r,channelField:o=>t===o?i:void 0}}}function Olt(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 Rlt(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 pl({x:{...o,type:a,range:[0,t]}})}function WI(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 tW(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||WI(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 iW="year",eW="month",rW="day",GI="hour",XI="minute",HI="second",Dlt="millisecond",yx=1e3,gx=yx*60,xx=gx*60,QI=xx*24,Llt=QI*7,nW=QI*30,oW=QI*365,mx=[[HI,1,yx],[HI,5,5*yx],[HI,15,15*yx],[HI,30,30*yx],[XI,1,gx],[XI,5,5*gx],[XI,15,15*gx],[XI,30,30*gx],[GI,1,xx],[GI,3,3*xx],[GI,6,6*xx],[GI,12,12*xx],[rW,1,QI],[rW,7,Llt],[eW,1,nW],[eW,3,3*nW],[iW,1,oW]];function sW(e,t,r){let n=t-e,i=n/r,o=Io(s=>s[2]).right(mx,i);return o===mx.length?{interval:iW,step:WI(n/oW,r)}:o?(o=mx[i/mx[o-1][2]<mx[o][2]/i?o-1:o],{interval:o[0],step:o[1]}):{interval:Dlt,step:WI(n,r,1)}}var Flt=new Set(["rectY-x","rectX-y","rect-x","rect-y","ruleY-x","ruleX-y"]);function klt(e,t){return Flt.has(`${e.type}-${t}`)}function O8(e,t={}){let r=(n,i)=>klt(n,i)?{[`${i}1`]:M8(n,i,e,t),[`${i}2`]:M8(n,i,e,{...t,offset:1})}:{[i]:M8(n,i,e,t)};return r[cy]=!0,r}function M8(e,t,r,n){return new N8(r,e,t,n)}function Clt(e,t){let r=e.plot.getAttribute(`${t}Scale`);return r==="utc"||r==="time"}var N8=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"||Clt(t,r)?"date":"number"),d;if(f==="number"){let{apply:h,sqlApply:p,sqlInvert:m}=Sf(t,r),y=tW(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)),_=ee(y.min,Nt(x,u?ee(u,b):b));d=m(_)}else{let{interval:h,step:p=1}=f==="date"?sW(s,a,l||40):i,m=eA(n,h,p);d=u?ee(m,Xb(h,u*p)):m}return`${d}`}};var Ps=class extends Qs{constructor(t,r,n="input"){super(t),this.element=r||document.createElement("div"),n&&this.element.setAttribute("class",n),Object.defineProperty(this.element,"value",{value:this})}activate(){}};var Blt=e=>e&&typeof e=="object"&&!Array.isArray(e);var bx=class extends Ps{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,t),this.from=i,this.column=o,this.format=a,this.field=u;let f=this.selection=n,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=>Blt(h)?h:{value:h}),this.selectedValue(l===void 0?"":l),this.update()),f){let h=!Lr(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(){Lr(this.selection)&&this.selection.activate(Uc(this.field,0,{source:this}))}publish(t){let{selection:r,field:n}=this;if(Lr(r)){t===""&&(t=void 0);let i=Uc(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=Lr(i)?i.valueFor(this):i.value;this.selectedValue(o===void 0?"":o)}return this}};var Plt=0;var _x=class extends Ps{constructor({element:t,filterBy:r,from:n,column:i,label:o,type:s="contains",field:a=i,as:c}={}){if(super(r,t),this.id="search_"+ ++Plt,this.type=s,this.from=n,this.column=i,this.selection=c,this.field=a,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)}),Lr(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 lM(r,t,{source:this,method:n})}activate(){Lr(this.selection)&&this.selection.activate(this.clause(""))}publish(t){let{selection:r}=this;Lr(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 Ult=0;var wx=class extends Ps{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,t),this.id="slider_"+ ++Ult,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,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&&(Lr(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:Vr(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 vu(r,i,{source:this,bin:"ceil",scale:{type:"identity",domain:i},pixelSize:this.step})}else return Uc(r,t,{source:this})}activate(){Lr(this.selection)&&this.selection.activate(this.clause(0))}publish(t){let{selection:r}=this;Lr(r)?r.update(this.clause(t)):or(this.selection)&&r.update(t)}};var D8=aW(e=>{let t=ZI(e);return r=>r==null?"":typeof r=="number"?t(r):r instanceof Date?L8(r):`${r}`}),ZI=aW(e=>t=>t===0?"0":t.toLocaleString(e)),gle=D8(),xle=ZI();function L8(e){return gh(e,"Invalid Date")}function aW(e){let t=null,r;return(n="en")=>n===t?r:r=e(t=n)}var $lt=-1;var vx=class extends Ps{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,t,null),this.id=`table-${++$lt}`,this.element.setAttribute("id",this.id),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.isPending=!1,this.selection=f,this.currentRow=-1,this.sortHeader=null,this.sortColumn=null,this.sortDesc=!1,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{isPending: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.isPending=!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=zlt(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),ii().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=jlt(this.format,t),this.style.innerText=Ylt(this.id,qlt(this.align,t),Vlt(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?pA(o):o:[]).limit(r).offset(n)}queryResult(t){return this.isPending||(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.isPending=!1,this}activate(){Lr(this.selection)&&this.selection.activate(this.clause([]))}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 zlt(e){let t=e.parentElement;return Object.hasOwn(t,"__row__")?+t.__row__:-1}function jlt(e={},t,r){return t.map(({column:n,type:i})=>{if(n in e)return e[n];switch(i){case"number":return ZI(r);case"date":return L8;default:return D8(r)}})}function qlt(e={},t){return t.map(({column:r,type:n})=>r in e?e[r]:n==="number"?"right":"left")}function Vlt(e={},t){return t.map(({column:r})=>e[r])}function Ylt(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 Sx(e,...t){let r=e?.context?.coordinator??ii();for(let n of t)r.connect(n)}function KI(e,t,r){let n=new t(r);return Sx(e,n),n.element}function cW(e){return KI(this,bx,e)}function lW(e){return KI(this,_x,e)}function uW(e){return KI(this,wx,e)}function fW(e){return KI(this,vx,e)}function dW({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 hW(...e){return dW({direction:"vertical"},e.flat())}function pW(...e){return dW({direction:"horizontal"},e.flat())}function mW({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 yW(e){return mW({dim:"height",size:e})}function gW(e){return mW({dim:"width",size:e})}var _W={};ti(_W,{align:()=>X8,ariaDescription:()=>rO,ariaLabel:()=>eO,aspectRatio:()=>H8,axis:()=>Q8,clip:()=>J8,colorBase:()=>UD,colorClamp:()=>ED,colorConstant:()=>zD,colorDomain:()=>TD,colorExponent:()=>$D,colorInterpolate:()=>RD,colorLabel:()=>FD,colorN:()=>MD,colorNice:()=>ND,colorPercent:()=>kD,colorPivot:()=>DD,colorRange:()=>AD,colorReverse:()=>CD,colorScale:()=>ID,colorScheme:()=>OD,colorSymmetric:()=>LD,colorTickFormat:()=>PD,colorZero:()=>BD,facetGrid:()=>IR,facetLabel:()=>TR,facetMargin:()=>bR,facetMarginBottom:()=>wR,facetMarginLeft:()=>vR,facetMarginRight:()=>SR,facetMarginTop:()=>_R,fxAlign:()=>DR,fxAriaDescription:()=>QR,fxAriaLabel:()=>HR,fxAxis:()=>CR,fxDomain:()=>AR,fxFontVariant:()=>XR,fxGrid:()=>qR,fxInset:()=>MR,fxInsetLeft:()=>NR,fxInsetRight:()=>OR,fxLabel:()=>YR,fxLabelAnchor:()=>WR,fxLabelOffset:()=>GR,fxLine:()=>VR,fxPadding:()=>LR,fxPaddingInner:()=>FR,fxPaddingOuter:()=>kR,fxRange:()=>ER,fxReverse:()=>ZR,fxRound:()=>RR,fxTickFormat:()=>zR,fxTickPadding:()=>$R,fxTickRotate:()=>jR,fxTickSize:()=>PR,fxTickSpacing:()=>UR,fxTicks:()=>BR,fyAlign:()=>iD,fyAriaDescription:()=>vD,fyAriaLabel:()=>wD,fyAxis:()=>cD,fyDomain:()=>KR,fyFontVariant:()=>_D,fyGrid:()=>mD,fyInset:()=>tD,fyInsetBottom:()=>rD,fyInsetTop:()=>eD,fyLabel:()=>gD,fyLabelAnchor:()=>xD,fyLabelOffset:()=>bD,fyLine:()=>yD,fyPadding:()=>oD,fyPaddingInner:()=>sD,fyPaddingOuter:()=>aD,fyRange:()=>JR,fyReverse:()=>SD,fyRound:()=>nD,fyTickFormat:()=>hD,fyTickPadding:()=>dD,fyTickRotate:()=>pD,fyTickSize:()=>uD,fyTickSpacing:()=>fD,fyTicks:()=>lD,grid:()=>K8,height:()=>q8,inset:()=>Z8,lengthBase:()=>vL,lengthClamp:()=>xL,lengthConstant:()=>IL,lengthDomain:()=>yL,lengthExponent:()=>SL,lengthNice:()=>bL,lengthPercent:()=>_L,lengthRange:()=>gL,lengthScale:()=>mL,lengthZero:()=>wL,margin:()=>U8,marginBottom:()=>G8,marginLeft:()=>V8,marginRight:()=>Y8,marginTop:()=>W8,margins:()=>P8,name:()=>C8,opacityBase:()=>KD,opacityClamp:()=>YD,opacityConstant:()=>tL,opacityDomain:()=>qD,opacityExponent:()=>JD,opacityLabel:()=>GD,opacityNice:()=>WD,opacityPercent:()=>XD,opacityRange:()=>VD,opacityReverse:()=>HD,opacityScale:()=>jD,opacityTickFormat:()=>ZD,opacityZero:()=>QD,padding:()=>tO,projectionClip:()=>kL,projectionDomain:()=>NL,projectionInset:()=>OL,projectionInsetBottom:()=>FL,projectionInsetLeft:()=>RL,projectionInsetRight:()=>DL,projectionInsetTop:()=>LL,projectionParallels:()=>AL,projectionPrecision:()=>EL,projectionRotate:()=>ML,projectionType:()=>TL,rBase:()=>dL,rClamp:()=>aL,rConstant:()=>pL,rDomain:()=>oL,rExponent:()=>hL,rLabel:()=>lL,rNice:()=>cL,rPercent:()=>uL,rRange:()=>sL,rScale:()=>iL,rZero:()=>fL,style:()=>z8,symbolDomain:()=>rL,symbolRange:()=>nL,symbolScale:()=>eL,width:()=>j8,xAlign:()=>dO,xAriaDescription:()=>RO,xAriaLabel:()=>OO,xAxis:()=>yO,xBase:()=>kO,xClamp:()=>uO,xConstant:()=>BO,xDomain:()=>iO,xExponent:()=>CO,xFontVariant:()=>NO,xGrid:()=>SO,xInset:()=>aO,xInsetLeft:()=>cO,xInsetRight:()=>lO,xLabel:()=>TO,xLabelAnchor:()=>AO,xLabelArrow:()=>EO,xLabelOffset:()=>MO,xLine:()=>IO,xNice:()=>sO,xPadding:()=>hO,xPaddingInner:()=>pO,xPaddingOuter:()=>mO,xPercent:()=>DO,xRange:()=>oO,xReverse:()=>LO,xRound:()=>fO,xScale:()=>nO,xTickFormat:()=>wO,xTickPadding:()=>_O,xTickRotate:()=>vO,xTickSize:()=>xO,xTickSpacing:()=>bO,xTicks:()=>gO,xZero:()=>FO,xyDomain:()=>$8,yAlign:()=>GO,yAriaDescription:()=>dR,yAriaLabel:()=>fR,yAxis:()=>ZO,yBase:()=>yR,yClamp:()=>YO,yConstant:()=>xR,yDomain:()=>UO,yExponent:()=>gR,yFontVariant:()=>uR,yGrid:()=>iR,yInset:()=>jO,yInsetBottom:()=>VO,yInsetTop:()=>qO,yLabel:()=>sR,yLabelAnchor:()=>aR,yLabelArrow:()=>cR,yLabelOffset:()=>lR,yLine:()=>oR,yNice:()=>zO,yPadding:()=>XO,yPaddingInner:()=>HO,yPaddingOuter:()=>QO,yPercent:()=>hR,yRange:()=>$O,yReverse:()=>pR,yRound:()=>WO,yScale:()=>PO,yTickFormat:()=>rR,yTickPadding:()=>eR,yTickRotate:()=>nR,yTickSize:()=>JO,yTickSpacing:()=>tR,yTicks:()=>KO,yZero:()=>mR});var Ix=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()}},F8=new Ix;function k8(e,t,r){(e?.context?.namedPlots??F8).request(t,r)}function xW(e,t,r){(e?.context?.namedPlots??F8).set(t,r)}function C8(e){return t=>xW(this,e,t)}function bW(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 Wlt(e,t){return r=>{bW(r,e,t)}}function B8(e){return t=>{for(let[r,n]of Object.entries(e))bW(t,r,n)}}function P8(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),B8(o)}function U8(e){return B8({marginTop:e,marginBottom:e,marginLeft:e,marginRight:e})}function $8(e){return B8({xDomain:e,yDomain:e})}var F=e=>t=>Wlt(e,t),z8=F("style"),j8=F("width"),q8=F("height"),V8=F("marginLeft"),Y8=F("marginRight"),W8=F("marginTop"),G8=F("marginBottom"),X8=F("align"),H8=F("aspectRatio"),Q8=F("axis"),Z8=F("inset"),K8=F("grid"),J8=F("clip"),tO=F("padding"),eO=F("ariaLabel"),rO=F("ariaDescription"),nO=F("xScale"),iO=F("xDomain"),oO=F("xRange"),sO=F("xNice"),aO=F("xInset"),cO=F("xInsetLeft"),lO=F("xInsetRight"),uO=F("xClamp"),fO=F("xRound"),dO=F("xAlign"),hO=F("xPadding"),pO=F("xPaddingInner"),mO=F("xPaddingOuter"),yO=F("xAxis"),gO=F("xTicks"),xO=F("xTickSize"),bO=F("xTickSpacing"),_O=F("xTickPadding"),wO=F("xTickFormat"),vO=F("xTickRotate"),SO=F("xGrid"),IO=F("xLine"),TO=F("xLabel"),AO=F("xLabelAnchor"),EO=F("xLabelArrow"),MO=F("xLabelOffset"),NO=F("xFontVariant"),OO=F("xAriaLabel"),RO=F("xAriaDescription"),DO=F("xPercent"),LO=F("xReverse"),FO=F("xZero"),kO=F("xBase"),CO=F("xExponent"),BO=F("xConstant"),PO=F("yScale"),UO=F("yDomain"),$O=F("yRange"),zO=F("yNice"),jO=F("yInset"),qO=F("yInsetTop"),VO=F("yInsetBottom"),YO=F("yClamp"),WO=F("yRound"),GO=F("yAlign"),XO=F("yPadding"),HO=F("yPaddingInner"),QO=F("yPaddingOuter"),ZO=F("yAxis"),KO=F("yTicks"),JO=F("yTickSize"),tR=F("yTickSpacing"),eR=F("yTickPadding"),rR=F("yTickFormat"),nR=F("yTickRotate"),iR=F("yGrid"),oR=F("yLine"),sR=F("yLabel"),aR=F("yLabelAnchor"),cR=F("yLabelArrow"),lR=F("yLabelOffset"),uR=F("yFontVariant"),fR=F("yAriaLabel"),dR=F("yAriaDescription"),hR=F("yPercent"),pR=F("yReverse"),mR=F("yZero"),yR=F("yBase"),gR=F("yExponent"),xR=F("yConstant"),bR=F("facetMargin"),_R=F("facetMarginTop"),wR=F("facetMarginBottom"),vR=F("facetMarginLeft"),SR=F("facetMarginRight"),IR=F("facetGrid"),TR=F("facetLabel"),AR=F("fxDomain"),ER=F("fxRange"),MR=F("fxInset"),NR=F("fxInsetLeft"),OR=F("fxInsetRight"),RR=F("fxRound"),DR=F("fxAlign"),LR=F("fxPadding"),FR=F("fxPaddingInner"),kR=F("fxPaddingOuter"),CR=F("fxAxis"),BR=F("fxTicks"),PR=F("fxTickSize"),UR=F("fxTickSpacing"),$R=F("fxTickPadding"),zR=F("fxTickFormat"),jR=F("fxTickRotate"),qR=F("fxGrid"),VR=F("fxLine"),YR=F("fxLabel"),WR=F("fxLabelAnchor"),GR=F("fxLabelOffset"),XR=F("fxFontVariant"),HR=F("fxAriaLabel"),QR=F("fxAriaDescription"),ZR=F("fxReverse"),KR=F("fyDomain"),JR=F("fyRange"),tD=F("fyInset"),eD=F("fyInsetTop"),rD=F("fyInsetBottom"),nD=F("fyRound"),iD=F("fyAlign"),oD=F("fyPadding"),sD=F("fyPaddingInner"),aD=F("fyPaddingOuter"),cD=F("fyAxis"),lD=F("fyTicks"),uD=F("fyTickSize"),fD=F("fyTickSpacing"),dD=F("fyTickPadding"),hD=F("fyTickFormat"),pD=F("fyTickRotate"),mD=F("fyGrid"),yD=F("fyLine"),gD=F("fyLabel"),xD=F("fyLabelAnchor"),bD=F("fyLabelOffset"),_D=F("fyFontVariant"),wD=F("fyAriaLabel"),vD=F("fyAriaDescription"),SD=F("fyReverse"),ID=F("colorScale"),TD=F("colorDomain"),AD=F("colorRange"),ED=F("colorClamp"),MD=F("colorN"),ND=F("colorNice"),OD=F("colorScheme"),RD=F("colorInterpolate"),DD=F("colorPivot"),LD=F("colorSymmetric"),FD=F("colorLabel"),kD=F("colorPercent"),CD=F("colorReverse"),BD=F("colorZero"),PD=F("colorTickFormat"),UD=F("colorBase"),$D=F("colorExponent"),zD=F("colorConstant"),jD=F("opacityScale"),qD=F("opacityDomain"),VD=F("opacityRange"),YD=F("opacityClamp"),WD=F("opacityNice"),GD=F("opacityLabel"),XD=F("opacityPercent"),HD=F("opacityReverse"),QD=F("opacityZero"),ZD=F("opacityTickFormat"),KD=F("opacityBase"),JD=F("opacityExponent"),tL=F("opacityConstant"),eL=F("symbolScale"),rL=F("symbolDomain"),nL=F("symbolRange"),iL=F("rScale"),oL=F("rDomain"),sL=F("rRange"),aL=F("rClamp"),cL=F("rNice"),lL=F("rLabel"),uL=F("rPercent"),fL=F("rZero"),dL=F("rBase"),hL=F("rExponent"),pL=F("rConstant"),mL=F("lengthScale"),yL=F("lengthDomain"),gL=F("lengthRange"),xL=F("lengthClamp"),bL=F("lengthNice"),_L=F("lengthPercent"),wL=F("lengthZero"),vL=F("lengthBase"),SL=F("lengthExponent"),IL=F("lengthConstant"),TL=F("projectionType"),AL=F("projectionParallels"),EL=F("projectionPrecision"),ML=F("projectionRotate"),NL=F("projectionDomain"),OL=F("projectionInset"),RL=F("projectionInsetLeft"),DL=F("projectionInsetRight"),LL=F("projectionInsetTop"),FL=F("projectionInsetBottom"),kL=F("projectionClip");function wW(e,t){return{table:e,options:t}}var vW={};ti(vW,{area:()=>CL,areaX:()=>BL,areaY:()=>PL,arrow:()=>RF,axisFx:()=>CF,axisFy:()=>BF,axisX:()=>FF,axisY:()=>kF,barX:()=>jL,barY:()=>qL,cell:()=>VL,cellX:()=>YL,cellY:()=>WL,circle:()=>JL,contour:()=>gF,delaunayLink:()=>MF,delaunayMesh:()=>NF,denseLine:()=>yF,density:()=>mF,densityX:()=>hF,densityY:()=>pF,dot:()=>QL,dotX:()=>ZL,dotY:()=>KL,errorbarX:()=>IF,errorbarY:()=>TF,frame:()=>LF,geo:()=>jF,graticule:()=>VF,gridFx:()=>$F,gridFy:()=>zF,gridX:()=>PF,gridY:()=>UF,heatmap:()=>xF,hexagon:()=>tF,hexbin:()=>wF,hexgrid:()=>vF,hull:()=>OF,image:()=>dF,line:()=>UL,lineX:()=>$L,lineY:()=>zL,link:()=>DF,raster:()=>bF,rasterTile:()=>_F,rect:()=>GL,rectX:()=>XL,rectY:()=>HL,regressionY:()=>SF,ruleX:()=>iF,ruleY:()=>oF,sphere:()=>qF,spike:()=>fF,text:()=>eF,textX:()=>rF,textY:()=>nF,tickX:()=>sF,tickY:()=>aF,vector:()=>cF,vectorX:()=>lF,vectorY:()=>uF,voronoi:()=>AF,voronoiMesh:()=>EF,waffleX:()=>YF,waffleY:()=>WF});var Glt=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=Glt.has(e)?null:[{}]);let n=e.startsWith("area")||e.startsWith("line")?Z0:Tr;return JI(n,e,t,r)}function JI(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 CL=(...e)=>St("area",...e),BL=(...e)=>St("areaX",...e),PL=(...e)=>St("areaY",...e),UL=(...e)=>St("line",...e),$L=(...e)=>St("lineX",...e),zL=(...e)=>St("lineY",...e),jL=(...e)=>St("barX",...e),qL=(...e)=>St("barY",...e),VL=(...e)=>St("cell",...e),YL=(...e)=>St("cellX",...e),WL=(...e)=>St("cellY",...e),GL=(...e)=>St("rect",...e),XL=(...e)=>St("rectX",...e),HL=(...e)=>St("rectY",...e),QL=(...e)=>St("dot",...e),ZL=(...e)=>St("dotX",...e),KL=(...e)=>St("dotY",...e),JL=(...e)=>St("circle",...e),tF=(...e)=>St("hexagon",...e),eF=(...e)=>St("text",...e),rF=(...e)=>St("textX",...e),nF=(...e)=>St("textY",...e),iF=(...e)=>St("ruleX",...e),oF=(...e)=>St("ruleY",...e),sF=(...e)=>St("tickX",...e),aF=(...e)=>St("tickY",...e),cF=(...e)=>St("vector",...e),lF=(...e)=>St("vectoX",...e),uF=(...e)=>St("vectorY",...e),fF=(...e)=>St("spike",...e),dF=(...e)=>St("image",...e),hF=(...e)=>JI(cp,"areaX",...e),pF=(...e)=>JI(cp,"areaY",...e),mF=(...e)=>Us(ix,...e),yF=(...e)=>Us(nx,...e),gF=(...e)=>Us(tx,...e),xF=(...e)=>Us(rx,...e),bF=(...e)=>Us(Fl,...e),_F=(...e)=>Us(ax,...e),wF=(...e)=>Us(sx,...e),vF=(...e)=>St("hexgrid",...e),SF=(...e)=>Us(cx,...e),IF=(...e)=>JI(up,"ruleY",...e),TF=(...e)=>Us(up,"ruleX",...e),AF=(...e)=>St("voronoi",...e),EF=(...e)=>St("voronoiMesh",...e),MF=(...e)=>St("delaunayLink",...e),NF=(...e)=>St("delaunayMesh",...e),OF=(...e)=>St("hull",...e),RF=(...e)=>St("arrow",...e),DF=(...e)=>St("link",...e),LF=(...e)=>St("frame",...e),FF=(...e)=>St("axisX",...e),kF=(...e)=>St("axisY",...e),CF=(...e)=>St("axisFx",...e),BF=(...e)=>St("axisFy",...e),PF=(...e)=>St("gridX",...e),UF=(...e)=>St("gridY",...e),$F=(...e)=>St("gridFx",...e),zF=(...e)=>St("gridFy",...e),jF=(...e)=>Us(ox,...e),qF=(...e)=>St("sphere",...e),VF=(...e)=>St("graticule",...e),YF=(...e)=>St("waffleX",...e),WF=(...e)=>St("waffleY",...e);var SW={};ti(SW,{highlight:()=>GF,intervalX:()=>XF,intervalXY:()=>QF,intervalY:()=>HF,nearest:()=>ZF,nearestX:()=>KF,nearestY:()=>JF,pan:()=>ok,panX:()=>sk,panY:()=>ak,panZoom:()=>ck,panZoomX:()=>lk,panZoomY:()=>uk,region:()=>tk,toggle:()=>Ef,toggleColor:()=>ik,toggleX:()=>ek,toggleY:()=>rk,toggleZ:()=>nk});function $s(e,t){return r=>{let n=r.marks[r.marks.length-1];r.addInteractor(new e(n,t))}}function GF({by:e,...t}){return $s(lx,{selection:e,channels:t})}function XF({as:e,...t}){return $s(Cl,{...t,selection:e,channel:"x"})}function HF({as:e,...t}){return $s(Cl,{...t,selection:e,channel:"y"})}function QF({as:e,...t}){return $s(dx,{...t,selection:e})}function ZF({as:e,...t}){return $s(If,{...t,selection:e,pointer:"xy"})}function KF({as:e,...t}){return $s(If,{...t,selection:e,pointer:"x"})}function JF({as:e,...t}){return $s(If,{...t,selection:e,pointer:"y"})}function tk({as:e,...t}){return $s(px,{...t,selection:e})}function Ef({as:e,...t}){return $s(Af,{...t,selection:e})}function ek(e){return Ef({...e,channels:["x"]})}function rk(e){return Ef({...e,channels:["y"]})}function nk(e){return Ef({...e,channels:["z"]})}function ik(e){return Ef({...e,channels:["color"]})}function hp(e){return $s(hx,e)}function ok(e={}){return hp({...e,zoom:!1})}function sk(e={}){return hp({...e,zoom:!1,pany:!1})}function ak(e={}){return hp({...e,zoom:!1,panx:!1})}function ck(e={}){return hp(e)}function lk(e={}){return hp({...e,pany:!1})}function uk(e={}){return hp({...e,panx:!1})}var IW={};ti(IW,{colorLegend:()=>dk,opacityLegend:()=>hk,symbolLegend:()=>pk});function fk(e,t={}){if(t.for){let{for:r,...n}=t,i=new dp(e,n),o=typeof r,s=a=>a.addLegend(i,!1);return o==="string"?k8(this,r,s):r.value&&s(r.value),i.element}else return r=>r.addLegend(new dp(e,t))}function dk(e){return fk.call(this,"color",e)}function hk(e){return fk.call(this,"opacity",e)}function pk(e){return fk.call(this,"symbol",e)}function TW(...e){let t=new H0;return e.flat().forEach(r=>r(t)),Sx(this,...t.marks),t.update(),t.element}function Xlt({coordinator:e=ii(),namedPlots:t=new Ix,extensions:r=null,...n}={}){return{...mk,...r,context:{coordinator:e,namedPlots:t,...n}}}export{sm as Coordinator,ts as Fixed,Qs as MosaicClient,Sc as Param,ft as Query,jo as Selection,X8 as align,sn as and,CL as area,BL as areaX,PL as areaY,xc as argmax,bc as argmin,rO as ariaDescription,eO as ariaLabel,NT as arrayAgg,RF as arrow,H8 as aspectRatio,_W as attributeDirectives,Hp as avg,Q8 as axis,CF as axisFx,BF as axisFy,FF as axisX,kF as axisY,jL as barX,qL as barY,O8 as bin,Gf as cast,VL as cell,YL as cellX,WL as cellY,rm as centroid,mA as centroidX,yA as centroidY,JL as circle,J8 as clip,UD as colorBase,ED as colorClamp,zD as colorConstant,TD as colorDomain,$D as colorExponent,RD as colorInterpolate,FD as colorLabel,dk as colorLegend,MD as colorN,ND as colorNice,kD as colorPercent,DD as colorPivot,AD as colorRange,CD as colorReverse,ID as colorScale,OD as colorScheme,LD as colorSymmetric,PD as colorTickFormat,BD as colorZero,Gl as column,Sx as connect,gF as contour,ii as coordinator,OT as corr,Or as count,DT as covarPop,RT as covariance,Xlt as createAPIContext,LA as createSchema,wc as createTable,TA as cume_dist,iA as dateDay,rA as dateMonth,nA as dateMonthDay,MF as delaunayLink,NF as delaunayMesh,yF as denseLine,SA as dense_rank,mF as density,hF as densityX,pF as densityY,QL as dot,ZL as dotX,KL as dotY,LT as entropy,lA as eq,IF as errorbarX,TF as errorbarY,IR as facetGrid,TR as facetLabel,bR as facetMargin,wR as facetMarginBottom,vR as facetMarginLeft,SR as facetMarginRight,_R as facetMarginTop,FT as first,MA as first_value,JT as float32,Xe as float64,LF as frame,wW as from,DR as fxAlign,QR as fxAriaDescription,HR as fxAriaLabel,CR as fxAxis,AR as fxDomain,XR as fxFontVariant,qR as fxGrid,MR as fxInset,NR as fxInsetLeft,OR as fxInsetRight,YR as fxLabel,WR as fxLabelAnchor,GR as fxLabelOffset,VR as fxLine,LR as fxPadding,FR as fxPaddingInner,kR as fxPaddingOuter,ER as fxRange,ZR as fxReverse,RR as fxRound,zR as fxTickFormat,$R as fxTickPadding,jR as fxTickRotate,PR as fxTickSize,UR as fxTickSpacing,BR as fxTicks,iD as fyAlign,vD as fyAriaDescription,wD as fyAriaLabel,cD as fyAxis,KR as fyDomain,_D as fyFontVariant,mD as fyGrid,tD as fyInset,rD as fyInsetBottom,eD as fyInsetTop,gD as fyLabel,xD as fyLabelAnchor,bD as fyLabelOffset,yD as fyLine,oD as fyPadding,sD as fyPaddingInner,aD as fyPaddingOuter,JR as fyRange,SD as fyReverse,nD as fyRound,hD as fyTickFormat,dD as fyTickPadding,pD as fyTickRotate,uD as fyTickSize,fD as fyTickSpacing,lD as fyTicks,jF as geo,em as geojson,kT as geomean,VF as graticule,K8 as grid,$F as gridFx,zF as gridFy,PF as gridX,UF as gridY,Di as gt,uA as gte,pW as hconcat,xF as heatmap,q8 as height,tF as hexagon,wF as hexbin,vF as hexgrid,GF as highlight,gW as hspace,OF as hull,dF as image,Z8 as inset,ve as int32,SW as interactorDirectives,XF as intervalX,QF as intervalXY,HF as intervalY,Yr as isBetween,fA as isDistinct,dA as isNotBetween,tm as isNotDistinct,Ri as isNotNull,eu as isNull,CT as kurtosis,EA as lag,$T as last,NA as last_value,Hf as lead,IW as legendDirectives,vL as lengthBase,xL as lengthClamp,IL as lengthConstant,yL as lengthDomain,SL as lengthExponent,bL as lengthNice,_L as lengthPercent,gL as lengthRange,mL as lengthScale,wL as lengthZero,UL as line,$L as lineX,zL as lineY,DF as link,Nr as literal,CA as loadCSV,FA as loadExtension,BA as loadJSON,$A as loadObjects,PA as loadParquet,UA as loadSpatial,ze as lt,ni as lte,BT as mad,U8 as margin,G8 as marginBottom,V8 as marginLeft,Y8 as marginRight,W8 as marginTop,P8 as margins,vW as markDirectives,Vr as max,PT as median,cW as menu,jn as min,UT as mode,C8 as name,F8 as namedPlots,ZF as nearest,KF as nearestX,JF as nearestY,oo as neq,cA as not,OA as nth_value,AA as ntile,KD as opacityBase,YD as opacityClamp,tL as opacityConstant,qD as opacityDomain,JD as opacityExponent,GD as opacityLabel,hk as opacityLegend,WD as opacityNice,XD as opacityPercent,VD as opacityRange,HD as opacityReverse,jD as opacityScale,ZD as opacityTickFormat,QD as opacityZero,Oi as or,tO as padding,ok as pan,sk as panX,ak as panY,ck as panZoom,lk as panZoomX,uk as panZoomY,IA as percent_rank,TW as plot,zT as product,kL as projectionClip,NL as projectionDomain,OL as projectionInset,FL as projectionInsetBottom,RL as projectionInsetLeft,DL as projectionInsetRight,LL as projectionInsetTop,AL as projectionParallels,EL as projectionPrecision,ML as projectionRotate,TL as projectionType,jT as quantile,dL as rBase,aL as rClamp,pL as rConstant,oL as rDomain,hL as rExponent,lL as rLabel,cL as rNice,uL as rPercent,sL as rRange,iL as rScale,fL as rZero,vA as rank,bF as raster,_F as rasterTile,GL as rect,XL as rectX,HL as rectY,tk as region,SF as regressionY,k8 as requestNamedPlot,vC as restConnector,wA as row_number,iF as ruleX,oF as ruleY,lW as search,XT as skewness,uW as slider,wb as socketConnector,qF as sphere,fF as spike,er as sql,Kp as stddev,HT as stddevPop,QT as stringAgg,z8 as style,oe as sum,rL as symbolDomain,pk as symbolLegend,nL as symbolRange,eL as symbolScale,fW as table,eF as text,rF as textX,nF as textY,sF as tickX,aF as tickY,Ef as toggle,ik as toggleColor,ek as toggleX,rk as toggleY,nk as toggleZ,KT as varPop,ZT as variance,hW as vconcat,cF as vector,lF as vectorX,uF as vectorY,AF as voronoi,EF as voronoiMesh,yW as vspace,YF as waffleX,WF as waffleY,S5 as wasmConnector,j8 as width,dO as xAlign,RO as xAriaDescription,OO as xAriaLabel,yO as xAxis,kO as xBase,uO as xClamp,BO as xConstant,iO as xDomain,CO as xExponent,NO as xFontVariant,SO as xGrid,aO as xInset,cO as xInsetLeft,lO as xInsetRight,TO as xLabel,AO as xLabelAnchor,EO as xLabelArrow,MO as xLabelOffset,IO as xLine,sO as xNice,hO as xPadding,pO as xPaddingInner,mO as xPaddingOuter,DO as xPercent,oO as xRange,LO as xReverse,fO as xRound,nO as xScale,wO as xTickFormat,_O as xTickPadding,vO as xTickRotate,xO as xTickSize,bO as xTickSpacing,gO as xTicks,FO as xZero,$8 as xyDomain,GO as yAlign,dR as yAriaDescription,fR as yAriaLabel,ZO as yAxis,yR as yBase,YO as yClamp,xR as yConstant,UO as yDomain,gR as yExponent,uR as yFontVariant,iR as yGrid,jO as yInset,VO as yInsetBottom,qO as yInsetTop,sR as yLabel,aR as yLabelAnchor,cR as yLabelArrow,lR as yLabelOffset,oR as yLine,zO as yNice,XO as yPadding,HO as yPaddingInner,QO as yPaddingOuter,hR as yPercent,$O as yRange,pR as yReverse,WO as yRound,PO as yScale,rR as yTickFormat,eR as yTickPadding,nR as yTickRotate,JO as yTickSize,tR as yTickSpacing,KO as yTicks,mR as yZero};
|