@uwdata/mosaic-plot 0.5.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 +28 -0
- package/README.md +6 -0
- package/dist/mosaic-plot.js +42313 -0
- package/dist/mosaic-plot.min.js +69 -0
- package/package.json +38 -0
- package/src/index.js +30 -0
- package/src/interactors/Highlight.js +101 -0
- package/src/interactors/Interval1D.js +90 -0
- package/src/interactors/Interval2D.js +102 -0
- package/src/interactors/Nearest.js +66 -0
- package/src/interactors/PanZoom.js +121 -0
- package/src/interactors/Toggle.js +111 -0
- package/src/interactors/util/brush.js +45 -0
- package/src/interactors/util/close-to.js +9 -0
- package/src/interactors/util/get-field.js +4 -0
- package/src/interactors/util/invert.js +3 -0
- package/src/interactors/util/patchScreenCTM.js +13 -0
- package/src/interactors/util/sanitize-styles.js +9 -0
- package/src/interactors/util/to-kebab-case.js +9 -0
- package/src/legend.js +64 -0
- package/src/marks/ConnectedMark.js +66 -0
- package/src/marks/ContourMark.js +89 -0
- package/src/marks/DenseLineMark.js +146 -0
- package/src/marks/Density1DMark.js +104 -0
- package/src/marks/Density2DMark.js +69 -0
- package/src/marks/GeoMark.js +35 -0
- package/src/marks/Grid2DMark.js +191 -0
- package/src/marks/HexbinMark.js +88 -0
- package/src/marks/Mark.js +207 -0
- package/src/marks/RasterMark.js +121 -0
- package/src/marks/RasterTileMark.js +331 -0
- package/src/marks/RegressionMark.js +117 -0
- package/src/marks/util/bin-field.js +17 -0
- package/src/marks/util/density.js +226 -0
- package/src/marks/util/extent.js +56 -0
- package/src/marks/util/grid.js +57 -0
- package/src/marks/util/handle-param.js +14 -0
- package/src/marks/util/is-arrow-table.js +3 -0
- package/src/marks/util/is-color.js +18 -0
- package/src/marks/util/is-constant-option.js +41 -0
- package/src/marks/util/is-symbol.js +20 -0
- package/src/marks/util/raster.js +44 -0
- package/src/marks/util/stats.js +133 -0
- package/src/marks/util/to-data-array.js +70 -0
- package/src/plot-attributes.js +212 -0
- package/src/plot-renderer.js +161 -0
- package/src/plot.js +136 -0
- package/src/symbols.js +3 -0
- package/src/transforms/bin.js +81 -0
- package/src/transforms/index.js +3 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
var YF=Object.create;var Aw=Object.defineProperty;var WF=Object.getOwnPropertyDescriptor;var GF=Object.getOwnPropertyNames;var XF=Object.getPrototypeOf,HF=Object.prototype.hasOwnProperty;var x3=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),zs=(e,t)=>{for(var n in t)Aw(e,n,{get:t[n],enumerable:!0})},ZF=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of GF(t))!HF.call(e,i)&&i!==n&&Aw(e,i,{get:()=>t[i],enumerable:!(r=WF(t,i))||r.enumerable});return e};var KF=(e,t,n)=>(n=e!=null?YF(XF(e)):{},ZF(t||!e||!e.__esModule?Aw(n,"default",{value:e,enumerable:!0}):n,e));var YB=x3((IOt,jB)=>{"use strict";function gW(e,t,n,r,i){for(var o=i+1;r<=i;){var s=r+i>>>1,a=e[s],c=n!==void 0?n(a,t):a-t;c>=0?(o=s,i=s-1):r=s+1}return o}function bW(e,t,n,r,i){for(var o=i+1;r<=i;){var s=r+i>>>1,a=e[s],c=n!==void 0?n(a,t):a-t;c>0?(o=s,i=s-1):r=s+1}return o}function xW(e,t,n,r,i){for(var o=r-1;r<=i;){var s=r+i>>>1,a=e[s],c=n!==void 0?n(a,t):a-t;c<0?(o=s,r=s+1):i=s-1}return o}function wW(e,t,n,r,i){for(var o=r-1;r<=i;){var s=r+i>>>1,a=e[s],c=n!==void 0?n(a,t):a-t;c<=0?(o=s,r=s+1):i=s-1}return o}function _W(e,t,n,r,i){for(;r<=i;){var o=r+i>>>1,s=e[o],a=n!==void 0?n(s,t):s-t;if(a===0)return o;a<=0?r=o+1:i=o-1}return-1}function Bm(e,t,n,r,i,o){return typeof n=="function"?o(e,t,n,r===void 0?0:r|0,i===void 0?e.length-1:i|0):o(e,t,void 0,n===void 0?0:n|0,r===void 0?e.length-1:r|0)}jB.exports={ge:function(e,t,n,r,i){return Bm(e,t,n,r,i,gW)},gt:function(e,t,n,r,i){return Bm(e,t,n,r,i,bW)},lt:function(e,t,n,r,i){return Bm(e,t,n,r,i,xW)},le:function(e,t,n,r,i){return Bm(e,t,n,r,i,wW)},eq:function(e,t,n,r,i){return Bm(e,t,n,r,i,_W)}}});var JB=x3((MOt,QB)=>{"use strict";var dw=YB(),Ff=0,bl=1,hw=2;QB.exports=SW;function RM(e,t,n,r,i){this.mid=e,this.left=t,this.right=n,this.leftPoints=r,this.rightPoints=i,this.count=(t?t.count:0)+(n?n.count:0)+r.length}var Fm=RM.prototype;function CM(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 XB(e,t){var n=Lf(t);e.mid=n.mid,e.left=n.left,e.right=n.right,e.leftPoints=n.leftPoints,e.rightPoints=n.rightPoints,e.count=n.count}function WB(e,t){var n=e.intervals([]);n.push(t),XB(e,n)}function GB(e,t){var n=e.intervals([]),r=n.indexOf(t);return r<0?Ff:(n.splice(r,1),XB(e,n),bl)}Fm.intervals=function(e){return e.push.apply(e,this.leftPoints),this.left&&this.left.intervals(e),this.right&&this.right.intervals(e),e};Fm.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)?WB(this,e):this.left.insert(e):this.left=Lf([e]);else if(e[0]>this.mid)this.right?4*(this.right.count+1)>3*(t+1)?WB(this,e):this.right.insert(e):this.right=Lf([e]);else{var n=dw.ge(this.leftPoints,e,$M),r=dw.ge(this.rightPoints,e,UM);this.leftPoints.splice(n,0,e),this.rightPoints.splice(r,0,e)}};Fm.remove=function(e){var t=this.count-this.leftPoints;if(e[1]<this.mid){if(!this.left)return Ff;var n=this.right?this.right.count:0;if(4*n>3*(t-1))return GB(this,e);var r=this.left.remove(e);return r===hw?(this.left=null,this.count-=1,bl):(r===bl&&(this.count-=1),r)}else if(e[0]>this.mid){if(!this.right)return Ff;var i=this.left?this.left.count:0;if(4*i>3*(t-1))return GB(this,e);var r=this.right.remove(e);return r===hw?(this.right=null,this.count-=1,bl):(r===bl&&(this.count-=1),r)}else{if(this.count===1)return this.leftPoints[0]===e?hw:Ff;if(this.leftPoints.length===1&&this.leftPoints[0]===e){if(this.left&&this.right){for(var o=this,s=this.left;s.right;)o=s,s=s.right;if(o===this)s.right=this.right;else{var a=this.left,r=this.right;o.count-=s.count,o.right=s.left,s.left=a,s.right=r}CM(this,s),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?CM(this,this.left):CM(this,this.right);return bl}for(var a=dw.ge(this.leftPoints,e,$M);a<this.leftPoints.length&&this.leftPoints[a][0]===e[0];++a)if(this.leftPoints[a]===e){this.count-=1,this.leftPoints.splice(a,1);for(var r=dw.ge(this.rightPoints,e,UM);r<this.rightPoints.length&&this.rightPoints[r][1]===e[1];++r)if(this.rightPoints[r]===e)return this.rightPoints.splice(r,1),bl}return Ff}};function HB(e,t,n){for(var r=0;r<e.length&&e[r][0]<=t;++r){var i=n(e[r]);if(i)return i}}function ZB(e,t,n){for(var r=e.length-1;r>=0&&e[r][1]>=t;--r){var i=n(e[r]);if(i)return i}}function KB(e,t){for(var n=0;n<e.length;++n){var r=t(e[n]);if(r)return r}}Fm.queryPoint=function(e,t){if(e<this.mid){if(this.left){var n=this.left.queryPoint(e,t);if(n)return n}return HB(this.leftPoints,e,t)}else if(e>this.mid){if(this.right){var n=this.right.queryPoint(e,t);if(n)return n}return ZB(this.rightPoints,e,t)}else return KB(this.leftPoints,t)};Fm.queryInterval=function(e,t,n){if(e<this.mid&&this.left){var r=this.left.queryInterval(e,t,n);if(r)return r}if(t>this.mid&&this.right){var r=this.right.queryInterval(e,t,n);if(r)return r}return t<this.mid?HB(this.leftPoints,t,n):e>this.mid?ZB(this.rightPoints,e,n):KB(this.leftPoints,n)};function vW(e,t){return e-t}function $M(e,t){var n=e[0]-t[0];return n||e[1]-t[1]}function UM(e,t){var n=e[1]-t[1];return n||e[0]-t[0]}function Lf(e){if(e.length===0)return null;for(var t=[],n=0;n<e.length;++n)t.push(e[n][0],e[n][1]);t.sort(vW);for(var r=t[t.length>>1],i=[],o=[],s=[],n=0;n<e.length;++n){var a=e[n];a[1]<r?i.push(a):r<a[0]?o.push(a):s.push(a)}var c=s,l=s.slice();return c.sort($M),l.sort(UM),new RM(r,Lf(i),Lf(o),c,l)}function kM(e){this.root=e}var Cf=kM.prototype;Cf.insert=function(e){this.root?this.root.insert(e):this.root=new RM(e[0],null,null,[e],[e])};Cf.remove=function(e){if(this.root){var t=this.root.remove(e);return t===hw&&(this.root=null),t!==Ff}return!1};Cf.queryPoint=function(e,t){if(this.root)return this.root.queryPoint(e,t)};Cf.queryInterval=function(e,t,n){if(e<=t&&this.root)return this.root.queryInterval(e,t,n)};Object.defineProperty(Cf,"count",{get:function(){return this.root?this.root.count:0}});Object.defineProperty(Cf,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}});function SW(e){return!e||e.length===0?new kM(null):new kM(Lf(e))}});var Vf=Symbol("Fixed"),kr=Symbol("Transient"),qf=Symbol("Transform");var w3={};function jf(e,t=!1){let n,r,i=w3;function o(l){n=e(l).then(()=>{if(r){let{value:u}=r;r=null,o(u)}else n=null})}function s(l){r={event:l}}function a(l){n?s(l):o(l)}function c(l){i!==l&&requestAnimationFrame(()=>{let u=i;i=w3,a(u)}),i=l}return t?c:a}var Yf=class{constructor(t){this._filterBy=t,this._requestUpdate=jf(()=>this.requestQuery(),!0),this._coordinator=null}get coordinator(){return this._coordinator}set coordinator(t){this._coordinator=t}get filterBy(){return this._filterBy}get filterIndexable(){return!0}fields(){return null}fieldInfo(){return this}query(){return null}queryPending(){return this}queryResult(){return this}queryError(t){return console.error(t),this}requestQuery(t){let n=t||this.query(this.filterBy?.predicate(this));return this._coordinator.requestQuery(this,n)}requestUpdate(){this._requestUpdate()}update(){return this}};function v3(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function H(e,t,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(f){s(f)}}function c(u){try{l(r.throw(u))}catch(f){s(f)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(e,t||[])).next())})}function _3(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ft(e){return this instanceof Ft?(this.v=e,this):new Ft(e)}function dr(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),i,o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(h){r[h]&&(i[h]=function(d){return new Promise(function(p,y){o.push([h,d,p,y])>1||a(h,d)})})}function a(h,d){try{c(r[h](d))}catch(p){f(o[0][3],p)}}function c(h){h.value instanceof Ft?Promise.resolve(h.value.v).then(l,u):f(o[0][2],h)}function l(h){a("next",h)}function u(h){a("throw",h)}function f(h,d){h(d),o.shift(),o.length&&a(o[0][0],o[0][1])}}function wl(e){var t,n;return t={},r("next"),r("throw",function(i){throw i}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(i,o){t[i]=e[i]?function(s){return(n=!n)?{value:Ft(e[i](s)),done:!1}:o?o(s):s}:o}}function ii(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof _3=="function"?_3(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(o){n[o]=e[o]&&function(s){return new Promise(function(a,c){s=e[o](s),i(a,c,s.done,s.value)})}}function i(o,s,a,c){Promise.resolve(c).then(function(l){o({value:l,done:a})},s)}}var Fw={};zs(Fw,{compareArrayLike:()=>Bw,joinUint8Arrays:()=>mr,memcpy:()=>_l,rebaseValueOffsets:()=>Xm,toArrayBufferView:()=>kt,toArrayBufferViewAsyncIterator:()=>si,toArrayBufferViewIterator:()=>Ri,toBigInt64Array:()=>iL,toBigUint64Array:()=>aL,toFloat32Array:()=>cL,toFloat32ArrayAsyncIterator:()=>IL,toFloat32ArrayIterator:()=>yL,toFloat64Array:()=>lL,toFloat64ArrayAsyncIterator:()=>ML,toFloat64ArrayIterator:()=>gL,toInt16Array:()=>rL,toInt16ArrayAsyncIterator:()=>wL,toInt16ArrayIterator:()=>hL,toInt32Array:()=>Ka,toInt32ArrayAsyncIterator:()=>_L,toInt32ArrayIterator:()=>dL,toInt8Array:()=>nL,toInt8ArrayAsyncIterator:()=>xL,toInt8ArrayIterator:()=>fL,toUint16Array:()=>oL,toUint16ArrayAsyncIterator:()=>vL,toUint16ArrayIterator:()=>pL,toUint32Array:()=>sL,toUint32ArrayAsyncIterator:()=>SL,toUint32ArrayIterator:()=>mL,toUint8Array:()=>Et,toUint8ArrayAsyncIterator:()=>Ow,toUint8ArrayIterator:()=>Nw,toUint8ClampedArray:()=>uL,toUint8ClampedArrayAsyncIterator:()=>TL,toUint8ClampedArrayIterator:()=>bL});var QF=new TextDecoder("utf-8"),Wf=e=>QF.decode(e),JF=new TextEncoder,Vs=e=>JF.encode(e);var tL=e=>typeof e=="number",S3=e=>typeof e=="boolean",Ke=e=>typeof e=="function",Rn=e=>e!=null&&Object(e)===e,pr=e=>Rn(e)&&Ke(e.then);var oi=e=>Rn(e)&&Ke(e[Symbol.iterator]),Rr=e=>Rn(e)&&Ke(e[Symbol.asyncIterator]),Vm=e=>Rn(e)&&Rn(e.schema);var qm=e=>Rn(e)&&"done"in e&&"value"in e;var jm=e=>Rn(e)&&Ke(e.stat)&&tL(e.fd);var Ym=e=>Rn(e)&&Gf(e.body),Wm=e=>"_getDOMStream"in e&&"_getNodeStream"in e,I3=e=>Rn(e)&&Ke(e.abort)&&Ke(e.getWriter)&&!Wm(e),Gf=e=>Rn(e)&&Ke(e.cancel)&&Ke(e.getReader)&&!Wm(e),M3=e=>Rn(e)&&Ke(e.end)&&Ke(e.write)&&S3(e.writable)&&!Wm(e),Gm=e=>Rn(e)&&Ke(e.read)&&Ke(e.pipe)&&S3(e.readable)&&!Wm(e),T3=e=>Rn(e)&&Ke(e.clear)&&Ke(e.bytes)&&Ke(e.position)&&Ke(e.setPosition)&&Ke(e.capacity)&&Ke(e.getBufferIdentifier)&&Ke(e.createLong);var Dw=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function eL(e){let t=e[0]?[e[0]]:[],n,r,i,o;for(let s,a,c=0,l=0,u=e.length;++c<u;){if(s=t[l],a=e[c],!s||!a||s.buffer!==a.buffer||a.byteOffset<s.byteOffset){a&&(t[++l]=a);continue}if({byteOffset:n,byteLength:i}=s,{byteOffset:r,byteLength:o}=a,n+i<r||r+o<n){a&&(t[++l]=a);continue}t[l]=new Uint8Array(s.buffer,n,r-n+o)}return t}function _l(e,t,n=0,r=t.byteLength){let i=e.byteLength,o=new Uint8Array(e.buffer,e.byteOffset,i),s=new Uint8Array(t.buffer,t.byteOffset,Math.min(r,i));return o.set(s,n),e}function mr(e,t){let n=eL(e),r=n.reduce((u,f)=>u+f.byteLength,0),i,o,s,a=0,c=-1,l=Math.min(t||Number.POSITIVE_INFINITY,r);for(let u=n.length;++c<u;){if(i=n[c],o=i.subarray(0,Math.min(i.length,l-a)),l<=a+o.length){o.length<i.length?n[c]=i.subarray(o.length):o.length===i.length&&c++,s?_l(s,o,a):s=o;break}_l(s||(s=new Uint8Array(l)),o,a),a+=o.length}return[s||new Uint8Array(0),n.slice(c),r-(s?s.byteLength:0)]}function kt(e,t){let n=qm(t)?t.value:t;return n instanceof e?e===Uint8Array?new e(n.buffer,n.byteOffset,n.byteLength):n:n?(typeof n=="string"&&(n=Vs(n)),n instanceof ArrayBuffer?new e(n):n instanceof Dw?new e(n):T3(n)?kt(e,n.bytes()):ArrayBuffer.isView(n)?n.byteLength<=0?new e(0):new e(n.buffer,n.byteOffset,n.byteLength/e.BYTES_PER_ELEMENT):e.from(n)):new e(0)}var nL=e=>kt(Int8Array,e),rL=e=>kt(Int16Array,e),Ka=e=>kt(Int32Array,e),iL=e=>kt(BigInt64Array,e),Et=e=>kt(Uint8Array,e),oL=e=>kt(Uint16Array,e),sL=e=>kt(Uint32Array,e),aL=e=>kt(BigUint64Array,e),cL=e=>kt(Float32Array,e),lL=e=>kt(Float64Array,e),uL=e=>kt(Uint8ClampedArray,e),Ew=e=>(e.next(),e);function*Ri(e,t){let n=function*(i){yield i},r=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Dw?n(t):oi(t)?t:n(t);return yield*Ew(function*(i){let o=null;do o=i.next(yield kt(e,o));while(!o.done)}(r[Symbol.iterator]())),new e}var fL=e=>Ri(Int8Array,e),hL=e=>Ri(Int16Array,e),dL=e=>Ri(Int32Array,e),Nw=e=>Ri(Uint8Array,e),pL=e=>Ri(Uint16Array,e),mL=e=>Ri(Uint32Array,e),yL=e=>Ri(Float32Array,e),gL=e=>Ri(Float64Array,e),bL=e=>Ri(Uint8ClampedArray,e);function si(e,t){return dr(this,arguments,function*(){if(pr(t))return yield Ft(yield Ft(yield*wl(ii(si(e,yield Ft(t))))));let r=function(s){return dr(this,arguments,function*(){yield yield Ft(yield Ft(s))})},i=function(s){return dr(this,arguments,function*(){yield Ft(yield*wl(ii(Ew(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 Dw?r(t):oi(t)?i(t):Rr(t)?t:r(t);return yield Ft(yield*wl(ii(Ew(function(s){return dr(this,arguments,function*(){let a=null;do a=yield Ft(s.next(yield yield Ft(kt(e,a))));while(!a.done)})}(o[Symbol.asyncIterator]()))))),yield Ft(new e)})}var xL=e=>si(Int8Array,e),wL=e=>si(Int16Array,e),_L=e=>si(Int32Array,e),Ow=e=>si(Uint8Array,e),vL=e=>si(Uint16Array,e),SL=e=>si(Uint32Array,e),IL=e=>si(Float32Array,e),ML=e=>si(Float64Array,e),TL=e=>si(Uint8ClampedArray,e);function Xm(e,t,n){if(e!==0){n=n.slice(0,t);for(let r=-1,i=n.length;++r<i;)n[r]+=e}return n.subarray(0,t)}function Bw(e,t){let n=0,r=e.length;if(r!==t.length)return!1;if(r>0)do if(e[n]!==t[n])return!1;while(++n<r);return!0}var pn={fromIterable(e){return Hm(AL(e))},fromAsyncIterable(e){return Hm(EL(e))},fromDOMStream(e){return Hm(DL(e))},fromNodeStream(e){return Hm(NL(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')}},Hm=e=>(e.next(),e);function*AL(e){let t,n=!1,r=[],i,o,s,a=0;function c(){return o==="peek"?mr(r,s)[0]:([i,r,a]=mr(r,s),i)}({cmd:o,size:s}=yield null);let l=Nw(e)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(s-a)?l.next():l.next(s-a),!t&&i.byteLength>0&&(r.push(i),a+=i.byteLength),t||s<=a)do({cmd:o,size:s}=yield c());while(s<a);while(!t)}catch(u){(n=!0)&&typeof l.throw=="function"&&l.throw(u)}finally{n===!1&&typeof l.return=="function"&&l.return(null)}return null}function EL(e){return dr(this,arguments,function*(){let n,r=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?mr(i,a)[0]:([o,i,c]=mr(i,a),o)}({cmd:s,size:a}=yield yield Ft(null));let u=Ow(e)[Symbol.asyncIterator]();try{do if({done:n,value:o}=Number.isNaN(a-c)?yield Ft(u.next()):yield Ft(u.next(a-c)),!n&&o.byteLength>0&&(i.push(o),c+=o.byteLength),n||a<=c)do({cmd:s,size:a}=yield yield Ft(l()));while(a<c);while(!n)}catch(f){(r=!0)&&typeof u.throw=="function"&&(yield Ft(u.throw(f)))}finally{r===!1&&typeof u.return=="function"&&(yield Ft(u.return(new Uint8Array(0))))}return yield Ft(null)})}function DL(e){return dr(this,arguments,function*(){let n=!1,r=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?mr(i,a)[0]:([o,i,c]=mr(i,a),o)}({cmd:s,size:a}=yield yield Ft(null));let u=new Cw(e);try{do if({done:n,value:o}=Number.isNaN(a-c)?yield Ft(u.read()):yield Ft(u.read(a-c)),!n&&o.byteLength>0&&(i.push(Et(o)),c+=o.byteLength),n||a<=c)do({cmd:s,size:a}=yield yield Ft(l()));while(a<c);while(!n)}catch(f){(r=!0)&&(yield Ft(u.cancel(f)))}finally{r===!1?yield Ft(u.cancel()):e.locked&&u.releaseLock()}return yield Ft(null)})}var Cw=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 H(this,void 0,void 0,function*(){let{reader:n,source:r}=this;n&&(yield n.cancel(t).catch(()=>{})),r&&r.locked&&this.releaseLock()})}read(t){return H(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};let n=yield this.reader.read();return!n.done&&(n.value=Et(n)),n})}},Lw=(e,t)=>{let n=i=>r([t,i]),r;return[t,n,new Promise(i=>(r=i)&&e.once(t,n))]};function NL(e){return dr(this,arguments,function*(){let n=[],r="error",i=!1,o=null,s,a,c=0,l=[],u;function f(){return s==="peek"?mr(l,a)[0]:([u,l,c]=mr(l,a),u)}if({cmd:s,size:a}=yield yield Ft(null),e.isTTY)return yield yield Ft(new Uint8Array(0)),yield Ft(null);try{n[0]=Lw(e,"end"),n[1]=Lw(e,"error");do{if(n[2]=Lw(e,"readable"),[r,o]=yield Ft(Promise.race(n.map(d=>d[2]))),r==="error")break;if((i=r==="end")||(Number.isFinite(a-c)?(u=Et(e.read(a-c)),u.byteLength<a-c&&(u=Et(e.read()))):u=Et(e.read()),u.byteLength>0&&(l.push(u),c+=u.byteLength)),i||a<=c)do({cmd:s,size:a}=yield yield Ft(f()));while(a<c)}while(!i)}finally{yield Ft(h(n,r==="error"?o:null))}return yield Ft(null);function h(d,p){return u=l=null,new Promise((y,b)=>{for(let[m,g]of d)e.off(m,g);try{let m=e.destroy;m&&m.call(e,p),p=void 0}catch(m){p=m||p}finally{p!=null?b(p):y()}})}})}var Ie;(function(e){e[e.V1=0]="V1",e[e.V2=1]="V2",e[e.V3=2]="V3",e[e.V4=3]="V4",e[e.V5=4]="V5"})(Ie||(Ie={}));var me;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(me||(me={}));var we;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(we||(we={}));var Tn;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(Tn||(Tn={}));var pt;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(pt||(pt={}));var er;(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"})(er||(er={}));var Xt;(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"})(Xt||(Xt={}));var F;(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth",e[e.DurationSecond=-27]="DurationSecond",e[e.DurationMillisecond=-28]="DurationMillisecond",e[e.DurationMicrosecond=-29]="DurationMicrosecond",e[e.DurationNanosecond=-30]="DurationNanosecond"})(F||(F={}));var ai;(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(ai||(ai={}));var t_={};zs(t_,{clampIndex:()=>_C,clampRange:()=>Kf,createElementComparator:()=>Ys});var kw={};zs(kw,{valueToString:()=>ci});function ci(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=>ci(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,n)=>typeof n=="bigint"?`${n}`:n)}var $w={};zs($w,{BN:()=>Hf,bigNumToBigInt:()=>D3,bigNumToString:()=>Il,isArrowBigNumSymbol:()=>A3});var A3=Symbol.for("isArrowBigNum");function li(e,...t){return t.length===0?Object.setPrototypeOf(kt(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}li.prototype[A3]=!0;li.prototype.toJSON=function(){return`"${Il(this)}"`};li.prototype.valueOf=function(){return E3(this)};li.prototype.toString=function(){return Il(this)};li.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return E3(this);case"string":return Il(this);case"default":return D3(this)}return Il(this)};function vl(...e){return li.apply(this,e)}function Sl(...e){return li.apply(this,e)}function Xf(...e){return li.apply(this,e)}Object.setPrototypeOf(vl.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(Sl.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Xf.prototype,Object.create(Uint32Array.prototype));Object.assign(vl.prototype,li.prototype,{constructor:vl,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(Sl.prototype,li.prototype,{constructor:Sl,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Xf.prototype,li.prototype,{constructor:Xf,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});function E3(e){let{buffer:t,byteOffset:n,length:r,signed:i}=e,o=new BigUint64Array(t,n,r),s=i&&o.at(-1)&BigInt(1)<<BigInt(63),a=BigInt(s?1:0),c=BigInt(0);if(s){for(let l of o)a+=~l*(BigInt(1)<<BigInt(32)*c++);a*=BigInt(-1)}else for(let l of o)a+=l*(BigInt(1)<<BigInt(32)*c++);return a}var Il=e=>{if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return Rw(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return Rw(e);t=t.slice();let r=1;for(let o=0;o<t.length;o++){let s=t[o],a=~s+r;t[o]=a,r&=s===0?1:0}return`-${Rw(t)}`},D3=e=>e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:Il(e);function Rw(e){let t="",n=new Uint32Array(2),r=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),i=new Uint32Array((r=new Uint16Array(r).reverse()).buffer),o=-1,s=r.length-1;do{for(n[0]=r[o=0];o<s;)r[o++]=n[1]=n[0]/10,n[0]=(n[0]-n[1]*10<<16)+r[o];r[o]=n[1]=n[0]/10,n[0]=n[0]-n[1]*10,t=`${n[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t??"0"}var Hf=class e{static new(t,n){switch(n){case!0:return new vl(t);case!1:return new Sl(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new vl(t)}return t.byteLength===16?new Xf(t):new Sl(t)}static signed(t){return new vl(t)}static unsigned(t){return new Sl(t)}static decimal(t){return new Xf(t)}constructor(t,n){return e.new(t,n)}};function nr(e){if(typeof e=="bigint"&&(e<Number.MIN_SAFE_INTEGER||e>Number.MAX_SAFE_INTEGER))throw new TypeError(`${e} is not safe to convert to a number.`);return Number(e)}var N3,O3,B3,F3,L3,C3,k3,R3,$3,U3,P3,z3,V3,q3,j3,Y3,W3,G3,X3,H3,st=class e{static isNull(t){return t?.typeId===F.Null}static isInt(t){return t?.typeId===F.Int}static isFloat(t){return t?.typeId===F.Float}static isBinary(t){return t?.typeId===F.Binary}static isUtf8(t){return t?.typeId===F.Utf8}static isBool(t){return t?.typeId===F.Bool}static isDecimal(t){return t?.typeId===F.Decimal}static isDate(t){return t?.typeId===F.Date}static isTime(t){return t?.typeId===F.Time}static isTimestamp(t){return t?.typeId===F.Timestamp}static isInterval(t){return t?.typeId===F.Interval}static isDuration(t){return t?.typeId===F.Duration}static isList(t){return t?.typeId===F.List}static isStruct(t){return t?.typeId===F.Struct}static isUnion(t){return t?.typeId===F.Union}static isFixedSizeBinary(t){return t?.typeId===F.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===F.FixedSizeList}static isMap(t){return t?.typeId===F.Map}static isDictionary(t){return t?.typeId===F.Dictionary}static isDenseUnion(t){return e.isUnion(t)&&t.mode===me.Dense}static isSparseUnion(t){return e.isUnion(t)&&t.mode===me.Sparse}get typeId(){return F.NONE}};N3=Symbol.toStringTag;st[N3]=(e=>(e.children=null,e.ArrayType=Array,e[Symbol.toStringTag]="DataType"))(st.prototype);var $n=class extends st{toString(){return"Null"}get typeId(){return F.Null}};O3=Symbol.toStringTag;$n[O3]=(e=>e[Symbol.toStringTag]="Null")($n.prototype);var Ce=class extends st{constructor(t,n){super(),this.isSigned=t,this.bitWidth=n}get typeId(){return F.Int}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}};B3=Symbol.toStringTag;Ce[B3]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(Ce.prototype);var Zm=class extends Ce{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},Km=class extends Ce{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},$i=class extends Ce{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},Qm=class extends Ce{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},Jm=class extends Ce{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},ty=class extends Ce{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},ey=class extends Ce{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},ny=class extends Ce{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(Zm.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(Km.prototype,"ArrayType",{value:Int16Array});Object.defineProperty($i.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(Qm.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(Jm.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(ty.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(ey.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(ny.prototype,"ArrayType",{value:BigUint64Array});var rr=class extends st{constructor(t){super(),this.precision=t}get typeId(){return F.Float}get ArrayType(){switch(this.precision){case we.HALF:return Uint16Array;case we.SINGLE:return Float32Array;case we.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};F3=Symbol.toStringTag;rr[F3]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(rr.prototype);var ry=class extends rr{constructor(){super(we.HALF)}},iy=class extends rr{constructor(){super(we.SINGLE)}},oy=class extends rr{constructor(){super(we.DOUBLE)}};Object.defineProperty(ry.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(iy.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(oy.prototype,"ArrayType",{value:Float64Array});var Bo=class extends st{constructor(){super()}get typeId(){return F.Binary}toString(){return"Binary"}};L3=Symbol.toStringTag;Bo[L3]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(Bo.prototype);var Fo=class extends st{constructor(){super()}get typeId(){return F.Utf8}toString(){return"Utf8"}};C3=Symbol.toStringTag;Fo[C3]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(Fo.prototype);var Lo=class extends st{constructor(){super()}get typeId(){return F.Bool}toString(){return"Bool"}};k3=Symbol.toStringTag;Lo[k3]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(Lo.prototype);var Co=class extends st{constructor(t,n,r=128){super(),this.scale=t,this.precision=n,this.bitWidth=r}get typeId(){return F.Decimal}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};R3=Symbol.toStringTag;Co[R3]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(Co.prototype);var ko=class extends st{constructor(t){super(),this.unit=t}get typeId(){return F.Date}toString(){return`Date${(this.unit+1)*32}<${Tn[this.unit]}>`}};$3=Symbol.toStringTag;ko[$3]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Date"))(ko.prototype);var ui=class extends st{constructor(t,n){super(),this.unit=t,this.bitWidth=n}get typeId(){return F.Time}toString(){return`Time${this.bitWidth}<${pt[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};U3=Symbol.toStringTag;ui[U3]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))(ui.prototype);var Ro=class extends st{constructor(t,n){super(),this.unit=t,this.timezone=n}get typeId(){return F.Timestamp}toString(){return`Timestamp<${pt[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};P3=Symbol.toStringTag;Ro[P3]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Timestamp"))(Ro.prototype);var $o=class extends st{constructor(t){super(),this.unit=t}get typeId(){return F.Interval}toString(){return`Interval<${er[this.unit]}>`}};z3=Symbol.toStringTag;$o[z3]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))($o.prototype);var Uo=class extends st{constructor(t){super(),this.unit=t}get typeId(){return F.Duration}toString(){return`Duration<${pt[this.unit]}>`}};V3=Symbol.toStringTag;Uo[V3]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Duration"))(Uo.prototype);var fi=class extends st{constructor(t){super(),this.children=[t]}get typeId(){return F.List}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};q3=Symbol.toStringTag;fi[q3]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(fi.prototype);var he=class extends st{constructor(t){super(),this.children=t}get typeId(){return F.Struct}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};j3=Symbol.toStringTag;he[j3]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(he.prototype);var hi=class extends st{constructor(t,n,r){super(),this.mode=t,this.children=r,this.typeIds=n=Int32Array.from(n),this.typeIdToChildIndex=n.reduce((i,o,s)=>(i[o]=s)&&i||i,Object.create(null))}get typeId(){return F.Union}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};Y3=Symbol.toStringTag;hi[Y3]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(hi.prototype);var Po=class extends st{constructor(t){super(),this.byteWidth=t}get typeId(){return F.FixedSizeBinary}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};W3=Symbol.toStringTag;Po[W3]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(Po.prototype);var di=class extends st{constructor(t,n){super(),this.listSize=t,this.children=[n]}get typeId(){return F.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}};G3=Symbol.toStringTag;di[G3]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(di.prototype);var pi=class extends st{constructor(t,n=!1){var r,i,o;if(super(),this.children=[t],this.keysSorted=n,t&&(t.name="entries",!((r=t?.type)===null||r===void 0)&&r.children)){let s=(i=t?.type)===null||i===void 0?void 0:i.children[0];s&&(s.name="key");let a=(o=t?.type)===null||o===void 0?void 0:o.children[1];a&&(a.name="value")}}get typeId(){return F.Map}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};X3=Symbol.toStringTag;pi[X3]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(pi.prototype);var OL=(e=>()=>++e)(-1),yr=class extends st{constructor(t,n,r,i){super(),this.indices=n,this.dictionary=t,this.isOrdered=i||!1,this.id=r==null?OL():nr(r)}get typeId(){return F.Dictionary}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};H3=Symbol.toStringTag;yr[H3]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(yr.prototype);function gr(e){let t=e;switch(e.typeId){case F.Decimal:return e.bitWidth/32;case F.Timestamp:return 2;case F.Date:return 1+t.unit;case F.Interval:return 1+t.unit;case F.FixedSizeList:return t.listSize;case F.FixedSizeBinary:return t.byteWidth;default:return 1}}var lt=class{visitMany(t,...n){return t.map((r,i)=>this.visit(r,...n.map(o=>o[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,n=!0){return BL(this,t,n)}getVisitFnByTypeId(t,n=!0){return Ml(this,t,n)}visitNull(t,...n){return null}visitBool(t,...n){return null}visitInt(t,...n){return null}visitFloat(t,...n){return null}visitUtf8(t,...n){return null}visitBinary(t,...n){return null}visitFixedSizeBinary(t,...n){return null}visitDate(t,...n){return null}visitTimestamp(t,...n){return null}visitTime(t,...n){return null}visitDecimal(t,...n){return null}visitList(t,...n){return null}visitStruct(t,...n){return null}visitUnion(t,...n){return null}visitDictionary(t,...n){return null}visitInterval(t,...n){return null}visitDuration(t,...n){return null}visitFixedSizeList(t,...n){return null}visitMap(t,...n){return null}};function BL(e,t,n=!0){return typeof t=="number"?Ml(e,t,n):typeof t=="string"&&t in F?Ml(e,F[t],n):t&&t instanceof st?Ml(e,Z3(t),n):t?.type&&t.type instanceof st?Ml(e,Z3(t.type),n):Ml(e,F.NONE,n)}function Ml(e,t,n=!0){let r=null;switch(t){case F.Null:r=e.visitNull;break;case F.Bool:r=e.visitBool;break;case F.Int:r=e.visitInt;break;case F.Int8:r=e.visitInt8||e.visitInt;break;case F.Int16:r=e.visitInt16||e.visitInt;break;case F.Int32:r=e.visitInt32||e.visitInt;break;case F.Int64:r=e.visitInt64||e.visitInt;break;case F.Uint8:r=e.visitUint8||e.visitInt;break;case F.Uint16:r=e.visitUint16||e.visitInt;break;case F.Uint32:r=e.visitUint32||e.visitInt;break;case F.Uint64:r=e.visitUint64||e.visitInt;break;case F.Float:r=e.visitFloat;break;case F.Float16:r=e.visitFloat16||e.visitFloat;break;case F.Float32:r=e.visitFloat32||e.visitFloat;break;case F.Float64:r=e.visitFloat64||e.visitFloat;break;case F.Utf8:r=e.visitUtf8;break;case F.Binary:r=e.visitBinary;break;case F.FixedSizeBinary:r=e.visitFixedSizeBinary;break;case F.Date:r=e.visitDate;break;case F.DateDay:r=e.visitDateDay||e.visitDate;break;case F.DateMillisecond:r=e.visitDateMillisecond||e.visitDate;break;case F.Timestamp:r=e.visitTimestamp;break;case F.TimestampSecond:r=e.visitTimestampSecond||e.visitTimestamp;break;case F.TimestampMillisecond:r=e.visitTimestampMillisecond||e.visitTimestamp;break;case F.TimestampMicrosecond:r=e.visitTimestampMicrosecond||e.visitTimestamp;break;case F.TimestampNanosecond:r=e.visitTimestampNanosecond||e.visitTimestamp;break;case F.Time:r=e.visitTime;break;case F.TimeSecond:r=e.visitTimeSecond||e.visitTime;break;case F.TimeMillisecond:r=e.visitTimeMillisecond||e.visitTime;break;case F.TimeMicrosecond:r=e.visitTimeMicrosecond||e.visitTime;break;case F.TimeNanosecond:r=e.visitTimeNanosecond||e.visitTime;break;case F.Decimal:r=e.visitDecimal;break;case F.List:r=e.visitList;break;case F.Struct:r=e.visitStruct;break;case F.Union:r=e.visitUnion;break;case F.DenseUnion:r=e.visitDenseUnion||e.visitUnion;break;case F.SparseUnion:r=e.visitSparseUnion||e.visitUnion;break;case F.Dictionary:r=e.visitDictionary;break;case F.Interval:r=e.visitInterval;break;case F.IntervalDayTime:r=e.visitIntervalDayTime||e.visitInterval;break;case F.IntervalYearMonth:r=e.visitIntervalYearMonth||e.visitInterval;break;case F.Duration:r=e.visitDuration;break;case F.DurationSecond:r=e.visitDurationSecond||e.visitDuration;break;case F.DurationMillisecond:r=e.visitDurationMillisecond||e.visitDuration;break;case F.DurationMicrosecond:r=e.visitDurationMicrosecond||e.visitDuration;break;case F.DurationNanosecond:r=e.visitDurationNanosecond||e.visitDuration;break;case F.FixedSizeList:r=e.visitFixedSizeList;break;case F.Map:r=e.visitMap;break}if(typeof r=="function")return r;if(!n)return()=>null;throw new Error(`Unrecognized type '${F[t]}'`)}function Z3(e){switch(e.typeId){case F.Null:return F.Null;case F.Int:{let{bitWidth:t,isSigned:n}=e;switch(t){case 8:return n?F.Int8:F.Uint8;case 16:return n?F.Int16:F.Uint16;case 32:return n?F.Int32:F.Uint32;case 64:return n?F.Int64:F.Uint64}return F.Int}case F.Float:switch(e.precision){case we.HALF:return F.Float16;case we.SINGLE:return F.Float32;case we.DOUBLE:return F.Float64}return F.Float;case F.Binary:return F.Binary;case F.Utf8:return F.Utf8;case F.Bool:return F.Bool;case F.Decimal:return F.Decimal;case F.Time:switch(e.unit){case pt.SECOND:return F.TimeSecond;case pt.MILLISECOND:return F.TimeMillisecond;case pt.MICROSECOND:return F.TimeMicrosecond;case pt.NANOSECOND:return F.TimeNanosecond}return F.Time;case F.Timestamp:switch(e.unit){case pt.SECOND:return F.TimestampSecond;case pt.MILLISECOND:return F.TimestampMillisecond;case pt.MICROSECOND:return F.TimestampMicrosecond;case pt.NANOSECOND:return F.TimestampNanosecond}return F.Timestamp;case F.Date:switch(e.unit){case Tn.DAY:return F.DateDay;case Tn.MILLISECOND:return F.DateMillisecond}return F.Date;case F.Interval:switch(e.unit){case er.DAY_TIME:return F.IntervalDayTime;case er.YEAR_MONTH:return F.IntervalYearMonth}return F.Interval;case F.Duration:switch(e.unit){case pt.SECOND:return F.DurationSecond;case pt.MILLISECOND:return F.DurationMillisecond;case pt.MICROSECOND:return F.DurationMicrosecond;case pt.NANOSECOND:return F.DurationNanosecond}return F.Duration;case F.Map:return F.Map;case F.List:return F.List;case F.Struct:return F.Struct;case F.Union:switch(e.mode){case me.Dense:return F.DenseUnion;case me.Sparse:return F.SparseUnion}return F.Union;case F.FixedSizeBinary:return F.FixedSizeBinary;case F.FixedSizeList:return F.FixedSizeList;case F.Dictionary:return F.Dictionary}throw new Error(`Unrecognized type '${F[e.typeId]}'`)}lt.prototype.visitInt8=null;lt.prototype.visitInt16=null;lt.prototype.visitInt32=null;lt.prototype.visitInt64=null;lt.prototype.visitUint8=null;lt.prototype.visitUint16=null;lt.prototype.visitUint32=null;lt.prototype.visitUint64=null;lt.prototype.visitFloat16=null;lt.prototype.visitFloat32=null;lt.prototype.visitFloat64=null;lt.prototype.visitDateDay=null;lt.prototype.visitDateMillisecond=null;lt.prototype.visitTimestampSecond=null;lt.prototype.visitTimestampMillisecond=null;lt.prototype.visitTimestampMicrosecond=null;lt.prototype.visitTimestampNanosecond=null;lt.prototype.visitTimeSecond=null;lt.prototype.visitTimeMillisecond=null;lt.prototype.visitTimeMicrosecond=null;lt.prototype.visitTimeNanosecond=null;lt.prototype.visitDenseUnion=null;lt.prototype.visitSparseUnion=null;lt.prototype.visitIntervalDayTime=null;lt.prototype.visitIntervalYearMonth=null;lt.prototype.visitDuration=null;lt.prototype.visitDurationSecond=null;lt.prototype.visitDurationMillisecond=null;lt.prototype.visitDurationMicrosecond=null;lt.prototype.visitDurationNanosecond=null;var Uw={};zs(Uw,{float64ToUint16:()=>Zf,uint16ToFloat64:()=>sy});var K3=new Float64Array(1),Tl=new Uint32Array(K3.buffer);function sy(e){let t=(e&31744)>>10,n=(e&1023)/1024,r=Math.pow(-1,(e&32768)>>15);switch(t){case 31:return r*(n?Number.NaN:1/0);case 0:return r*(n?6103515625e-14*n:0)}return r*Math.pow(2,t-15)*(1+n)}function Zf(e){if(e!==e)return 32256;K3[0]=e;let t=(Tl[1]&2147483648)>>16&65535,n=Tl[1]&2146435072,r=0;return n>=1089470464?Tl[0]>0?n=31744:(n=(n&2080374784)>>16,r=(Tl[1]&1048575)>>10):n<=1056964608?(r=1048576+(Tl[1]&1048575),r=1048576+(r<<(n>>20)-998)>>21,n=0):(n=n-1056964608>>10,r=(Tl[1]&1048575)+512>>10),t|n|r&65535}var wt=class extends lt{};function It(e){return(t,n,r)=>{if(t.setValid(n,r!=null))return e(t,n,r)}}var FL=(e,t,n)=>{e[t]=Math.trunc(n/864e5)},Pw=(e,t,n)=>{e[t]=Math.trunc(n%4294967296),e[t+1]=Math.trunc(n/4294967296)},LL=(e,t,n)=>{e[t]=Math.trunc(n*1e3%4294967296),e[t+1]=Math.trunc(n*1e3/4294967296)},CL=(e,t,n)=>{e[t]=Math.trunc(n*1e6%4294967296),e[t+1]=Math.trunc(n*1e6/4294967296)},Q3=(e,t,n,r)=>{if(n+1<t.length){let{[n]:i,[n+1]:o}=t;e.set(r.subarray(0,o-i),i)}},kL=({offset:e,values:t},n,r)=>{let i=e+n;r?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},zo=({values:e},t,n)=>{e[t]=n},zw=({values:e},t,n)=>{e[t]=n},J3=({values:e},t,n)=>{e[t]=Zf(n)},RL=(e,t,n)=>{switch(e.type.precision){case we.HALF:return J3(e,t,n);case we.SINGLE:case we.DOUBLE:return zw(e,t,n)}},ay=({values:e},t,n)=>{FL(e,t,n.valueOf())},cy=({values:e},t,n)=>{Pw(e,t*2,n.valueOf())},Vw=({stride:e,values:t},n,r)=>{t.set(r.subarray(0,e),e*n)},$L=({values:e,valueOffsets:t},n,r)=>Q3(e,t,n,r),UL=({values:e,valueOffsets:t},n,r)=>{Q3(e,t,n,Vs(r))},qw=(e,t,n)=>{e.type.unit===Tn.DAY?ay(e,t,n):cy(e,t,n)},ly=({values:e},t,n)=>Pw(e,t*2,n/1e3),uy=({values:e},t,n)=>Pw(e,t*2,n),fy=({values:e},t,n)=>LL(e,t*2,n),hy=({values:e},t,n)=>CL(e,t*2,n),jw=(e,t,n)=>{switch(e.type.unit){case pt.SECOND:return ly(e,t,n);case pt.MILLISECOND:return uy(e,t,n);case pt.MICROSECOND:return fy(e,t,n);case pt.NANOSECOND:return hy(e,t,n)}},dy=({values:e},t,n)=>{e[t]=n},py=({values:e},t,n)=>{e[t]=n},my=({values:e},t,n)=>{e[t]=n},yy=({values:e},t,n)=>{e[t]=n},Yw=(e,t,n)=>{switch(e.type.unit){case pt.SECOND:return dy(e,t,n);case pt.MILLISECOND:return py(e,t,n);case pt.MICROSECOND:return my(e,t,n);case pt.NANOSECOND:return yy(e,t,n)}},Ww=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},PL=(e,t,n)=>{let r=e.children[0],i=e.valueOffsets,o=mn.getVisitFn(r);if(Array.isArray(n))for(let s=-1,a=i[t],c=i[t+1];a<c;)o(r,a++,n[++s]);else for(let s=-1,a=i[t],c=i[t+1];a<c;)o(r,a++,n.get(++s))},zL=(e,t,n)=>{let r=e.children[0],{valueOffsets:i}=e,o=mn.getVisitFn(r),{[t]:s,[t+1]:a}=i,c=n instanceof Map?n.entries():Object.entries(n);for(let l of c)if(o(r,s,l),++s>=a)break},VL=(e,t)=>(n,r,i,o)=>r&&n(r,e,t[o]),qL=(e,t)=>(n,r,i,o)=>r&&n(r,e,t.get(o)),jL=(e,t)=>(n,r,i,o)=>r&&n(r,e,t.get(i.name)),YL=(e,t)=>(n,r,i,o)=>r&&n(r,e,t[i.name]),WL=(e,t,n)=>{let r=e.type.children.map(o=>mn.getVisitFn(o.type)),i=n instanceof Map?jL(t,n):n instanceof zt?qL(t,n):Array.isArray(n)?VL(t,n):YL(t,n);e.type.children.forEach((o,s)=>i(r[s],e.children[s],o,s))},GL=(e,t,n)=>{e.type.mode===me.Dense?t6(e,t,n):e6(e,t,n)},t6=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];mn.visit(i,e.valueOffsets[t],n)},e6=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];mn.visit(i,t,n)},XL=(e,t,n)=>{var r;(r=e.dictionary)===null||r===void 0||r.set(e.values[t],n)},Gw=(e,t,n)=>{e.type.unit===er.DAY_TIME?gy(e,t,n):by(e,t,n)},gy=({values:e},t,n)=>{e.set(n.subarray(0,2),2*t)},by=({values:e},t,n)=>{e[t]=n[0]*12+n[1]%12},xy=({values:e},t,n)=>{e[t]=n},wy=({values:e},t,n)=>{e[t]=n},_y=({values:e},t,n)=>{e[t]=n},vy=({values:e},t,n)=>{e[t]=n},Xw=(e,t,n)=>{switch(e.type.unit){case pt.SECOND:return xy(e,t,n);case pt.MILLISECOND:return wy(e,t,n);case pt.MICROSECOND:return _y(e,t,n);case pt.NANOSECOND:return vy(e,t,n)}},HL=(e,t,n)=>{let{stride:r}=e,i=e.children[0],o=mn.getVisitFn(i);if(Array.isArray(n))for(let s=-1,a=t*r;++s<r;)o(i,a+s,n[s]);else for(let s=-1,a=t*r;++s<r;)o(i,a+s,n.get(s))};wt.prototype.visitBool=It(kL);wt.prototype.visitInt=It(zo);wt.prototype.visitInt8=It(zo);wt.prototype.visitInt16=It(zo);wt.prototype.visitInt32=It(zo);wt.prototype.visitInt64=It(zo);wt.prototype.visitUint8=It(zo);wt.prototype.visitUint16=It(zo);wt.prototype.visitUint32=It(zo);wt.prototype.visitUint64=It(zo);wt.prototype.visitFloat=It(RL);wt.prototype.visitFloat16=It(J3);wt.prototype.visitFloat32=It(zw);wt.prototype.visitFloat64=It(zw);wt.prototype.visitUtf8=It(UL);wt.prototype.visitBinary=It($L);wt.prototype.visitFixedSizeBinary=It(Vw);wt.prototype.visitDate=It(qw);wt.prototype.visitDateDay=It(ay);wt.prototype.visitDateMillisecond=It(cy);wt.prototype.visitTimestamp=It(jw);wt.prototype.visitTimestampSecond=It(ly);wt.prototype.visitTimestampMillisecond=It(uy);wt.prototype.visitTimestampMicrosecond=It(fy);wt.prototype.visitTimestampNanosecond=It(hy);wt.prototype.visitTime=It(Yw);wt.prototype.visitTimeSecond=It(dy);wt.prototype.visitTimeMillisecond=It(py);wt.prototype.visitTimeMicrosecond=It(my);wt.prototype.visitTimeNanosecond=It(yy);wt.prototype.visitDecimal=It(Ww);wt.prototype.visitList=It(PL);wt.prototype.visitStruct=It(WL);wt.prototype.visitUnion=It(GL);wt.prototype.visitDenseUnion=It(t6);wt.prototype.visitSparseUnion=It(e6);wt.prototype.visitDictionary=It(XL);wt.prototype.visitInterval=It(Gw);wt.prototype.visitIntervalDayTime=It(gy);wt.prototype.visitIntervalYearMonth=It(by);wt.prototype.visitDuration=It(Xw);wt.prototype.visitDurationSecond=It(xy);wt.prototype.visitDurationMillisecond=It(wy);wt.prototype.visitDurationMicrosecond=It(_y);wt.prototype.visitDurationNanosecond=It(vy);wt.prototype.visitFixedSizeList=It(HL);wt.prototype.visitMap=It(zL);var mn=new wt;var mi=Symbol.for("parent"),Al=Symbol.for("rowIndex"),qs=class{constructor(t,n){return this[mi]=t,this[Al]=n,new Proxy(this,new Zw)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Al],n=this[mi],r=n.type.children,i={};for(let o=-1,s=r.length;++o<s;)i[r[o].name]=Pe.visit(n.children[o],t);return i}toString(){return`{${[...this].map(([t,n])=>`${ci(t)}: ${ci(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new Hw(this[mi],this[Al])}},Hw=class{constructor(t,n){this.childIndex=0,this.children=t.children,this.rowIndex=n,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,Pe.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(qs.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[mi]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Al]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var Zw=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[mi].type.children.map(n=>n.name)}has(t,n){return t[mi].type.children.findIndex(r=>r.name===n)!==-1}getOwnPropertyDescriptor(t,n){if(t[mi].type.children.findIndex(r=>r.name===n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,n){if(Reflect.has(t,n))return t[n];let r=t[mi].type.children.findIndex(i=>i.name===n);if(r!==-1){let i=Pe.visit(t[mi].children[r],t[Al]);return Reflect.set(t,n,i),i}}set(t,n,r){let i=t[mi].type.children.findIndex(o=>o.name===n);return i!==-1?(mn.visit(t[mi].children[i],t[Al],r),Reflect.set(t,n,r)):Reflect.has(t,n)||typeof n=="symbol"?Reflect.set(t,n,r):!1}};var mt=class extends lt{};function vt(e){return(t,n)=>t.getValid(n)?e(t,n):null}var ZL=(e,t)=>864e5*e[t],Kw=(e,t)=>4294967296*e[t+1]+(e[t]>>>0),KL=(e,t)=>4294967296*(e[t+1]/1e3)+(e[t]>>>0)/1e3,QL=(e,t)=>4294967296*(e[t+1]/1e6)+(e[t]>>>0)/1e6,n6=e=>new Date(e),JL=(e,t)=>n6(ZL(e,t)),tC=(e,t)=>n6(Kw(e,t)),eC=(e,t)=>null,r6=(e,t,n)=>{if(n+1>=t.length)return null;let r=t[n],i=t[n+1];return e.subarray(r,i)},nC=({offset:e,values:t},n)=>{let r=e+n;return(t[r>>3]&1<<r%8)!==0},i6=({values:e},t)=>JL(e,t),o6=({values:e},t)=>tC(e,t*2),js=({stride:e,values:t},n)=>t[e*n],rC=({stride:e,values:t},n)=>sy(t[e*n]),s6=({values:e},t)=>e[t],iC=({stride:e,values:t},n)=>t.subarray(e*n,e*(n+1)),oC=({values:e,valueOffsets:t},n)=>r6(e,t,n),sC=({values:e,valueOffsets:t},n)=>{let r=r6(e,t,n);return r!==null?Wf(r):null},aC=({values:e},t)=>e[t],cC=({type:e,values:t},n)=>e.precision!==we.HALF?t[n]:sy(t[n]),lC=(e,t)=>e.type.unit===Tn.DAY?i6(e,t):o6(e,t),a6=({values:e},t)=>1e3*Kw(e,t*2),c6=({values:e},t)=>Kw(e,t*2),l6=({values:e},t)=>KL(e,t*2),u6=({values:e},t)=>QL(e,t*2),uC=(e,t)=>{switch(e.type.unit){case pt.SECOND:return a6(e,t);case pt.MILLISECOND:return c6(e,t);case pt.MICROSECOND:return l6(e,t);case pt.NANOSECOND:return u6(e,t)}},f6=({values:e},t)=>e[t],h6=({values:e},t)=>e[t],d6=({values:e},t)=>e[t],p6=({values:e},t)=>e[t],fC=(e,t)=>{switch(e.type.unit){case pt.SECOND:return f6(e,t);case pt.MILLISECOND:return h6(e,t);case pt.MICROSECOND:return d6(e,t);case pt.NANOSECOND:return p6(e,t)}},hC=({values:e,stride:t},n)=>Hf.decimal(e.subarray(t*n,t*(n+1))),dC=(e,t)=>{let{valueOffsets:n,stride:r,children:i}=e,{[t*r]:o,[t*r+1]:s}=n,c=i[0].slice(o,s-o);return new zt([c])},pC=(e,t)=>{let{valueOffsets:n,children:r}=e,{[t]:i,[t+1]:o}=n,s=r[0];return new Ui(s.slice(i,o-i))},mC=(e,t)=>new qs(e,t),yC=(e,t)=>e.type.mode===me.Dense?m6(e,t):y6(e,t),m6=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return Pe.visit(r,e.valueOffsets[t])},y6=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return Pe.visit(r,t)},gC=(e,t)=>{var n;return(n=e.dictionary)===null||n===void 0?void 0:n.get(e.values[t])},bC=(e,t)=>e.type.unit===er.DAY_TIME?g6(e,t):b6(e,t),g6=({values:e},t)=>e.subarray(2*t,2*(t+1)),b6=({values:e},t)=>{let n=e[t],r=new Int32Array(2);return r[0]=Math.trunc(n/12),r[1]=Math.trunc(n%12),r},x6=({values:e},t)=>e[t],w6=({values:e},t)=>e[t],_6=({values:e},t)=>e[t],v6=({values:e},t)=>e[t],xC=(e,t)=>{switch(e.type.unit){case pt.SECOND:return x6(e,t);case pt.MILLISECOND:return w6(e,t);case pt.MICROSECOND:return _6(e,t);case pt.NANOSECOND:return v6(e,t)}},wC=(e,t)=>{let{stride:n,children:r}=e,o=r[0].slice(t*n,n);return new zt([o])};mt.prototype.visitNull=vt(eC);mt.prototype.visitBool=vt(nC);mt.prototype.visitInt=vt(aC);mt.prototype.visitInt8=vt(js);mt.prototype.visitInt16=vt(js);mt.prototype.visitInt32=vt(js);mt.prototype.visitInt64=vt(s6);mt.prototype.visitUint8=vt(js);mt.prototype.visitUint16=vt(js);mt.prototype.visitUint32=vt(js);mt.prototype.visitUint64=vt(s6);mt.prototype.visitFloat=vt(cC);mt.prototype.visitFloat16=vt(rC);mt.prototype.visitFloat32=vt(js);mt.prototype.visitFloat64=vt(js);mt.prototype.visitUtf8=vt(sC);mt.prototype.visitBinary=vt(oC);mt.prototype.visitFixedSizeBinary=vt(iC);mt.prototype.visitDate=vt(lC);mt.prototype.visitDateDay=vt(i6);mt.prototype.visitDateMillisecond=vt(o6);mt.prototype.visitTimestamp=vt(uC);mt.prototype.visitTimestampSecond=vt(a6);mt.prototype.visitTimestampMillisecond=vt(c6);mt.prototype.visitTimestampMicrosecond=vt(l6);mt.prototype.visitTimestampNanosecond=vt(u6);mt.prototype.visitTime=vt(fC);mt.prototype.visitTimeSecond=vt(f6);mt.prototype.visitTimeMillisecond=vt(h6);mt.prototype.visitTimeMicrosecond=vt(d6);mt.prototype.visitTimeNanosecond=vt(p6);mt.prototype.visitDecimal=vt(hC);mt.prototype.visitList=vt(dC);mt.prototype.visitStruct=vt(mC);mt.prototype.visitUnion=vt(yC);mt.prototype.visitDenseUnion=vt(m6);mt.prototype.visitSparseUnion=vt(y6);mt.prototype.visitDictionary=vt(gC);mt.prototype.visitInterval=vt(bC);mt.prototype.visitIntervalDayTime=vt(g6);mt.prototype.visitIntervalYearMonth=vt(b6);mt.prototype.visitDuration=vt(xC);mt.prototype.visitDurationSecond=vt(x6);mt.prototype.visitDurationMillisecond=vt(w6);mt.prototype.visitDurationMicrosecond=vt(_6);mt.prototype.visitDurationNanosecond=vt(v6);mt.prototype.visitFixedSizeList=vt(wC);mt.prototype.visitMap=vt(pC);var Pe=new mt;var $r=Symbol.for("keys"),El=Symbol.for("vals"),Ui=class{constructor(t){return this[$r]=new zt([t.children[0]]).memoize(),this[El]=t.children[1],new Proxy(this,new Jw)}[Symbol.iterator](){return new Qw(this[$r],this[El])}get size(){return this[$r].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[$r],n=this[El],r={};for(let i=-1,o=t.length;++i<o;)r[t.get(i)]=Pe.visit(n,i);return r}toString(){return`{${[...this].map(([t,n])=>`${ci(t)}: ${ci(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},Qw=class{constructor(t,n){this.keys=t,this.vals=n,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){let t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),Pe.visit(this.vals,t)]})}},Jw=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[$r].toArray().map(String)}has(t,n){return t[$r].includes(n)}getOwnPropertyDescriptor(t,n){if(t[$r].indexOf(n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,n){if(Reflect.has(t,n))return t[n];let r=t[$r].indexOf(n);if(r!==-1){let i=Pe.visit(Reflect.get(t,El),r);return Reflect.set(t,n,i),i}}set(t,n,r){let i=t[$r].indexOf(n);return i!==-1?(mn.visit(Reflect.get(t,El),i,r),Reflect.set(t,n,r)):Reflect.has(t,n)?Reflect.set(t,n,r):!1}};Object.defineProperties(Ui.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[$r]:{writable:!0,enumerable:!1,configurable:!1,value:null},[El]:{writable:!0,enumerable:!1,configurable:!1,value:null}});function _C(e,t,n){let r=e.length,i=t>-1?t:r+t%r;return n?n(e,i):i}var S6;function Kf(e,t,n,r){let{length:i=0}=e,o=typeof t!="number"?0:t,s=typeof n!="number"?i:n;return o<0&&(o=(o%i+i)%i),s<0&&(s=(s%i+i)%i),s<o&&(S6=o,o=s,s=S6),s>i&&(s=i),r?r(e,o,s):[o,s]}var I6=e=>e!==e;function Ys(e){if(typeof e!=="object"||e===null)return I6(e)?I6:n=>n===e;if(e instanceof Date){let n=e.valueOf();return r=>r instanceof Date?r.valueOf()===n:!1}return ArrayBuffer.isView(e)?n=>n?Bw(e,n):!1:e instanceof Map?SC(e):Array.isArray(e)?vC(e):e instanceof zt?IC(e):MC(e,!0)}function vC(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=Ys(e[n]);return Sy(t)}function SC(e){let t=-1,n=[];for(let r of e.values())n[++t]=Ys(r);return Sy(n)}function IC(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=Ys(e.get(n));return Sy(t)}function MC(e,t=!1){let n=Object.keys(e);if(!t&&n.length===0)return()=>!1;let r=[];for(let i=-1,o=n.length;++i<o;)r[i]=Ys(e[n[i]]);return Sy(r,n)}function Sy(e,t){return n=>{if(!n||typeof n!="object")return!1;switch(n.constructor){case Array:return TC(e,n);case Map:return M6(e,n,n.keys());case Ui:case qs:case Object:case void 0:return M6(e,n,t||Object.keys(n))}return n instanceof zt?AC(e,n):!1}}function TC(e,t){let n=e.length;if(t.length!==n)return!1;for(let r=-1;++r<n;)if(!e[r](t[r]))return!1;return!0}function AC(e,t){let n=e.length;if(t.length!==n)return!1;for(let r=-1;++r<n;)if(!e[r](t.get(r)))return!1;return!0}function M6(e,t,n){let r=n[Symbol.iterator](),i=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),o=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),s=0,a=e.length,c=o.next(),l=r.next(),u=i.next();for(;s<a&&!l.done&&!u.done&&!c.done&&!(l.value!==u.value||!e[s](c.value));++s,l=r.next(),u=i.next(),c=o.next());return s===a&&l.done&&u.done&&c.done?!0:(r.return&&r.return(),i.return&&i.return(),o.return&&o.return(),!1)}var e_={};zs(e_,{BitIterator:()=>Qa,getBit:()=>T6,getBool:()=>My,packBools:()=>tc,popcnt_array:()=>A6,popcnt_bit_range:()=>Qf,popcnt_uint32:()=>Iy,setBool:()=>EC,truncateBitmap:()=>Ja});function My(e,t,n,r){return(n&1<<r)!==0}function T6(e,t,n,r){return(n&1<<r)>>r}function EC(e,t,n){return n?!!(e[t>>3]|=1<<t%8)||!0:!(e[t>>3]&=~(1<<t%8))&&!1}function Ja(e,t,n){let r=n.byteLength+7&-8;if(e>0||n.byteLength<r){let i=new Uint8Array(r);return i.set(e%8===0?n.subarray(e>>3):tc(new Qa(n,e,t,null,My)).subarray(0,r)),i}return n}function tc(e){let t=[],n=0,r=0,i=0;for(let s of e)s&&(i|=1<<r),++r===8&&(t[n++]=i,i=r=0);(n===0||r>0)&&(t[n++]=i);let o=new Uint8Array(t.length+7&-8);return o.set(t),o}var Qa=class{constructor(t,n,r,i,o){this.bytes=t,this.length=r,this.context=i,this.get=o,this.bit=n%8,this.byteIndex=n>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}};function Qf(e,t,n){if(n-t<=0)return 0;if(n-t<8){let o=0;for(let s of new Qa(e,t,n-t,e,T6))o+=s;return o}let r=n>>3<<3,i=t+(t%8===0?0:8-t%8);return Qf(e,t,i)+Qf(e,r,n)+A6(e,i>>3,r-i>>3)}function A6(e,t,n){let r=0,i=Math.trunc(t),o=new DataView(e.buffer,e.byteOffset,e.byteLength),s=n===void 0?e.byteLength:i+n;for(;s-i>=4;)r+=Iy(o.getUint32(i)),i+=4;for(;s-i>=2;)r+=Iy(o.getUint16(i)),i+=2;for(;s-i>=1;)r+=Iy(o.getUint8(i)),i+=1;return r}function Iy(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 DC=-1,re=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 st.isSparseUnion(t)?this.children.some(n=>n.nullable):st.isDenseUnion(t)?this.children.some(n=>n.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0,{valueOffsets:n,values:r,nullBitmap:i,typeIds:o}=this;return n&&(t+=n.byteLength),r&&(t+=r.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),this.children.reduce((s,a)=>s+a.byteLength,t)}get nullCount(){if(st.isUnion(this.type))return this.children.reduce((r,i)=>r+i.nullCount,0);let t=this._nullCount,n;return t<=DC&&(n=this.nullBitmap)&&(this._nullCount=t=this.length-Qf(n,this.offset,this.offset+this.length)),t}constructor(t,n,r,i,o,s=[],a){this.type=t,this.children=s,this.dictionary=a,this.offset=Math.floor(Math.max(n||0,0)),this.length=Math.floor(Math.max(r||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let c;o instanceof e?(this.stride=o.stride,this.values=o.values,this.typeIds=o.typeIds,this.nullBitmap=o.nullBitmap,this.valueOffsets=o.valueOffsets):(this.stride=gr(t),o&&((c=o[0])&&(this.valueOffsets=c),(c=o[1])&&(this.values=c),(c=o[2])&&(this.nullBitmap=c),(c=o[3])&&(this.typeIds=c)))}getValid(t){let{type:n}=this;if(st.isUnion(n)){let r=n,i=this.children[r.typeIdToChildIndex[this.typeIds[t]]],o=r.mode===me.Dense?this.valueOffsets[t]:t;return i.getValid(o)}if(this.nullable&&this.nullCount>0){let r=this.offset+t;return(this.nullBitmap[r>>3]&1<<r%8)!==0}return!0}setValid(t,n){let r,{type:i}=this;if(st.isUnion(i)){let o=i,s=this.children[o.typeIdToChildIndex[this.typeIds[t]]],a=o.mode===me.Dense?this.valueOffsets[t]:t;r=s.getValid(a),s.setValid(a,n)}else{let{nullBitmap:o}=this,{offset:s,length:a}=this,c=s+t,l=1<<c%8,u=c>>3;(!o||o.byteLength<=u)&&(o=new Uint8Array((s+a+63&-64)>>3).fill(255),this.nullCount>0&&o.set(Ja(s,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:o,_nullCount:-1}));let f=o[u];r=(f&l)!==0,n?o[u]=f|l:o[u]=f&~l}return r!==!!n&&(this._nullCount=this.nullCount+(n?-1:1)),n}clone(t=this.type,n=this.offset,r=this.length,i=this._nullCount,o=this,s=this.children){return new e(t,n,r,i,o,s,this.dictionary)}slice(t,n){let{stride:r,typeId:i,children:o}=this,s=+(this._nullCount===0)-1,a=i===16?r:1,c=this._sliceBuffers(t,n,r,i);return this.clone(this.type,this.offset+t,n,s,c,o.length===0||this.valueOffsets?o:this._sliceChildren(o,a*t,a*n))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===F.Null)return this.clone(this.type,0,t,0);let{length:n,nullCount:r}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,n>>3);i[n>>3]=(1<<n-(n&-8))-1,r>0&&i.set(Ja(this.offset,n,this.nullBitmap),0);let o=this.buffers;return o[ai.VALIDITY]=i,this.clone(this.type,0,t,r+(t-n),o)}_sliceBuffers(t,n,r,i){let o,{buffers:s}=this;return(o=s[ai.TYPE])&&(s[ai.TYPE]=o.subarray(t,t+n)),(o=s[ai.OFFSET])&&(s[ai.OFFSET]=o.subarray(t,t+n+1))||(o=s[ai.DATA])&&(s[ai.DATA]=i===6?o:o.subarray(r*t,r*(t+n))),s}_sliceChildren(t,n,r){return t.map(i=>i.slice(n,r))}};re.prototype.children=Object.freeze([]);var n_=class e extends lt{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:n,["offset"]:r=0,["length"]:i=0}=t;return new re(n,r,i,i)}visitBool(t){let{["type"]:n,["offset"]:r=0}=t,i=Et(t.nullBitmap),o=kt(n.ArrayType,t.data),{["length"]:s=o.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new re(n,r,s,a,[void 0,o,i])}visitInt(t){let{["type"]:n,["offset"]:r=0}=t,i=Et(t.nullBitmap),o=kt(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new re(n,r,s,a,[void 0,o,i])}visitFloat(t){let{["type"]:n,["offset"]:r=0}=t,i=Et(t.nullBitmap),o=kt(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new re(n,r,s,a,[void 0,o,i])}visitUtf8(t){let{["type"]:n,["offset"]:r=0}=t,i=Et(t.data),o=Et(t.nullBitmap),s=Ka(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new re(n,r,a,c,[s,i,o])}visitBinary(t){let{["type"]:n,["offset"]:r=0}=t,i=Et(t.data),o=Et(t.nullBitmap),s=Ka(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new re(n,r,a,c,[s,i,o])}visitFixedSizeBinary(t){let{["type"]:n,["offset"]:r=0}=t,i=Et(t.nullBitmap),o=kt(n.ArrayType,t.data),{["length"]:s=o.length/gr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new re(n,r,s,a,[void 0,o,i])}visitDate(t){let{["type"]:n,["offset"]:r=0}=t,i=Et(t.nullBitmap),o=kt(n.ArrayType,t.data),{["length"]:s=o.length/gr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new re(n,r,s,a,[void 0,o,i])}visitTimestamp(t){let{["type"]:n,["offset"]:r=0}=t,i=Et(t.nullBitmap),o=kt(n.ArrayType,t.data),{["length"]:s=o.length/gr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new re(n,r,s,a,[void 0,o,i])}visitTime(t){let{["type"]:n,["offset"]:r=0}=t,i=Et(t.nullBitmap),o=kt(n.ArrayType,t.data),{["length"]:s=o.length/gr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new re(n,r,s,a,[void 0,o,i])}visitDecimal(t){let{["type"]:n,["offset"]:r=0}=t,i=Et(t.nullBitmap),o=kt(n.ArrayType,t.data),{["length"]:s=o.length/gr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new re(n,r,s,a,[void 0,o,i])}visitList(t){let{["type"]:n,["offset"]:r=0,["child"]:i}=t,o=Et(t.nullBitmap),s=Ka(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new re(n,r,a,c,[s,void 0,o],[i])}visitStruct(t){let{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,o=Et(t.nullBitmap),{length:s=i.reduce((c,{length:l})=>Math.max(c,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new re(n,r,s,a,[void 0,void 0,o],i)}visitUnion(t){let{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,o=kt(n.ArrayType,t.typeIds),{["length"]:s=o.length,["nullCount"]:a=-1}=t;if(st.isSparseUnion(n))return new re(n,r,s,a,[void 0,void 0,void 0,o],i);let c=Ka(t.valueOffsets);return new re(n,r,s,a,[c,void 0,void 0,o],i)}visitDictionary(t){let{["type"]:n,["offset"]:r=0}=t,i=Et(t.nullBitmap),o=kt(n.indices.ArrayType,t.data),{["dictionary"]:s=new zt([new e().visit({type:n.dictionary})])}=t,{["length"]:a=o.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new re(n,r,a,c,[void 0,o,i],[],s)}visitInterval(t){let{["type"]:n,["offset"]:r=0}=t,i=Et(t.nullBitmap),o=kt(n.ArrayType,t.data),{["length"]:s=o.length/gr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new re(n,r,s,a,[void 0,o,i])}visitDuration(t){let{["type"]:n,["offset"]:r=0}=t,i=Et(t.nullBitmap),o=kt(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new re(n,r,s,a,[void 0,o,i])}visitFixedSizeList(t){let{["type"]:n,["offset"]:r=0,["child"]:i=new e().visit({type:n.valueType})}=t,o=Et(t.nullBitmap),{["length"]:s=i.length/gr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new re(n,r,s,a,[void 0,void 0,o],[i])}visitMap(t){let{["type"]:n,["offset"]:r=0,["child"]:i=new e().visit({type:n.childType})}=t,o=Et(t.nullBitmap),s=Ka(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new re(n,r,a,c,[s,void 0,o],[i])}},NC=new n_;function Dt(e){return NC.visit(e)}var Jf=class{constructor(t=0,n){this.numChunks=t,this.getChunkIterator=n,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let t=this.chunkIterator.next();if(!t.done)return t;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}};function Ty(e){return e.reduce((t,n)=>t+n.nullCount,0)}function Ay(e){return e.reduce((t,n,r)=>(t[r+1]=t[r]+n.length,t),new Uint32Array(e.length+1))}function Ey(e,t,n,r){let i=[];for(let o=-1,s=e.length;++o<s;){let a=e[o],c=t[o],{length:l}=a;if(c>=r)break;if(n>=c+l)continue;if(c>=n&&c+l<=r){i.push(a);continue}let u=Math.max(0,n-c),f=Math.min(r-c,l);i.push(a.slice(u,f-u))}return i.length===0&&i.push(e[0].slice(0,0)),i}function r_(e,t,n,r){let i=0,o=0,s=t.length-1;do{if(i>=s-1)return n<t[s]?r(e,i,n-t[i]):null;o=i+Math.trunc((s-i)*.5),n<t[o]?s=o:i=o}while(i<s)}function th(e,t){return e.getValid(t)}function Ws(e){function t(n,r,i){return e(n[r],i)}return function(n){let r=this.data;return r_(r,this._offsets,n,t)}}function Dy(e){let t;function n(r,i,o){return e(r[i],o,t)}return function(r,i){let o=this.data;t=i;let s=r_(o,this._offsets,r,n);return t=void 0,s}}function Ny(e){let t;function n(r,i,o){let s=o,a=0,c=0;for(let l=i-1,u=r.length;++l<u;){let f=r[l];if(~(a=e(f,t,s)))return c+a;s=0,c+=f.length}return-1}return function(r,i){t=r;let o=this.data,s=typeof i!="number"?n(o,0,0):r_(o,this._offsets,i,n);return t=void 0,s}}var yt=class extends lt{};function OC(e,t){return t===null&&e.length>0?0:-1}function BC(e,t){let{nullBitmap:n}=e;if(!n||e.nullCount<=0)return-1;let r=0;for(let i of new Qa(n,e.offset+(t||0),e.length,n,My)){if(!i)return r;++r}return-1}function Nt(e,t,n){if(t===void 0)return-1;if(t===null)switch(e.typeId){case F.Union:break;case F.Dictionary:break;default:return BC(e,n)}let r=Pe.getVisitFn(e),i=Ys(t);for(let o=(n||0)-1,s=e.length;++o<s;)if(i(r(e,o)))return o;return-1}function E6(e,t,n){let r=Pe.getVisitFn(e),i=Ys(t);for(let o=(n||0)-1,s=e.length;++o<s;)if(i(r(e,o)))return o;return-1}yt.prototype.visitNull=OC;yt.prototype.visitBool=Nt;yt.prototype.visitInt=Nt;yt.prototype.visitInt8=Nt;yt.prototype.visitInt16=Nt;yt.prototype.visitInt32=Nt;yt.prototype.visitInt64=Nt;yt.prototype.visitUint8=Nt;yt.prototype.visitUint16=Nt;yt.prototype.visitUint32=Nt;yt.prototype.visitUint64=Nt;yt.prototype.visitFloat=Nt;yt.prototype.visitFloat16=Nt;yt.prototype.visitFloat32=Nt;yt.prototype.visitFloat64=Nt;yt.prototype.visitUtf8=Nt;yt.prototype.visitBinary=Nt;yt.prototype.visitFixedSizeBinary=Nt;yt.prototype.visitDate=Nt;yt.prototype.visitDateDay=Nt;yt.prototype.visitDateMillisecond=Nt;yt.prototype.visitTimestamp=Nt;yt.prototype.visitTimestampSecond=Nt;yt.prototype.visitTimestampMillisecond=Nt;yt.prototype.visitTimestampMicrosecond=Nt;yt.prototype.visitTimestampNanosecond=Nt;yt.prototype.visitTime=Nt;yt.prototype.visitTimeSecond=Nt;yt.prototype.visitTimeMillisecond=Nt;yt.prototype.visitTimeMicrosecond=Nt;yt.prototype.visitTimeNanosecond=Nt;yt.prototype.visitDecimal=Nt;yt.prototype.visitList=Nt;yt.prototype.visitStruct=Nt;yt.prototype.visitUnion=Nt;yt.prototype.visitDenseUnion=E6;yt.prototype.visitSparseUnion=E6;yt.prototype.visitDictionary=Nt;yt.prototype.visitInterval=Nt;yt.prototype.visitIntervalDayTime=Nt;yt.prototype.visitIntervalYearMonth=Nt;yt.prototype.visitDuration=Nt;yt.prototype.visitDurationSecond=Nt;yt.prototype.visitDurationMillisecond=Nt;yt.prototype.visitDurationMicrosecond=Nt;yt.prototype.visitDurationNanosecond=Nt;yt.prototype.visitFixedSizeList=Nt;yt.prototype.visitMap=Nt;var ec=new yt;var gt=class extends lt{};function St(e){let{type:t}=e;if(e.nullCount===0&&e.stride===1&&(t.typeId===F.Timestamp||t instanceof Ce&&t.bitWidth!==64||t instanceof ui&&t.bitWidth!==64||t instanceof rr&&t.precision!==we.HALF))return new Jf(e.data.length,r=>{let i=e.data[r];return i.values.subarray(0,i.length)[Symbol.iterator]()});let n=0;return new Jf(e.data.length,r=>{let o=e.data[r].length,s=e.slice(n,n+o);return n+=o,new i_(s)})}var i_=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}};gt.prototype.visitNull=St;gt.prototype.visitBool=St;gt.prototype.visitInt=St;gt.prototype.visitInt8=St;gt.prototype.visitInt16=St;gt.prototype.visitInt32=St;gt.prototype.visitInt64=St;gt.prototype.visitUint8=St;gt.prototype.visitUint16=St;gt.prototype.visitUint32=St;gt.prototype.visitUint64=St;gt.prototype.visitFloat=St;gt.prototype.visitFloat16=St;gt.prototype.visitFloat32=St;gt.prototype.visitFloat64=St;gt.prototype.visitUtf8=St;gt.prototype.visitBinary=St;gt.prototype.visitFixedSizeBinary=St;gt.prototype.visitDate=St;gt.prototype.visitDateDay=St;gt.prototype.visitDateMillisecond=St;gt.prototype.visitTimestamp=St;gt.prototype.visitTimestampSecond=St;gt.prototype.visitTimestampMillisecond=St;gt.prototype.visitTimestampMicrosecond=St;gt.prototype.visitTimestampNanosecond=St;gt.prototype.visitTime=St;gt.prototype.visitTimeSecond=St;gt.prototype.visitTimeMillisecond=St;gt.prototype.visitTimeMicrosecond=St;gt.prototype.visitTimeNanosecond=St;gt.prototype.visitDecimal=St;gt.prototype.visitList=St;gt.prototype.visitStruct=St;gt.prototype.visitUnion=St;gt.prototype.visitDenseUnion=St;gt.prototype.visitSparseUnion=St;gt.prototype.visitDictionary=St;gt.prototype.visitInterval=St;gt.prototype.visitIntervalDayTime=St;gt.prototype.visitIntervalYearMonth=St;gt.prototype.visitDuration=St;gt.prototype.visitDurationSecond=St;gt.prototype.visitDurationMillisecond=St;gt.prototype.visitDurationMicrosecond=St;gt.prototype.visitDurationNanosecond=St;gt.prototype.visitFixedSizeList=St;gt.prototype.visitMap=St;var Dl=new gt;var FC=(e,t)=>e+t,Pi=class extends lt{visitNull(t,n){return 0}visitInt(t,n){return t.type.bitWidth/8}visitFloat(t,n){return t.type.ArrayType.BYTES_PER_ELEMENT}visitBool(t,n){return 1/8}visitDecimal(t,n){return t.type.bitWidth/8}visitDate(t,n){return(t.type.unit+1)*4}visitTime(t,n){return t.type.bitWidth/8}visitTimestamp(t,n){return t.type.unit===pt.SECOND?4:8}visitInterval(t,n){return(t.type.unit+1)*4}visitDuration(t,n){return 8}visitStruct(t,n){return t.children.reduce((r,i)=>r+br.visit(i,n),0)}visitFixedSizeBinary(t,n){return t.type.byteWidth}visitMap(t,n){return 8+t.children.reduce((r,i)=>r+br.visit(i,n),0)}visitDictionary(t,n){var r;return t.type.indices.bitWidth/8+(((r=t.dictionary)===null||r===void 0?void 0:r.getByteLength(t.values[n]))||0)}},LC=({valueOffsets:e},t)=>8+(e[t+1]-e[t]),CC=({valueOffsets:e},t)=>8+(e[t+1]-e[t]),kC=({valueOffsets:e,stride:t,children:n},r)=>{let i=n[0],{[r*t]:o}=e,{[r*t+1]:s}=e,a=br.getVisitFn(i.type),c=i.slice(o,s-o),l=8;for(let u=-1,f=s-o;++u<f;)l+=a(c,u);return l},RC=({stride:e,children:t},n)=>{let r=t[0],i=r.slice(n*e,e),o=br.getVisitFn(r.type),s=0;for(let a=-1,c=i.length;++a<c;)s+=o(i,a);return s},$C=(e,t)=>e.type.mode===me.Dense?D6(e,t):N6(e,t),D6=({type:e,children:t,typeIds:n,valueOffsets:r},i)=>{let o=e.typeIdToChildIndex[n[i]];return 8+br.visit(t[o],r[i])},N6=({children:e},t)=>4+br.visitMany(e,e.map(()=>t)).reduce(FC,0);Pi.prototype.visitUtf8=LC;Pi.prototype.visitBinary=CC;Pi.prototype.visitList=kC;Pi.prototype.visitFixedSizeList=RC;Pi.prototype.visitUnion=$C;Pi.prototype.visitDenseUnion=D6;Pi.prototype.visitSparseUnion=N6;var br=new Pi;var O6,B6={},F6={},zt=class e{constructor(t){var n,r,i;let o=t[0]instanceof e?t.flatMap(a=>a.data):t;if(o.length===0||o.some(a=>!(a instanceof re)))throw new TypeError("Vector constructor expects an Array of Data instances.");let s=(n=o[0])===null||n===void 0?void 0:n.type;switch(o.length){case 0:this._offsets=[0];break;case 1:{let{get:a,set:c,indexOf:l,byteLength:u}=B6[s.typeId],f=o[0];this.isValid=h=>th(f,h),this.get=h=>a(f,h),this.set=(h,d)=>c(f,h,d),this.indexOf=h=>l(f,h),this.getByteLength=h=>u(f,h),this._offsets=[0,f.length];break}default:Object.setPrototypeOf(this,F6[s.typeId]),this._offsets=Ay(o);break}this.data=o,this.type=s,this.stride=gr(s),this.numChildren=(i=(r=s.children)===null||r===void 0?void 0:r.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,n)=>t+n.byteLength,0)}get nullCount(){return Ty(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${F[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}set(t,n){}indexOf(t,n){return-1}includes(t,n){return this.indexOf(t,n)>-1}getByteLength(t){return 0}[Symbol.iterator](){return Dl.visit(this)}concat(...t){return new e(this.data.concat(t.flatMap(n=>n.data).flat(Number.POSITIVE_INFINITY)))}slice(t,n){return new e(Kf(this,t,n,({data:r,_offsets:i},o,s)=>Ey(r,i,o,s)))}toJSON(){return[...this]}toArray(){let{type:t,data:n,length:r,stride:i,ArrayType:o}=this;switch(t.typeId){case F.Int:case F.Float:case F.Decimal:case F.Time:case F.Timestamp:switch(n.length){case 0:return new o;case 1:return n[0].values.subarray(0,r*i);default:return n.reduce((s,{values:a,length:c})=>(s.array.set(a.subarray(0,c*i),s.offset),s.offset+=c*i,s),{array:new o(r*i),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var n;return this.getChildAt((n=this.type.children)===null||n===void 0?void 0:n.findIndex(r=>r.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new e(this.data.map(({children:n})=>n[t])):null}get isMemoized(){return st.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(st.isDictionary(this.type)){let t=new Oy(this.data[0].dictionary),n=this.data.map(r=>{let i=r.clone();return i.dictionary=t,i});return new e(n)}return new Oy(this)}unmemoize(){if(st.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),n=this.data.map(r=>{let i=r.clone();return i.dictionary=t,i});return new e(n)}return this}};O6=Symbol.toStringTag;zt[O6]=(e=>{e.type=st.prototype,e.data=[],e.length=0,e.stride=1,e.numChildren=0,e._offsets=new Uint32Array([0]),e[Symbol.isConcatSpreadable]=!0;let t=Object.keys(F).map(n=>F[n]).filter(n=>typeof n=="number"&&n!==F.NONE);for(let n of t){let r=Pe.getVisitFnByTypeId(n),i=mn.getVisitFnByTypeId(n),o=ec.getVisitFnByTypeId(n),s=br.getVisitFnByTypeId(n);B6[n]={get:r,set:i,indexOf:o,byteLength:s},F6[n]=Object.create(e,{isValid:{value:Ws(th)},get:{value:Ws(Pe.getVisitFnByTypeId(n))},set:{value:Dy(mn.getVisitFnByTypeId(n))},indexOf:{value:Ny(ec.getVisitFnByTypeId(n))},getByteLength:{value:Ws(br.getVisitFnByTypeId(n))}})}return"Vector"})(zt.prototype);var Oy=class e extends zt{constructor(t){super(t.data);let n=this.get,r=this.set,i=this.slice,o=new Array(this.length);Object.defineProperty(this,"get",{value(s){let a=o[s];if(a!==void 0)return a;let c=n.call(this,s);return o[s]=c,c}}),Object.defineProperty(this,"set",{value(s,a){r.call(this,s,a),o[s]=a}}),Object.defineProperty(this,"slice",{value:(s,a)=>new e(i.call(this,s,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new zt(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function L6(e){if(!e||e.length<=0)return function(i){return!0};let t="",n=e.filter(r=>r===r);return n.length>0&&(t=`
|
|
2
|
+
switch (x) {${n.map(r=>`
|
|
3
|
+
case ${UC(r)}:`).join("")}
|
|
4
|
+
return false;
|
|
5
|
+
}`),e.length!==n.length&&(t=`if (x !== x) return false;
|
|
6
|
+
${t}`),new Function("x",`${t}
|
|
7
|
+
return true;`)}function UC(e){return typeof e!="bigint"?ci(e):`${ci(e)}n`}var o_=(e,t)=>(Math.ceil(e)*t+63&-64||64)/t,PC=(e,t=0)=>e.length>=t?e.subarray(0,t):_l(new e.constructor(t),e,0),Gs=class{constructor(t,n=1){this.buffer=t,this.stride=n,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t.constructor,this._resize(this.length=Math.ceil(t.length/n))}get byteLength(){return Math.ceil(this.length*this.stride)*this.BYTES_PER_ELEMENT}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(t,n){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;let n=this.stride,r=this.length*n,i=this.buffer.length;r>=i&&this._resize(i===0?o_(r*1,this.BYTES_PER_ELEMENT):o_(r*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=o_(t*this.stride,this.BYTES_PER_ELEMENT);let n=PC(this.buffer,t);return this.clear(),n}clear(){return this.length=0,this._resize(0),this}_resize(t){return this.buffer=_l(new this.ArrayType(t),this.buffer)}};Gs.prototype.offset=0;var Vo=class extends Gs{last(){return this.get(this.length-1)}get(t){return this.buffer[t]}set(t,n){return this.reserve(t-this.length+1),this.buffer[t*this.stride]=n,this}},Nl=class extends Vo{constructor(t=new Uint8Array(0)){super(t,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,n){let{buffer:r}=this.reserve(t-this.length+1),i=t>>3,o=t%8,s=r[i]>>o&1;return n?s===0&&(r[i]|=1<<o,++this.numValid):s===1&&(r[i]&=~(1<<o),--this.numValid),this}clear(){return this.numValid=0,super.clear()}},Ol=class extends Vo{constructor(t=new Int32Array(1)){super(t,1)}append(t){return this.set(this.length-1,t)}set(t,n){let r=this.length-1,i=this.reserve(t-r+1).buffer;return r<t++&&i.fill(i[r],r,t),i[t]=i[t-1]+n,this}flush(t=this.length-1){return t>this.length&&this.set(t-1,0),super.flush(t+1)}};var ye=class{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t){throw new Error('"throughDOM" not available in this environment')}constructor({type:t,nullValues:n}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=n,this.stride=gr(t),this._nulls=new Nl,n&&n.length>0&&(this._isValid=L6(n))}toVector(){return new zt([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:n,_values:r,_nulls:i,_typeIds:o,children:s}=this;return n&&(t+=n.byteLength),r&&(t+=r.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),s.reduce((a,c)=>a+c.byteLength,t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((n,r)=>n+r.reservedByteLength,t)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(t){return this.set(this.length,t)}isValid(t){return this._isValid(t)}set(t,n){return this.setValid(t,this.isValid(n))&&this.setValue(t,n),this}setValue(t,n){this._setValue(this,t,n)}setValid(t,n){return this.length=this._nulls.set(t,+n).length,n}addChild(t,n=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(t){return this.children[t]||null}flush(){let t,n,r,i,{type:o,length:s,nullCount:a,_typeIds:c,_offsets:l,_values:u,_nulls:f}=this;(n=c?.flush(s))?i=l?.flush(s):(i=l?.flush(s))?t=u?.flush(l.last()):t=u?.flush(s),a>0&&(r=f?.flush(s));let h=this.children.map(d=>d.flush());return this.clear(),Dt({type:o,length:s,nullCount:a,children:h,child:h[0],data:t,typeIds:n,nullBitmap:r,valueOffsets:i})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,n,r,i;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(n=this._values)===null||n===void 0||n.clear(),(r=this._offsets)===null||r===void 0||r.clear(),(i=this._typeIds)===null||i===void 0||i.clear();for(let o of this.children)o.clear();return this}};ye.prototype.length=1;ye.prototype.stride=1;ye.prototype.children=null;ye.prototype.finished=!1;ye.prototype.nullValues=null;ye.prototype._isValid=()=>!0;var ze=class extends ye{constructor(t){super(t),this._values=new Vo(new this.ArrayType(0),this.stride)}setValue(t,n){let r=this._values;return r.reserve(t-r.length+1),super.setValue(t,n)}},zi=class extends ye{constructor(t){super(t),this._pendingLength=0,this._offsets=new Ol}setValue(t,n){let r=this._pending||(this._pending=new Map),i=r.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=n instanceof Ui?n[$r].length:n.length,r.set(t,n)}setValid(t,n){return super.setValid(t,n)?!0:((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){let t=this._pending,n=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,n),this}};var nc=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,n,r,i){return t.prep(8,24),t.writeInt64(BigInt(i??0)),t.pad(4),t.writeInt32(r),t.writeInt64(BigInt(n??0)),t.offset()}};var Vi=new Int32Array(2),By=new Float32Array(Vi.buffer),Fy=new Float64Array(Vi.buffer),Bl=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var eh;(function(e){e[e.UTF8_BYTES=1]="UTF8_BYTES",e[e.UTF16_STRING=2]="UTF16_STRING"})(eh||(eh={}));var xr=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 Vi[0]=this.readInt32(t),By[0]}readFloat64(t){return Vi[Bl?0:1]=this.readInt32(t),Vi[Bl?1:0]=this.readInt32(t+4),Fy[0]}writeInt8(t,n){this.bytes_[t]=n}writeUint8(t,n){this.bytes_[t]=n}writeInt16(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8}writeUint16(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8}writeInt32(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8,this.bytes_[t+2]=n>>16,this.bytes_[t+3]=n>>24}writeUint32(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8,this.bytes_[t+2]=n>>16,this.bytes_[t+3]=n>>24}writeInt64(t,n){this.writeInt32(t,Number(BigInt.asIntN(32,n))),this.writeInt32(t+4,Number(BigInt.asIntN(32,n>>BigInt(32))))}writeUint64(t,n){this.writeUint32(t,Number(BigInt.asUintN(32,n))),this.writeUint32(t+4,Number(BigInt.asUintN(32,n>>BigInt(32))))}writeFloat32(t,n){By[0]=n,this.writeInt32(t,Vi[0])}writeFloat64(t,n){Fy[0]=n,this.writeInt32(t,Vi[Bl?0:1]),this.writeInt32(t+4,Vi[Bl?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let n=0;n<4;n++)t+=String.fromCharCode(this.readInt8(this.position_+4+n));return t}__offset(t,n){let r=t-this.readInt32(t);return n<this.readInt16(r)?this.readInt16(r+n):0}__union(t,n){return t.bb_pos=n+this.readInt32(n),t.bb=this,t}__string(t,n){t+=this.readInt32(t);let r=this.readInt32(t);t+=4;let i=this.bytes_.subarray(t,t+r);return n===eh.UTF8_BYTES?i:this.text_decoder_.decode(i)}__union_with_string(t,n){return typeof t=="string"?this.__string(n):this.__union(t,n)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let n=0;n<4;n++)if(t.charCodeAt(n)!=this.readInt8(this.position()+4+n))return!1;return!0}createScalarList(t,n){let r=[];for(let i=0;i<n;++i){let o=t(i);o!==null&&r.push(o)}return r}createObjList(t,n){let r=[];for(let i=0;i<n;++i){let o=t(i);o!==null&&r.push(o.unpack())}return r}};var rc=class e{constructor(t){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let n;t?n=t:n=1024,this.bb=xr.allocate(n),this.space=n}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(t){this.force_defaults=t}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,n){t>this.minalign&&(this.minalign=t);let r=~(this.bb.capacity()-this.space+n)+1&t-1;for(;this.space<r+t+n;){let i=this.bb.capacity();this.bb=e.growByteBuffer(this.bb),this.space+=this.bb.capacity()-i}this.pad(r)}pad(t){for(let n=0;n<t;n++)this.bb.writeInt8(--this.space,0)}writeInt8(t){this.bb.writeInt8(this.space-=1,t)}writeInt16(t){this.bb.writeInt16(this.space-=2,t)}writeInt32(t){this.bb.writeInt32(this.space-=4,t)}writeInt64(t){this.bb.writeInt64(this.space-=8,t)}writeFloat32(t){this.bb.writeFloat32(this.space-=4,t)}writeFloat64(t){this.bb.writeFloat64(this.space-=8,t)}addInt8(t){this.prep(1,0),this.writeInt8(t)}addInt16(t){this.prep(2,0),this.writeInt16(t)}addInt32(t){this.prep(4,0),this.writeInt32(t)}addInt64(t){this.prep(8,0),this.writeInt64(t)}addFloat32(t){this.prep(4,0),this.writeFloat32(t)}addFloat64(t){this.prep(8,0),this.writeFloat64(t)}addFieldInt8(t,n,r){(this.force_defaults||n!=r)&&(this.addInt8(n),this.slot(t))}addFieldInt16(t,n,r){(this.force_defaults||n!=r)&&(this.addInt16(n),this.slot(t))}addFieldInt32(t,n,r){(this.force_defaults||n!=r)&&(this.addInt32(n),this.slot(t))}addFieldInt64(t,n,r){(this.force_defaults||n!==r)&&(this.addInt64(n),this.slot(t))}addFieldFloat32(t,n,r){(this.force_defaults||n!=r)&&(this.addFloat32(n),this.slot(t))}addFieldFloat64(t,n,r){(this.force_defaults||n!=r)&&(this.addFloat64(n),this.slot(t))}addFieldOffset(t,n,r){(this.force_defaults||n!=r)&&(this.addOffset(n),this.slot(t))}addFieldStruct(t,n,r){n!=r&&(this.nested(n),this.slot(t))}nested(t){if(t!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")}slot(t){this.vtable!==null&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){let n=t.capacity();if(n&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");let r=n<<1,i=xr.allocate(r);return i.setPosition(r-n),i.bytes().set(t.bytes(),r-n),i}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let n=0;n<t;n++)this.vtable[n]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let t=this.offset(),n=this.vtable_in_use-1;for(;n>=0&&this.vtable[n]==0;n--);let r=n+1;for(;n>=0;n--)this.addInt16(this.vtable[n]!=0?t-this.vtable[n]:0);let i=2;this.addInt16(t-this.object_start);let o=(r+i)*2;this.addInt16(o);let s=0,a=this.space;t:for(n=0;n<this.vtables.length;n++){let c=this.bb.capacity()-this.vtables[n];if(o==this.bb.readInt16(c)){for(let l=2;l<o;l+=2)if(this.bb.readInt16(a+l)!=this.bb.readInt16(c+l))continue t;s=this.vtables[n];break}}return s?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,s-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,n,r){let i=r?4:0;if(n){let o=n;if(this.prep(this.minalign,8+i),o.length!=4)throw new TypeError("FlatBuffers: file identifier must be length "+4);for(let s=3;s>=0;s--)this.writeInt8(o.charCodeAt(s))}this.prep(this.minalign,4+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,n){this.finish(t,n,!0)}requiredField(t,n){let r=this.bb.capacity()-t,i=r-this.bb.readInt32(r);if(!(n<this.bb.readInt16(i)&&this.bb.readInt16(i+n)!=0))throw new TypeError("FlatBuffers: field "+n+" must be set")}startVector(t,n,r){this.notNested(),this.vector_num_elems=n,this.prep(4,t*n),this.prep(r,t*n)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);let n=this.createString(t);return this.string_maps.set(t,n),n}createString(t){if(t==null)return 0;let n;t instanceof Uint8Array?n=t:n=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,n.length,1),this.bb.setPosition(this.space-=n.length);for(let r=0,i=this.space,o=this.bb.bytes();r<n.length;r++)o[i++]=n[r];return this.endVector()}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){let n=[];for(let r=0;r<t.length;++r){let i=t[r];if(i!==null)n.push(this.createObjectOffset(i));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return n}createStructOffsetList(t,n){return n(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}};var Qe=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsKeyValue(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}key(t){let n=this.bb.__offset(this.bb_pos,4);return n?this.bb.__string(this.bb_pos+n,t):null}value(t){let n=this.bb.__offset(this.bb_pos,6);return n?this.bb.__string(this.bb_pos+n,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,n){t.addFieldOffset(0,n,0)}static addValue(t,n){t.addFieldOffset(1,n,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,n,r){return e.startKeyValue(t),e.addKey(t,n),e.addValue(t,r),e.endKeyValue(t)}};var Xs;(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"})(Xs||(Xs={}));var Hs;(function(e){e[e.Little=0]="Little",e[e.Big=1]="Big"})(Hs||(Hs={}));var nh;(function(e){e[e.DenseArray=0]="DenseArray"})(nh||(nh={}));var gi=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsInt(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startInt(t){t.startObject(2)}static addBitWidth(t,n){t.addFieldInt32(0,n,0)}static addIsSigned(t,n){t.addFieldInt8(1,+n,0)}static endInt(t){return t.endObject()}static createInt(t,n,r){return e.startInt(t),e.addBitWidth(t,n),e.addIsSigned(t,r),e.endInt(t)}};var qi=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDictionaryEncoding(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new gi).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}isOrdered(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}dictionaryKind(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):nh.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,n){t.addFieldInt64(0,n,BigInt("0"))}static addIndexType(t,n){t.addFieldOffset(1,n,0)}static addIsOrdered(t,n){t.addFieldInt8(2,+n,0)}static addDictionaryKind(t,n){t.addFieldInt16(3,n,nh.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var rh=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsBinary(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return e.startBinary(t),e.endBinary(t)}};var ih=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsBool(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return e.startBool(t),e.endBool(t)}};var oh;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(oh||(oh={}));var Zs=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDate(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):oh.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,oh.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,n){return e.startDate(t),e.addUnit(t,n),e.endDate(t)}};var ji=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDecimal(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,n){t.addFieldInt32(0,n,0)}static addScale(t,n){t.addFieldInt32(1,n,0)}static addBitWidth(t,n){t.addFieldInt32(2,n,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,n,r,i){return e.startDecimal(t),e.addPrecision(t,n),e.addScale(t,r),e.addBitWidth(t,i),e.endDecimal(t)}};var bi;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(bi||(bi={}));var Ks=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDuration(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):bi.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,bi.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,n){return e.startDuration(t),e.addUnit(t,n),e.endDuration(t)}};var Qs=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFixedSizeBinary(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,n){t.addFieldInt32(0,n,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,n){return e.startFixedSizeBinary(t),e.addByteWidth(t,n),e.endFixedSizeBinary(t)}};var Js=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFixedSizeList(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}listSize(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,n){t.addFieldInt32(0,n,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,n){return e.startFixedSizeList(t),e.addListSize(t,n),e.endFixedSizeList(t)}};var sh;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(sh||(sh={}));var ta=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFloatingPoint(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):sh.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,n){t.addFieldInt16(0,n,sh.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,n){return e.startFloatingPoint(t),e.addPrecision(t,n),e.endFloatingPoint(t)}};var ah;(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"})(ah||(ah={}));var ea=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsInterval(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ah.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,ah.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,n){return e.startInterval(t),e.addUnit(t,n),e.endInterval(t)}};var ch=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsList(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return e.startList(t),e.endList(t)}};var na=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsMap(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let t=this.bb.__offset(this.bb_pos,4);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startMap(t){t.startObject(1)}static addKeysSorted(t,n){t.addFieldInt8(0,+n,0)}static endMap(t){return t.endObject()}static createMap(t,n){return e.startMap(t),e.addKeysSorted(t,n),e.endMap(t)}};var lh=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsNull(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return e.startNull(t),e.endNull(t)}};var uh=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsStruct_(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return e.startStruct_(t),e.endStruct_(t)}};var qo=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsTime(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):bi.MILLISECOND}bitWidth(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,n){t.addFieldInt16(0,n,bi.MILLISECOND)}static addBitWidth(t,n){t.addFieldInt32(1,n,32)}static endTime(t){return t.endObject()}static createTime(t,n,r){return e.startTime(t),e.addUnit(t,n),e.addBitWidth(t,r),e.endTime(t)}};var jo=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsTimestamp(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):bi.SECOND}timezone(t){let n=this.bb.__offset(this.bb_pos,6);return n?this.bb.__string(this.bb_pos+n,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,n){t.addFieldInt16(0,n,bi.SECOND)}static addTimezone(t,n){t.addFieldOffset(1,n,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,n,r){return e.startTimestamp(t),e.addUnit(t,n),e.addTimezone(t,r),e.endTimestamp(t)}};var fh;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(fh||(fh={}));var xi=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsUnion(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}mode(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):fh.Sparse}typeIds(t){let n=this.bb.__offset(this.bb_pos,6);return n?this.bb.readInt32(this.bb.__vector(this.bb_pos+n)+t*4):0}typeIdsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){let t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,n){t.addFieldInt16(0,n,fh.Sparse)}static addTypeIds(t,n){t.addFieldOffset(1,n,0)}static createTypeIdsVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addInt32(n[r]);return t.endVector()}static startTypeIdsVector(t,n){t.startVector(4,n,4)}static endUnion(t){return t.endObject()}static createUnion(t,n,r){return e.startUnion(t),e.addMode(t,n),e.addTypeIds(t,r),e.endUnion(t)}};var hh=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsUtf8(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return e.startUtf8(t),e.endUtf8(t)}};var de;(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"})(de||(de={}));var An=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsField(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}name(t){let n=this.bb.__offset(this.bb_pos,4);return n?this.bb.__string(this.bb_pos+n,t):null}nullable(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):de.NONE}type(t){let n=this.bb.__offset(this.bb_pos,10);return n?this.bb.__union(t,this.bb_pos+n):null}dictionary(t){let n=this.bb.__offset(this.bb_pos,12);return n?(t||new qi).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}children(t,n){let r=this.bb.__offset(this.bb_pos,14);return r?(n||new e).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}childrenLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,n){let r=this.bb.__offset(this.bb_pos,16);return r?(n||new Qe).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,n){t.addFieldOffset(0,n,0)}static addNullable(t,n){t.addFieldInt8(1,+n,0)}static addTypeType(t,n){t.addFieldInt8(2,n,de.NONE)}static addType(t,n){t.addFieldOffset(3,n,0)}static addDictionary(t,n){t.addFieldOffset(4,n,0)}static addChildren(t,n){t.addFieldOffset(5,n,0)}static createChildrenVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startChildrenVector(t,n){t.startVector(4,n,4)}static addCustomMetadata(t,n){t.addFieldOffset(6,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static endField(t){return t.endObject()}};var ir=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsSchema(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Hs.Little}fields(t,n){let r=this.bb.__offset(this.bb_pos,6);return r?(n||new An).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}fieldsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,n){let r=this.bb.__offset(this.bb_pos,8);return r?(n||new Qe).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){let n=this.bb.__offset(this.bb_pos,10);return n?this.bb.readInt64(this.bb.__vector(this.bb_pos+n)+t*8):BigInt(0)}featuresLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,n){t.addFieldInt16(0,n,Hs.Little)}static addFields(t,n){t.addFieldOffset(1,n,0)}static createFieldsVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startFieldsVector(t,n){t.startVector(4,n,4)}static addCustomMetadata(t,n){t.addFieldOffset(2,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static addFeatures(t,n){t.addFieldOffset(3,n,0)}static createFeaturesVector(t,n){t.startVector(8,n.length,8);for(let r=n.length-1;r>=0;r--)t.addInt64(n[r]);return t.endVector()}static startFeaturesVector(t,n){t.startVector(8,n,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,n){t.finish(n)}static finishSizePrefixedSchemaBuffer(t,n){t.finish(n,void 0,!0)}static createSchema(t,n,r,i,o){return e.startSchema(t),e.addEndianness(t,n),e.addFields(t,r),e.addCustomMetadata(t,i),e.addFeatures(t,o),e.endSchema(t)}};var wr=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFooter(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Xs.V1}schema(t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new ir).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}dictionaries(t,n){let r=this.bb.__offset(this.bb_pos,8);return r?(n||new nc).__init(this.bb.__vector(this.bb_pos+r)+t*24,this.bb):null}dictionariesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,n){let r=this.bb.__offset(this.bb_pos,10);return r?(n||new nc).__init(this.bb.__vector(this.bb_pos+r)+t*24,this.bb):null}recordBatchesLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,n){let r=this.bb.__offset(this.bb_pos,12);return r?(n||new Qe).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,n){t.addFieldInt16(0,n,Xs.V1)}static addSchema(t,n){t.addFieldOffset(1,n,0)}static addDictionaries(t,n){t.addFieldOffset(2,n,0)}static startDictionariesVector(t,n){t.startVector(24,n,8)}static addRecordBatches(t,n){t.addFieldOffset(3,n,0)}static startRecordBatchesVector(t,n){t.startVector(24,n,8)}static addCustomMetadata(t,n){t.addFieldOffset(4,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,n){t.finish(n)}static finishSizePrefixedFooterBuffer(t,n){t.finish(n,void 0,!0)}};var te=class e{constructor(t=[],n,r,i=Ie.V5){this.fields=t||[],this.metadata=n||new Map,r||(r=s_(t)),this.dictionaries=r,this.metadataVersion=i}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,n)=>`${n}: ${t}`).join(", ")} }>`}select(t){let n=new Set(t),r=this.fields.filter(i=>n.has(i.name));return new e(r,this.metadata)}selectAt(t){let n=t.map(r=>this.fields[r]).filter(Boolean);return new e(n,this.metadata)}assign(...t){let n=t[0]instanceof e?t[0]:Array.isArray(t[0])?new e(t[0]):new e(t),r=[...this.fields],i=Cy(Cy(new Map,this.metadata),n.metadata),o=n.fields.filter(a=>{let c=r.findIndex(l=>l.name===a.name);return~c?(r[c]=a.clone({metadata:Cy(Cy(new Map,r[c].metadata),a.metadata)}))&&!1:!0}),s=s_(o,new Map);return new e([...r,...o],i,new Map([...this.dictionaries,...s]))}};te.prototype.fields=null;te.prototype.metadata=null;te.prototype.dictionaries=null;var Rt=class e{static new(...t){let[n,r,i,o]=t;return t[0]&&typeof t[0]=="object"&&({name:n}=t[0],r===void 0&&(r=t[0].type),i===void 0&&(i=t[0].nullable),o===void 0&&(o=t[0].metadata)),new e(`${n}`,r,i,o)}constructor(t,n,r=!1,i){this.name=t,this.type=n,this.nullable=r,this.metadata=i||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[n,r,i,o]=t;return!t[0]||typeof t[0]!="object"?[n=this.name,r=this.type,i=this.nullable,o=this.metadata]=t:{name:n=this.name,type:r=this.type,nullable:i=this.nullable,metadata:o=this.metadata}=t[0],e.new(n,r,i,o)}};Rt.prototype.type=null;Rt.prototype.name=null;Rt.prototype.nullable=null;Rt.prototype.metadata=null;function Cy(e,t){return new Map([...e||new Map,...t||new Map])}function s_(e,t=new Map){for(let n=-1,r=e.length;++n<r;){let o=e[n].type;if(st.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&&s_(o.children,t)}return t}var zC=rc,VC=xr,Yo=class{static decode(t){t=new VC(Et(t));let n=wr.getRootAsFooter(t),r=te.decode(n.schema(),new Map,n.version());return new a_(r,n)}static encode(t){let n=new zC,r=te.encode(n,t.schema);wr.startRecordBatchesVector(n,t.numRecordBatches);for(let s of[...t.recordBatches()].slice().reverse())Wo.encode(n,s);let i=n.endVector();wr.startDictionariesVector(n,t.numDictionaries);for(let s of[...t.dictionaryBatches()].slice().reverse())Wo.encode(n,s);let o=n.endVector();return wr.startFooter(n),wr.addSchema(n,r),wr.addVersion(n,Ie.V5),wr.addRecordBatches(n,i),wr.addDictionaries(n,o),wr.finishFooterBuffer(n,wr.endFooter(n)),n.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,n=Ie.V5,r,i){this.schema=t,this.version=n,r&&(this._recordBatches=r),i&&(this._dictionaryBatches=i)}*recordBatches(){for(let t,n=-1,r=this.numRecordBatches;++n<r;)(t=this.getRecordBatch(n))&&(yield t)}*dictionaryBatches(){for(let t,n=-1,r=this.numDictionaries;++n<r;)(t=this.getDictionaryBatch(n))&&(yield t)}getRecordBatch(t){return t>=0&&t<this.numRecordBatches&&this._recordBatches[t]||null}getDictionaryBatch(t){return t>=0&&t<this.numDictionaries&&this._dictionaryBatches[t]||null}};var a_=class extends Yo{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(t,n){super(t,n.version()),this._footer=n}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){let n=this._footer.recordBatches(t);if(n)return Wo.decode(n)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let n=this._footer.dictionaries(t);if(n)return Wo.decode(n)}return null}},Wo=class e{static decode(t){return new e(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,n){let{metaDataLength:r}=n,i=BigInt(n.offset),o=BigInt(n.bodyLength);return nc.createBlock(t,i,r,o)}constructor(t,n,r){this.metaDataLength=t,this.offset=nr(r),this.bodyLength=nr(n)}};var pe=Object.freeze({done:!0,value:void 0}),dh=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},ic=class{tee(){return this._getDOMStream().tee()}pipe(t,n){return this._getNodeStream().pipe(t,n)}pipeTo(t,n){return this._getDOMStream().pipeTo(t,n)}pipeThrough(t,n){return this._getDOMStream().pipeThrough(t,n)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}},ky=class extends ic{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return H(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(pe);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return pn.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return pn.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return H(this,void 0,void 0,function*(){return yield this.abort(t),pe})}return(t){return H(this,void 0,void 0,function*(){return yield this.close(),pe})}read(t){return H(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return H(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((n,r)=>{this.resolvers.push({resolve:n,reject:r})}):Promise.resolve(pe)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var Yi=class extends ky{write(t){if((t=Et(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Wf(this.toUint8Array(!0)):this.toUint8Array(!1).then(Wf)}toUint8Array(t=!1){return t?mr(this._values)[0]:H(this,void 0,void 0,function*(){var n,r,i,o;let s=[],a=0;try{for(var c=!0,l=ii(this),u;u=yield l.next(),n=u.done,!n;c=!0){o=u.value,c=!1;let f=o;s.push(f),a+=f.byteLength}}catch(f){r={error:f}}finally{try{!c&&!n&&(i=l.return)&&(yield i.call(l))}finally{if(r)throw r.error}}return mr(s,a)[0]})}},Wi=class{constructor(t){t&&(this.source=new c_(pn.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)}},Pr=class e{constructor(t){t instanceof e?this.source=t.source:t instanceof Yi?this.source=new Go(pn.fromAsyncIterable(t)):Gm(t)?this.source=new Go(pn.fromNodeStream(t)):Gf(t)?this.source=new Go(pn.fromDOMStream(t)):Ym(t)?this.source=new Go(pn.fromDOMStream(t.body)):oi(t)?this.source=new Go(pn.fromIterable(t)):pr(t)?this.source=new Go(pn.fromAsyncIterable(t)):Rr(t)&&(this.source=new Go(pn.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)}},c_=class{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,n="read"){return this.source.next({cmd:n,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||pe)}return(t){return Object.create(this.source.return&&this.source.return(t)||pe)}},Go=class{constructor(t){this.source=t,this._closedPromise=new Promise(n=>this._closedPromiseResolve=n)}cancel(t){return H(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return H(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return H(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t,n="read"){return H(this,void 0,void 0,function*(){return yield this.source.next({cmd:n,size:t})})}throw(t){return H(this,void 0,void 0,function*(){let n=this.source.throw&&(yield this.source.throw(t))||pe;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(n)})}return(t){return H(this,void 0,void 0,function*(){let n=this.source.return&&(yield this.source.return(t))||pe;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(n)})}};var ph=class extends Wi{constructor(t,n){super(),this.position=0,this.buffer=Et(t),this.size=n===void 0?this.buffer.byteLength:n}readInt32(t){let{buffer:n,byteOffset:r}=this.readAt(t,4);return new DataView(n,r).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){let{buffer:n,size:r,position:i}=this;return n&&i<r?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(r,i+Math.min(r-i,t)),n.subarray(i,this.position)):null}readAt(t,n){let r=this.buffer,i=Math.min(this.size,t+n);return r?r.subarray(t,i):new Uint8Array(n)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}},ra=class extends Pr{constructor(t,n){super(),this.position=0,this._handle=t,typeof n=="number"?this.size=n:this._pending=H(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return H(this,void 0,void 0,function*(){let{buffer:n,byteOffset:r}=yield this.readAt(t,4);return new DataView(n,r).getInt32(0,!0)})}seek(t){return H(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 H(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:n,size:r,position:i}=this;if(n&&i<r){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let o=i,s=0,a=0,c=Math.min(r,o+Math.min(r-o,t)),l=new Uint8Array(Math.max(0,(this.position=c)-o));for(;(o+=a)<c&&(s+=a)<l.byteLength;)({bytesRead:a}=yield n.read(l,s,l.byteLength-s,o));return l}return null})}readAt(t,n){return H(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:r,size:i}=this;if(r&&t+n<i){let o=Math.min(i,t+n),s=new Uint8Array(o-t);return(yield r.read(s,0,n,t)).buffer}return new Uint8Array(n)})}close(){return H(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return H(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return H(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var u_={};zs(u_,{BaseInt64:()=>mh,Int128:()=>yh,Int64:()=>Xo,Uint64:()=>Me});function Fl(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}var Ll=8,l_=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],mh=class{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){let n=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),r=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]),i=n[3]*r[3];this.buffer[0]=i&65535;let o=i>>>16;return i=n[2]*r[3],o+=i,i=n[3]*r[2]>>>0,o+=i,this.buffer[0]+=o<<16,this.buffer[1]=o>>>0<i?65536:0,this.buffer[1]+=o>>>16,this.buffer[1]+=n[1]*r[3]+n[2]*r[2]+n[3]*r[1],this.buffer[1]+=n[0]*r[3]+n[1]*r[2]+n[2]*r[1]+n[3]*r[0]<<16,this}_plus(t){let n=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],n<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=n}lessThan(t){return this.buffer[1]<t.buffer[1]||this.buffer[1]===t.buffer[1]&&this.buffer[0]<t.buffer[0]}equals(t){return this.buffer[1]===t.buffer[1]&&this.buffer[0]==t.buffer[0]}greaterThan(t){return t.lessThan(this)}hex(){return`${Fl(this.buffer[1])} ${Fl(this.buffer[0])}`}},Me=class e extends mh{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,n=new Uint32Array(2)){return e.fromString(typeof t=="string"?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(2)){return e.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(2)){let r=t.length,i=new e(n);for(let o=0;o<r;){let s=Ll<r-o?Ll:r-o,a=new e(new Uint32Array([Number.parseInt(t.slice(o,o+s),10),0])),c=new e(new Uint32Array([l_[s],0]));i.times(c),i.plus(a),o+=s}return i}static convertArray(t){let n=new Uint32Array(t.length*2);for(let r=-1,i=t.length;++r<i;)e.from(t[r],new Uint32Array(n.buffer,n.byteOffset+2*r*4,2));return n}static multiply(t,n){return new e(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new e(new Uint32Array(t.buffer)).plus(n)}},Xo=class e extends mh{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(t){return this._times(t),this}plus(t){return this._plus(t),this}lessThan(t){let n=this.buffer[1]<<0,r=t.buffer[1]<<0;return n<r||n===r&&this.buffer[0]<t.buffer[0]}static from(t,n=new Uint32Array(2)){return e.fromString(typeof t=="string"?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(2)){return e.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(2)){let r=t.startsWith("-"),i=t.length,o=new e(n);for(let s=r?1:0;s<i;){let a=Ll<i-s?Ll:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0])),l=new e(new Uint32Array([l_[a],0]));o.times(l),o.plus(c),s+=a}return r?o.negate():o}static convertArray(t){let n=new Uint32Array(t.length*2);for(let r=-1,i=t.length;++r<i;)e.from(t[r],new Uint32Array(n.buffer,n.byteOffset+2*r*4,2));return n}static multiply(t,n){return new e(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new e(new Uint32Array(t.buffer)).plus(n)}},yh=class e{constructor(t){this.buffer=t}high(){return new Xo(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new Xo(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(t){let n=new Me(new Uint32Array([this.buffer[3],0])),r=new Me(new Uint32Array([this.buffer[2],0])),i=new Me(new Uint32Array([this.buffer[1],0])),o=new Me(new Uint32Array([this.buffer[0],0])),s=new Me(new Uint32Array([t.buffer[3],0])),a=new Me(new Uint32Array([t.buffer[2],0])),c=new Me(new Uint32Array([t.buffer[1],0])),l=new Me(new Uint32Array([t.buffer[0],0])),u=Me.multiply(o,l);this.buffer[0]=u.low();let f=new Me(new Uint32Array([u.high(),0]));return u=Me.multiply(i,l),f.plus(u),u=Me.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 Me(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(Me.multiply(r,l)).plus(Me.multiply(i,c)).plus(Me.multiply(o,a)),this.buffer[3]+=Me.multiply(n,l).plus(Me.multiply(r,c)).plus(Me.multiply(i,a)).plus(Me.multiply(o,s)).low(),this}plus(t){let n=new Uint32Array(4);return n[3]=this.buffer[3]+t.buffer[3]>>>0,n[2]=this.buffer[2]+t.buffer[2]>>>0,n[1]=this.buffer[1]+t.buffer[1]>>>0,n[0]=this.buffer[0]+t.buffer[0]>>>0,n[0]<this.buffer[0]>>>0&&++n[1],n[1]<this.buffer[1]>>>0&&++n[2],n[2]<this.buffer[2]>>>0&&++n[3],this.buffer[3]=n[3],this.buffer[2]=n[2],this.buffer[1]=n[1],this.buffer[0]=n[0],this}hex(){return`${Fl(this.buffer[3])} ${Fl(this.buffer[2])} ${Fl(this.buffer[1])} ${Fl(this.buffer[0])}`}static multiply(t,n){return new e(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new e(new Uint32Array(t.buffer)).plus(n)}static from(t,n=new Uint32Array(4)){return e.fromString(typeof t=="string"?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(4)){return e.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(4)){let r=t.startsWith("-"),i=t.length,o=new e(n);for(let s=r?1:0;s<i;){let a=Ll<i-s?Ll:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0,0,0])),l=new e(new Uint32Array([l_[a],0,0,0]));o.times(l),o.plus(c),s+=a}return r?o.negate():o}static convertArray(t){let n=new Uint32Array(t.length*4);for(let r=-1,i=t.length;++r<i;)e.from(t[r],new Uint32Array(n.buffer,n.byteOffset+4*4*r,4));return n}};var gh=class extends lt{constructor(t,n,r,i,o=Ie.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=n,this.buffers=r,this.dictionaries=i,this.metadataVersion=o}visit(t){return super.visit(t instanceof Rt?t.type:t)}visitNull(t,{length:n}=this.nextFieldNode()){return Dt({type:t,length:n})}visitBool(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitInt(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitFloat(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitUtf8(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinary(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitFixedSizeBinary(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDate(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitTimestamp(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitTime(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDecimal(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitList(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),children:this.visitMany(t.children)})}visitUnion(t,{length:n,nullCount:r}=this.nextFieldNode()){return this.metadataVersion<Ie.V5&&this.readNullBitmap(t,r),t.mode===me.Sparse?this.visitSparseUnion(t,{length:n,nullCount:r}):this.visitDenseUnion(t,{length:n,nullCount:r})}visitDenseUnion(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDuration(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitFixedSizeList(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),child:this.visit(t.children[0])})}visitMap(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,n,r=this.nextBufferRange()){return n>0&&this.readData(t,r)||new Uint8Array(0)}readOffsets(t,n){return this.readData(t,n)}readTypeIds(t,n){return this.readData(t,n)}readData(t,{length:n,offset:r}=this.nextBufferRange()){return this.bytes.subarray(r,r+n)}readDictionary(t){return this.dictionaries.get(t.id)}},Ry=class extends gh{constructor(t,n,r,i,o){super(new Uint8Array(0),n,r,i,o),this.sources=t}readNullBitmap(t,n,{offset:r}=this.nextBufferRange()){return n<=0?new Uint8Array(0):tc(this.sources[r])}readOffsets(t,{offset:n}=this.nextBufferRange()){return kt(Uint8Array,kt(Int32Array,this.sources[n]))}readTypeIds(t,{offset:n}=this.nextBufferRange()){return kt(Uint8Array,kt(t.ArrayType,this.sources[n]))}readData(t,{offset:n}=this.nextBufferRange()){let{sources:r}=this;return st.isTimestamp(t)?kt(Uint8Array,Xo.convertArray(r[n])):(st.isInt(t)||st.isTime(t))&&t.bitWidth===64||st.isDuration(t)?kt(Uint8Array,Xo.convertArray(r[n])):st.isDate(t)&&t.unit===Tn.MILLISECOND?kt(Uint8Array,Xo.convertArray(r[n])):st.isDecimal(t)?kt(Uint8Array,yh.convertArray(r[n])):st.isBinary(t)||st.isFixedSizeBinary(t)?qC(r[n]):st.isBool(t)?tc(r[n]):st.isUtf8(t)?Vs(r[n].join("")):kt(Uint8Array,kt(t.ArrayType,r[n].map(i=>+i)))}};function qC(e){let t=e.join(""),n=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)n[r>>1]=Number.parseInt(t.slice(r,r+2),16);return n}var Cl=class extends zi{constructor(t){super(t),this._values=new Gs(new Uint8Array(0))}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,n){return super.setValue(t,Et(n))}_flushPending(t,n){let r=this._offsets,i=this._values.reserve(n).buffer,o=0;for(let[s,a]of t)if(a===void 0)r.set(s,0);else{let c=a.length;i.set(a,o),r.set(s,c),o+=c}}};var $y=class extends ye{constructor(t){super(t),this._values=new Nl}setValue(t,n){this._values.set(t,+n)}};var oc=class extends ze{};oc.prototype._setValue=qw;var bh=class extends oc{};bh.prototype._setValue=ay;var xh=class extends oc{};xh.prototype._setValue=cy;var wh=class extends ze{};wh.prototype._setValue=Ww;var Uy=class extends ye{constructor({type:t,nullValues:n,dictionaryHashFunction:r}){super({type:new yr(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=sc({type:this.type.indices,nullValues:n}),this.dictionary=sc({type:this.type.dictionary,nullValues:null}),typeof r=="function"&&(this.valueToKey=r)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,n){let r=this.indices;return n=r.setValid(t,n),this.length=r.length,n}setValue(t,n){let r=this._keysToIndices,i=this.valueToKey(n),o=r[i];return o===void 0&&(r[i]=o=this._dictionaryOffset+this.dictionary.append(n).length-1),this.indices.setValue(t,o)}flush(){let t=this.type,n=this._dictionary,r=this.dictionary.toVector(),i=this.indices.flush().clone(t);return i.dictionary=n?n.concat(r):r,this.finished||(this._dictionaryOffset+=r.length),this._dictionary=i.dictionary,this.clear(),i}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(t){return typeof t=="string"?t:`${t}`}};var _h=class extends ze{};_h.prototype._setValue=Vw;var Py=class extends ye{setValue(t,n){let[r]=this.children,i=t*this.stride;for(let o=-1,s=n.length;++o<s;)r.set(i+o,n[o])}addChild(t,n="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");let r=this.children.push(t);return this.type=new di(this.type.listSize,new Rt(n,t.type,!0)),r}};var ac=class extends ze{setValue(t,n){this._values.set(t,n)}},zy=class extends ac{setValue(t,n){super.setValue(t,Zf(n))}},Vy=class extends ac{},qy=class extends ac{};var cc=class extends ze{};cc.prototype._setValue=Gw;var vh=class extends cc{};vh.prototype._setValue=gy;var Sh=class extends cc{};Sh.prototype._setValue=by;var Ho=class extends ze{};Ho.prototype._setValue=Xw;var Ih=class extends Ho{};Ih.prototype._setValue=xy;var Mh=class extends Ho{};Mh.prototype._setValue=wy;var Th=class extends Ho{};Th.prototype._setValue=_y;var Ah=class extends Ho{};Ah.prototype._setValue=vy;var zr=class extends ze{setValue(t,n){this._values.set(t,n)}},jy=class extends zr{},Yy=class extends zr{},Wy=class extends zr{},Gy=class extends zr{},Xy=class extends zr{},Hy=class extends zr{},Zy=class extends zr{},Ky=class extends zr{};var Qy=class extends zi{constructor(t){super(t),this._offsets=new Ol}addChild(t,n="0"){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new fi(new Rt(n,t.type,!0)),this.numChildren-1}_flushPending(t){let n=this._offsets,[r]=this.children;for(let[i,o]of t)if(typeof o>"u")n.set(i,0);else{let s=o,a=s.length,c=n.set(i,a).buffer[i];for(let l=-1;++l<a;)r.set(c+l,s[l])}}};var Jy=class extends zi{set(t,n){return super.set(t,n)}setValue(t,n){let r=n instanceof Map?n:new Map(Object.entries(n)),i=this._pending||(this._pending=new Map),o=i.get(t);o&&(this._pendingLength-=o.size),this._pendingLength+=r.size,i.set(t,r)}addChild(t,n=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new pi(new Rt(n,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let n=this._offsets,[r]=this.children;for(let[i,o]of t)if(o===void 0)n.set(i,0);else{let{[i]:s,[i+1]:a}=n.set(i,o.size).buffer;for(let c of o.entries())if(r.set(s,c),++s>=a)break}}};var t0=class extends ye{setValue(t,n){}setValid(t,n){return this.length=Math.max(t+1,this.length),n}};var e0=class extends ye{setValue(t,n){let{children:r,type:i}=this;switch(Array.isArray(n)||n.constructor){case!0:return i.children.forEach((o,s)=>r[s].set(t,n[s]));case Map:return i.children.forEach((o,s)=>r[s].set(t,n.get(o.name)));default:return i.children.forEach((o,s)=>r[s].set(t,n[o.name]))}}setValid(t,n){return super.setValid(t,n)||this.children.forEach(r=>r.setValid(t,n)),n}addChild(t,n=`${this.numChildren}`){let r=this.children.push(t);return this.type=new he([...this.type.children,new Rt(n,t.type,!0)]),r}};var Zo=class extends ze{};Zo.prototype._setValue=jw;var Eh=class extends Zo{};Eh.prototype._setValue=ly;var Dh=class extends Zo{};Dh.prototype._setValue=uy;var Nh=class extends Zo{};Nh.prototype._setValue=fy;var Oh=class extends Zo{};Oh.prototype._setValue=hy;var Ko=class extends ze{};Ko.prototype._setValue=Yw;var Bh=class extends Ko{};Bh.prototype._setValue=dy;var Fh=class extends Ko{};Fh.prototype._setValue=py;var Lh=class extends Ko{};Lh.prototype._setValue=my;var Ch=class extends Ko{};Ch.prototype._setValue=yy;var kl=class extends ye{constructor(t){super(t),this._typeIds=new Vo(new Int8Array(0),1),typeof t.valueToChildTypeId=="function"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,n){return this.set(this.length,t,n)}set(t,n,r){return r===void 0&&(r=this._valueToChildTypeId(this,n,t)),this.setValue(t,n,r),this}setValue(t,n,r){this._typeIds.set(t,r);let i=this.type.typeIdToChildIndex[r],o=this.children[i];o?.set(t,n)}addChild(t,n=`${this.children.length}`){let r=this.children.push(t),{type:{children:i,mode:o,typeIds:s}}=this,a=[...i,new Rt(n,t.type)];return this.type=new hi(o,[...s,r],a),r}_valueToChildTypeId(t,n,r){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}},n0=class extends kl{},r0=class extends kl{constructor(t){super(t),this._offsets=new Vo(new Int32Array(0))}setValue(t,n,r){let i=this._typeIds.set(t,r).buffer[t],o=this.getChildAt(this.type.typeIdToChildIndex[i]),s=this._offsets.set(t,o.length).buffer[t];o?.set(s,n)}};var kh=class extends zi{constructor(t){super(t),this._values=new Gs(new Uint8Array(0))}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,n){return super.setValue(t,Vs(n))}_flushPending(t,n){}};kh.prototype._flushPending=Cl.prototype._flushPending;var f_=class extends lt{visitNull(){return t0}visitBool(){return $y}visitInt(){return zr}visitInt8(){return jy}visitInt16(){return Yy}visitInt32(){return Wy}visitInt64(){return Gy}visitUint8(){return Xy}visitUint16(){return Hy}visitUint32(){return Zy}visitUint64(){return Ky}visitFloat(){return ac}visitFloat16(){return zy}visitFloat32(){return Vy}visitFloat64(){return qy}visitUtf8(){return kh}visitBinary(){return Cl}visitFixedSizeBinary(){return _h}visitDate(){return oc}visitDateDay(){return bh}visitDateMillisecond(){return xh}visitTimestamp(){return Zo}visitTimestampSecond(){return Eh}visitTimestampMillisecond(){return Dh}visitTimestampMicrosecond(){return Nh}visitTimestampNanosecond(){return Oh}visitTime(){return Ko}visitTimeSecond(){return Bh}visitTimeMillisecond(){return Fh}visitTimeMicrosecond(){return Lh}visitTimeNanosecond(){return Ch}visitDecimal(){return wh}visitList(){return Qy}visitStruct(){return e0}visitUnion(){return kl}visitDenseUnion(){return r0}visitSparseUnion(){return n0}visitDictionary(){return Uy}visitInterval(){return cc}visitIntervalDayTime(){return vh}visitIntervalYearMonth(){return Sh}visitDuration(){return Ho}visitDurationSecond(){return Ih}visitDurationMillisecond(){return Mh}visitDurationMicrosecond(){return Th}visistDurationNanosecond(){return Ah}visitFixedSizeList(){return Py}visitMap(){return Jy}},C6=new f_;var bt=class extends lt{compareSchemas(t,n){return t===n||n instanceof t.constructor&&this.compareManyFields(t.fields,n.fields)}compareManyFields(t,n){return t===n||Array.isArray(t)&&Array.isArray(n)&&t.length===n.length&&t.every((r,i)=>this.compareFields(r,n[i]))}compareFields(t,n){return t===n||n instanceof t.constructor&&t.name===n.name&&t.nullable===n.nullable&&this.visit(t.type,n.type)}};function Un(e,t){return t instanceof e.constructor}function Rh(e,t){return e===t||Un(e,t)}function Qo(e,t){return e===t||Un(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function i0(e,t){return e===t||Un(e,t)&&e.precision===t.precision}function jC(e,t){return e===t||Un(e,t)&&e.byteWidth===t.byteWidth}function h_(e,t){return e===t||Un(e,t)&&e.unit===t.unit}function $h(e,t){return e===t||Un(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function Uh(e,t){return e===t||Un(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function YC(e,t){return e===t||Un(e,t)&&e.children.length===t.children.length&&Gi.compareManyFields(e.children,t.children)}function WC(e,t){return e===t||Un(e,t)&&e.children.length===t.children.length&&Gi.compareManyFields(e.children,t.children)}function d_(e,t){return e===t||Un(e,t)&&e.mode===t.mode&&e.typeIds.every((n,r)=>n===t.typeIds[r])&&Gi.compareManyFields(e.children,t.children)}function GC(e,t){return e===t||Un(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&Gi.visit(e.indices,t.indices)&&Gi.visit(e.dictionary,t.dictionary)}function p_(e,t){return e===t||Un(e,t)&&e.unit===t.unit}function Ph(e,t){return e===t||Un(e,t)&&e.unit===t.unit}function XC(e,t){return e===t||Un(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&Gi.compareManyFields(e.children,t.children)}function HC(e,t){return e===t||Un(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&Gi.compareManyFields(e.children,t.children)}bt.prototype.visitNull=Rh;bt.prototype.visitBool=Rh;bt.prototype.visitInt=Qo;bt.prototype.visitInt8=Qo;bt.prototype.visitInt16=Qo;bt.prototype.visitInt32=Qo;bt.prototype.visitInt64=Qo;bt.prototype.visitUint8=Qo;bt.prototype.visitUint16=Qo;bt.prototype.visitUint32=Qo;bt.prototype.visitUint64=Qo;bt.prototype.visitFloat=i0;bt.prototype.visitFloat16=i0;bt.prototype.visitFloat32=i0;bt.prototype.visitFloat64=i0;bt.prototype.visitUtf8=Rh;bt.prototype.visitBinary=Rh;bt.prototype.visitFixedSizeBinary=jC;bt.prototype.visitDate=h_;bt.prototype.visitDateDay=h_;bt.prototype.visitDateMillisecond=h_;bt.prototype.visitTimestamp=$h;bt.prototype.visitTimestampSecond=$h;bt.prototype.visitTimestampMillisecond=$h;bt.prototype.visitTimestampMicrosecond=$h;bt.prototype.visitTimestampNanosecond=$h;bt.prototype.visitTime=Uh;bt.prototype.visitTimeSecond=Uh;bt.prototype.visitTimeMillisecond=Uh;bt.prototype.visitTimeMicrosecond=Uh;bt.prototype.visitTimeNanosecond=Uh;bt.prototype.visitDecimal=Rh;bt.prototype.visitList=YC;bt.prototype.visitStruct=WC;bt.prototype.visitUnion=d_;bt.prototype.visitDenseUnion=d_;bt.prototype.visitSparseUnion=d_;bt.prototype.visitDictionary=GC;bt.prototype.visitInterval=p_;bt.prototype.visitIntervalDayTime=p_;bt.prototype.visitIntervalYearMonth=p_;bt.prototype.visitDuration=Ph;bt.prototype.visitDurationSecond=Ph;bt.prototype.visitDurationMillisecond=Ph;bt.prototype.visitDurationMicrosecond=Ph;bt.prototype.visitDurationNanosecond=Ph;bt.prototype.visitFixedSizeList=XC;bt.prototype.visitMap=HC;var Gi=new bt;function lc(e,t){return Gi.compareSchemas(e,t)}function k6(e,t){return Gi.compareFields(e,t)}function R6(e,t){return Gi.visit(e,t)}function sc(e){let t=e.type,n=new(C6.getVisitFn(t)())(e);if(t.children&&t.children.length>0){let r=e.children||[],i={nullValues:e.nullValues},o=Array.isArray(r)?(s,a)=>r[a]||i:({name:s})=>r[s]||i;for(let[s,a]of t.children.entries()){let{type:c}=a,l=o(a,s);n.children.push(sc(Object.assign(Object.assign({},l),{type:c})))}}return n}function o0(e,t){return ZC(e,t.map(n=>n.data.concat()))}function ZC(e,t){let n=[...e.fields],r=[],i={numBatches:t.reduce((f,h)=>Math.max(f,h.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=KC(n,s,u,t,i),s>0&&(r[o++]=Dt({type:new he(n),length:s,nullCount:0,children:u.slice()})))}return[e=e.assign(n),r.map(f=>new De(e,f))]}function KC(e,t,n,r,i){var o;let s=(t+63&-64)>>3;for(let a=-1,c=r.length;++a<c;){let l=n[a],u=l?.length;if(u>=t)u===t?n[a]=l:(n[a]=l.slice(0,t),i.numBatches=Math.max(i.numBatches,r[a].unshift(l.slice(t,u-t))));else{let f=e[a];e[a]=f.clone({nullable:!0}),n[a]=(o=l?._changeLengthAndBackfillNullBitmap(t))!==null&&o!==void 0?o:Dt({type:f.type,length:t,nullCount:t,nullBitmap:new Uint8Array(s)})}}return n}var $6,or=class e{constructor(...t){var n,r;if(t.length===0)return this.batches=[],this.schema=new te([]),this._offsets=[0],this;let i,o;t[0]instanceof te&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(o=t.pop());let s=c=>{if(c){if(c instanceof De)return[c];if(c instanceof e)return c.batches;if(c instanceof re){if(c.type instanceof he)return[new De(new te(c.type.children),c)]}else{if(Array.isArray(c))return c.flatMap(l=>s(l));if(typeof c[Symbol.iterator]=="function")return[...c].flatMap(l=>s(l));if(typeof c=="object"){let l=Object.keys(c),u=l.map(d=>new zt([c[d]])),f=new te(l.map((d,p)=>new Rt(String(d),u[p].type))),[,h]=o0(f,u);return h.length===0?[new De(c)]:h}}}return[]},a=t.flatMap(c=>s(c));if(i=(r=i??((n=a[0])===null||n===void 0?void 0:n.schema))!==null&&r!==void 0?r:new te([]),!(i instanceof te))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let c of a){if(!(c instanceof De))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!lc(i,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=o??Ay(this.data)}get data(){return this.batches.map(({data:t})=>t)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((t,n)=>t+n.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=Ty(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}set(t,n){}indexOf(t,n){return-1}getByteLength(t){return 0}[Symbol.iterator](){return this.batches.length>0?Dl.visit(new zt(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
|
|
8
|
+
${this.toArray().join(`,
|
|
9
|
+
`)}
|
|
10
|
+
]`}concat(...t){let n=this.schema,r=this.data.concat(t.flatMap(({data:i})=>i));return new e(n,r.map(i=>new De(n,i)))}slice(t,n){let r=this.schema;[t,n]=Kf({length:this.numRows},t,n);let i=Ey(this.data,this._offsets,t,n);return new e(r,i.map(o=>new De(r,o)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(n=>n.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let n=this.data.map(r=>r.children[t]);if(n.length===0){let{type:r}=this.schema.fields[t],i=Dt({type:r,length:0,nullCount:0});n.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new zt(n)}return null}setChild(t,n){var r;return this.setChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(i=>i.name===t),n)}setChildAt(t,n){let r=this.schema,i=[...this.batches];if(t>-1&&t<this.numCols){n||(n=new zt([Dt({type:new $n,length:this.numRows})]));let o=r.fields.slice(),s=o[t].clone({type:n.type}),a=this.schema.fields.map((c,l)=>this.getChildAt(l));[o[t],a[t]]=[s,n],[r,i]=o0(r,a)}return new e(r,i)}select(t){let n=this.schema.fields.reduce((r,i,o)=>r.set(i.name,o),new Map);return this.selectAt(t.map(r=>n.get(r)).filter(r=>r>-1))}selectAt(t){let n=this.schema.selectAt(t),r=this.batches.map(i=>i.selectAt(t));return new e(n,r)}assign(t){let n=this.schema.fields,[r,i]=t.schema.fields.reduce((a,c,l)=>{let[u,f]=a,h=n.findIndex(d=>d.name===c.name);return~h?f[h]=l:u.push(l),a},[[],[]]),o=this.schema.assign(t.schema),s=[...n.map((a,c)=>[c,i[c]]).map(([a,c])=>c===void 0?this.getChildAt(a):t.getChildAt(c)),...r.map(a=>t.getChildAt(a))].filter(Boolean);return new e(...o0(o,s))}};$6=Symbol.toStringTag;or[$6]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e.isValid=Ws(th),e.get=Ws(Pe.getVisitFn(F.Struct)),e.set=Dy(mn.getVisitFn(F.Struct)),e.indexOf=Ny(ec.getVisitFn(F.Struct)),e.getByteLength=Ws(br.getVisitFn(F.Struct)),"Table"))(or.prototype);var P6,De=class e{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof te))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=Dt({nullCount:0,type:new he(this.schema.fields),children:this.schema.fields.map(n=>Dt({type:n.type,nullCount:0}))})]=t,!(this.data instanceof re))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=U6(this.schema,this.data.children);break}case 1:{let[n]=t,{fields:r,children:i,length:o}=Object.keys(n).reduce((c,l,u)=>(c.children[u]=n[l],c.length=Math.max(c.length,n[l].length),c.fields[u]=Rt.new({name:l,type:n[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),s=new te(r),a=Dt({type:new he(r),length:o,children:i,nullCount:0});[this.schema,this.data]=U6(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=z6(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 Pe.visit(this.data,t)}set(t,n){return mn.visit(this.data,t,n)}indexOf(t,n){return ec.visit(this.data,t,n)}getByteLength(t){return br.visit(this.data,t)}[Symbol.iterator](){return Dl.visit(new zt([this.data]))}toArray(){return[...this]}concat(...t){return new or(this.schema,[this,...t])}slice(t,n){let[r]=new zt([this.data]).slice(t,n).data;return new e(this.schema,r)}getChild(t){var n;return this.getChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(r=>r.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new zt([this.data.children[t]]):null}setChild(t,n){var r;return this.setChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(i=>i.name===t),n)}setChildAt(t,n){let r=this.schema,i=this.data;if(t>-1&&t<this.numCols){n||(n=new zt([Dt({type:new $n,length:this.numRows})]));let o=r.fields.slice(),s=i.children.slice(),a=o[t].clone({type:n.type});[o[t],s[t]]=[a,n.data[0]],r=new te(o,new Map(this.schema.metadata)),i=Dt({type:new he(o),children:s})}return new e(r,i)}select(t){let n=this.schema.select(t),r=new he(n.fields),i=[];for(let o of t){let s=this.schema.fields.findIndex(a=>a.name===o);~s&&(i[s]=this.data.children[s])}return new e(n,Dt({type:r,length:this.numRows,children:i}))}selectAt(t){let n=this.schema.selectAt(t),r=t.map(o=>this.data.children[o]).filter(Boolean),i=Dt({type:new he(n.fields),length:this.numRows,children:r});return new e(n,i)}};P6=Symbol.toStringTag;De[P6]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(De.prototype);function U6(e,t,n=t.reduce((r,i)=>Math.max(r,i.length),0)){var r;let i=[...e.fields],o=[...t],s=(n+63&-64)>>3;for(let[a,c]of e.fields.entries()){let l=t[a];(!l||l.length!==n)&&(i[a]=c.clone({nullable:!0}),o[a]=(r=l?._changeLengthAndBackfillNullBitmap(n))!==null&&r!==void 0?r:Dt({type:c.type,length:n,nullCount:n,nullBitmap:new Uint8Array(s)}))}return[e.assign(i),Dt({type:new he(i),length:n,children:o})]}function z6(e,t,n=new Map){var r,i;if(((r=e?.length)!==null&&r!==void 0?r:0)>0&&e?.length===t?.length)for(let o=-1,s=e.length;++o<s;){let{type:a}=e[o],c=t[o];for(let l of[c,...((i=c?.dictionary)===null||i===void 0?void 0:i.data)||[]])z6(a.children,l?.children,n);if(st.isDictionary(a)){let{id:l}=a;if(!n.has(l))c?.dictionary&&n.set(l,c.dictionary);else if(n.get(l)!==c.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return n}var uc=class extends De{constructor(t){let n=t.fields.map(i=>Dt({type:i.type})),r=Dt({type:new he(t.fields),nullCount:0,children:n});super(t,r)}};var zh;(function(e){e[e.BUFFER=0]="BUFFER"})(zh||(zh={}));var Vh;(function(e){e[e.LZ4_FRAME=0]="LZ4_FRAME",e[e.ZSTD=1]="ZSTD"})(Vh||(Vh={}));var s0=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsBodyCompression(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}codec(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):Vh.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):zh.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,n){t.addFieldInt8(0,n,Vh.LZ4_FRAME)}static addMethod(t,n){t.addFieldInt8(1,n,zh.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,n,r){return e.startBodyCompression(t),e.addCodec(t,n),e.addMethod(t,r),e.endBodyCompression(t)}};var Rl=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(t,n,r){return t.prep(8,16),t.writeInt64(BigInt(r??0)),t.writeInt64(BigInt(n??0)),t.offset()}};var $l=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(t,n,r){return t.prep(8,16),t.writeInt64(BigInt(r??0)),t.writeInt64(BigInt(n??0)),t.offset()}};var _r=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsRecordBatch(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}length(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,n){let r=this.bb.__offset(this.bb_pos,6);return r?(n||new $l).__init(this.bb.__vector(this.bb_pos+r)+t*16,this.bb):null}nodesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,n){let r=this.bb.__offset(this.bb_pos,8);return r?(n||new Rl).__init(this.bb.__vector(this.bb_pos+r)+t*16,this.bb):null}buffersLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){let n=this.bb.__offset(this.bb_pos,10);return n?(t||new s0).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}static startRecordBatch(t){t.startObject(4)}static addLength(t,n){t.addFieldInt64(0,n,BigInt("0"))}static addNodes(t,n){t.addFieldOffset(1,n,0)}static startNodesVector(t,n){t.startVector(16,n,8)}static addBuffers(t,n){t.addFieldOffset(2,n,0)}static startBuffersVector(t,n){t.startVector(16,n,8)}static addCompression(t,n){t.addFieldOffset(3,n,0)}static endRecordBatch(t){return t.endObject()}};var Jo=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDictionaryBatch(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new _r).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}isDelta(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startDictionaryBatch(t){t.startObject(3)}static addId(t,n){t.addFieldInt64(0,n,BigInt("0"))}static addData(t,n){t.addFieldOffset(1,n,0)}static addIsDelta(t,n){t.addFieldInt8(2,+n,0)}static endDictionaryBatch(t){return t.endObject()}};var Ul;(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"})(Ul||(Ul={}));var wi=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsMessage(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Xs.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):Ul.NONE}header(t){let n=this.bb.__offset(this.bb_pos,8);return n?this.bb.__union(t,this.bb_pos+n):null}bodyLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,n){let r=this.bb.__offset(this.bb_pos,12);return r?(n||new Qe).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,n){t.addFieldInt16(0,n,Xs.V1)}static addHeaderType(t,n){t.addFieldInt8(1,n,Ul.NONE)}static addHeader(t,n){t.addFieldOffset(2,n,0)}static addBodyLength(t,n){t.addFieldInt64(3,n,BigInt("0"))}static addCustomMetadata(t,n){t.addFieldOffset(4,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,n){t.finish(n)}static finishSizePrefixedMessageBuffer(t,n){t.finish(n,void 0,!0)}static createMessage(t,n,r,i,o,s){return e.startMessage(t),e.addVersion(t,n),e.addHeaderType(t,r),e.addHeader(t,i),e.addBodyLength(t,o),e.addCustomMetadata(t,s),e.endMessage(t)}};var m_=class extends lt{visit(t,n){return t==null||n==null?void 0:super.visit(t,n)}visitNull(t,n){return lh.startNull(n),lh.endNull(n)}visitInt(t,n){return gi.startInt(n),gi.addBitWidth(n,t.bitWidth),gi.addIsSigned(n,t.isSigned),gi.endInt(n)}visitFloat(t,n){return ta.startFloatingPoint(n),ta.addPrecision(n,t.precision),ta.endFloatingPoint(n)}visitBinary(t,n){return rh.startBinary(n),rh.endBinary(n)}visitBool(t,n){return ih.startBool(n),ih.endBool(n)}visitUtf8(t,n){return hh.startUtf8(n),hh.endUtf8(n)}visitDecimal(t,n){return ji.startDecimal(n),ji.addScale(n,t.scale),ji.addPrecision(n,t.precision),ji.addBitWidth(n,t.bitWidth),ji.endDecimal(n)}visitDate(t,n){return Zs.startDate(n),Zs.addUnit(n,t.unit),Zs.endDate(n)}visitTime(t,n){return qo.startTime(n),qo.addUnit(n,t.unit),qo.addBitWidth(n,t.bitWidth),qo.endTime(n)}visitTimestamp(t,n){let r=t.timezone&&n.createString(t.timezone)||void 0;return jo.startTimestamp(n),jo.addUnit(n,t.unit),r!==void 0&&jo.addTimezone(n,r),jo.endTimestamp(n)}visitInterval(t,n){return ea.startInterval(n),ea.addUnit(n,t.unit),ea.endInterval(n)}visitDuration(t,n){return Ks.startDuration(n),Ks.addUnit(n,t.unit),Ks.endDuration(n)}visitList(t,n){return ch.startList(n),ch.endList(n)}visitStruct(t,n){return uh.startStruct_(n),uh.endStruct_(n)}visitUnion(t,n){xi.startTypeIdsVector(n,t.typeIds.length);let r=xi.createTypeIdsVector(n,t.typeIds);return xi.startUnion(n),xi.addMode(n,t.mode),xi.addTypeIds(n,r),xi.endUnion(n)}visitDictionary(t,n){let r=this.visit(t.indices,n);return qi.startDictionaryEncoding(n),qi.addId(n,BigInt(t.id)),qi.addIsOrdered(n,t.isOrdered),r!==void 0&&qi.addIndexType(n,r),qi.endDictionaryEncoding(n)}visitFixedSizeBinary(t,n){return Qs.startFixedSizeBinary(n),Qs.addByteWidth(n,t.byteWidth),Qs.endFixedSizeBinary(n)}visitFixedSizeList(t,n){return Js.startFixedSizeList(n),Js.addListSize(n,t.listSize),Js.endFixedSizeList(n)}visitMap(t,n){return na.startMap(n),na.addKeysSorted(n,t.keysSorted),na.endMap(n)}},a0=new m_;function Y6(e,t=new Map){return new te(JC(e,t),c0(e.metadata),t)}function y_(e){return new yn(e.count,G6(e.columns),X6(e.columns))}function W6(e){return new ar(y_(e.data),e.id,e.isDelta)}function JC(e,t){return(e.fields||[]).filter(Boolean).map(n=>Rt.fromJSON(n,t))}function V6(e,t){return(e.children||[]).filter(Boolean).map(n=>Rt.fromJSON(n,t))}function G6(e){return(e||[]).reduce((t,n)=>[...t,new Vr(n.count,tk(n.VALIDITY)),...G6(n.children)],[])}function X6(e,t=[]){for(let n=-1,r=(e||[]).length;++n<r;){let i=e[n];i.VALIDITY&&t.push(new sr(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new sr(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new sr(t.length,i.OFFSET.length)),i.DATA&&t.push(new sr(t.length,i.DATA.length)),t=X6(i.children,t)}return t}function tk(e){return(e||[]).reduce((t,n)=>t+ +(n===0),0)}function H6(e,t){let n,r,i,o,s,a;return!t||!(o=e.dictionary)?(s=j6(e,V6(e,t)),i=new Rt(e.name,s,e.nullable,c0(e.metadata))):t.has(n=o.id)?(r=(r=o.indexType)?q6(r):new $i,a=new yr(t.get(n),r,n,o.isOrdered),i=new Rt(e.name,a,e.nullable,c0(e.metadata))):(r=(r=o.indexType)?q6(r):new $i,t.set(n,s=j6(e,V6(e,t))),a=new yr(s,r,n,o.isOrdered),i=new Rt(e.name,a,e.nullable,c0(e.metadata))),i||null}function c0(e=[]){return new Map(e.map(({key:t,value:n})=>[t,n]))}function q6(e){return new Ce(e.isSigned,e.bitWidth)}function j6(e,t){let n=e.type.name;switch(n){case"NONE":return new $n;case"null":return new $n;case"binary":return new Bo;case"utf8":return new Fo;case"bool":return new Lo;case"list":return new fi((t||[])[0]);case"struct":return new he(t||[]);case"struct_":return new he(t||[])}switch(n){case"int":{let r=e.type;return new Ce(r.isSigned,r.bitWidth)}case"floatingpoint":{let r=e.type;return new rr(we[r.precision])}case"decimal":{let r=e.type;return new Co(r.scale,r.precision,r.bitWidth)}case"date":{let r=e.type;return new ko(Tn[r.unit])}case"time":{let r=e.type;return new ui(pt[r.unit],r.bitWidth)}case"timestamp":{let r=e.type;return new Ro(pt[r.unit],r.timezone)}case"interval":{let r=e.type;return new $o(er[r.unit])}case"duration":{let r=e.type;return new Uo(pt[r.unit])}case"union":{let r=e.type,[i,...o]=(r.mode+"").toLowerCase(),s=i.toUpperCase()+o.join("");return new hi(me[s],r.typeIds||[],t||[])}case"fixedsizebinary":{let r=e.type;return new Po(r.byteWidth)}case"fixedsizelist":{let r=e.type;return new di(r.listSize,(t||[])[0])}case"map":{let r=e.type;return new pi((t||[])[0],r.keysSorted)}}throw new Error(`Unrecognized type: "${n}"`)}var ek=rc,nk=xr,cr=class e{static fromJSON(t,n){let r=new e(0,Ie.V5,n);return r._createHeader=rk(t,n),r}static decode(t){t=new nk(Et(t));let n=wi.getRootAsMessage(t),r=n.bodyLength(),i=n.version(),o=n.headerType(),s=new e(r,i,o);return s._createHeader=ik(n,o),s}static encode(t){let n=new ek,r=-1;return t.isSchema()?r=te.encode(n,t.header()):t.isRecordBatch()?r=yn.encode(n,t.header()):t.isDictionaryBatch()&&(r=ar.encode(n,t.header())),wi.startMessage(n),wi.addVersion(n,Ie.V5),wi.addHeader(n,r),wi.addHeaderType(n,t.headerType),wi.addBodyLength(n,BigInt(t.bodyLength)),wi.finishMessageBuffer(n,wi.endMessage(n)),n.asUint8Array()}static from(t,n=0){if(t instanceof te)return new e(0,Ie.V5,Xt.Schema,t);if(t instanceof yn)return new e(n,Ie.V5,Xt.RecordBatch,t);if(t instanceof ar)return new e(n,Ie.V5,Xt.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===Xt.Schema}isRecordBatch(){return this.headerType===Xt.RecordBatch}isDictionaryBatch(){return this.headerType===Xt.DictionaryBatch}constructor(t,n,r,i){this._version=n,this._headerType=r,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=nr(t)}},yn=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,n,r){this._nodes=n,this._buffers=r,this._length=nr(t)}},ar=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,n,r=!1){this._data=t,this._isDelta=r,this._id=nr(n)}},sr=class{constructor(t,n){this.offset=nr(t),this.length=nr(n)}},Vr=class{constructor(t,n){this.length=nr(t),this.nullCount=nr(n)}};function rk(e,t){return()=>{switch(t){case Xt.Schema:return te.fromJSON(e);case Xt.RecordBatch:return yn.fromJSON(e);case Xt.DictionaryBatch:return ar.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${Xt[t]}, type: ${t} }`)}}function ik(e,t){return()=>{switch(t){case Xt.Schema:return te.decode(e.header(new ir),new Map,e.version());case Xt.RecordBatch:return yn.decode(e.header(new _r),e.version());case Xt.DictionaryBatch:return ar.decode(e.header(new Jo),e.version())}throw new Error(`Unrecognized Message type: { name: ${Xt[t]}, type: ${t} }`)}}Rt.encode=mk;Rt.decode=dk;Rt.fromJSON=H6;te.encode=pk;te.decode=ok;te.fromJSON=Y6;yn.encode=yk;yn.decode=sk;yn.fromJSON=y_;ar.encode=gk;ar.decode=ak;ar.fromJSON=W6;Vr.encode=bk;Vr.decode=lk;sr.encode=xk;sr.decode=ck;function ok(e,t=new Map,n=Ie.V5){let r=hk(e,t);return new te(r,l0(e),t,n)}function sk(e,t=Ie.V5){if(e.compression()!==null)throw new Error("Record batch compression not implemented");return new yn(e.length(),uk(e),fk(e,t))}function ak(e,t=Ie.V5){return new ar(yn.decode(e.data(),t),e.id(),e.isDelta())}function ck(e){return new sr(e.offset(),e.length())}function lk(e){return new Vr(e.length(),e.nullCount())}function uk(e){let t=[];for(let n,r=-1,i=-1,o=e.nodesLength();++r<o;)(n=e.nodes(r))&&(t[++i]=Vr.decode(n));return t}function fk(e,t){let n=[];for(let r,i=-1,o=-1,s=e.buffersLength();++i<s;)(r=e.buffers(i))&&(t<Ie.V4&&(r.bb_pos+=8*(i+1)),n[++o]=sr.decode(r));return n}function hk(e,t){let n=[];for(let r,i=-1,o=-1,s=e.fieldsLength();++i<s;)(r=e.fields(i))&&(n[++o]=Rt.decode(r,t));return n}function Z6(e,t){let n=[];for(let r,i=-1,o=-1,s=e.childrenLength();++i<s;)(r=e.children(i))&&(n[++o]=Rt.decode(r,t));return n}function dk(e,t){let n,r,i,o,s,a;return!t||!(a=e.dictionary())?(i=Q6(e,Z6(e,t)),r=new Rt(e.name(),i,e.nullable(),l0(e))):t.has(n=nr(a.id()))?(o=(o=a.indexType())?K6(o):new $i,s=new yr(t.get(n),o,n,a.isOrdered()),r=new Rt(e.name(),s,e.nullable(),l0(e))):(o=(o=a.indexType())?K6(o):new $i,t.set(n,i=Q6(e,Z6(e,t))),s=new yr(i,o,n,a.isOrdered()),r=new Rt(e.name(),s,e.nullable(),l0(e))),r||null}function l0(e){let t=new Map;if(e)for(let n,r,i=-1,o=Math.trunc(e.customMetadataLength());++i<o;)(n=e.customMetadata(i))&&(r=n.key())!=null&&t.set(r,n.value());return t}function K6(e){return new Ce(e.isSigned(),e.bitWidth())}function Q6(e,t){let n=e.typeType();switch(n){case de.NONE:return new $n;case de.Null:return new $n;case de.Binary:return new Bo;case de.Utf8:return new Fo;case de.Bool:return new Lo;case de.List:return new fi((t||[])[0]);case de.Struct_:return new he(t||[])}switch(n){case de.Int:{let r=e.type(new gi);return new Ce(r.isSigned(),r.bitWidth())}case de.FloatingPoint:{let r=e.type(new ta);return new rr(r.precision())}case de.Decimal:{let r=e.type(new ji);return new Co(r.scale(),r.precision(),r.bitWidth())}case de.Date:{let r=e.type(new Zs);return new ko(r.unit())}case de.Time:{let r=e.type(new qo);return new ui(r.unit(),r.bitWidth())}case de.Timestamp:{let r=e.type(new jo);return new Ro(r.unit(),r.timezone())}case de.Interval:{let r=e.type(new ea);return new $o(r.unit())}case de.Duration:{let r=e.type(new Ks);return new Uo(r.unit())}case de.Union:{let r=e.type(new xi);return new hi(r.mode(),r.typeIdsArray()||[],t||[])}case de.FixedSizeBinary:{let r=e.type(new Qs);return new Po(r.byteWidth())}case de.FixedSizeList:{let r=e.type(new Js);return new di(r.listSize(),(t||[])[0])}case de.Map:{let r=e.type(new na);return new pi((t||[])[0],r.keysSorted())}}throw new Error(`Unrecognized type: "${de[n]}" (${n})`)}function pk(e,t){let n=t.fields.map(o=>Rt.encode(e,o));ir.startFieldsVector(e,n.length);let r=ir.createFieldsVector(e,n),i=t.metadata&&t.metadata.size>0?ir.createCustomMetadataVector(e,[...t.metadata].map(([o,s])=>{let a=e.createString(`${o}`),c=e.createString(`${s}`);return Qe.startKeyValue(e),Qe.addKey(e,a),Qe.addValue(e,c),Qe.endKeyValue(e)})):-1;return ir.startSchema(e),ir.addFields(e,r),ir.addEndianness(e,wk?Hs.Little:Hs.Big),i!==-1&&ir.addCustomMetadata(e,i),ir.endSchema(e)}function mk(e,t){let n=-1,r=-1,i=-1,o=t.type,s=t.typeId;st.isDictionary(o)?(s=o.dictionary.typeId,i=a0.visit(o,e),r=a0.visit(o.dictionary,e)):r=a0.visit(o,e);let a=(o.children||[]).map(u=>Rt.encode(e,u)),c=An.createChildrenVector(e,a),l=t.metadata&&t.metadata.size>0?An.createCustomMetadataVector(e,[...t.metadata].map(([u,f])=>{let h=e.createString(`${u}`),d=e.createString(`${f}`);return Qe.startKeyValue(e),Qe.addKey(e,h),Qe.addValue(e,d),Qe.endKeyValue(e)})):-1;return t.name&&(n=e.createString(t.name)),An.startField(e),An.addType(e,r),An.addTypeType(e,s),An.addChildren(e,c),An.addNullable(e,!!t.nullable),n!==-1&&An.addName(e,n),i!==-1&&An.addDictionary(e,i),l!==-1&&An.addCustomMetadata(e,l),An.endField(e)}function yk(e,t){let n=t.nodes||[],r=t.buffers||[];_r.startNodesVector(e,n.length);for(let s of n.slice().reverse())Vr.encode(e,s);let i=e.endVector();_r.startBuffersVector(e,r.length);for(let s of r.slice().reverse())sr.encode(e,s);let o=e.endVector();return _r.startRecordBatch(e),_r.addLength(e,BigInt(t.length)),_r.addNodes(e,i),_r.addBuffers(e,o),_r.endRecordBatch(e)}function gk(e,t){let n=yn.encode(e,t.data);return Jo.startDictionaryBatch(e),Jo.addId(e,BigInt(t.id)),Jo.addIsDelta(e,t.isDelta),Jo.addData(e,n),Jo.endDictionaryBatch(e)}function bk(e,t){return $l.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function xk(e,t){return Rl.createBuffer(e,BigInt(t.offset),BigInt(t.length))}var wk=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})();var b_=e=>`Expected ${Xt[e]} Message in stream, but was null or length 0.`,x_=e=>`Header pointer of flatbuffer-encoded ${Xt[e]} Message is null or length 0.`,J6=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,tT=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,Pl=class{constructor(t){this.source=t instanceof Wi?t:new Wi(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?pe:t.value===-1&&(t=this.readMetadataLength()).done?pe:(t=this.readMetadata(t.value)).done?pe:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let n;if((n=this.next()).done)return null;if(t!=null&&n.value.headerType!==t)throw new Error(b_(t));return n.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let n=Et(this.source.read(t));if(n.byteLength<t)throw new Error(tT(t,n.byteLength));return n.byteOffset%8===0&&n.byteOffset+n.byteLength<=n.buffer.byteLength?n:n.slice()}readSchema(t=!1){let n=Xt.Schema,r=this.readMessage(n),i=r?.header();if(t&&!i)throw new Error(x_(n));return i}readMetadataLength(){let t=this.source.read(u0),n=t&&new xr(t),r=n?.readInt32(0)||0;return{done:r===0,value:r}}readMetadata(t){let n=this.source.read(t);if(!n)return pe;if(n.byteLength<t)throw new Error(J6(t,n.byteLength));return{done:!1,value:cr.decode(n)}}},qh=class{constructor(t,n){this.source=t instanceof Pr?t:jm(t)?new ra(t,n):new Pr(t)}[Symbol.asyncIterator](){return this}next(){return H(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?pe:t.value===-1&&(t=yield this.readMetadataLength()).done?pe:(t=yield this.readMetadata(t.value)).done?pe:t})}throw(t){return H(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return H(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return H(this,void 0,void 0,function*(){let n;if((n=yield this.next()).done)return null;if(t!=null&&n.value.headerType!==t)throw new Error(b_(t));return n.value})}readMessageBody(t){return H(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let n=Et(yield this.source.read(t));if(n.byteLength<t)throw new Error(tT(t,n.byteLength));return n.byteOffset%8===0&&n.byteOffset+n.byteLength<=n.buffer.byteLength?n:n.slice()})}readSchema(t=!1){return H(this,void 0,void 0,function*(){let n=Xt.Schema,r=yield this.readMessage(n),i=r?.header();if(t&&!i)throw new Error(x_(n));return i})}readMetadataLength(){return H(this,void 0,void 0,function*(){let t=yield this.source.read(u0),n=t&&new xr(t),r=n?.readInt32(0)||0;return{done:r===0,value:r}})}readMetadata(t){return H(this,void 0,void 0,function*(){let n=yield this.source.read(t);if(!n)return pe;if(n.byteLength<t)throw new Error(J6(t,n.byteLength));return{done:!1,value:cr.decode(n)}})}},jh=class extends Pl{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof dh?t:new dh(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:cr.fromJSON(t.schema,Xt.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let n=t.dictionaries[this._dictionaryIndex++];return this._body=n.data.columns,{done:!1,value:cr.fromJSON(n,Xt.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let n=t.batches[this._batchIndex++];return this._body=n.columns,{done:!1,value:cr.fromJSON(n,Xt.RecordBatch)}}return this._body=[],pe}readMessageBody(t){return n(this._body);function n(r){return(r||[]).reduce((i,o)=>[...i,...o.VALIDITY&&[o.VALIDITY]||[],...o.TYPE_ID&&[o.TYPE_ID]||[],...o.OFFSET&&[o.OFFSET]||[],...o.DATA&&[o.DATA]||[],...n(o.children)],[])}}readMessage(t){let n;if((n=this.next()).done)return null;if(t!=null&&n.value.headerType!==t)throw new Error(b_(t));return n.value}readSchema(){let t=Xt.Schema,n=this.readMessage(t),r=n?.header();if(!n||!r)throw new Error(x_(t));return r}},u0=4,g_="ARROW1",zl=new Uint8Array(g_.length);for(let e=0;e<g_.length;e+=1)zl[e]=g_.codePointAt(e);function f0(e,t=0){for(let n=-1,r=zl.length;++n<r;)if(zl[n]!==e[t+n])return!1;return!0}var Vl=zl.length,w_=Vl+u0,eT=Vl*2+u0;var vr=class e extends ic{constructor(t){super(),this._impl=t}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(t){return this._impl.throw(t)}return(t){return this._impl.return(t)}cancel(){return this._impl.cancel()}reset(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}open(t){let n=this._impl.open(t);return pr(n)?n.then(()=>this):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return pn.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return pn.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,n){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof e?t:Vm(t)?vk(t):jm(t)?Mk(t):pr(t)?H(this,void 0,void 0,function*(){return yield e.from(yield t)}):Ym(t)||Gf(t)||Gm(t)||Rr(t)?Ik(new Pr(t)):Sk(new Wi(t))}static readAll(t){return t instanceof e?t.isSync()?nT(t):rT(t):Vm(t)||ArrayBuffer.isView(t)||oi(t)||qm(t)?nT(t):rT(t)}},ts=class extends vr{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return dr(this,arguments,function*(){yield Ft(yield*wl(ii(this[Symbol.iterator]())))})}},fc=class extends vr{constructor(t){super(t),this._impl=t}readAll(){var t,n,r,i;return H(this,void 0,void 0,function*(){let o=new Array;try{for(var s=!0,a=ii(this),c;c=yield a.next(),t=c.done,!t;s=!0){i=c.value,s=!1;let l=i;o.push(l)}}catch(l){n={error:l}}finally{try{!s&&!t&&(r=a.return)&&(yield r.call(a))}finally{if(n)throw n.error}}return o})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},hc=class extends ts{constructor(t){super(t),this._impl=t}},h0=class extends fc{constructor(t){super(t),this._impl=t}},d0=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,n){let r=this._loadVectors(t,n,this.schema.fields),i=Dt({type:new he(this.schema.fields),length:t.length,children:r});return new De(this.schema,i)}_loadDictionaryBatch(t,n){let{id:r,isDelta:i}=t,{dictionaries:o,schema:s}=this,a=o.get(r);if(i||!a){let c=s.dictionaries.get(r),l=this._loadVectors(t.data,n,[c]);return(a&&i?a.concat(new zt(l)):new zt(l)).memoize()}return a.memoize()}_loadVectors(t,n,r){return new gh(n,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(r)}},ql=class extends d0{constructor(t,n){super(n),this._reader=Vm(t)?new jh(this._handle=t):new Pl(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=iT(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):pe}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):pe}next(){if(this.closed)return pe;let t,{_reader:n}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let r=t.header(),i=n.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(r,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let r=t.header(),i=n.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(r,i);this.dictionaries.set(r.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new uc(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},jl=class extends d0{constructor(t,n){super(n),this._reader=new qh(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return H(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 H(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=iT(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return H(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):pe})}return(t){return H(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):pe})}next(){return H(this,void 0,void 0,function*(){if(this.closed)return pe;let t,{_reader:n}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let r=t.header(),i=yield n.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(r,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let r=t.header(),i=yield n.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(r,i);this.dictionaries.set(r.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new uc(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return H(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},p0=class extends ql{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,n){super(t instanceof ph?t:new ph(t),n)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let n of this._footer.dictionaryBatches())n&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var n;if(this.closed)return null;this._footer||this.open();let r=(n=this._footer)===null||n===void 0?void 0:n.getRecordBatch(t);if(r&&this._handle.seek(r.offset)){let i=this._reader.readMessage(Xt.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s)}}return null}_readDictionaryBatch(t){var n;let r=(n=this._footer)===null||n===void 0?void 0:n.getDictionaryBatch(t);if(r&&this._handle.seek(r.offset)){let i=this._reader.readMessage(Xt.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}}_readFooter(){let{_handle:t}=this,n=t.size-w_,r=t.readInt32(n),i=t.readAt(n-r,r);return Yo.decode(i)}_readNextMessageAndValidate(t){var n;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let r=(n=this._footer)===null||n===void 0?void 0:n.getRecordBatch(this._recordBatchIndex);if(r&&this._handle.seek(r.offset))return this._reader.readMessage(t)}return null}},__=class extends jl{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,...n){let r=typeof n[0]!="number"?n.shift():void 0,i=n[0]instanceof Map?n.shift():void 0;super(t instanceof ra?t:new ra(t,r),i)}isFile(){return!0}isAsync(){return!0}open(t){let n=Object.create(null,{open:{get:()=>super.open}});return H(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let r of this._footer.dictionaryBatches())r&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield n.open.call(this,t)})}readRecordBatch(t){var n;return H(this,void 0,void 0,function*(){if(this.closed)return null;this._footer||(yield this.open());let r=(n=this._footer)===null||n===void 0?void 0:n.getRecordBatch(t);if(r&&(yield this._handle.seek(r.offset))){let i=yield this._reader.readMessage(Xt.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s)}}return null})}_readDictionaryBatch(t){var n;return H(this,void 0,void 0,function*(){let r=(n=this._footer)===null||n===void 0?void 0:n.getDictionaryBatch(t);if(r&&(yield this._handle.seek(r.offset))){let i=yield this._reader.readMessage(Xt.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 H(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let n=t.size-w_,r=yield t.readInt32(n),i=yield t.readAt(n-r,r);return Yo.decode(i)})}_readNextMessageAndValidate(t){return H(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let n=this._footer.getRecordBatch(this._recordBatchIndex);if(n&&(yield this._handle.seek(n.offset)))return yield this._reader.readMessage(t)}return null})}},v_=class extends ql{constructor(t,n){super(t,n)}_loadVectors(t,n,r){return new Ry(n,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(r)}};function iT(e,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:e.autoDestroy}function*nT(e){let t=vr.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function rT(e){return dr(this,arguments,function*(){let n=yield Ft(vr.from(e));try{if(!(yield Ft(n.open({autoDestroy:!1}))).closed)do yield yield Ft(n);while(!(yield Ft(n.reset().open())).closed)}finally{yield Ft(n.cancel())}})}function vk(e){return new ts(new v_(e))}function Sk(e){let t=e.peek(Vl+7&-8);return t&&t.byteLength>=4?f0(t)?new hc(new p0(e.read())):new ts(new ql(e)):new ts(new ql(function*(){}()))}function Ik(e){return H(this,void 0,void 0,function*(){let t=yield e.peek(Vl+7&-8);return t&&t.byteLength>=4?f0(t)?new hc(new p0(yield e.read())):new fc(new jl(e)):new fc(new jl(function(){return dr(this,arguments,function*(){})}()))})}function Mk(e){return H(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),n=new ra(e,t);return t>=eT&&f0(yield n.readAt(0,Vl+7&-8))?new h0(new __(n)):new fc(new jl(n))})}var Ne=class e extends lt{static assemble(...t){let n=i=>i.flatMap(o=>Array.isArray(o)?n(o):o instanceof De?o.data.children:o.data),r=new e;return r.visitMany(n(t)),r}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof zt)return this.visitMany(t.data),this;let{type:n}=t;if(!st.isDictionary(n)){let{length:r}=t;if(r>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(st.isUnion(n))this.nodes.push(new Vr(r,0));else{let{nullCount:i}=t;st.isNull(n)||_i.call(this,i<=0?new Uint8Array(0):Ja(t.offset,r,t.nullBitmap)),this.nodes.push(new Vr(r,i))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}};function _i(e){let t=e.byteLength+7&-8;return this.buffers.push(e),this.bufferRegions.push(new sr(this._byteLength,t)),this._byteLength+=t,this}function Tk(e){var t;let{type:n,length:r,typeIds:i,valueOffsets:o}=e;if(_i.call(this,i),n.mode===me.Sparse)return S_.call(this,e);if(n.mode===me.Dense){if(e.offset<=0)return _i.call(this,o),S_.call(this,e);{let s=new Int32Array(r),a=Object.create(null),c=Object.create(null);for(let l,u,f=-1;++f<r;)(l=i[f])!==void 0&&((u=a[l])===void 0&&(u=a[l]=o[f]),s[f]=o[f]-u,c[l]=((t=c[l])!==null&&t!==void 0?t:0)+1);_i.call(this,s),this.visitMany(e.children.map((l,u)=>{let f=n.typeIds[u],h=a[f],d=c[f];return l.slice(h,Math.min(r,d))}))}}return this}function Ak(e){let t;return e.nullCount>=e.length?_i.call(this,new Uint8Array(0)):(t=e.values)instanceof Uint8Array?_i.call(this,Ja(e.offset,e.length,t)):_i.call(this,tc(e.values))}function es(e){return _i.call(this,e.values.subarray(0,e.length*e.stride))}function oT(e){let{length:t,values:n,valueOffsets:r}=e,{[0]:i,[t]:o}=r,s=Math.min(o-i,n.byteLength-i);return _i.call(this,Xm(-i,t+1,r)),_i.call(this,n.subarray(i,i+s)),this}function I_(e){let{length:t,valueOffsets:n}=e;if(n){let{[0]:r,[t]:i}=n;return _i.call(this,Xm(-r,t+1,n)),this.visit(e.children[0].slice(r,i-r))}return this.visit(e.children[0])}function S_(e){return this.visitMany(e.type.children.map((t,n)=>e.children[n]).filter(Boolean))[0]}Ne.prototype.visitBool=Ak;Ne.prototype.visitInt=es;Ne.prototype.visitFloat=es;Ne.prototype.visitUtf8=oT;Ne.prototype.visitBinary=oT;Ne.prototype.visitFixedSizeBinary=es;Ne.prototype.visitDate=es;Ne.prototype.visitTimestamp=es;Ne.prototype.visitTime=es;Ne.prototype.visitDecimal=es;Ne.prototype.visitList=I_;Ne.prototype.visitStruct=S_;Ne.prototype.visitUnion=Tk;Ne.prototype.visitInterval=es;Ne.prototype.visitDuration=es;Ne.prototype.visitFixedSizeList=I_;Ne.prototype.visitMap=I_;var dc=class extends ic{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,n){throw new Error('"throughDOM" not available in this environment')}constructor(t){super(),this._position=0,this._started=!1,this._sink=new Yi,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,Rn(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 pr(t)?t.then(n=>this.writeAll(n)):Rr(t)?T_(this,t):M_(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,n=null){return t===this._sink||t instanceof Yi?this._sink=t:(this._sink=new Yi,t&&I3(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&M3(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,(!n||!lc(n,this._schema))&&(n==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=n,this._writeSchema(n))),this}write(t){let n=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof or&&!(n=t.schema))return this.finish()&&void 0;if(t instanceof De&&!(n=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(n&&!lc(n,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,n)}t instanceof De?t instanceof uc||this._writeRecordBatch(t):t instanceof or?this.writeAll(t.batches):oi(t)&&this.writeAll(t)}_writeMessage(t,n=8){let r=n-1,i=cr.encode(t),o=i.byteLength,s=this._writeLegacyIpcFormat?4:8,a=o+s+r&~r,c=a-o-s;return t.headerType===Xt.RecordBatch?this._recordBatchBlocks.push(new Wo(a,t.bodyLength,this._position)):t.headerType===Xt.DictionaryBatch&&this._dictionaryBlocks.push(new Wo(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-s)),o>0&&this._write(i),this._writePadding(c)}_write(t){if(this._started){let n=Et(t);n&&n.byteLength>0&&(this._sink.write(n),this._position+=n.byteLength)}return this}_writeSchema(t){return this._writeMessage(cr.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(zl)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:n,nodes:r,bufferRegions:i,buffers:o}=Ne.assemble(t),s=new yn(t.numRows,r,i),a=cr.from(s,n);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(o)}_writeDictionaryBatch(t,n,r=!1){this._dictionaryDeltaOffsets.set(n,t.length+(this._dictionaryDeltaOffsets.get(n)||0));let{byteLength:i,nodes:o,bufferRegions:s,buffers:a}=Ne.assemble(new zt([t])),c=new yn(t.length,o,s),l=new ar(c,n,r),u=cr.from(l,i);return this._writeMessage(u)._writeBodyBuffers(a)}_writeBodyBuffers(t){let n,r,i;for(let o=-1,s=t.length;++o<s;)(n=t[o])&&(r=n.byteLength)>0&&(this._write(n),(i=(r+7&-8)-r)>0&&this._writePadding(i));return this}_writeDictionaries(t){for(let[n,r]of t.dictionaries){let i=this._dictionaryDeltaOffsets.get(n)||0;if(i===0||(r=r?.slice(i)).length>0)for(let o of r.data)this._writeDictionaryBatch(o,n,i>0),i+=o.length}return this}},Yh=class e extends dc{static writeAll(t,n){let r=new e(n);return pr(t)?t.then(i=>r.writeAll(i)):Rr(t)?T_(r,t):M_(r,t)}},Wh=class e extends dc{static writeAll(t){let n=new e;return pr(t)?t.then(r=>n.writeAll(r)):Rr(t)?T_(n,t):M_(n,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){let n=Yo.encode(new Yo(t,Ie.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(n)._write(Int32Array.of(n.byteLength))._writeMagic()}};function M_(e,t){let n=t;t instanceof or&&(n=t.batches,e.reset(void 0,t.schema));for(let r of n)e.write(r);return e.finish()}function T_(e,t){var n,r,i,o,s,a,c;return H(this,void 0,void 0,function*(){try{for(n=!0,r=ii(t);i=yield r.next(),o=i.done,!o;n=!0){c=i.value,n=!1;let l=c;e.write(l)}}catch(l){s={error:l}}finally{try{!n&&!o&&(a=r.return)&&(yield a.call(r))}finally{if(s)throw s.error}}return e.finish()})}function sT(e,t){if(Rr(e))return Dk(e,t);if(oi(e))return Ek(e,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function Ek(e,t){let n=null,r=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){o(s,n||(n=e[Symbol.iterator]()))},pull(s){n?o(s,n):s.close()},cancel(){(n?.return&&n.return()||!0)&&(n=null)}}),Object.assign({highWaterMark:r?i:void 0},t));function o(s,a){let c,l=null,u=s.desiredSize||null;for(;!(l=a.next(r?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=Et(l.value))&&(u!=null&&r&&(u=u-c.byteLength+1),l.value=c),s.enqueue(l.value),u!=null&&--u<=0)return;s.close()}}function Dk(e,t){let n=null,r=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){return H(this,void 0,void 0,function*(){yield o(s,n||(n=e[Symbol.asyncIterator]()))})},pull(s){return H(this,void 0,void 0,function*(){n?yield o(s,n):s.close()})},cancel(){return H(this,void 0,void 0,function*(){(n?.return&&(yield n.return())||!0)&&(n=null)})}}),Object.assign({highWaterMark:r?i:void 0},t));function o(s,a){return H(this,void 0,void 0,function*(){let c,l=null,u=s.desiredSize||null;for(;!(l=yield a.next(r?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=Et(l.value))&&(u!=null&&r&&(u=u-c.byteLength+1),l.value=c),s.enqueue(l.value),u!=null&&--u<=0)return;s.close()})}}function lT(e){return new A_(e)}var A_=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:n,["writableStrategy"]:r,["queueingStrategy"]:i="count"}=t,o=v3(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=sc(o),this._getSize=i!=="bytes"?aT:cT;let{["highWaterMark"]:s=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},n),{["highWaterMark"]:a=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},r);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:c=>{this._maybeFlush(this._builder,this._controller=c)},start:c=>{this._maybeFlush(this._builder,this._controller=c)}},{highWaterMark:s,size:i!=="bytes"?aT:cT}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:a,size:c=>this._writeValueAndReturnChunkSize(c)})}_writeValueAndReturnChunkSize(t){let n=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-n}_maybeFlush(t,n){n!=null&&(this._bufferedSize>=n.desiredSize&&++this._numChunks&&this._enqueue(n,t.toVector()),t.finished&&((t.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(n,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(n,null)))}_enqueue(t,n){this._bufferedSize=0,this._controller=null,n==null?t.close():t.enqueue(n)}},aT=e=>{var t;return(t=e?.length)!==null&&t!==void 0?t:0},cT=e=>{var t;return(t=e?.byteLength)!==null&&t!==void 0?t:0};function m0(e,t){let n=new Yi,r=null,i=new ReadableStream({cancel(){return H(this,void 0,void 0,function*(){yield n.close()})},start(a){return H(this,void 0,void 0,function*(){yield s(a,r||(r=yield o()))})},pull(a){return H(this,void 0,void 0,function*(){r?yield s(a,r):a.close()})}});return{writable:new WritableStream(n,Object.assign({highWaterMark:Math.pow(2,14)},e)),readable:i};function o(){return H(this,void 0,void 0,function*(){return yield(yield vr.from(n)).open(t)})}function s(a,c){return H(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 y0(e,t){let n=new this(e),r=new Pr(n),i=new ReadableStream({cancel(){return H(this,void 0,void 0,function*(){yield r.cancel()})},pull(s){return H(this,void 0,void 0,function*(){yield o(s)})},start(s){return H(this,void 0,void 0,function*(){yield o(s)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(n,e),readable:i};function o(s){return H(this,void 0,void 0,function*(){let a=null,c=s.desiredSize;for(;a=yield r.read(c||null);)if(s.enqueue(a),c!=null&&(c-=a.byteLength)<=0)return;s.close()})}}function Gh(e){let t=vr.from(e);return pr(t)?t.then(n=>Gh(n)):t.isAsync()?t.readAll().then(n=>new or(n)):new or(t.readAll())}var Ok=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},$w),u_),e_),Uw),Fw),t_),kw),{compareSchemas:lc,compareFields:k6,compareTypes:R6});pn.toDOMStream=sT;ye.throughDOM=lT;vr.throughDOM=m0;hc.throughDOM=m0;ts.throughDOM=m0;dc.throughDOM=y0;Wh.throughDOM=y0;Yh.throughDOM=y0;function E_(e="ws://localhost:3000/"){let t=[],n=!1,r=null,i,o={open(){n=!0,c()},close(){for(n=!1,r=null,i=null;t.length;)t.shift().reject("Socket closed")},error(l){if(r){let{reject:u}=r;r=null,c(),u(l)}else console.error("WebSocket error: ",l)},message({data:l}){if(r){let{query:u,resolve:f,reject:h}=r;if(r=null,c(),typeof l=="string"){let d=JSON.parse(l);d.error?h(d.error):f(d)}else if(u.type==="exec")f();else if(u.type==="arrow")f(Gh(l.arrayBuffer()));else throw new Error(`Unexpected socket data: ${l}`)}else console.log("WebSocket message: ",l)}};function s(){i=new WebSocket(e);for(let l in o)i.addEventListener(l,o[l])}function a(l,u,f){i==null&&s(),t.push({query:l,resolve:u,reject:f}),n&&!r&&c()}function c(){t.length&&(r=t.shift(),i.send(JSON.stringify(r.query)))}return{get connected(){return n},query(l){return new Promise((u,f)=>a(l,u,f))}}}var lr=class{constructor(t,n){t&&(this.table=String(t)),n&&(this.column=n)}get columns(){return this.column?[this.column]:[]}toString(){let{table:t,column:n}=this;if(n){let r=n.startsWith("*")?n:`"${n}"`;return`${t?`${uT(t)}.`:""}${r}`}else return t?uT(t):"NULL"}};function uT(e){return e.split(".").map(n=>`"${n}"`).join(".")}function fT(e,t){return e instanceof lr&&e.column===t}function Ht(e){return typeof e=="string"?g0(e):e}function pc(e){return typeof e=="string"?hT(e):e}function hT(e){return new lr(e)}function g0(e,t){return arguments.length===1&&(t=e,e=null),new lr(e,t)}function ns(e){switch(typeof e){case"boolean":return e?"TRUE":"FALSE";case"string":return`'${e}'`;case"number":return Number.isFinite(e)?String(e):"NULL";default:if(e==null)return"NULL";if(e instanceof Date){let t=+e;if(Number.isNaN(t))return"NULL";let n=e.getUTCFullYear(),r=e.getUTCMonth(),i=e.getUTCDate();return t===Date.UTC(n,r,i)?`MAKE_DATE(${n}, ${r+1}, ${i})`:`EPOCH_MS(${t})`}else return e instanceof RegExp?`'${e.source}'`:String(e)}}var rs=e=>typeof e?.addEventListener=="function";function b0(e){return e instanceof ia}var ia=class{constructor(t,n,r){this._expr=Array.isArray(t)?t:[t],this._deps=n||[],this.annotate(r);let i=this._expr.filter(o=>rs(o));i.length>0?(this._params=Array.from(new Set(i)),this._params.forEach(o=>{o.addEventListener("value",()=>Bk(this,this.map?.get("value")))})):this.addEventListener=void 0}get value(){return this}get columns(){let{_params:t,_deps:n}=this;if(t){let r=new Set(t.flatMap(i=>{let o=i.value?.columns;return Array.isArray(o)?o:[]}));if(r.size){let i=new Set(n);return r.forEach(o=>i.add(o)),Array.from(i)}}return n}get column(){return this._deps.length?this._deps[0]:this.columns[0]}annotate(...t){return Object.assign(this,...t)}toString(){return this._expr.map(t=>rs(t)&&!b0(t)?ns(t.value):t).join("")}addEventListener(t,n){let r=this.map||(this.map=new Map);(r.get(t)||(r.set(t,new Set),r.get(t))).add(n)}};function Bk(e,t){if(t?.size)return Promise.allSettled(Array.from(t,n=>n(e)))}function D_(e,t){let n=[e[0]],r=new Set,i=t.length;for(let o=0,s=0;o<i;){let a=t[o];rs(a)?n[++s]=a:(Array.isArray(a?.columns)&&a.columns.forEach(l=>r.add(l)),n[s]+=typeof a=="string"?a:ns(a));let c=e[++o];rs(n[s])?n[++s]=c:n[s]+=c}return{spans:n,cols:Array.from(r)}}function q(e,...t){let{spans:n,cols:r}=D_(e,t);return new ia(n,r)}var Xh=e=>({value:e,toString:()=>ns(e)});function Hh(e){e(this.op,this),this.children?.forEach(t=>t.visit(e))}function dT(e,t){let n=t.filter(i=>i!=null).map(Ht),r=n.map((i,o)=>o?` ${e} `:"");return n.length===1?r.push(""):n.length>1&&(r[0]="(",r.push(")")),q(r,...n).annotate({op:e,children:n,visit:Hh})}var Sr=(...e)=>dT("AND",e.flat()),Zh=(...e)=>dT("OR",e.flat()),Fk=e=>t=>q`(${e} ${Ht(t)})`.annotate({op:e,a:t,visit:Hh}),Lk=Fk("NOT"),pT=e=>t=>q`(${Ht(t)} ${e})`.annotate({op:e,a:t,visit:Hh}),Kh=pT("IS NULL"),mc=pT("IS NOT NULL"),oa=e=>(t,n)=>q`(${Ht(t)} ${e} ${Ht(n)})`.annotate({op:e,a:t,b:n,visit:Hh}),N_=oa("="),O_=oa("<>"),yc=oa("<"),Qh=oa(">"),gc=oa("<="),Ck=oa(">="),kk=oa("IS DISTINCT FROM"),B_=oa("IS NOT DISTINCT FROM");function Rk(e,t,n,r){t=Ht(t);let i=e.startsWith("NOT ")?"NOT ":"";return(n?r?q`${i}(${n[0]} <= ${t} AND ${t} < ${n[1]})`:q`(${t} ${e} ${n[0]} AND ${n[1]})`:q``).annotate({op:e,visit:Hh,field:t,range:n})}var Oe=(e,t,n)=>Rk("BETWEEN",e,t,n);function bc(e,t){return Array.from({length:e},()=>t)}function gn(e,t){return(...n)=>{let r=n.map(Ht),i=t?`::${t}`:"";return(r.length?q([`${e}(`,...bc(r.length-1,", "),`)${i}`],...r):q`${e}()${i}`).annotate({func:e,args:r})}}var $k=gn("REGEXP_MATCHES"),Uk=gn("CONTAINS"),Pk=gn("PREFIX"),zk=gn("SUFFIX"),Vk=gn("LOWER"),qk=gn("UPPER"),jk=gn("LENGTH"),Yk=gn("ISNAN"),Wk=gn("ISFINITE"),Gk=gn("ISINF");var Jh=class e extends ia{constructor(t,n,r,i,o="",s="",a=""){let c;if(i&&!(o||s||a))c=i?q`${n} OVER "${i}"`:q`${n} OVER ()`;else{let h=o&&s?" ":"",d=(o||s)&&a?" ":"";c=q`${n} OVER (${i?`"${i}" `:""}${o}${h}${s}${d}${a})`}r&&(c=q`(${c})::${r}`);let{_expr:u,_deps:f}=c;super(u,f,{window:t,func:n,type:r,name:i,group:o,order:s,frame:a})}get basis(){return this.column}get label(){let{func:t}=this;return t.label??t.toString()}over(t){let{window:n,func:r,type:i,group:o,order:s,frame:a}=this;return new e(n,r,i,t,o,s,a)}partitionby(...t){let n=t.flat().filter(u=>u).map(Ht),r=q(["PARTITION BY ",bc(n.length-1,", "),""],...n),{window:i,func:o,type:s,name:a,order:c,frame:l}=this;return new e(i,o,s,a,r,c,l)}orderby(...t){let n=t.flat().filter(u=>u).map(Ht),r=q(["ORDER BY ",bc(n.length-1,", "),""],...n),{window:i,func:o,type:s,name:a,group:c,frame:l}=this;return new e(i,o,s,a,c,r,l)}rows(t){let n=mT("ROWS",t),{window:r,func:i,type:o,name:s,group:a,order:c}=this;return new e(r,i,o,s,a,c,n)}range(t){let n=mT("RANGE",t),{window:r,func:i,type:o,name:s,group:a,order:c}=this;return new e(r,i,o,s,a,c,n)}};function mT(e,t){if(rs(t)){let n=q`${t}`;return n.toString=()=>`${e} ${yT(t.value)}`,n}return`${e} ${yT(t)}`}function yT(e){let[t,n]=e,r=t===0?"CURRENT ROW":Number.isFinite(t)?`${Math.abs(t)} PRECEDING`:"UNBOUNDED PRECEDING",i=n===0?"CURRENT ROW":Number.isFinite(n)?`${Math.abs(n)} FOLLOWING`:"UNBOUNDED FOLLOWING";return`BETWEEN ${r} AND ${i}`}function vi(e,t){return(...n)=>{let r=gn(e)(...n);return new Jh(e,r,t)}}var Xk=vi("ROW_NUMBER","INTEGER"),Hk=vi("RANK","INTEGER"),Zk=vi("DENSE_RANK","INTEGER"),Kk=vi("PERCENT_RANK"),Qk=vi("CUME_DIST"),Jk=vi("NTILE"),t7=vi("LAG"),e7=vi("LEAD"),n7=vi("FIRST_VALUE"),r7=vi("LAST_VALUE"),i7=vi("NTH_VALUE");var F_=class e extends ia{constructor(t,n,r,i,o){n=(n||[]).map(Ht);let{strings:s,exprs:a}=o7(t,n,r,i,o),{spans:c,cols:l}=D_(s,a);super(c,l,{aggregate:t,args:n,type:r,isDistinct:i,filter:o})}get basis(){return this.column}get label(){let{aggregate:t,args:n,isDistinct:r}=this,i=r?"DISTINCT"+(n.length?" ":""):"",o=n.length?`(${i}${n.map(s7).join(", ")})`:"";return`${t.toLowerCase()}${o}`}distinct(){let{aggregate:t,args:n,type:r,filter:i}=this;return new e(t,n,r,!0,i)}where(t){let{aggregate:n,args:r,type:i,isDistinct:o}=this;return new e(n,r,i,o,t)}window(){let{aggregate:t,args:n,type:r,isDistinct:i}=this,o=new e(t,n,null,i);return new Jh(t,o,r)}partitionby(...t){return this.window().partitionby(...t)}orderby(...t){return this.window().orderby(...t)}rows(t,n){return this.window().rows(t,n)}range(t,n){return this.window().range(t,n)}};function o7(e,t,n,r,i){let o=`)${n?`::${n}`:""}`,s=[`${e}(${r?"DISTINCT ":""}`],a=[];return t.length?(s=s.concat([...bc(t.length-1,", "),`${o}${i?" FILTER (WHERE ":""}`,...i?[")"]:[]]),a=[...t,...i?[i]:[]]):s[0]+="*"+o,{exprs:a,strings:s}}function s7(e){let t=ns(e);return t&&t.startsWith('"')&&t.endsWith('"')?t.slice(1,-1):t}function Wt(e,t){return(...n)=>new F_(e,n,t)}var Si=Wt("COUNT","INTEGER"),a7=Wt("AVG"),c7=Wt("AVG"),l7=Wt("MAD"),sa=Wt("MAX"),aa=Wt("MIN"),Ii=Wt("SUM","DOUBLE"),u7=Wt("PRODUCT"),f7=Wt("MEDIAN"),h7=Wt("QUANTILE"),d7=Wt("MODE"),p7=Wt("VARIANCE"),m7=Wt("STDDEV"),y7=Wt("SKEWNESS"),g7=Wt("KURTOSIS"),b7=Wt("ENTROPY"),x7=Wt("VAR_POP"),w7=Wt("STDDEV_POP"),_7=Wt("CORR"),v7=Wt("COVAR_POP"),L_=Wt("REGR_INTERCEPT"),C_=Wt("REGR_SLOPE"),k_=Wt("REGR_COUNT"),S7=Wt("REGR_R2"),R_=Wt("REGR_SYY"),$_=Wt("REGR_SXX"),I7=Wt("REGR_SXY"),U_=Wt("REGR_AVGX"),M7=Wt("REGR_AVGY"),T7=Wt("FIRST"),A7=Wt("LAST"),x0=Wt("ARG_MIN"),w0=Wt("ARG_MAX"),E7=Wt("STRING_AGG"),D7=Wt("ARRAY_AGG");function gT(e,t){let n=Ht(e),r=q`CAST(${n} AS ${t})`;return Object.defineProperty(r,"label",{enumerable:!0,get(){return e.label}}),Object.defineProperty(r,"aggregate",{enumerable:!0,get(){return e.aggregate||!1}}),r}var _0=e=>gT(e,"DOUBLE");var td=e=>{let t=Ht(e);return q`(1000 * (epoch(${t}) - second(${t})) + millisecond(${t}))::DOUBLE`};var P_=gn("ST_AsGeoJSON"),N7=gn("ST_X"),O7=gn("ST_Y"),B7=gn("ST_CENTROID");var Ct=class e{static select(...t){return new e().select(...t)}static from(...t){return new e().from(...t)}static with(...t){return new e().with(...t)}static union(...t){return new xc("UNION",t.flat())}static unionAll(...t){return new xc("UNION ALL",t.flat())}static intersect(...t){return new xc("INTERSECT",t.flat())}static except(...t){return new xc("EXCEPT",t.flat())}constructor(){this.query={with:[],select:[],from:[],where:[],groupby:[],having:[],window:[],qualify:[],orderby:[]}}clone(){let t=new e;return t.query={...this.query},t}with(...t){let{query:n}=this;if(t.length===0)return n.with;{let r=[],i=(o,s)=>{let a=s.clone();a.cteFor=this,r.push({as:o,query:a})};return t.flat().forEach(o=>{if(o!=null)if(o.as&&o.query)i(o.as,o.query);else for(let s in o)i(s,o[s])}),n.with=n.with.concat(r),this}}select(...t){let{query:n}=this;if(t.length===0)return n.select;{let r=[];for(let i of t.flat())if(i!=null)if(typeof i=="string")r.push({as:i,expr:Ht(i)});else if(i instanceof lr)r.push({as:i.column,expr:i});else if(Array.isArray(i))r.push({as:i[0],expr:i[1]});else for(let o in i)r.push({as:v0(o),expr:Ht(i[o])});return n.select=n.select.concat(r),this}}$select(...t){return this.query.select=[],this.select(...t)}distinct(t=!0){return this.query.distinct=!!t,this}from(...t){let{query:n}=this;if(t.length===0)return n.from;{let r=[];return t.flat().forEach(i=>{if(i!=null)if(typeof i=="string")r.push({as:i,from:pc(i)});else if(i instanceof lr)r.push({as:i.table,from:i});else if(S0(i)||b0(i))r.push({from:i});else if(Array.isArray(i))r.push({as:v0(i[0]),from:pc(i[1])});else for(let o in i)r.push({as:v0(o),from:pc(i[o])})}),n.from=n.from.concat(r),this}}$from(...t){return this.query.from=[],this.from(...t)}sample(t,n){let{query:r}=this;if(arguments.length===0)return r.sample;{let i=t;return typeof t=="number"&&(i=t>0&&t<1?{perc:100*t,method:n}:{rows:Math.round(t),method:n}),r.sample=i,this}}where(...t){let{query:n}=this;return t.length===0?n.where:(n.where=n.where.concat(t.flat().filter(r=>r)),this)}$where(...t){return this.query.where=[],this.where(...t)}groupby(...t){let{query:n}=this;return t.length===0?n.groupby:(n.groupby=n.groupby.concat(t.flat().filter(r=>r).map(Ht)),this)}$groupby(...t){return this.query.groupby=[],this.groupby(...t)}having(...t){let{query:n}=this;return t.length===0?n.having:(n.having=n.having.concat(t.flat().filter(r=>r)),this)}window(...t){let{query:n}=this;if(t.length===0)return n.window;{let r=[];return t.flat().forEach(i=>{if(i!=null)for(let o in i)r.push({as:v0(o),expr:i[o]})}),n.window=n.window.concat(r),this}}qualify(...t){let{query:n}=this;return t.length===0?n.qualify:(n.qualify=n.qualify.concat(t.flat().filter(r=>r)),this)}orderby(...t){let{query:n}=this;return t.length===0?n.orderby:(n.orderby=n.orderby.concat(t.flat().filter(r=>r).map(Ht)),this)}limit(t){let{query:n}=this;return arguments.length===0?n.limit:(n.limit=Number.isFinite(t)?t:void 0,this)}offset(t){let{query:n}=this;return arguments.length===0?n.offset:(n.offset=Number.isFinite(t)?t:void 0,this)}get subqueries(){let{query:t,cteFor:n}=this,i=(n?.query||t).with?.reduce((s,{as:a,query:c})=>(s[a]=c,s),{}),o=[];return t.from.forEach(({from:s})=>{if(S0(s))o.push(s);else if(i[s.table]){let a=i[s.table];o.push(a)}}),o}toString(){let{select:t,distinct:n,from:r,sample:i,where:o,groupby:s,having:a,window:c,qualify:l,orderby:u,limit:f,offset:h,with:d}=this.query,p=[];if(d.length){let b=d.map(({as:m,query:g})=>`"${m}" AS (${g})`);p.push(`WITH ${b.join(", ")}`)}let y=t.map(({as:b,expr:m})=>fT(m,b)&&!m.table?`${m}`:`${m} AS "${b}"`);if(p.push(`SELECT${n?" DISTINCT":""} ${y.join(", ")}`),r.length){let b=r.map(({as:m,from:g})=>{let x=S0(g)?`(${g})`:`${g}`;return!m||m===g.table?x:`${x} AS "${m}"`});p.push(`FROM ${b.join(", ")}`)}if(o.length){let b=o.map(String).filter(m=>m).join(" AND ");b&&p.push(`WHERE ${b}`)}if(i){let{rows:b,perc:m,method:g,seed:x}=i,w=b?`${b} ROWS`:`${m} PERCENT`,v=g?` (${g}${x!=null?`, ${x}`:""})`:"";p.push(`USING SAMPLE ${w}${v}`)}if(s.length&&p.push(`GROUP BY ${s.join(", ")}`),a.length){let b=a.map(String).filter(m=>m).join(" AND ");b&&p.push(`HAVING ${b}`)}if(c.length){let b=c.map(({as:m,expr:g})=>`"${m}" AS (${g})`);p.push(`WINDOW ${b.join(", ")}`)}if(l.length){let b=l.map(String).filter(m=>m).join(" AND ");b&&p.push(`QUALIFY ${b}`)}return u.length&&p.push(`ORDER BY ${u.join(", ")}`),Number.isFinite(f)&&p.push(`LIMIT ${f}`),Number.isFinite(h)&&p.push(`OFFSET ${h}`),p.join(" ")}},xc=class e{constructor(t,n){this.op=t,this.queries=n.map(r=>r.clone()),this.query={orderby:[]}}clone(){let t=new e(this.op,this.queries);return t.query={...this.query},t}orderby(...t){let{query:n}=this;return t.length===0?n.orderby:(n.orderby=n.orderby.concat(t.flat().filter(r=>r).map(Ht)),this)}limit(t){let{query:n}=this;return arguments.length===0?n.limit:(n.limit=Number.isFinite(t)?t:void 0,this)}offset(t){let{query:n}=this;return arguments.length===0?n.offset:(n.offset=Number.isFinite(t)?t:void 0,this)}get subqueries(){let{queries:t,cteFor:n}=this;return n&&t.forEach(r=>r.cteFor=n),t}toString(){let{op:t,queries:n,query:{orderby:r,limit:i,offset:o}}=this,s=[n.join(` ${t} `)];return r.length&&s.push(`ORDER BY ${r.join(", ")}`),Number.isFinite(i)&&s.push(`LIMIT ${i}`),Number.isFinite(o)&&s.push(`OFFSET ${o}`),s.join(" ")}};function S0(e){return e instanceof Ct||e instanceof xc}function v0(e){return F7(e)?e.slice(1,-1):e}function F7(e){return e[0]==='"'&&e[e.length-1]==='"'}function I0(e,t,{replace:n=!1,temp:r=!0,view:i=!1}={}){return"CREATE"+(n?" OR REPLACE ":" ")+(r?"TEMP ":"")+(i?"VIEW":"TABLE")+(n?" ":" IF NOT EXISTS ")+e+" AS "+t}function bT(e){switch(e){case"BIGINT":case"HUGEINT":case"INTEGER":case"SMALLINT":case"TINYINT":case"UBIGINT":case"UINTEGER":case"USMALLINT":case"UTINYINT":case"DOUBLE":case"FLOAT":case"REAL":case"DECIMAL":return"number";case"DATE":case"TIMESTAMP":case"TIMESTAMPTZ":case"TIMESTAMP WITH TIME ZONE":case"TIME":case"TIMESTAMP_NS":return"date";case"BOOLEAN":return"boolean";case"VARCHAR":case"UUID":return"string";case"LIST":return"array";case"BLOB":case"STRUCT":case"MAP":return"object";default:throw new Error(`Unsupported type: ${e}`)}}var L7="count",C7="nulls",k7="max",R7="min",$7="distinct";var U7={[L7]:Si,[$7]:e=>Si(e).distinct(),[k7]:sa,[R7]:aa,[C7]:e=>Si().where(Kh(e))};function xT({table:e,column:t},n){return Ct.from(e).select(n.map(r=>[r,U7[r](t)]))}var wT=()=>Object.create(null),M0=class{constructor(t){this.mc=t,this.clear()}clear(){this.tables=wT()}tableInfo(t){let n=this.tables;if(n[t])return n[t];let r=P7(this.mc,t).catch(i=>{throw n[t]=null,i});return n[t]=r}async fieldInfo({table:t,column:n,stats:r}){let o=(await this.tableInfo(t))[n];if(o==null)return;if(!r?.length)return o;let s=await this.mc.query(xT(o,r),{persist:!0}),a={...o,...Array.from(s)[0]};for(let c in a){let l=a[c];typeof l=="bigint"&&(a[c]=Number(l))}return a}async queryFields(t){let n=await z7(this,t);return(await Promise.all(n.map(i=>this.fieldInfo(i)))).filter(i=>i)}};async function P7(e,t){let n=await e.query(`DESCRIBE ${pc(t)}`,{type:"json",cache:!1}),r=wT();for(let i of n)r[i.column_name]={table:t,column:i.column_name,sqlType:i.column_type,type:bT(i.column_type),nullable:i.null==="YES"};return r}async function z7(e,t){return t.length===1&&t[0].column==="*"?Object.values(await e.tableInfo(t[0].table)):t}function vT(e){let t=2166136261;for(let n=0,r=e.length;n<r;++n){let i=e.charCodeAt(n),o=i&65280;o&&(t=_T(t^o>>8)),t=_T(t^i&255)}return V7(t)}function _T(e){return e+(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24)}function V7(e){return e+=e<<13,e^=e>>>7,e+=e<<3,e^=e>>>17,e+=e<<5,e&4294967295}var MT=e=>e,T0=class{constructor(t,{selection:n,temp:r=!0}){this.mc=t,this.selection=n,this.temp=r,this.reset()}reset(){this.enabled=!1,this.clients=null,this.indices=null,this.activeView=null}clear(){this.indices&&(this.mc.cancel(Array.from(this.indices.values(),t=>t.result)),this.indices=null)}index(t,n){if(this.clients!==t){let l=Array.from(t,IT),u=l[0]?.from;this.enabled=l.every(f=>f&&f.from===u),this.clients=t,this.activeView=null,this.clear()}if(!this.enabled)return!1;n=n||this.selection.active;let{source:r}=n;if(r&&r===this.activeView?.source)return!0;if(this.clear(),!r)return!1;let i=this.activeView=q7(n);if(!i)return!1;this.mc.logger().warn("DATA CUBE INDEX CONSTRUCTION");let o=this.selection.remove(r),s=this.indices=new Map,{mc:a,temp:c}=this;for(let l of t){if(o.skip(l,n))continue;let u=IT(l),f=l.query(o.predicate(l)).select({...i.columns,...u.count}).groupby(Object.keys(i.columns)),[h]=f.subqueries;if(h){let g=Object.values(i.columns).map(x=>x.columns[0]);W7(h,g)}let d=f.orderby();f.query.orderby=[];let p=f.toString(),b=`cube_index_${(vT(p)>>>0).toString(16)}`,m=a.exec(I0(b,p,{temp:c}));s.set(l,{table:b,result:m,order:d,...u})}}async update(){let{clients:t,selection:n,activeView:r}=this,i=r.predicate(n.active.predicate);return Promise.all(Array.from(t).map(o=>this.updateClient(o,i)))}async updateClient(t,n){let r=this.indices.get(t);if(!r)return;n||(n=this.activeView.predicate(this.selection.active.predicate));let{table:i,dims:o,aggr:s,order:a=[]}=r,c=Ct.select(o,s).from(i).groupby(o).where(n).orderby(a);return this.mc.updateClient(t,c)}};function q7(e){let{source:t,schema:n}=e,r=e.predicate?.columns;if(!n||!r)return null;let{type:i,scales:o,pixelSize:s=1}=n,a;if(i==="interval"&&o){let c=o.map(l=>j7(l,s));if(c.some(l=>l==null))return null;c.length===1?(a=l=>l?Oe("active0",l.range.map(c[0])):[],r={active0:c[0](e.predicate.field)}):(a=l=>l?Sr(l.children.map(({range:u},f)=>Oe(`active${f}`,u.map(c[f])))):[],r=Object.fromEntries(e.predicate.children.map((l,u)=>[`active${u}`,c[u](l.field)])))}else if(i==="point")a=MT,r=Object.fromEntries(r.map(c=>[c.toString(),c]));else return null;return{source:t,columns:r,predicate:a}}function j7(e,t){let{type:n,domain:r,range:i}=e,o,s;switch(n){case"linear":o=MT,s=Ht;break;case"log":o=Math.log,s=a=>q`LN(${Ht(a)})`;break;case"symlog":o=a=>Math.sign(a)*Math.log1p(Math.abs(a)),s=a=>(a=Ht(a),q`SIGN(${a}) * LN(1 + ABS(${a}))`);break;case"sqrt":o=Math.sqrt,s=a=>q`SQRT(${Ht(a)})`;break;case"utc":case"time":o=a=>+a,s=a=>a instanceof Date?+a:td(Ht(a));break}return o?Y7(r,i,t,o,s):null}function Y7(e,t,n,r,i){let o=r(Math.min(e[0],e[1])),s=r(Math.max(e[0],e[1])),a=Math.abs(r(t[1])-r(t[0]))/(s-o)/n,c=n===1?"":`${n}::INTEGER * `;return l=>q`${c}FLOOR(${a}::DOUBLE * (${i(l)} - ${o}::DOUBLE))::INTEGER`}var ST={from:NaN};function IT(e){if(!e.filterIndexable)return ST;let t=e.query(),n=z_(t);if(!n||!t.groupby)return ST;let r=new Set(t.groupby().map(a=>a.column)),i=[],o=[],s;for(let{as:a,expr:{aggregate:c}}of t.select())switch(c?.toUpperCase?.()){case"COUNT":case"SUM":i.push({[a]:q`SUM("${a}")::DOUBLE`});break;case"AVG":s="_count_",i.push({[a]:q`(SUM("${a}" * ${s}) / SUM(${s}))::DOUBLE`});break;case"MAX":i.push({[a]:q`MAX("${a}")`});break;case"MIN":i.push({[a]:q`MIN("${a}")`});break;default:if(r.has(a))o.push(a);else return null}return{aggr:i,dims:o,count:s?{[s]:q`COUNT(*)`}:{},from:n}}function z_(e){let t=e.subqueries;if(e.select){let r=e.from();if(!r.length)return;if(t.length===0)return r[0].from.table}let n=z_(t[0]);for(let r=1;r<t.length;++r){let i=z_(t[r]);if(i!==void 0&&i!==n)return NaN}return n}function W7(e,t){let n=new Set,r=i=>{n.has(i)||(n.add(i),i.select&&i.from().length&&i.select(t),i.subqueries.forEach(r))};r(e)}var A0=class{constructor(t,n,r=!0){this.mc=t,this.selection=n,this.clients=new Set,this.indexer=r?new T0(this.mc,{...r,selection:n}):null;let{value:i,activate:o}=this.handlers={value:()=>this.update(),activate:s=>this.indexer?.index(this.clients,s)};n.addEventListener("value",i),n.addEventListener("activate",o)}finalize(){let{value:t,activate:n}=this.handlers;this.selection.removeEventListener("value",t),this.selection.removeEventListener("activate",n)}reset(){this.indexer?.reset()}add(t){return(this.clients=new Set(this.clients)).add(t),this}remove(t){return this.clients.has(t)&&(this.clients=new Set(this.clients)).delete(t),this}update(){let{mc:t,indexer:n,clients:r,selection:i}=this;return n?.index(r)?n.update():G7(t,r,i)}};function G7(e,t,n){return Promise.all(Array.from(t).map(r=>{let i=n.predicate(r);if(i!=null)return e.updateClient(r,r.query(i))}))}function E0(){let e,t,n=new Promise((r,i)=>{e=r,t=i});return n.fulfill=r=>(e(r),n),n.reject=r=>(t(r),n),n}function X7(e){return(typeof requestAnimationFrame<"u"?requestAnimationFrame:typeof setImmediate<"u"?setImmediate:setTimeout)(e)}function TT(e,t,n){let r=[],i=0;function o(){let s=H7(r,t);r=[],i=0;for(let a of s)K7(a,e,n),tR(a,t)}return{add(s,a){s.request.type==="arrow"?(i=i||X7(()=>o()),r.push({entry:s,priority:a,index:r.length})):e(s,a)}}}function H7(e,t){let n=[],r=new Map;for(let i of e){let{entry:{request:o}}=i,s=Z7(o.query,t);if(!r.has(s)){let a=[];n.push(a),r.set(s,a)}r.get(s).push(i)}return n}function Z7(e,t){let n=`${e}`;if(e instanceof Ct&&!t.get(n)){if(e.orderby().length||e.where().length||e.qualify().length||e.having().length)return n;let r=e.clone().$select("*"),i=e.groupby();if(i.length){let o={};e.select().forEach(({as:s,expr:a})=>o[s]=a),r.$groupby(i.map(s=>s instanceof lr&&o[s.column]||s))}return`${r}`}else return n}function K7(e,t,n){if(Q7(e))t({request:{type:"arrow",cache:!1,record:!1,query:J7(e,n)},result:e.result=E0()});else for(let{entry:r,priority:i}of e)t(r,i)}function Q7(e){if(e.length>1){let t=`${e[0].entry.request.query}`;for(let n=1;n<e.length;++n)if(t!==`${e[n].entry.request.query}`)return!0}return!1}function J7(e,t){let n=e.maps=[],r=new Map;for(let s of e){let{query:a}=s.entry.request,c=[];n.push(c);for(let{as:l,expr:u}of a.select()){let f=`${u}`;r.has(f)||r.set(f,[`col${r.size}`,u]);let[h]=r.get(f);c.push([h,l])}t(`${a}`)}let i=e[0].entry.request.query.clone(),o=i.groupby();if(o.length){let s={};e.maps[0].forEach(([a,c])=>s[c]=a),i.$groupby(o.map(a=>a instanceof lr&&s[a.column]||a))}return i.$select(Array.from(r.values()))}async function tR(e,t){let{maps:n,result:r}=e;if(!n)return;let i;try{i=await r}catch(o){for(let{entry:s}of e)s.result.reject(o);return}e.forEach(({entry:o},s)=>{let{request:a,result:c}=o,l=eR(i,n[s]);a.cache&&t.set(String(a.query),l),c.fulfill(l)})}function eR(e,t){if(t){let n={};for(let[r,i]of t)n[i]=e.getChild(r);return new e.constructor(n)}else return e}var nR=typeof requestIdleCallback<"u"?requestIdleCallback:setTimeout,AT=()=>({get:()=>{},set:(e,t)=>t,clear:()=>{}});function ET({max:e=1e3,ttl:t=3*60*60*1e3}={}){let n=new Map;function r(){let i=performance.now()-t,o=null,s=1/0;for(let[a,c]of n){let{last:l}=c;l<s&&(o=a,s=l),i>l&&n.delete(a)}o&&n.delete(o)}return{get(i){let o=n.get(i);if(o)return o.last=performance.now(),o.value},set(i,o){return n.set(i,{last:performance.now(),value:o}),n.size>e&&nR(r),o},clear(){n=new Map}}}function DT(e){let t=Array.from({length:e},()=>({head:null,tail:null}));return{isEmpty(){return t.every(n=>!n.head)},insert(n,r){let i=t[r];if(!i)throw new Error(`Invalid queue priority rank: ${r}`);let o={item:n,next:null};i.head===null?i.head=i.tail=o:i.tail=i.tail.next=o},remove(n){for(let r of t){let{head:i,tail:o}=r;for(let s=null,a=i;a;s=a,a=a.next)n(a.item)&&(a===i?i=a.next:s.next=a.next,a===o&&(o=s||i));r.head=i,r.tail=o}},next(){for(let n of t){let{head:r}=n;if(r!==null)return n.head=r.next,n.tail===r&&(n.tail=null),r.item}}}}var Xi={High:0,Normal:1,Low:2};function NT(){let e=DT(3),t,n,r,i=[],o=null,s;function a(){if(o||e.isEmpty())return;let{request:f,result:h}=e.next();o=u(f,h),o.finally(()=>{o=null,a()})}function c(f,h=Xi.Normal){e.insert(f,h),a()}function l(f){i.length&&f&&i.forEach(h=>h.add(f))}async function u(f,h){try{let{query:d,type:p,cache:y=!1,record:b=!0,options:m}=f,g=d?`${d}`:null;if(b&&l(g),y){let v=n.get(g);if(v){r.debug("Cache"),h.fulfill(v);return}}let x=performance.now(),w=await t.query({type:p,sql:g,...m});y&&n.set(g,w),r.debug(`Request: ${(performance.now()-x).toFixed(1)}`),h.fulfill(w)}catch(d){h.reject(d)}}return{cache(f){return f!==void 0?n=f===!0?ET():f||AT():n},logger(f){return f?r=f:r},connector(f){return f?t=f:t},consolidate(f){f&&!s?s=TT(c,n,l):!f&&s&&(s=null)},request(f,h=Xi.Normal){let d=E0(),p={request:f,result:d};return s?s.add(p,h):c(p,h),d},cancel(f){let h=new Set(f);e.remove(({result:d})=>h.has(d))},clear(){e.remove(({result:f})=>(f.reject("Cleared"),!0))},record(){let f=[],h={add(d){f.push(d)},reset(){f=[]},snapshot(){return f.slice()},stop(){return i=i.filter(d=>d!==h),f}};return i.push(h),h}}}function OT(){return{debug(){},info(){},log(){},warn(){},error(){}}}var D0;function V_(e){return e?D0=e:D0==null&&(D0=new N0),D0}var N0=class{constructor(t=E_(),n={}){let{logger:r=console,manager:i=NT()}=n;this.catalog=new M0(this),this.manager=i,this.logger(r),this.configure(n),this.databaseConnector(t),this.clear()}logger(t){return arguments.length&&(this._logger=t||OT(),this.manager.logger(this._logger)),this._logger}configure({cache:t=!0,consolidate:n=!0,indexes:r=!0}){this.manager.cache(t),this.manager.consolidate(n),this.indexes=r}clear({clients:t=!0,cache:n=!0,catalog:r=!1}={}){this.manager.clear(),t&&(this.clients?.forEach(i=>this.disconnect(i)),this.filterGroups?.forEach(i=>i.finalize()),this.clients=new Set,this.filterGroups=new Map),n&&this.manager.cache().clear(),r&&this.catalog.clear()}databaseConnector(t){return this.manager.connector(t)}cancel(t){this.manager.cancel(t)}exec(t,{priority:n=Xi.Normal}={}){return t=Array.isArray(t)?t.join(`;
|
|
11
|
+
`):t,this.manager.request({type:"exec",query:t},n)}query(t,{type:n="arrow",cache:r=!0,priority:i=Xi.Normal,...o}={}){return this.manager.request({type:n,query:t,cache:r,options:o},i)}prefetch(t,n={}){return this.query(t,{...n,cache:!0,priority:Xi.Low})}createBundle(t,n,r=Xi.Low){let i={name:t,queries:n};return this.manager.request({type:"create-bundle",options:i},r)}loadBundle(t,n=Xi.High){let r={name:t};return this.manager.request({type:"load-bundle",options:r},n)}updateClient(t,n,r=Xi.Normal){return t.queryPending(),this.query(n,{priority:r}).then(i=>t.queryResult(i).update(),i=>{t.queryError(i),this._logger.error(i)})}requestQuery(t,n){return this.filterGroups.get(t.filterBy)?.reset(),n?this.updateClient(t,n):t.update()}async connect(t){let{catalog:n,clients:r,filterGroups:i,indexes:o}=this;if(r.has(t))throw new Error("Client already connected.");r.add(t),t.coordinator=this;let s=t.fields();s?.length&&t.fieldInfo(await n.queryFields(s));let a=t.filterBy;if(a)if(i.has(a))i.get(a).add(t);else{let c=new A0(this,a,o);i.set(a,c.add(t))}t.requestQuery()}disconnect(t){let{clients:n,filterGroups:r}=this;n.has(t)&&(n.delete(t),r.get(t.filterBy)?.remove(t),t.coordinator=null)}};var O0=class{constructor(){this._callbacks=new Map}addEventListener(t,n){this._callbacks.has(t)||this._callbacks.set(t,{callbacks:new Set,pending:null,queue:new q_}),this._callbacks.get(t).callbacks.add(n)}removeEventListener(t,n){let r=this._callbacks.get(t);r&&r.callbacks.delete(n)}willEmit(t,n){return n}emitQueueFilter(){return null}cancel(t){this._callbacks.get(t)?.queue.clear()}emit(t,n){let r=this._callbacks.get(t)||{};if(r.pending)r.queue.enqueue(n,this.emitQueueFilter(t,n));else{let i=this.willEmit(t,n),{callbacks:o,queue:s}=r;if(o?.size){let a=Promise.allSettled(Array.from(o,c=>c(i))).then(()=>{r.pending=null,s.isEmpty()||this.emit(t,s.dequeue())});r.pending=a}}}},q_=class{constructor(){this.clear()}clear(){this.next=null}isEmpty(){return!this.next}enqueue(t,n){let r={value:t};if(n&&this.next){let i=this;for(;i.next;)n(i.next.value)?i=i.next:i.next=i.next.next;i.next=r}else this.next=r}dequeue(){let{next:t}=this;return this.next=t?.next,t?.value}};function ed(e,t){return e===t?!1:e instanceof Date&&t instanceof Date?+e!=+t:Array.isArray(e)&&Array.isArray(t)?rR(e,t):!0}function rR(e,t){if(e.length!==t.length)return!0;for(let n=0;n<e.length;++n)if(e[n]!==t[n])return!0;return!1}function Yl(e){return e instanceof Wl}var Wl=class e extends O0{constructor(t){super(),this._value=t}static value(t){return new e(t)}static array(t){if(t.some(n=>Yl(n))){let n=new e,r=()=>n.update(t.map(i=>Yl(i)?i.value:i));return r(),t.forEach(i=>Yl(i)?i.addEventListener("value",r):0),n}return new e(t)}get value(){return this._value}update(t,{force:n}={}){return ed(this._value,t)||n?this.emit("value",t):this.cancel("value"),this}willEmit(t,n){return t==="value"&&(this._value=n),n}};function j_(e){return e instanceof _c}var _c=class e extends Wl{static intersect({cross:t=!1}={}){return new e(new wc({cross:t}))}static union({cross:t=!1}={}){return new e(new wc({cross:t,union:!0}))}static single({cross:t=!1}={}){return new e(new wc({cross:t,single:!0}))}static crossfilter(){return new e(new wc({cross:!0}))}constructor(t=new wc){super([]),this._resolved=this._value,this._resolver=t}clone(){let t=new e(this._resolver);return t._value=t._resolved=this._value,t}remove(t){let n=this.clone();return n._value=n._resolved=n._resolver.resolve(this._resolved,{source:t}),n._value.active={source:t},n}get active(){return this.clauses.active}get value(){return this.active?.value}get clauses(){return super.value}get single(){return this._resolver.single}activate(t){this.emit("activate",t)}update(t){return this._resolved=this._resolver.resolve(this._resolved,t,!0),this._resolved.active=t,super.update(this._resolved)}willEmit(t,n){return t==="value"?(this._value=n,this.value):n}emitQueueFilter(t,n){return t==="value"?this._resolver.queueFilter(n):null}skip(t,n){return this._resolver.skip(t,n)}predicate(t,n=!1){let{clauses:r}=this,i=n?null:r.active;return this._resolver.predicate(r,i,t)}},wc=class{constructor({union:t,cross:n,single:r}={}){this.union=!!t,this.cross=!!n,this.single=!!r}resolve(t,n,r=!1){let{source:i,predicate:o}=n,s=t.filter(c=>i!==c.source),a=this.single?[]:s;return this.single&&r&&s.forEach(c=>c.source?.reset?.()),o&&a.push(n),a}skip(t,n){return this.cross&&n?.clients?.has(t)}predicate(t,n,r){let{union:i}=this;if(this.skip(r,n))return;let o=t.filter(s=>!this.skip(r,s)).map(s=>s.predicate);return i&&o.length>1?Zh(o):o}queueFilter(t){if(this.cross){let n=t.active?.source;return r=>r.active?.source!==n}}};function Y_(){let e=new Set,t,n=new Promise(r=>t=r);return{pending(r){e.add(r)},ready(r){return e.delete(r),e.size===0},resolve(){n=new Promise(r=>{t(),t=r})},get promise(){return n}}}var yw={};zs(yw,{Area:()=>hl,Arrow:()=>dm,BarX:()=>pm,BarY:()=>mm,Cell:()=>dl,Contour:()=>Im,Density:()=>Am,Dot:()=>pl,Frame:()=>om,Geo:()=>Em,Hexgrid:()=>Dm,Image:()=>Nm,Line:()=>ml,Link:()=>fm,Mark:()=>xt,Raster:()=>Sm,Rect:()=>gl,RuleX:()=>tm,RuleY:()=>em,Text:()=>ll,TickX:()=>xm,TickY:()=>wm,Tip:()=>sm,Vector:()=>fl,area:()=>um,areaX:()=>Va,areaY:()=>Us,arrow:()=>TO,auto:()=>RO,autoSpec:()=>fM,axisFx:()=>C1,axisFy:()=>L1,axisX:()=>rm,axisY:()=>nm,barX:()=>Ao,barY:()=>Eo,bin:()=>$s,binX:()=>Mo,binY:()=>To,bollinger:()=>Wa,bollingerX:()=>qO,bollingerY:()=>jO,boxX:()=>YO,boxY:()=>WO,cell:()=>qa,cellX:()=>EO,cellY:()=>DO,centroid:()=>VB,circle:()=>BO,cluster:()=>zB,column:()=>ln,contour:()=>eB,crosshair:()=>iB,crosshairX:()=>oB,crosshairY:()=>sB,delaunayLink:()=>lB,delaunayMesh:()=>uB,density:()=>mB,differenceY:()=>bB,dodgeX:()=>nF,dodgeY:()=>rF,dot:()=>ni,dotX:()=>NO,dotY:()=>OO,filter:()=>UD,find:()=>XD,formatIsoDate:()=>wI,formatMonth:()=>JD,formatWeekday:()=>t5,frame:()=>df,geo:()=>ow,geoCentroid:()=>qB,graticule:()=>wB,gridFx:()=>U1,gridFy:()=>R1,gridX:()=>$1,gridY:()=>k1,group:()=>Wp,groupX:()=>La,groupY:()=>Ca,groupZ:()=>Yp,hexagon:()=>FO,hexbin:()=>_B,hexgrid:()=>vB,hull:()=>fB,identity:()=>W,image:()=>IB,indexOf:()=>ve,initializer:()=>xe,interpolateNearest:()=>bM,interpolateNone:()=>iw,interpolatorBarycentric:()=>gM,interpolatorRandomWalk:()=>xM,legend:()=>XN,line:()=>yl,lineX:()=>ja,lineY:()=>Ya,linearRegressionX:()=>AB,linearRegressionY:()=>EB,link:()=>H1,map:()=>fr,mapX:()=>Tf,mapY:()=>Af,marks:()=>Ze,normalize:()=>pw,normalizeX:()=>aF,normalizeY:()=>cF,plot:()=>cm,pointer:()=>cf,pointerX:()=>lf,pointerY:()=>ol,raster:()=>KO,rect:()=>gm,rectX:()=>Sf,rectY:()=>If,reverse:()=>PD,ruleX:()=>Fr,ruleY:()=>Lr,scale:()=>So,select:()=>uF,selectFirst:()=>PM,selectLast:()=>zM,selectMaxX:()=>dF,selectMaxY:()=>pF,selectMinX:()=>fF,selectMinY:()=>hF,shiftX:()=>lF,shuffle:()=>zD,sort:()=>Qx,sphere:()=>xB,spike:()=>EN,stackX:()=>cM,stackX1:()=>gO,stackX2:()=>bO,stackY:()=>lM,stackY1:()=>xO,stackY2:()=>wO,text:()=>Io,textX:()=>A1,textY:()=>E1,tickX:()=>ew,tickY:()=>nw,tip:()=>V1,transform:()=>un,tree:()=>LM,treeLink:()=>uw,treeNode:()=>Om,valueof:()=>dt,vector:()=>KI,vectorX:()=>O1,vectorY:()=>B1,voronoi:()=>hB,voronoiMesh:()=>dB,window:()=>Ef,windowX:()=>$O,windowY:()=>UO});function qt(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Pn(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function is(e){let t,n,r;e.length!==2?(t=qt,n=(a,c)=>qt(e(a),c),r=(a,c)=>e(a)-c):(t=e===qt||e===Pn?e:iR,n=e,r=e);function i(a,c,l=0,u=a.length){if(l<u){if(t(c,c)!==0)return u;do{let f=l+u>>>1;n(a[f],c)<0?l=f+1:u=f}while(l<u)}return l}function o(a,c,l=0,u=a.length){if(l<u){if(t(c,c)!==0)return u;do{let f=l+u>>>1;n(a[f],c)<=0?l=f+1:u=f}while(l<u)}return l}function s(a,c,l=0,u=a.length){let f=i(a,c,l,u-1);return f>l&&r(a[f-1],c)>-r(a[f],c)?f-1:f}return{left:i,center:s,right:o}}function iR(){return 0}function nd(e){return e===null?NaN:+e}function*BT(e,t){if(t===void 0)for(let n of e)n!=null&&(n=+n)>=n&&(yield n);else{let n=-1;for(let r of e)(r=t(r,++n,e))!=null&&(r=+r)>=r&&(yield r)}}var FT=is(qt),LT=FT.right,oR=FT.left,sR=is(nd).center,os=LT;var rd=CT(kT),W_=CT(aR);function CT(e){return function(t,n,r=n){if(!((n=+n)>=0))throw new RangeError("invalid rx");if(!((r=+r)>=0))throw new RangeError("invalid ry");let{data:i,width:o,height:s}=t;if(!((o=Math.floor(o))>=0))throw new RangeError("invalid width");if(!((s=Math.floor(s!==void 0?s:i.length/o))>=0))throw new RangeError("invalid height");if(!o||!s||!n&&!r)return t;let a=n&&e(n),c=r&&e(r),l=i.slice();return a&&c?(Gl(a,l,i,o,s),Gl(a,i,l,o,s),Gl(a,l,i,o,s),Xl(c,i,l,o,s),Xl(c,l,i,o,s),Xl(c,i,l,o,s)):a?(Gl(a,i,l,o,s),Gl(a,l,i,o,s),Gl(a,i,l,o,s)):c&&(Xl(c,i,l,o,s),Xl(c,l,i,o,s),Xl(c,i,l,o,s)),t}}function Gl(e,t,n,r,i){for(let o=0,s=r*i;o<s;)e(t,n,o,o+=r,1)}function Xl(e,t,n,r,i){for(let o=0,s=r*i;o<r;++o)e(t,n,o,o+s,r)}function aR(e){let t=kT(e);return(n,r,i,o,s)=>{i<<=2,o<<=2,s<<=2,t(n,r,i+0,o+0,s),t(n,r,i+1,o+1,s),t(n,r,i+2,o+2,s),t(n,r,i+3,o+3,s)}}function kT(e){let t=Math.floor(e);if(t===e)return cR(e);let n=e-t,r=2*e+1;return(i,o,s,a,c)=>{if(!((a-=c)>=s))return;let l=t*o[s],u=c*t,f=u+c;for(let h=s,d=s+u;h<d;h+=c)l+=o[Math.min(a,h)];for(let h=s,d=a;h<=d;h+=c)l+=o[Math.min(a,h+u)],i[h]=(l+n*(o[Math.max(s,h-f)]+o[Math.min(a,h+f)]))/r,l-=o[Math.max(s,h-u)]}}function cR(e){let t=2*e+1;return(n,r,i,o,s)=>{if(!((o-=s)>=i))return;let a=e*r[i],c=s*e;for(let l=i,u=i+c;l<u;l+=s)a+=r[Math.min(o,l)];for(let l=i,u=o;l<=u;l+=s)a+=r[Math.min(o,l+c)],n[l]=a/t,a-=r[Math.max(i,l-c)]}}function Hi(e,t){let n=0;if(t===void 0)for(let r of e)r!=null&&(r=+r)>=r&&++n;else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(i=+i)>=i&&++n}return n}function lR(e){return e.length|0}function uR(e){return!(e>0)}function fR(e){return typeof e!="object"||"length"in e?e:Array.from(e)}function hR(e){return t=>e(...t)}function B0(...e){let t=typeof e[e.length-1]=="function"&&hR(e.pop());e=e.map(fR);let n=e.map(lR),r=e.length-1,i=new Array(r+1).fill(0),o=[];if(r<0||n.some(uR))return o;for(;;){o.push(i.map((a,c)=>e[c][a]));let s=r;for(;++i[s]===n[s];){if(s===0)return t?o.map(t):o;i[s--]=0}}}function F0(e,t){var n=0,r=0;return Float64Array.from(e,t===void 0?i=>n+=+i||0:i=>n+=+t(i,r++,e)||0)}function ca(e,t){let n=0,r,i=0,o=0;if(t===void 0)for(let s of e)s!=null&&(s=+s)>=s&&(r=s-i,i+=r/++n,o+=r*(s-i));else{let s=-1;for(let a of e)(a=t(a,++s,e))!=null&&(a=+a)>=a&&(r=a-i,i+=r/++n,o+=r*(a-i))}if(n>1)return o/(n-1)}function qr(e,t){let n=ca(e,t);return n&&Math.sqrt(n)}function ie(e,t){let n,r;if(t===void 0)for(let i of e)i!=null&&(n===void 0?i>=i&&(n=r=i):(n>i&&(n=i),r<i&&(r=i)));else{let i=-1;for(let o of e)(o=t(o,++i,e))!=null&&(n===void 0?o>=o&&(n=r=o):(n>o&&(n=o),r<o&&(r=o)))}return[n,r]}var bn=class{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){let n=this._partials,r=0;for(let i=0;i<this._n&&i<32;i++){let o=n[i],s=t+o,a=Math.abs(t)<Math.abs(o)?t-(s-o):o-(s-t);a&&(n[r++]=a),t=s}return n[r]=t,this._n=r+1,this}valueOf(){let t=this._partials,n=this._n,r,i,o,s=0;if(n>0){for(s=t[--n];n>0&&(r=s,i=t[--n],s=r+i,o=i-(s-r),!o););n>0&&(o<0&&t[n-1]<0||o>0&&t[n-1]>0)&&(i=o*2,r=s+i,i==r-s&&(s=r))}return s}};var zn=class extends Map{constructor(t,n=UT){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(let[r,i]of t)this.set(r,i)}get(t){return super.get(G_(this,t))}has(t){return super.has(G_(this,t))}set(t,n){return super.set(RT(this,t),n)}delete(t){return super.delete($T(this,t))}},Ir=class extends Set{constructor(t,n=UT){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(let r of t)this.add(r)}has(t){return super.has(G_(this,t))}add(t){return super.add(RT(this,t))}delete(t){return super.delete($T(this,t))}};function G_({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function RT({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function $T({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function UT(e){return e!==null&&typeof e=="object"?e.valueOf():e}function id(e){return e}function tn(e,...t){return H_(e,id,id,t)}function Mi(e,t,...n){return H_(e,id,t,n)}function X_(e,t,...n){return H_(e,Array.from,t,n)}function H_(e,t,n,r){return function i(o,s){if(s>=r.length)return n(o);let a=new zn,c=r[s++],l=-1;for(let u of o){let f=c(u,++l,o),h=a.get(f);h?h.push(u):a.set(f,[u])}for(let[u,f]of a)a.set(u,i(f,s));return t(a)}(e,0)}function Z_(e,t){return Array.from(t,n=>e[n])}function Zi(e,...t){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");e=Array.from(e);let[n]=t;if(n&&n.length!==2||t.length>1){let r=Uint32Array.from(e,(i,o)=>o);return t.length>1?(t=t.map(i=>e.map(i)),r.sort((i,o)=>{for(let s of t){let a=vc(s[i],s[o]);if(a)return a}})):(n=e.map(n),r.sort((i,o)=>vc(n[i],n[o]))),Z_(e,r)}return e.sort(od(n))}function od(e=qt){if(e===qt)return vc;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{let r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function vc(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}function Hl(e,t,n){return(t.length!==2?Zi(Mi(e,t,n),([r,i],[o,s])=>qt(i,s)||qt(r,o)):Zi(tn(e,n),([r,i],[o,s])=>t(i,s)||qt(r,o))).map(([r])=>r)}var dR=Math.sqrt(50),pR=Math.sqrt(10),mR=Math.sqrt(2);function L0(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),s=o>=dR?10:o>=pR?5:o>=mR?2:1,a,c,l;return i<0?(l=Math.pow(10,-i)/s,a=Math.round(e*l),c=Math.round(t*l),a/l<e&&++a,c/l>t&&--c,l=-l):(l=Math.pow(10,i)*s,a=Math.round(e/l),c=Math.round(t/l),a*l<e&&++a,c*l>t&&--c),c<a&&.5<=n&&n<2?L0(e,t,n*2):[a,c,l]}function xn(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];let r=t<e,[i,o,s]=r?L0(t,e,n):L0(e,t,n);if(!(o>=i))return[];let a=o-i+1,c=new Array(a);if(r)if(s<0)for(let l=0;l<a;++l)c[l]=(o-l)/-s;else for(let l=0;l<a;++l)c[l]=(o-l)*s;else if(s<0)for(let l=0;l<a;++l)c[l]=(i+l)/-s;else for(let l=0;l<a;++l)c[l]=(i+l)*s;return c}function ss(e,t,n){return t=+t,e=+e,n=+n,L0(e,t,n)[2]}function Zl(e,t,n){t=+t,e=+e,n=+n;let r=t<e,i=r?ss(t,e,n):ss(e,t,n);return(r?-1:1)*(i<0?1/-i:i)}function Kl(e,t,n){let r;for(;;){let i=ss(e,t,n);if(i===r||i===0||!isFinite(i))return[e,t];i>0?(e=Math.floor(e/i)*i,t=Math.ceil(t/i)*i):i<0&&(e=Math.ceil(e*i)/i,t=Math.floor(t*i)/i),r=i}}function la(e){return Math.max(1,Math.ceil(Math.log(Hi(e))/Math.LN2)+1)}function $t(e,t){let n;if(t===void 0)for(let r of e)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n<i||n===void 0&&i>=i)&&(n=i)}return n}function C0(e,t){let n,r=-1,i=-1;if(t===void 0)for(let o of e)++i,o!=null&&(n<o||n===void 0&&o>=o)&&(n=o,r=i);else for(let o of e)(o=t(o,++i,e))!=null&&(n<o||n===void 0&&o>=o)&&(n=o,r=i);return r}function oe(e,t){let n;if(t===void 0)for(let r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function k0(e,t){let n,r=-1,i=-1;if(t===void 0)for(let o of e)++i,o!=null&&(n>o||n===void 0&&o>=o)&&(n=o,r=i);else for(let o of e)(o=t(o,++i,e))!=null&&(n>o||n===void 0&&o>=o)&&(n=o,r=i);return r}function R0(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?vc:od(i);r>n;){if(r-n>600){let c=r-n+1,l=t-n+1,u=Math.log(c),f=.5*Math.exp(2*u/3),h=.5*Math.sqrt(u*f*(c-f)/c)*(l-c/2<0?-1:1),d=Math.max(n,Math.floor(t-l*f/c+h)),p=Math.min(r,Math.floor(t+(c-l)*f/c+h));R0(e,t,d,p,i)}let o=e[t],s=n,a=r;for(sd(e,n,t),i(e[r],o)>0&&sd(e,n,r);s<a;){for(sd(e,s,a),++s,--a;i(e[s],o)<0;)++s;for(;i(e[a],o)>0;)--a}i(e[n],o)===0?sd(e,n,a):(++a,sd(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}return e}function sd(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function Sc(e,t=qt){let n,r=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(r?qt(s,i)>0:qt(s,s)===0)&&(n=o,i=s,r=!0)}}else for(let i of e)(r?t(i,n)>0:t(i,i)===0)&&(n=i,r=!0);return n}function Vn(e,t,n){if(e=Float64Array.from(BT(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return oe(e);if(t>=1)return $t(e);var r,i=(r-1)*t,o=Math.floor(i),s=$t(R0(e,o).subarray(0,o+1)),a=oe(e.subarray(o+1));return s+(a-s)*(i-o)}}function K_(e,t,n=nd){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,o=Math.floor(i),s=+n(e[o],o,e),a=+n(e[o+1],o+1,e);return s+(a-s)*(i-o)}}function $0(e,t,n){let r=Hi(e),i=Vn(e,.75)-Vn(e,.25);return r&&i?Math.ceil((n-t)/(2*i*Math.pow(r,-1/3))):1}function ad(e,t,n){let r=Hi(e),i=qr(e);return r&&i?Math.ceil((n-t)*Math.cbrt(r)/(3.49*i)):1}function as(e,t){let n=0,r=0;if(t===void 0)for(let i of e)i!=null&&(i=+i)>=i&&(++n,r+=i);else{let i=-1;for(let o of e)(o=t(o,++i,e))!=null&&(o=+o)>=o&&(++n,r+=o)}if(n)return r/n}function Ti(e,t){return Vn(e,.5,t)}function*gR(e){for(let t of e)yield*t}function Ql(e){return Array.from(gR(e))}function Jl(e,t){let n=new zn;if(t===void 0)for(let o of e)o!=null&&o>=o&&n.set(o,(n.get(o)||0)+1);else{let o=-1;for(let s of e)(s=t(s,++o,e))!=null&&s>=s&&n.set(s,(n.get(s)||0)+1)}let r,i=0;for(let[o,s]of n)s>i&&(i=s,r=o);return r}function U0(e,t=bR){let n=[],r,i=!1;for(let o of e)i&&n.push(t(r,o)),r=o,i=!0;return n}function bR(e,t){return[e,t]}function ke(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,o=new Array(i);++r<i;)o[r]=e+r*n;return o}function cd(e,t=qt){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");let n=Array.from(e),r=new Float64Array(n.length);t.length!==2&&(n=n.map(t),t=qt);let i=(a,c)=>t(n[a],n[c]),o,s;return e=Uint32Array.from(n,(a,c)=>c),e.sort(t===qt?(a,c)=>vc(n[a],n[c]):od(i)),e.forEach((a,c)=>{let l=i(a,o===void 0?a:o);l>=0?((o===void 0||l>0)&&(o=a,s=c),r[a]=s):r[a]=NaN}),r}function P0(e,t=qt){let n,r=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(r?qt(s,i)<0:qt(s,s)===0)&&(n=o,i=s,r=!0)}}else for(let i of e)(r?t(i,n)<0:t(i,i)===0)&&(n=i,r=!0);return n}function wn(e,t){let n=0;if(t===void 0)for(let r of e)(r=+r)&&(n+=r);else{let r=-1;for(let i of e)(i=+t(i,++r,e))&&(n+=i)}return n}function ua(e){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");return Array.from(e).reverse()}function PT(e){return e}var Q_=1,J_=2,tv=3,z0=4,zT=1e-6;function xR(e){return"translate("+e+",0)"}function wR(e){return"translate(0,"+e+")"}function _R(e){return t=>+e(t)}function vR(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),n=>+e(n)+t}function SR(){return!this.__axis}function IR(e,t){var n=[],r=null,i=null,o=6,s=6,a=3,c=typeof window<"u"&&window.devicePixelRatio>1?0:.5,l=e===Q_||e===z0?-1:1,u=e===z0||e===J_?"x":"y",f=e===Q_||e===tv?xR:wR;function h(d){var p=r??(t.ticks?t.ticks.apply(t,n):t.domain()),y=i??(t.tickFormat?t.tickFormat.apply(t,n):PT),b=Math.max(o,0)+a,m=t.range(),g=+m[0]+c,x=+m[m.length-1]+c,w=(t.bandwidth?vR:_R)(t.copy(),c),v=d.selection?d.selection():d,_=v.selectAll(".domain").data([null]),M=v.selectAll(".tick").data(p,t).order(),E=M.exit(),N=M.enter().append("g").attr("class","tick"),I=M.select("line"),T=M.select("text");_=_.merge(_.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),M=M.merge(N),I=I.merge(N.append("line").attr("stroke","currentColor").attr(u+"2",l*o)),T=T.merge(N.append("text").attr("fill","currentColor").attr(u,l*b).attr("dy",e===Q_?"0em":e===tv?"0.71em":"0.32em")),d!==v&&(_=_.transition(d),M=M.transition(d),I=I.transition(d),T=T.transition(d),E=E.transition(d).attr("opacity",zT).attr("transform",function(O){return isFinite(O=w(O))?f(O+c):this.getAttribute("transform")}),N.attr("opacity",zT).attr("transform",function(O){var B=this.parentNode.__axis;return f((B&&isFinite(B=B(O))?B:w(O))+c)})),E.remove(),_.attr("d",e===z0||e===J_?s?"M"+l*s+","+g+"H"+c+"V"+x+"H"+l*s:"M"+c+","+g+"V"+x:s?"M"+g+","+l*s+"V"+c+"H"+x+"V"+l*s:"M"+g+","+c+"H"+x),M.attr("opacity",1).attr("transform",function(O){return f(w(O)+c)}),I.attr(u+"2",l*o),T.attr(u,l*b).text(y),v.filter(SR).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===J_?"start":e===z0?"end":"middle"),v.each(function(){this.__axis=w})}return h.scale=function(d){return arguments.length?(t=d,h):t},h.ticks=function(){return n=Array.from(arguments),h},h.tickArguments=function(d){return arguments.length?(n=d==null?[]:Array.from(d),h):n.slice()},h.tickValues=function(d){return arguments.length?(r=d==null?null:Array.from(d),h):r&&r.slice()},h.tickFormat=function(d){return arguments.length?(i=d,h):i},h.tickSize=function(d){return arguments.length?(o=s=+d,h):o},h.tickSizeInner=function(d){return arguments.length?(o=+d,h):o},h.tickSizeOuter=function(d){return arguments.length?(s=+d,h):s},h.tickPadding=function(d){return arguments.length?(a=+d,h):a},h.offset=function(d){return arguments.length?(c=+d,h):c},h}function ev(e){return IR(tv,e)}var MR={value:()=>{}};function qT(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new V0(n)}function V0(e){this._=e}function TR(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}V0.prototype=qT.prototype={constructor:V0,on:function(e,t){var n=this._,r=TR(e+"",n),i,o=-1,s=r.length;if(arguments.length<2){for(;++o<s;)if((i=(e=r[o]).type)&&(i=AR(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++o<s;)if(i=(e=r[o]).type)n[i]=VT(n[i],e.name,t);else if(t==null)for(i in n)n[i]=VT(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new V0(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,o;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],i=0,o=r.length;i<o;++i)r[i].value.apply(t,n)}};function AR(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function VT(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=MR,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Ic=qT;var q0="http://www.w3.org/1999/xhtml",jr={svg:"http://www.w3.org/2000/svg",xhtml:q0,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function cs(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),jr.hasOwnProperty(t)?{space:jr[t],local:e}:e}function ER(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===q0&&t.documentElement.namespaceURI===q0?t.createElement(e):t.createElementNS(n,e)}}function DR(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ls(e){var t=cs(e);return(t.local?DR:ER)(t)}function NR(){}function Mc(e){return e==null?NR:function(){return this.querySelector(e)}}function jT(e){typeof e!="function"&&(e=Mc(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],s=o.length,a=r[i]=new Array(s),c,l,u=0;u<s;++u)(c=o[u])&&(l=e.call(c,c.__data__,u,o))&&("__data__"in c&&(l.__data__=c.__data__),a[u]=l);return new Be(r,this._parents)}function nv(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function OR(){return[]}function ld(e){return e==null?OR:function(){return this.querySelectorAll(e)}}function BR(e){return function(){return nv(e.apply(this,arguments))}}function YT(e){typeof e=="function"?e=BR(e):e=ld(e);for(var t=this._groups,n=t.length,r=[],i=[],o=0;o<n;++o)for(var s=t[o],a=s.length,c,l=0;l<a;++l)(c=s[l])&&(r.push(e.call(c,c.__data__,l,s)),i.push(c));return new Be(r,i)}function ud(e){return function(){return this.matches(e)}}function j0(e){return function(t){return t.matches(e)}}var FR=Array.prototype.find;function LR(e){return function(){return FR.call(this.children,e)}}function CR(){return this.firstElementChild}function WT(e){return this.select(e==null?CR:LR(typeof e=="function"?e:j0(e)))}var kR=Array.prototype.filter;function RR(){return Array.from(this.children)}function $R(e){return function(){return kR.call(this.children,e)}}function GT(e){return this.selectAll(e==null?RR:$R(typeof e=="function"?e:j0(e)))}function XT(e){typeof e!="function"&&(e=ud(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],s=o.length,a=r[i]=[],c,l=0;l<s;++l)(c=o[l])&&e.call(c,c.__data__,l,o)&&a.push(c);return new Be(r,this._parents)}function Y0(e){return new Array(e.length)}function HT(){return new Be(this._enter||this._groups.map(Y0),this._parents)}function fd(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}fd.prototype={constructor:fd,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 ZT(e){return function(){return e}}function UR(e,t,n,r,i,o){for(var s=0,a,c=t.length,l=o.length;s<l;++s)(a=t[s])?(a.__data__=o[s],r[s]=a):n[s]=new fd(e,o[s]);for(;s<c;++s)(a=t[s])&&(i[s]=a)}function PR(e,t,n,r,i,o,s){var a,c,l=new Map,u=t.length,f=o.length,h=new Array(u),d;for(a=0;a<u;++a)(c=t[a])&&(h[a]=d=s.call(c,c.__data__,a,t)+"",l.has(d)?i[a]=c:l.set(d,c));for(a=0;a<f;++a)d=s.call(e,o[a],a,o)+"",(c=l.get(d))?(r[a]=c,c.__data__=o[a],l.delete(d)):n[a]=new fd(e,o[a]);for(a=0;a<u;++a)(c=t[a])&&l.get(h[a])===c&&(i[a]=c)}function zR(e){return e.__data__}function KT(e,t){if(!arguments.length)return Array.from(this,zR);var n=t?PR:UR,r=this._parents,i=this._groups;typeof e!="function"&&(e=ZT(e));for(var o=i.length,s=new Array(o),a=new Array(o),c=new Array(o),l=0;l<o;++l){var u=r[l],f=i[l],h=f.length,d=VR(e.call(u,u&&u.__data__,l,r)),p=d.length,y=a[l]=new Array(p),b=s[l]=new Array(p),m=c[l]=new Array(h);n(u,f,y,b,m,d,t);for(var g=0,x=0,w,v;g<p;++g)if(w=y[g]){for(g>=x&&(x=g+1);!(v=b[x])&&++x<p;);w._next=v||null}}return s=new Be(s,r),s._enter=a,s._exit=c,s}function VR(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function QT(){return new Be(this._exit||this._groups.map(Y0),this._parents)}function JT(e,t,n){var r=this.enter(),i=this,o=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),n==null?o.remove():n(o),r&&i?r.merge(i).order():i}function tA(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,o=r.length,s=Math.min(i,o),a=new Array(i),c=0;c<s;++c)for(var l=n[c],u=r[c],f=l.length,h=a[c]=new Array(f),d,p=0;p<f;++p)(d=l[p]||u[p])&&(h[p]=d);for(;c<i;++c)a[c]=n[c];return new Be(a,this._parents)}function eA(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,o=r[i],s;--i>=0;)(s=r[i])&&(o&&s.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(s,o),o=s);return this}function nA(e){e||(e=qR);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var s=n[o],a=s.length,c=i[o]=new Array(a),l,u=0;u<a;++u)(l=s[u])&&(c[u]=l);c.sort(t)}return new Be(i,this._parents).order()}function qR(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function rA(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function iA(){return Array.from(this)}function oA(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,o=r.length;i<o;++i){var s=r[i];if(s)return s}return null}function sA(){let e=0;for(let t of this)++e;return e}function aA(){return!this.node()}function cA(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],o=0,s=i.length,a;o<s;++o)(a=i[o])&&e.call(a,a.__data__,o,i);return this}function jR(e){return function(){this.removeAttribute(e)}}function YR(e){return function(){this.removeAttributeNS(e.space,e.local)}}function WR(e,t){return function(){this.setAttribute(e,t)}}function GR(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function XR(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function HR(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function lA(e,t){var n=cs(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?YR:jR:typeof t=="function"?n.local?HR:XR:n.local?GR:WR)(n,t))}function W0(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function ZR(e){return function(){this.style.removeProperty(e)}}function KR(e,t,n){return function(){this.style.setProperty(e,t,n)}}function QR(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function uA(e,t,n){return arguments.length>1?this.each((t==null?ZR:typeof t=="function"?QR:KR)(e,t,n??"")):fa(this.node(),e)}function fa(e,t){return e.style.getPropertyValue(t)||W0(e).getComputedStyle(e,null).getPropertyValue(t)}function JR(e){return function(){delete this[e]}}function t9(e,t){return function(){this[e]=t}}function e9(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function fA(e,t){return arguments.length>1?this.each((t==null?JR:typeof t=="function"?e9:t9)(e,t)):this.node()[e]}function hA(e){return e.trim().split(/^|\s+/)}function rv(e){return e.classList||new dA(e)}function dA(e){this._node=e,this._names=hA(e.getAttribute("class")||"")}dA.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 pA(e,t){for(var n=rv(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function mA(e,t){for(var n=rv(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function n9(e){return function(){pA(this,e)}}function r9(e){return function(){mA(this,e)}}function i9(e,t){return function(){(t.apply(this,arguments)?pA:mA)(this,e)}}function yA(e,t){var n=hA(e+"");if(arguments.length<2){for(var r=rv(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?i9:t?n9:r9)(n,t))}function o9(){this.textContent=""}function s9(e){return function(){this.textContent=e}}function a9(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function gA(e){return arguments.length?this.each(e==null?o9:(typeof e=="function"?a9:s9)(e)):this.node().textContent}function c9(){this.innerHTML=""}function l9(e){return function(){this.innerHTML=e}}function u9(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function bA(e){return arguments.length?this.each(e==null?c9:(typeof e=="function"?u9:l9)(e)):this.node().innerHTML}function f9(){this.nextSibling&&this.parentNode.appendChild(this)}function xA(){return this.each(f9)}function h9(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function wA(){return this.each(h9)}function _A(e){var t=typeof e=="function"?e:ls(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function d9(){return null}function vA(e,t){var n=typeof e=="function"?e:ls(e),r=t==null?d9:typeof t=="function"?t:Mc(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function p9(){var e=this.parentNode;e&&e.removeChild(this)}function SA(){return this.each(p9)}function m9(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function y9(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function IA(e){return this.select(e?y9:m9)}function MA(e){return arguments.length?this.property("__data__",e):this.node().__data__}function g9(e){return function(t){e.call(this,t,this.__data__)}}function b9(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function x9(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,o;n<i;++n)o=t[n],(!e.type||o.type===e.type)&&o.name===e.name?this.removeEventListener(o.type,o.listener,o.options):t[++r]=o;++r?t.length=r:delete this.__on}}}function w9(e,t,n){return function(){var r=this.__on,i,o=g9(t);if(r){for(var s=0,a=r.length;s<a;++s)if((i=r[s]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=o,i.options=n),i.value=t;return}}this.addEventListener(e.type,o,n),i={type:e.type,name:e.name,value:t,listener:o,options:n},r?r.push(i):this.__on=[i]}}function TA(e,t,n){var r=b9(e+""),i,o=r.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,u;c<l;++c)for(i=0,u=a[c];i<o;++i)if((s=r[i]).type===u.type&&s.name===u.name)return u.value}return}for(a=t?w9:x9,i=0;i<o;++i)this.each(a(r[i],t,n));return this}function AA(e,t,n){var r=W0(e),i=r.CustomEvent;typeof i=="function"?i=new i(t,n):(i=r.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function _9(e,t){return function(){return AA(this,e,t)}}function v9(e,t){return function(){return AA(this,e,t.apply(this,arguments))}}function EA(e,t){return this.each((typeof t=="function"?v9:_9)(e,t))}function*DA(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,o=r.length,s;i<o;++i)(s=r[i])&&(yield s)}var iv=[null];function Be(e,t){this._groups=e,this._parents=t}function NA(){return new Be([[document.documentElement]],iv)}function S9(){return this}Be.prototype=NA.prototype={constructor:Be,select:jT,selectAll:YT,selectChild:WT,selectChildren:GT,filter:XT,data:KT,enter:HT,exit:QT,join:JT,merge:tA,selection:S9,order:eA,sort:nA,call:rA,nodes:iA,node:oA,size:sA,empty:aA,each:cA,attr:lA,style:uA,property:fA,classed:yA,text:gA,html:bA,raise:xA,lower:wA,append:_A,insert:vA,remove:SA,clone:IA,datum:MA,on:TA,dispatch:EA,[Symbol.iterator]:DA};var us=NA;function Ut(e){return typeof e=="string"?new Be([[document.querySelector(e)]],[document.documentElement]):new Be([[e]],iv)}function OA(e){let t;for(;t=e.sourceEvent;)e=t;return e}function En(e,t){if(e=OA(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var G0={capture:!0,passive:!1};function X0(e){e.preventDefault(),e.stopImmediatePropagation()}function hd(e){var t=e.document.documentElement,n=Ut(e).on("dragstart.drag",X0,G0);"onselectstart"in t?n.on("selectstart.drag",X0,G0):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function dd(e,t){var n=e.document.documentElement,r=Ut(e).on("dragstart.drag",null);t&&(r.on("click.drag",X0,G0),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}function fs(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function ha(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Qi(){}var da=.7,Ec=1/da,tu="\\s*([+-]?\\d+)\\s*",pd="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ki="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",I9=/^#([0-9a-f]{3,8})$/,M9=new RegExp(`^rgb\\(${tu},${tu},${tu}\\)$`),T9=new RegExp(`^rgb\\(${Ki},${Ki},${Ki}\\)$`),A9=new RegExp(`^rgba\\(${tu},${tu},${tu},${pd}\\)$`),E9=new RegExp(`^rgba\\(${Ki},${Ki},${Ki},${pd}\\)$`),D9=new RegExp(`^hsl\\(${pd},${Ki},${Ki}\\)$`),N9=new RegExp(`^hsla\\(${pd},${Ki},${Ki},${pd}\\)$`),BA={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};fs(Qi,Mr,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:FA,formatHex:FA,formatHex8:O9,formatHsl:B9,formatRgb:LA,toString:LA});function FA(){return this.rgb().formatHex()}function O9(){return this.rgb().formatHex8()}function B9(){return PA(this).formatHsl()}function LA(){return this.rgb().formatRgb()}function Mr(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=I9.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?CA(t):n===3?new Ve(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?H0(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?H0(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=M9.exec(e))?new Ve(t[1],t[2],t[3],1):(t=T9.exec(e))?new Ve(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=A9.exec(e))?H0(t[1],t[2],t[3],t[4]):(t=E9.exec(e))?H0(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=D9.exec(e))?$A(t[1],t[2]/100,t[3]/100,1):(t=N9.exec(e))?$A(t[1],t[2]/100,t[3]/100,t[4]):BA.hasOwnProperty(e)?CA(BA[e]):e==="transparent"?new Ve(NaN,NaN,NaN,0):null}function CA(e){return new Ve(e>>16&255,e>>8&255,e&255,1)}function H0(e,t,n,r){return r<=0&&(e=t=n=NaN),new Ve(e,t,n,r)}function md(e){return e instanceof Qi||(e=Mr(e)),e?(e=e.rgb(),new Ve(e.r,e.g,e.b,e.opacity)):new Ve}function en(e,t,n,r){return arguments.length===1?md(e):new Ve(e,t,n,r??1)}function Ve(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}fs(Ve,en,ha(Qi,{brighter(e){return e=e==null?Ec:Math.pow(Ec,e),new Ve(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?da:Math.pow(da,e),new Ve(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ve(Ac(this.r),Ac(this.g),Ac(this.b),K0(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:kA,formatHex:kA,formatHex8:F9,formatRgb:RA,toString:RA}));function kA(){return`#${Tc(this.r)}${Tc(this.g)}${Tc(this.b)}`}function F9(){return`#${Tc(this.r)}${Tc(this.g)}${Tc(this.b)}${Tc((isNaN(this.opacity)?1:this.opacity)*255)}`}function RA(){let e=K0(this.opacity);return`${e===1?"rgb(":"rgba("}${Ac(this.r)}, ${Ac(this.g)}, ${Ac(this.b)}${e===1?")":`, ${e})`}`}function K0(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ac(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Tc(e){return e=Ac(e),(e<16?"0":"")+e.toString(16)}function $A(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ai(e,t,n,r)}function PA(e){if(e instanceof Ai)return new Ai(e.h,e.s,e.l,e.opacity);if(e instanceof Qi||(e=Mr(e)),!e)return new Ai;if(e instanceof Ai)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),s=NaN,a=o-i,c=(o+i)/2;return a?(t===o?s=(n-r)/a+(n<r)*6:n===o?s=(r-t)/a+2:s=(t-n)/a+4,a/=c<.5?o+i:2-o-i,s*=60):a=c>0&&c<1?0:s,new Ai(s,a,c,e.opacity)}function yd(e,t,n,r){return arguments.length===1?PA(e):new Ai(e,t,n,r??1)}function Ai(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}fs(Ai,yd,ha(Qi,{brighter(e){return e=e==null?Ec:Math.pow(Ec,e),new Ai(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?da:Math.pow(da,e),new Ai(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Ve(ov(e>=240?e-240:e+120,i,r),ov(e,i,r),ov(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Ai(UA(this.h),Z0(this.s),Z0(this.l),K0(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=K0(this.opacity);return`${e===1?"hsl(":"hsla("}${UA(this.h)}, ${Z0(this.s)*100}%, ${Z0(this.l)*100}%${e===1?")":`, ${e})`}`}}));function UA(e){return e=(e||0)%360,e<0?e+360:e}function Z0(e){return Math.max(0,Math.min(1,e||0))}function ov(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var Q0=Math.PI/180,J0=180/Math.PI;var tg=18,zA=.96422,VA=1,qA=.82521,jA=4/29,eu=6/29,YA=3*eu*eu,L9=eu*eu*eu;function WA(e){if(e instanceof Ji)return new Ji(e.l,e.a,e.b,e.opacity);if(e instanceof hs)return GA(e);e instanceof Ve||(e=md(e));var t=lv(e.r),n=lv(e.g),r=lv(e.b),i=sv((.2225045*t+.7168786*n+.0606169*r)/VA),o,s;return t===n&&n===r?o=s=i:(o=sv((.4360747*t+.3850649*n+.1430804*r)/zA),s=sv((.0139322*t+.0971045*n+.7141733*r)/qA)),new Ji(116*i-16,500*(o-i),200*(i-s),e.opacity)}function nu(e,t,n,r){return arguments.length===1?WA(e):new Ji(e,t,n,r??1)}function Ji(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}fs(Ji,nu,ha(Qi,{brighter(e){return new Ji(this.l+tg*(e??1),this.a,this.b,this.opacity)},darker(e){return new Ji(this.l-tg*(e??1),this.a,this.b,this.opacity)},rgb(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,n=isNaN(this.b)?e:e-this.b/200;return t=zA*av(t),e=VA*av(e),n=qA*av(n),new Ve(cv(3.1338561*t-1.6168667*e-.4906146*n),cv(-.9787684*t+1.9161415*e+.033454*n),cv(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}}));function sv(e){return e>L9?Math.pow(e,1/3):e/YA+jA}function av(e){return e>eu?e*e*e:YA*(e-jA)}function cv(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function lv(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function C9(e){if(e instanceof hs)return new hs(e.h,e.c,e.l,e.opacity);if(e instanceof Ji||(e=WA(e)),e.a===0&&e.b===0)return new hs(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*J0;return new hs(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function gd(e,t,n,r){return arguments.length===1?C9(e):new hs(e,t,n,r??1)}function hs(e,t,n,r){this.h=+e,this.c=+t,this.l=+n,this.opacity=+r}function GA(e){if(isNaN(e.h))return new Ji(e.l,0,0,e.opacity);var t=e.h*Q0;return new Ji(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}fs(hs,gd,ha(Qi,{brighter(e){return new hs(this.h,this.c,this.l+tg*(e??1),this.opacity)},darker(e){return new hs(this.h,this.c,this.l-tg*(e??1),this.opacity)},rgb(){return GA(this).rgb()}}));var KA=-.14861,uv=1.78277,fv=-.29227,eg=-.90649,bd=1.97294,XA=bd*eg,HA=bd*uv,ZA=uv*fv-eg*KA;function k9(e){if(e instanceof Dc)return new Dc(e.h,e.s,e.l,e.opacity);e instanceof Ve||(e=md(e));var t=e.r/255,n=e.g/255,r=e.b/255,i=(ZA*r+XA*t-HA*n)/(ZA+XA-HA),o=r-i,s=(bd*(n-i)-fv*o)/eg,a=Math.sqrt(s*s+o*o)/(bd*i*(1-i)),c=a?Math.atan2(s,o)*J0-120:NaN;return new Dc(c<0?c+360:c,a,i,e.opacity)}function qn(e,t,n,r){return arguments.length===1?k9(e):new Dc(e,t,n,r??1)}function Dc(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}fs(Dc,qn,ha(Qi,{brighter(e){return e=e==null?Ec:Math.pow(Ec,e),new Dc(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?da:Math.pow(da,e),new Dc(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*Q0,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(e),i=Math.sin(e);return new Ve(255*(t+n*(KA*r+uv*i)),255*(t+n*(fv*r+eg*i)),255*(t+n*(bd*r)),this.opacity)}}));function hv(e,t,n,r,i){var o=e*e,s=o*e;return((1-3*e+3*o-s)*t+(4-6*o+3*s)*n+(1+3*e+3*o-3*s)*r+s*i)/6}function QA(e){var t=e.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),i=e[r],o=e[r+1],s=r>0?e[r-1]:2*i-o,a=r<t-1?e[r+2]:2*o-i;return hv((n-r/t)*t,s,i,o,a)}}function JA(e){var t=e.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*t),i=e[(r+t-1)%t],o=e[r%t],s=e[(r+1)%t],a=e[(r+2)%t];return hv((n-r/t)*t,i,o,s,a)}}var ru=e=>()=>e;function t4(e,t){return function(n){return e+n*t}}function R9(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function iu(e,t){var n=t-e;return n?t4(e,n>180||n<-180?n-360*Math.round(n/360):n):ru(isNaN(e)?t:e)}function e4(e){return(e=+e)==1?_e:function(t,n){return n-t?R9(t,n,e):ru(isNaN(t)?n:t)}}function _e(e,t){var n=t-e;return n?t4(e,n):ru(isNaN(e)?t:e)}var Yr=function e(t){var n=e4(t);function r(i,o){var s=n((i=en(i)).r,(o=en(o)).r),a=n(i.g,o.g),c=n(i.b,o.b),l=_e(i.opacity,o.opacity);return function(u){return i.r=s(u),i.g=a(u),i.b=c(u),i.opacity=l(u),i+""}}return r.gamma=e,r}(1);function n4(e){return function(t){var n=t.length,r=new Array(n),i=new Array(n),o=new Array(n),s,a;for(s=0;s<n;++s)a=en(t[s]),r[s]=a.r||0,i[s]=a.g||0,o[s]=a.b||0;return r=e(r),i=e(i),o=e(o),a.opacity=1,function(c){return a.r=r(c),a.g=i(c),a.b=o(c),a+""}}}var dv=n4(QA),$9=n4(JA);function r4(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(o){for(i=0;i<n;++i)r[i]=e[i]*(1-o)+t[i]*o;return r}}function i4(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function o4(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=new Array(r),o=new Array(n),s;for(s=0;s<r;++s)i[s]=Tr(e[s],t[s]);for(;s<n;++s)o[s]=t[s];return function(a){for(s=0;s<r;++s)o[s]=i[s](a);return o}}function s4(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function ge(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function a4(e,t){var n={},r={},i;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(i in t)i in e?n[i]=Tr(e[i],t[i]):r[i]=t[i];return function(o){for(i in n)r[i]=n[i](o);return r}}var mv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,pv=new RegExp(mv.source,"g");function U9(e){return function(){return e}}function P9(e){return function(t){return e(t)+""}}function xd(e,t){var n=mv.lastIndex=pv.lastIndex=0,r,i,o,s=-1,a=[],c=[];for(e=e+"",t=t+"";(r=mv.exec(e))&&(i=pv.exec(t));)(o=i.index)>n&&(o=t.slice(n,o),a[s]?a[s]+=o:a[++s]=o),(r=r[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,c.push({i:s,x:ge(r,i)})),n=pv.lastIndex;return n<t.length&&(o=t.slice(n),a[s]?a[s]+=o:a[++s]=o),a.length<2?c[0]?P9(c[0].x):U9(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 Tr(e,t){var n=typeof t,r;return t==null||n==="boolean"?ru(t):(n==="number"?ge:n==="string"?(r=Mr(t))?(t=r,Yr):xd:t instanceof Mr?Yr:t instanceof Date?s4:i4(t)?r4:Array.isArray(t)?o4:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?a4:ge)(e,t)}function Nc(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}var c4=180/Math.PI,ng={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function yv(e,t,n,r,i,o){var s,a,c;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,c/=a),e*r<t*n&&(e=-e,t=-t,c=-c,s=-s),{translateX:i,translateY:o,rotate:Math.atan2(t,e)*c4,skewX:Math.atan(c)*c4,scaleX:s,scaleY:a}}var rg;function l4(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?ng:yv(t.a,t.b,t.c,t.d,t.e,t.f)}function u4(e){return e==null?ng:(rg||(rg=document.createElementNS("http://www.w3.org/2000/svg","g")),rg.setAttribute("transform",e),(e=rg.transform.baseVal.consolidate())?(e=e.matrix,yv(e.a,e.b,e.c,e.d,e.e,e.f)):ng)}function f4(e,t,n,r){function i(l){return l.length?l.pop()+" ":""}function o(l,u,f,h,d,p){if(l!==f||u!==h){var y=d.push("translate(",null,t,null,n);p.push({i:y-4,x:ge(l,f)},{i:y-2,x:ge(u,h)})}else(f||h)&&d.push("translate("+f+t+h+n)}function s(l,u,f,h){l!==u?(l-u>180?u+=360:u-l>180&&(l+=360),h.push({i:f.push(i(f)+"rotate(",null,r)-2,x:ge(l,u)})):u&&f.push(i(f)+"rotate("+u+r)}function a(l,u,f,h){l!==u?h.push({i:f.push(i(f)+"skewX(",null,r)-2,x:ge(l,u)}):u&&f.push(i(f)+"skewX("+u+r)}function c(l,u,f,h,d,p){if(l!==f||u!==h){var y=d.push(i(d)+"scale(",null,",",null,")");p.push({i:y-4,x:ge(l,f)},{i:y-2,x:ge(u,h)})}else(f!==1||h!==1)&&d.push(i(d)+"scale("+f+","+h+")")}return function(l,u){var f=[],h=[];return l=e(l),u=e(u),o(l.translateX,l.translateY,u.translateX,u.translateY,f,h),s(l.rotate,u.rotate,f,h),a(l.skewX,u.skewX,f,h),c(l.scaleX,l.scaleY,u.scaleX,u.scaleY,f,h),l=u=null,function(d){for(var p=-1,y=h.length,b;++p<y;)f[(b=h[p]).i]=b.x(d);return f.join("")}}}var gv=f4(l4,"px, ","px)","deg)"),bv=f4(u4,", ",")",")");var z9=1e-12;function h4(e){return((e=Math.exp(e))+1/e)/2}function V9(e){return((e=Math.exp(e))-1/e)/2}function q9(e){return((e=Math.exp(2*e))-1)/(e+1)}var xv=function e(t,n,r){function i(o,s){var a=o[0],c=o[1],l=o[2],u=s[0],f=s[1],h=s[2],d=u-a,p=f-c,y=d*d+p*p,b,m;if(y<z9)m=Math.log(h/l)/t,b=function(M){return[a+M*d,c+M*p,l*Math.exp(t*M*m)]};else{var g=Math.sqrt(y),x=(h*h-l*l+r*y)/(2*l*n*g),w=(h*h-l*l-r*y)/(2*h*n*g),v=Math.log(Math.sqrt(x*x+1)-x),_=Math.log(Math.sqrt(w*w+1)-w);m=(_-v)/t,b=function(M){var E=M*m,N=h4(v),I=l/(n*g)*(N*q9(t*E+v)-V9(v));return[a+I*d,c+I*p,l*N/h4(t*E+v)]}}return b.duration=m*1e3*t/Math.SQRT2,b}return i.rho=function(o){var s=Math.max(.001,+o),a=s*s,c=a*a;return e(s,a,c)},i}(Math.SQRT2,2,4);function d4(e){return function(t,n){var r=e((t=yd(t)).h,(n=yd(n)).h),i=_e(t.s,n.s),o=_e(t.l,n.l),s=_e(t.opacity,n.opacity);return function(a){return t.h=r(a),t.s=i(a),t.l=o(a),t.opacity=s(a),t+""}}}var wv=d4(iu),j9=d4(_e);function ig(e,t){var n=_e((e=nu(e)).l,(t=nu(t)).l),r=_e(e.a,t.a),i=_e(e.b,t.b),o=_e(e.opacity,t.opacity);return function(s){return e.l=n(s),e.a=r(s),e.b=i(s),e.opacity=o(s),e+""}}function p4(e){return function(t,n){var r=e((t=gd(t)).h,(n=gd(n)).h),i=_e(t.c,n.c),o=_e(t.l,n.l),s=_e(t.opacity,n.opacity);return function(a){return t.h=r(a),t.c=i(a),t.l=o(a),t.opacity=s(a),t+""}}}var _v=p4(iu),Y9=p4(_e);function m4(e){return function t(n){n=+n;function r(i,o){var s=e((i=qn(i)).h,(o=qn(o)).h),a=_e(i.s,o.s),c=_e(i.l,o.l),l=_e(i.opacity,o.opacity);return function(u){return i.h=s(u),i.s=a(u),i.l=c(Math.pow(u,n)),i.opacity=l(u),i+""}}return r.gamma=t,r}(1)}var W9=m4(iu),ou=m4(_e);function to(e,t){t===void 0&&(t=e,e=Tr);for(var n=0,r=t.length-1,i=t[0],o=new Array(r<0?0:r);n<r;)o[n]=e(i,i=t[++n]);return function(s){var a=Math.max(0,Math.min(r-1,Math.floor(s*=r)));return o[a](s-a)}}function Dn(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e(r/(t-1));return n}var su=0,_d=0,wd=0,g4=1e3,og,vd,sg=0,Oc=0,ag=0,Sd=typeof performance=="object"&&performance.now?performance:Date,b4=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Md(){return Oc||(b4(G9),Oc=Sd.now()+ag)}function G9(){Oc=0}function Id(){this._call=this._time=this._next=null}Id.prototype=cg.prototype={constructor:Id,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Md():+n)+(t==null?0:+t),!this._next&&vd!==this&&(vd?vd._next=this:og=this,vd=this),this._call=e,this._time=n,vv()},stop:function(){this._call&&(this._call=null,this._time=1/0,vv())}};function cg(e,t,n){var r=new Id;return r.restart(e,t,n),r}function x4(){Md(),++su;for(var e=og,t;e;)(t=Oc-e._time)>=0&&e._call.call(void 0,t),e=e._next;--su}function y4(){Oc=(sg=Sd.now())+ag,su=_d=0;try{x4()}finally{su=0,H9(),Oc=0}}function X9(){var e=Sd.now(),t=e-sg;t>g4&&(ag-=t,sg=e)}function H9(){for(var e,t=og,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:og=n);vd=e,vv(r)}function vv(e){if(!su){_d&&(_d=clearTimeout(_d));var t=e-Oc;t>24?(e<1/0&&(_d=setTimeout(y4,e-Sd.now()-ag)),wd&&(wd=clearInterval(wd))):(wd||(sg=Sd.now(),wd=setInterval(X9,g4)),su=1,b4(y4))}}function lg(e,t,n){var r=new Id;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var Z9=Ic("start","end","cancel","interrupt"),K9=[],v4=0,w4=1,fg=2,ug=3,_4=4,hg=5,Td=6;function pa(e,t,n,r,i,o){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;Q9(e,n,{name:t,index:r,group:i,on:Z9,tween:K9,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:v4})}function Ad(e,t){var n=Je(e,t);if(n.state>v4)throw new Error("too late; already scheduled");return n}function _n(e,t){var n=Je(e,t);if(n.state>ug)throw new Error("too late; already running");return n}function Je(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Q9(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=cg(o,0,n.time);function o(l){n.state=w4,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var u,f,h,d;if(n.state!==w4)return c();for(u in r)if(d=r[u],d.name===n.name){if(d.state===ug)return lg(s);d.state===_4?(d.state=Td,d.timer.stop(),d.on.call("interrupt",e,e.__data__,d.index,d.group),delete r[u]):+u<t&&(d.state=Td,d.timer.stop(),d.on.call("cancel",e,e.__data__,d.index,d.group),delete r[u])}if(lg(function(){n.state===ug&&(n.state=_4,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=fg,n.on.call("start",e,e.__data__,n.index,n.group),n.state===fg){for(n.state=ug,i=new Array(h=n.tween.length),u=0,f=-1;u<h;++u)(d=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(i[++f]=d);i.length=f+1}}function a(l){for(var u=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=hg,1),f=-1,h=i.length;++f<h;)i[f].call(e,u);n.state===hg&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Td,n.timer.stop(),delete r[t];for(var l in r)return;delete e.__transition}}function eo(e,t){var n=e.__transition,r,i,o=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((r=n[s]).name!==t){o=!1;continue}i=r.state>fg&&r.state<hg,r.state=Td,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[s]}o&&delete e.__transition}}function S4(e){return this.each(function(){eo(this,e)})}function J9(e,t){var n,r;return function(){var i=_n(this,e),o=i.tween;if(o!==n){r=n=o;for(var s=0,a=r.length;s<a;++s)if(r[s].name===t){r=r.slice(),r.splice(s,1);break}}i.tween=r}}function t$(e,t,n){var r,i;if(typeof n!="function")throw new Error;return function(){var o=_n(this,e),s=o.tween;if(s!==r){i=(r=s).slice();for(var a={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=a;break}c===l&&i.push(a)}o.tween=i}}function I4(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=Je(this.node(),n).tween,i=0,o=r.length,s;i<o;++i)if((s=r[i]).name===e)return s.value;return null}return this.each((t==null?J9:t$)(n,e,t))}function au(e,t,n){var r=e._id;return e.each(function(){var i=_n(this,r);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return Je(i,r).value[t]}}function dg(e,t){var n;return(typeof t=="number"?ge:t instanceof Mr?Yr:(n=Mr(t))?(t=n,Yr):xd)(e,t)}function e$(e){return function(){this.removeAttribute(e)}}function n$(e){return function(){this.removeAttributeNS(e.space,e.local)}}function r$(e,t,n){var r,i=n+"",o;return function(){var s=this.getAttribute(e);return s===i?null:s===r?o:o=t(r=s,n)}}function i$(e,t,n){var r,i=n+"",o;return function(){var s=this.getAttributeNS(e.space,e.local);return s===i?null:s===r?o:o=t(r=s,n)}}function o$(e,t,n){var r,i,o;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),c=a+"",s===c?null:s===r&&c===i?o:(i=c,o=t(r=s,a)))}}function s$(e,t,n){var r,i,o;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),c=a+"",s===c?null:s===r&&c===i?o:(i=c,o=t(r=s,a)))}}function M4(e,t){var n=cs(e),r=n==="transform"?bv:dg;return this.attrTween(e,typeof t=="function"?(n.local?s$:o$)(n,r,au(this,"attr."+e,t)):t==null?(n.local?n$:e$)(n):(n.local?i$:r$)(n,r,t))}function a$(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function c$(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function l$(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&c$(e,o)),n}return i._value=t,i}function u$(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&a$(e,o)),n}return i._value=t,i}function T4(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=cs(e);return this.tween(n,(r.local?l$:u$)(r,t))}function f$(e,t){return function(){Ad(this,e).delay=+t.apply(this,arguments)}}function h$(e,t){return t=+t,function(){Ad(this,e).delay=t}}function A4(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?f$:h$)(t,e)):Je(this.node(),t).delay}function d$(e,t){return function(){_n(this,e).duration=+t.apply(this,arguments)}}function p$(e,t){return t=+t,function(){_n(this,e).duration=t}}function E4(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?d$:p$)(t,e)):Je(this.node(),t).duration}function m$(e,t){if(typeof t!="function")throw new Error;return function(){_n(this,e).ease=t}}function D4(e){var t=this._id;return arguments.length?this.each(m$(t,e)):Je(this.node(),t).ease}function y$(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;_n(this,e).ease=n}}function N4(e){if(typeof e!="function")throw new Error;return this.each(y$(this._id,e))}function O4(e){typeof e!="function"&&(e=ud(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],s=o.length,a=r[i]=[],c,l=0;l<s;++l)(c=o[l])&&e.call(c,c.__data__,l,o)&&a.push(c);return new jn(r,this._parents,this._name,this._id)}function B4(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,i=n.length,o=Math.min(r,i),s=new Array(r),a=0;a<o;++a)for(var c=t[a],l=n[a],u=c.length,f=s[a]=new Array(u),h,d=0;d<u;++d)(h=c[d]||l[d])&&(f[d]=h);for(;a<r;++a)s[a]=t[a];return new jn(s,this._parents,this._name,this._id)}function g$(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function b$(e,t,n){var r,i,o=g$(t)?Ad:_n;return function(){var s=o(this,e),a=s.on;a!==r&&(i=(r=a).copy()).on(t,n),s.on=i}}function F4(e,t){var n=this._id;return arguments.length<2?Je(this.node(),n).on.on(e):this.each(b$(n,e,t))}function x$(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function L4(){return this.on("end.remove",x$(this._id))}function C4(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Mc(e));for(var r=this._groups,i=r.length,o=new Array(i),s=0;s<i;++s)for(var a=r[s],c=a.length,l=o[s]=new Array(c),u,f,h=0;h<c;++h)(u=a[h])&&(f=e.call(u,u.__data__,h,a))&&("__data__"in u&&(f.__data__=u.__data__),l[h]=f,pa(l[h],t,n,h,l,Je(u,n)));return new jn(o,this._parents,t,n)}function k4(e){var t=this._name,n=this._id;typeof e!="function"&&(e=ld(e));for(var r=this._groups,i=r.length,o=[],s=[],a=0;a<i;++a)for(var c=r[a],l=c.length,u,f=0;f<l;++f)if(u=c[f]){for(var h=e.call(u,u.__data__,f,c),d,p=Je(u,n),y=0,b=h.length;y<b;++y)(d=h[y])&&pa(d,t,n,y,h,p);o.push(h),s.push(u)}return new jn(o,s,t,n)}var w$=us.prototype.constructor;function R4(){return new w$(this._groups,this._parents)}function _$(e,t){var n,r,i;return function(){var o=fa(this,e),s=(this.style.removeProperty(e),fa(this,e));return o===s?null:o===n&&s===r?i:i=t(n=o,r=s)}}function $4(e){return function(){this.style.removeProperty(e)}}function v$(e,t,n){var r,i=n+"",o;return function(){var s=fa(this,e);return s===i?null:s===r?o:o=t(r=s,n)}}function S$(e,t,n){var r,i,o;return function(){var s=fa(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),fa(this,e))),s===c?null:s===r&&c===i?o:(i=c,o=t(r=s,a))}}function I$(e,t){var n,r,i,o="style."+t,s="end."+o,a;return function(){var c=_n(this,e),l=c.on,u=c.value[o]==null?a||(a=$4(t)):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(s,i=u),c.on=r}}function U4(e,t,n){var r=(e+="")=="transform"?gv:dg;return t==null?this.styleTween(e,_$(e,r)).on("end.style."+e,$4(e)):typeof t=="function"?this.styleTween(e,S$(e,r,au(this,"style."+e,t))).each(I$(this._id,e)):this.styleTween(e,v$(e,r,t),n).on("end.style."+e,null)}function M$(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function T$(e,t,n){var r,i;function o(){var s=t.apply(this,arguments);return s!==i&&(r=(i=s)&&M$(e,s,n)),r}return o._value=t,o}function P4(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,T$(e,t,n??""))}function A$(e){return function(){this.textContent=e}}function E$(e){return function(){var t=e(this);this.textContent=t??""}}function z4(e){return this.tween("text",typeof e=="function"?E$(au(this,"text",e)):A$(e==null?"":e+""))}function D$(e){return function(t){this.textContent=e.call(this,t)}}function N$(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&D$(i)),t}return r._value=e,r}function V4(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,N$(e))}function q4(){for(var e=this._name,t=this._id,n=pg(),r=this._groups,i=r.length,o=0;o<i;++o)for(var s=r[o],a=s.length,c,l=0;l<a;++l)if(c=s[l]){var u=Je(c,t);pa(c,e,n,l,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new jn(r,this._parents,e,n)}function j4(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(o,s){var a={value:s},c={value:function(){--i===0&&o()}};n.each(function(){var l=_n(this,r),u=l.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),l.on=t}),i===0&&o()})}var O$=0;function jn(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function Y4(e){return us().transition(e)}function pg(){return++O$}var ds=us.prototype;jn.prototype=Y4.prototype={constructor:jn,select:C4,selectAll:k4,selectChild:ds.selectChild,selectChildren:ds.selectChildren,filter:O4,merge:B4,selection:R4,transition:q4,call:ds.call,nodes:ds.nodes,node:ds.node,size:ds.size,empty:ds.empty,each:ds.each,on:F4,attr:M4,attrTween:T4,style:U4,styleTween:P4,text:z4,textTween:V4,remove:L4,tween:I4,delay:A4,duration:E4,ease:D4,easeVarying:N4,end:j4,[Symbol.iterator]:ds[Symbol.iterator]};function mg(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var B$={time:null,delay:0,duration:250,ease:mg};function F$(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function W4(e){var t,n;e instanceof jn?(t=e._id,e=e._name):(t=pg(),(n=B$).time=Md(),e=e==null?null:e+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var s=r[o],a=s.length,c,l=0;l<a;++l)(c=s[l])&&pa(c,e,t,l,s,n||F$(c,t));return new jn(r,this._parents,e,t)}us.prototype.interrupt=S4;us.prototype.transition=W4;var yg=e=>()=>e;function Sv(e,{sourceEvent:t,target:n,selection:r,mode:i,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},selection:{value:r,enumerable:!0,configurable:!0},mode:{value:i,enumerable:!0,configurable:!0},_:{value:o}})}function G4(e){e.stopImmediatePropagation()}function gg(e){e.preventDefault(),e.stopImmediatePropagation()}var X4={name:"drag"},Iv={name:"space"},cu={name:"handle"},lu={name:"center"},{abs:H4,max:Nn,min:On}=Math;function Z4(e){return[+e[0],+e[1]]}function Tv(e){return[Z4(e[0]),Z4(e[1])]}var bg={name:"x",handles:["w","e"].map(Ed),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]]}},xg={name:"y",handles:["n","s"].map(Ed),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]]}},L$={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(Ed),input:function(e){return e==null?null:Tv(e)},output:function(e){return e}},ps={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"},K4={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},Q4={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},C$={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},k$={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function Ed(e){return{type:e}}function R$(e){return!e.ctrlKey&&!e.button}function $$(){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 U$(){return navigator.maxTouchPoints||"ontouchstart"in this}function Mv(e){for(;!e.__brush;)if(!(e=e.parentNode))return;return e.__brush}function P$(e){return e[0][0]===e[1][0]||e[0][1]===e[1][1]}function Av(){return Nv(bg)}function Ev(){return Nv(xg)}function Dv(){return Nv(L$)}function Nv(e){var t=$$,n=R$,r=U$,i=!0,o=Ic("start","brush","end"),s=6,a;function c(b){var m=b.property("__brush",y).selectAll(".overlay").data([Ed("overlay")]);m.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",ps.overlay).merge(m).each(function(){var x=Mv(this).extent;Ut(this).attr("x",x[0][0]).attr("y",x[0][1]).attr("width",x[1][0]-x[0][0]).attr("height",x[1][1]-x[0][1])}),b.selectAll(".selection").data([Ed("selection")]).enter().append("rect").attr("class","selection").attr("cursor",ps.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var g=b.selectAll(".handle").data(e.handles,function(x){return x.type});g.exit().remove(),g.enter().append("rect").attr("class",function(x){return"handle handle--"+x.type}).attr("cursor",function(x){return ps[x.type]}),b.each(l).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",h).filter(r).on("touchstart.brush",h).on("touchmove.brush",d).on("touchend.brush touchcancel.brush",p).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}c.move=function(b,m,g){b.tween?b.on("start.brush",function(x){u(this,arguments).beforestart().start(x)}).on("interrupt.brush end.brush",function(x){u(this,arguments).end(x)}).tween("brush",function(){var x=this,w=x.__brush,v=u(x,arguments),_=w.selection,M=e.input(typeof m=="function"?m.apply(this,arguments):m,w.extent),E=Tr(_,M);function N(I){w.selection=I===1&&M===null?null:E(I),l.call(x),v.brush()}return _!==null&&M!==null?N:N(1)}):b.each(function(){var x=this,w=arguments,v=x.__brush,_=e.input(typeof m=="function"?m.apply(x,w):m,v.extent),M=u(x,w).beforestart();eo(x),v.selection=_===null?null:_,l.call(x),M.start(g).brush(g).end(g)})},c.clear=function(b,m){c.move(b,null,m)};function l(){var b=Ut(this),m=Mv(this).selection;m?(b.selectAll(".selection").style("display",null).attr("x",m[0][0]).attr("y",m[0][1]).attr("width",m[1][0]-m[0][0]).attr("height",m[1][1]-m[0][1]),b.selectAll(".handle").style("display",null).attr("x",function(g){return g.type[g.type.length-1]==="e"?m[1][0]-s/2:m[0][0]-s/2}).attr("y",function(g){return g.type[0]==="s"?m[1][1]-s/2:m[0][1]-s/2}).attr("width",function(g){return g.type==="n"||g.type==="s"?m[1][0]-m[0][0]+s:s}).attr("height",function(g){return g.type==="e"||g.type==="w"?m[1][1]-m[0][1]+s:s})):b.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function u(b,m,g){var x=b.__brush.emitter;return x&&(!g||!x.clean)?x:new f(b,m,g)}function f(b,m,g){this.that=b,this.args=m,this.state=b.__brush,this.active=0,this.clean=g}f.prototype={beforestart:function(){return++this.active===1&&(this.state.emitter=this,this.starting=!0),this},start:function(b,m){return this.starting?(this.starting=!1,this.emit("start",b,m)):this.emit("brush",b),this},brush:function(b,m){return this.emit("brush",b,m),this},end:function(b,m){return--this.active===0&&(delete this.state.emitter,this.emit("end",b,m)),this},emit:function(b,m,g){var x=Ut(this.that).datum();o.call(b,this.that,new Sv(b,{sourceEvent:m,target:c,selection:e.output(this.state.selection),mode:g,dispatch:o}),x)}};function h(b){if(a&&!b.touches||!n.apply(this,arguments))return;var m=this,g=b.target.__data__.type,x=(i&&b.metaKey?g="overlay":g)==="selection"?X4:i&&b.altKey?lu:cu,w=e===xg?null:C$[g],v=e===bg?null:k$[g],_=Mv(m),M=_.extent,E=_.selection,N=M[0][0],I,T,O=M[0][1],B,S,A=M[1][0],D,L,k=M[1][1],C,R,$=0,U=0,G,J=w&&v&&i&&b.shiftKey,et,ot,j=Array.from(b.touches||[b],tt=>{let ne=tt.identifier;return tt=En(tt,m),tt.point0=tt.slice(),tt.identifier=ne,tt});eo(m);var nt=u(m,arguments,!0).beforestart();if(g==="overlay"){E&&(G=!0);let tt=[j[0],j[1]||j[0]];_.selection=E=[[I=e===xg?N:On(tt[0][0],tt[1][0]),B=e===bg?O:On(tt[0][1],tt[1][1])],[D=e===xg?A:Nn(tt[0][0],tt[1][0]),C=e===bg?k:Nn(tt[0][1],tt[1][1])]],j.length>1&&Bt(b)}else I=E[0][0],B=E[0][1],D=E[1][0],C=E[1][1];T=I,S=B,L=D,R=C;var z=Ut(m).attr("pointer-events","none"),X=z.selectAll(".overlay").attr("cursor",ps[g]);if(b.touches)nt.moved=P,nt.ended=ft;else{var rt=Ut(b.view).on("mousemove.brush",P,!0).on("mouseup.brush",ft,!0);i&&rt.on("keydown.brush",jt,!0).on("keyup.brush",Yt,!0),hd(b.view)}l.call(m),nt.start(b,x.name);function P(tt){for(let ne of tt.changedTouches||[tt])for(let hr of j)hr.identifier===ne.identifier&&(hr.cur=En(ne,m));if(J&&!et&&!ot&&j.length===1){let ne=j[0];H4(ne.cur[0]-ne[0])>H4(ne.cur[1]-ne[1])?ot=!0:et=!0}for(let ne of j)ne.cur&&(ne[0]=ne.cur[0],ne[1]=ne.cur[1]);G=!0,gg(tt),Bt(tt)}function Bt(tt){let ne=j[0],hr=ne.point0;var Ci;switch($=ne[0]-hr[0],U=ne[1]-hr[1],x){case Iv:case X4:{w&&($=Nn(N-I,On(A-D,$)),T=I+$,L=D+$),v&&(U=Nn(O-B,On(k-C,U)),S=B+U,R=C+U);break}case cu:{j[1]?(w&&(T=Nn(N,On(A,j[0][0])),L=Nn(N,On(A,j[1][0])),w=1),v&&(S=Nn(O,On(k,j[0][1])),R=Nn(O,On(k,j[1][1])),v=1)):(w<0?($=Nn(N-I,On(A-I,$)),T=I+$,L=D):w>0&&($=Nn(N-D,On(A-D,$)),T=I,L=D+$),v<0?(U=Nn(O-B,On(k-B,U)),S=B+U,R=C):v>0&&(U=Nn(O-C,On(k-C,U)),S=B,R=C+U));break}case lu:{w&&(T=Nn(N,On(A,I-$*w)),L=Nn(N,On(A,D+$*w))),v&&(S=Nn(O,On(k,B-U*v)),R=Nn(O,On(k,C+U*v)));break}}L<T&&(w*=-1,Ci=I,I=D,D=Ci,Ci=T,T=L,L=Ci,g in K4&&X.attr("cursor",ps[g=K4[g]])),R<S&&(v*=-1,Ci=B,B=C,C=Ci,Ci=S,S=R,R=Ci,g in Q4&&X.attr("cursor",ps[g=Q4[g]])),_.selection&&(E=_.selection),et&&(T=E[0][0],L=E[1][0]),ot&&(S=E[0][1],R=E[1][1]),(E[0][0]!==T||E[0][1]!==S||E[1][0]!==L||E[1][1]!==R)&&(_.selection=[[T,S],[L,R]],l.call(m),nt.brush(tt,x.name))}function ft(tt){if(G4(tt),tt.touches){if(tt.touches.length)return;a&&clearTimeout(a),a=setTimeout(function(){a=null},500)}else dd(tt.view,G),rt.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);z.attr("pointer-events","all"),X.attr("cursor",ps.overlay),_.selection&&(E=_.selection),P$(E)&&(_.selection=null,l.call(m)),nt.end(tt,x.name)}function jt(tt){switch(tt.keyCode){case 16:{J=w&&v;break}case 18:{x===cu&&(w&&(D=L-$*w,I=T+$*w),v&&(C=R-U*v,B=S+U*v),x=lu,Bt(tt));break}case 32:{(x===cu||x===lu)&&(w<0?D=L-$:w>0&&(I=T-$),v<0?C=R-U:v>0&&(B=S-U),x=Iv,X.attr("cursor",ps.selection),Bt(tt));break}default:return}gg(tt)}function Yt(tt){switch(tt.keyCode){case 16:{J&&(et=ot=J=!1,Bt(tt));break}case 18:{x===lu&&(w<0?D=L:w>0&&(I=T),v<0?C=R:v>0&&(B=S),x=cu,Bt(tt));break}case 32:{x===Iv&&(tt.altKey?(w&&(D=L-$*w,I=T+$*w),v&&(C=R-U*v,B=S+U*v),x=lu):(w<0?D=L:w>0&&(I=T),v<0?C=R:v>0&&(B=S),x=cu),X.attr("cursor",ps[g]),Bt(tt));break}default:return}gg(tt)}}function d(b){u(this,arguments).moved(b)}function p(b){u(this,arguments).ended(b)}function y(){var b=this.__brush||{selection:null};return b.extent=Tv(t.apply(this,arguments)),b.dim=e,b}return c.extent=function(b){return arguments.length?(t=typeof b=="function"?b:yg(Tv(b)),c):t},c.filter=function(b){return arguments.length?(n=typeof b=="function"?b:yg(!!b),c):n},c.touchable=function(b){return arguments.length?(r=typeof b=="function"?b:yg(!!b),c):r},c.handleSize=function(b){return arguments.length?(s=+b,c):s},c.keyModifiers=function(b){return arguments.length?(i=!!b,c):i},c.on=function(){var b=o.on.apply(o,arguments);return b===o?c:b},c}var Ov=Math.PI,Bv=2*Ov,Bc=1e-6,z$=Bv-Bc;function J4(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function V$(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return J4;let n=10**t;return function(r){this._+=r[0];for(let i=1,o=r.length;i<o;++i)this._+=Math.round(arguments[i]*n)/n+r[i]}}var ma=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?J4:V$(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,r,i){this._append`Q${+t},${+n},${this._x1=+r},${this._y1=+i}`}bezierCurveTo(t,n,r,i,o,s){this._append`C${+t},${+n},${+r},${+i},${this._x1=+o},${this._y1=+s}`}arcTo(t,n,r,i,o){if(t=+t,n=+n,r=+r,i=+i,o=+o,o<0)throw new Error(`negative radius: ${o}`);let s=this._x1,a=this._y1,c=r-t,l=i-n,u=s-t,f=a-n,h=u*u+f*f;if(this._x1===null)this._append`M${this._x1=t},${this._y1=n}`;else if(h>Bc)if(!(Math.abs(f*c-l*u)>Bc)||!o)this._append`L${this._x1=t},${this._y1=n}`;else{let d=r-s,p=i-a,y=c*c+l*l,b=d*d+p*p,m=Math.sqrt(y),g=Math.sqrt(h),x=o*Math.tan((Ov-Math.acos((y+h-b)/(2*m*g)))/2),w=x/g,v=x/m;Math.abs(w-1)>Bc&&this._append`L${t+w*u},${n+w*f}`,this._append`A${o},${o},0,0,${+(f*d>u*p)},${this._x1=t+v*c},${this._y1=n+v*l}`}}arc(t,n,r,i,o,s){if(t=+t,n=+n,r=+r,s=!!s,r<0)throw new Error(`negative radius: ${r}`);let a=r*Math.cos(i),c=r*Math.sin(i),l=t+a,u=n+c,f=1^s,h=s?i-o:o-i;this._x1===null?this._append`M${l},${u}`:(Math.abs(this._x1-l)>Bc||Math.abs(this._y1-u)>Bc)&&this._append`L${l},${u}`,r&&(h<0&&(h=h%Bv+Bv),h>z$?this._append`A${r},${r},0,1,${f},${t-a},${n-c}A${r},${r},0,1,${f},${this._x1=l},${this._y1=u}`:h>Bc&&this._append`A${r},${r},0,${+(h>=Ov)},${f},${this._x1=t+r*Math.cos(o)},${this._y1=n+r*Math.sin(o)}`)}rect(t,n,r,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}};function t8(){return new ma}t8.prototype=ma.prototype;function Yn(e=3){return new ma(+e)}var q$=Array.prototype,wg=q$.slice;function e8(e,t){return e-t}function n8(e){for(var t=0,n=e.length,r=e[n-1][1]*e[0][0]-e[n-1][0]*e[0][1];++t<n;)r+=e[t-1][1]*e[t][0]-e[t-1][0]*e[t][1];return r}var no=e=>()=>e;function r8(e,t){for(var n=-1,r=t.length,i;++n<r;)if(i=j$(e,t[n]))return i;return 0}function j$(e,t){for(var n=t[0],r=t[1],i=-1,o=0,s=e.length,a=s-1;o<s;a=o++){var c=e[o],l=c[0],u=c[1],f=e[a],h=f[0],d=f[1];if(Y$(c,f,t))return 0;u>r!=d>r&&n<(h-l)*(r-u)/(d-u)+l&&(i=-i)}return i}function Y$(e,t,n){var r;return W$(e,t,n)&&G$(e[r=+(e[0]===t[0])],n[r],t[r])}function W$(e,t,n){return(t[0]-e[0])*(n[1]-e[1])===(n[0]-e[0])*(t[1]-e[1])}function G$(e,t,n){return e<=t&&t<=n||n<=t&&t<=e}function i8(){}var ms=[[],[[[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 ya(){var e=1,t=1,n=la,r=c;function i(l){var u=n(l);if(Array.isArray(u))u=u.slice().sort(e8);else{let f=ie(l,X$);for(u=xn(...Kl(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 h=[],d=[];return s(l,f,function(p){r(p,l,f),n8(p)>0?h.push([p]):d.push(p)}),d.forEach(function(p){for(var y=0,b=h.length,m;y<b;++y)if(r8((m=h[y])[0],p)!==-1){m.push(p);return}}),{type:"MultiPolygon",value:u,coordinates:h}}function s(l,u,f){var h=new Array,d=new Array,p,y,b,m,g,x;for(p=y=-1,m=Fc(l[0],u),ms[m<<1].forEach(w);++p<e-1;)b=m,m=Fc(l[p+1],u),ms[b|m<<1].forEach(w);for(ms[m<<0].forEach(w);++y<t-1;){for(p=-1,m=Fc(l[y*e+e],u),g=Fc(l[y*e],u),ms[m<<1|g<<2].forEach(w);++p<e-1;)b=m,m=Fc(l[y*e+e+p+1],u),x=g,g=Fc(l[y*e+p+1],u),ms[b|m<<1|g<<2|x<<3].forEach(w);ms[m|g<<3].forEach(w)}for(p=-1,g=l[y*e]>=u,ms[g<<2].forEach(w);++p<e-1;)x=g,g=Fc(l[y*e+p+1],u),ms[g<<2|x<<3].forEach(w);ms[g<<3].forEach(w);function w(v){var _=[v[0][0]+p,v[0][1]+y],M=[v[1][0]+p,v[1][1]+y],E=a(_),N=a(M),I,T;(I=d[E])?(T=h[N])?(delete d[I.end],delete h[T.start],I===T?(I.ring.push(M),f(I.ring)):h[I.start]=d[T.end]={start:I.start,end:T.end,ring:I.ring.concat(T.ring)}):(delete d[I.end],I.ring.push(M),d[I.end=N]=I):(I=h[N])?(T=d[E])?(delete h[I.start],delete d[T.end],I===T?(I.ring.push(M),f(I.ring)):h[T.start]=d[I.end]={start:T.start,end:I.end,ring:T.ring.concat(I.ring)}):(delete h[I.start],I.ring.unshift(_),h[I.start=E]=I):h[E]=d[N]={start:E,end:N,ring:[_,M]}}}function a(l){return l[0]*2+l[1]*(e+1)*4}function c(l,u,f){l.forEach(function(h){var d=h[0],p=h[1],y=d|0,b=p|0,m=Fv(u[b*e+y]);d>0&&d<e&&y===d&&(h[0]=o8(d,Fv(u[b*e+y-1]),m,f)),p>0&&p<t&&b===p&&(h[1]=o8(p,Fv(u[(b-1)*e+y]),m,f))})}return i.contour=o,i.size=function(l){if(!arguments.length)return[e,t];var u=Math.floor(l[0]),f=Math.floor(l[1]);if(!(u>=0&&f>=0))throw new Error("invalid size");return e=u,t=f,i},i.thresholds=function(l){return arguments.length?(n=typeof l=="function"?l:Array.isArray(l)?no(wg.call(l)):no(l),i):n},i.smooth=function(l){return arguments.length?(r=l?c:i8,i):r===c},i}function X$(e){return isFinite(e)?e:NaN}function Fc(e,t){return e==null?!1:+e>=t}function Fv(e){return e==null||isNaN(e=+e)?-1/0:e}function o8(e,t,n,r){let i=r-t,o=n-t,s=isFinite(i)||isFinite(o)?i/o:Math.sign(i)/Math.sign(o);return isNaN(s)?e:e+s-.5}function H$(e){return e[0]}function Z$(e){return e[1]}function K$(){return 1}function Lv(){var e=H$,t=Z$,n=K$,r=960,i=500,o=20,s=2,a=o*3,c=r+a*2>>s,l=i+a*2>>s,u=no(20);function f(g){var x=new Float32Array(c*l),w=Math.pow(2,-s),v=-1;for(let B of g){var _=(e(B,++v,g)+a)*w,M=(t(B,v,g)+a)*w,E=+n(B,v,g);if(E&&_>=0&&_<c&&M>=0&&M<l){var N=Math.floor(_),I=Math.floor(M),T=_-N-.5,O=M-I-.5;x[N+I*c]+=(1-T)*(1-O)*E,x[N+1+I*c]+=T*(1-O)*E,x[N+1+(I+1)*c]+=T*O*E,x[N+(I+1)*c]+=(1-T)*O*E}}return rd({data:x,width:c,height:l},o*w),x}function h(g){var x=f(g),w=u(x),v=Math.pow(2,2*s);return Array.isArray(w)||(w=xn(Number.MIN_VALUE,$t(x)/v,w)),ya().size([c,l]).thresholds(w.map(_=>_*v))(x).map((_,M)=>(_.value=+w[M],d(_)))}h.contours=function(g){var x=f(g),w=ya().size([c,l]),v=Math.pow(2,2*s),_=M=>{M=+M;var E=d(w.contour(x,M*v));return E.value=M,E};return Object.defineProperty(_,"max",{get:()=>$t(x)/v}),_};function d(g){return g.coordinates.forEach(p),g}function p(g){g.forEach(y)}function y(g){g.forEach(b)}function b(g){g[0]=g[0]*Math.pow(2,s)-a,g[1]=g[1]*Math.pow(2,s)-a}function m(){return a=o*3,c=r+a*2>>s,l=i+a*2>>s,h}return h.x=function(g){return arguments.length?(e=typeof g=="function"?g:no(+g),h):e},h.y=function(g){return arguments.length?(t=typeof g=="function"?g:no(+g),h):t},h.weight=function(g){return arguments.length?(n=typeof g=="function"?g:no(+g),h):n},h.size=function(g){if(!arguments.length)return[r,i];var x=+g[0],w=+g[1];if(!(x>=0&&w>=0))throw new Error("invalid size");return r=x,i=w,m()},h.cellSize=function(g){if(!arguments.length)return 1<<s;if(!((g=+g)>=1))throw new Error("invalid cell size");return s=Math.floor(Math.log(g)/Math.LN2),m()},h.thresholds=function(g){return arguments.length?(u=typeof g=="function"?g:Array.isArray(g)?no(wg.call(g)):no(g),h):u},h.bandwidth=function(g){if(!arguments.length)return Math.sqrt(o*(o+1));if(!((g=+g)>=0))throw new Error("invalid bandwidth");return o=(Math.sqrt(4*g*g+1)-1)/2,m()},h}var Zt=11102230246251565e-32,qe=134217729,Dd=(3+8*Zt)*Zt;function Lc(e,t,n,r,i){let o,s,a,c,l=t[0],u=r[0],f=0,h=0;u>l==u>-l?(o=l,l=t[++f]):(o=u,u=r[++h]);let d=0;if(f<e&&h<n)for(u>l==u>-l?(s=l+o,a=o-(s-l),l=t[++f]):(s=u+o,a=o-(s-u),u=r[++h]),o=s,a!==0&&(i[d++]=a);f<e&&h<n;)u>l==u>-l?(s=o+l,c=s-o,a=o-(s-c)+(l-c),l=t[++f]):(s=o+u,c=s-o,a=o-(s-c)+(u-c),u=r[++h]),o=s,a!==0&&(i[d++]=a);for(;f<e;)s=o+l,c=s-o,a=o-(s-c)+(l-c),l=t[++f],o=s,a!==0&&(i[d++]=a);for(;h<n;)s=o+u,c=s-o,a=o-(s-c)+(u-c),u=r[++h],o=s,a!==0&&(i[d++]=a);return(o!==0||d===0)&&(i[d++]=o),d}function Nd(e,t){let n=t[0];for(let r=1;r<e;r++)n+=t[r];return n}function V(e){return new Float64Array(e)}var Q$=(3+16*Zt)*Zt,J$=(2+12*Zt)*Zt,tU=(9+64*Zt)*Zt*Zt,uu=V(4),s8=V(8),a8=V(12),c8=V(16),Wn=V(4);function eU(e,t,n,r,i,o,s){let a,c,l,u,f,h,d,p,y,b,m,g,x,w,v,_,M,E,N=e-i,I=n-i,T=t-o,O=r-o;w=N*O,h=qe*N,d=h-(h-N),p=N-d,h=qe*O,y=h-(h-O),b=O-y,v=p*b-(w-d*y-p*y-d*b),_=T*I,h=qe*T,d=h-(h-T),p=T-d,h=qe*I,y=h-(h-I),b=I-y,M=p*b-(_-d*y-p*y-d*b),m=v-M,f=v-m,uu[0]=v-(m+f)+(f-M),g=w+m,f=g-w,x=w-(g-f)+(m-f),m=x-_,f=x-m,uu[1]=x-(m+f)+(f-_),E=g+m,f=E-g,uu[2]=g-(E-f)+(m-f),uu[3]=E;let B=Nd(4,uu),S=J$*s;if(B>=S||-B>=S||(f=e-N,a=e-(N+f)+(f-i),f=n-I,l=n-(I+f)+(f-i),f=t-T,c=t-(T+f)+(f-o),f=r-O,u=r-(O+f)+(f-o),a===0&&c===0&&l===0&&u===0)||(S=tU*s+Dd*Math.abs(B),B+=N*u+O*a-(T*l+I*c),B>=S||-B>=S))return B;w=a*O,h=qe*a,d=h-(h-a),p=a-d,h=qe*O,y=h-(h-O),b=O-y,v=p*b-(w-d*y-p*y-d*b),_=c*I,h=qe*c,d=h-(h-c),p=c-d,h=qe*I,y=h-(h-I),b=I-y,M=p*b-(_-d*y-p*y-d*b),m=v-M,f=v-m,Wn[0]=v-(m+f)+(f-M),g=w+m,f=g-w,x=w-(g-f)+(m-f),m=x-_,f=x-m,Wn[1]=x-(m+f)+(f-_),E=g+m,f=E-g,Wn[2]=g-(E-f)+(m-f),Wn[3]=E;let A=Lc(4,uu,4,Wn,s8);w=N*u,h=qe*N,d=h-(h-N),p=N-d,h=qe*u,y=h-(h-u),b=u-y,v=p*b-(w-d*y-p*y-d*b),_=T*l,h=qe*T,d=h-(h-T),p=T-d,h=qe*l,y=h-(h-l),b=l-y,M=p*b-(_-d*y-p*y-d*b),m=v-M,f=v-m,Wn[0]=v-(m+f)+(f-M),g=w+m,f=g-w,x=w-(g-f)+(m-f),m=x-_,f=x-m,Wn[1]=x-(m+f)+(f-_),E=g+m,f=E-g,Wn[2]=g-(E-f)+(m-f),Wn[3]=E;let D=Lc(A,s8,4,Wn,a8);w=a*u,h=qe*a,d=h-(h-a),p=a-d,h=qe*u,y=h-(h-u),b=u-y,v=p*b-(w-d*y-p*y-d*b),_=c*l,h=qe*c,d=h-(h-c),p=c-d,h=qe*l,y=h-(h-l),b=l-y,M=p*b-(_-d*y-p*y-d*b),m=v-M,f=v-m,Wn[0]=v-(m+f)+(f-M),g=w+m,f=g-w,x=w-(g-f)+(m-f),m=x-_,f=x-m,Wn[1]=x-(m+f)+(f-_),E=g+m,f=E-g,Wn[2]=g-(E-f)+(m-f),Wn[3]=E;let L=Lc(D,a8,4,Wn,c8);return c8[L-1]}function fu(e,t,n,r,i,o){let s=(t-o)*(n-i),a=(e-i)*(r-o),c=s-a;if(s===0||a===0||s>0!=a>0)return c;let l=Math.abs(s+a);return Math.abs(c)>=Q$*l?c:-eU(e,t,n,r,i,o,l)}var Ppt=(7+56*Zt)*Zt,zpt=(3+28*Zt)*Zt,Vpt=(26+288*Zt)*Zt*Zt,qpt=V(4),jpt=V(4),Ypt=V(4),Wpt=V(4),Gpt=V(4),Xpt=V(4),Hpt=V(4),Zpt=V(4),Kpt=V(4),Qpt=V(8),Jpt=V(8),tmt=V(8),emt=V(4),nmt=V(8),rmt=V(8),imt=V(8),omt=V(12),smt=V(192),amt=V(192);var umt=(10+96*Zt)*Zt,fmt=(4+48*Zt)*Zt,hmt=(44+576*Zt)*Zt*Zt,dmt=V(4),pmt=V(4),mmt=V(4),ymt=V(4),gmt=V(4),bmt=V(4),xmt=V(4),wmt=V(4),_mt=V(8),vmt=V(8),Smt=V(8),Imt=V(8),Mmt=V(8),Tmt=V(8),Amt=V(8),Emt=V(8),Dmt=V(8),Nmt=V(4),Omt=V(4),Bmt=V(4),Fmt=V(8),Lmt=V(16),Cmt=V(16),kmt=V(16),Rmt=V(32),$mt=V(32),Umt=V(48),Pmt=V(64),zmt=V(1152),Vmt=V(1152);var Wmt=(16+224*Zt)*Zt,Gmt=(5+72*Zt)*Zt,Xmt=(71+1408*Zt)*Zt*Zt,Hmt=V(4),Zmt=V(4),Kmt=V(4),Qmt=V(4),Jmt=V(4),tyt=V(4),eyt=V(4),nyt=V(4),ryt=V(4),iyt=V(4),oyt=V(24),syt=V(24),ayt=V(24),cyt=V(24),lyt=V(24),uyt=V(24),fyt=V(24),hyt=V(24),dyt=V(24),pyt=V(24),myt=V(1152),yyt=V(1152),gyt=V(1152),byt=V(1152),xyt=V(1152),wyt=V(2304),_yt=V(2304),vyt=V(3456),Syt=V(5760),Iyt=V(8),Myt=V(8),Tyt=V(8),Ayt=V(16),Eyt=V(24),Dyt=V(48),Nyt=V(48),Oyt=V(96),Byt=V(192),Fyt=V(384),Lyt=V(384),Cyt=V(384),kyt=V(768);var Ryt=V(96),$yt=V(96),Uyt=V(96),Pyt=V(1152);var u8=Math.pow(2,-52),_g=new Uint32Array(512),du=class e{static from(t,n=aU,r=cU){let i=t.length,o=new Float64Array(i*2);for(let s=0;s<i;s++){let a=t[s];o[2*s]=n(a),o[2*s+1]=r(a)}return new e(o)}constructor(t){let n=t.length>>1;if(n>0&&typeof t[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=t;let r=Math.max(2*n-5,0);this._triangles=new Uint32Array(r*3),this._halfedges=new Int32Array(r*3),this._hashSize=Math.ceil(Math.sqrt(n)),this._hullPrev=new Uint32Array(n),this._hullNext=new Uint32Array(n),this._hullTri=new Uint32Array(n),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(n),this._dists=new Float64Array(n),this.update()}update(){let{coords:t,_hullPrev:n,_hullNext:r,_hullTri:i,_hullHash:o}=this,s=t.length>>1,a=1/0,c=1/0,l=-1/0,u=-1/0;for(let I=0;I<s;I++){let T=t[2*I],O=t[2*I+1];T<a&&(a=T),O<c&&(c=O),T>l&&(l=T),O>u&&(u=O),this._ids[I]=I}let f=(a+l)/2,h=(c+u)/2,d=1/0,p,y,b;for(let I=0;I<s;I++){let T=Cv(f,h,t[2*I],t[2*I+1]);T<d&&(p=I,d=T)}let m=t[2*p],g=t[2*p+1];d=1/0;for(let I=0;I<s;I++){if(I===p)continue;let T=Cv(m,g,t[2*I],t[2*I+1]);T<d&&T>0&&(y=I,d=T)}let x=t[2*y],w=t[2*y+1],v=1/0;for(let I=0;I<s;I++){if(I===p||I===y)continue;let T=oU(m,g,x,w,t[2*I],t[2*I+1]);T<v&&(b=I,v=T)}let _=t[2*b],M=t[2*b+1];if(v===1/0){for(let O=0;O<s;O++)this._dists[O]=t[2*O]-t[0]||t[2*O+1]-t[1];hu(this._ids,this._dists,0,s-1);let I=new Uint32Array(s),T=0;for(let O=0,B=-1/0;O<s;O++){let S=this._ids[O];this._dists[S]>B&&(I[T++]=S,B=this._dists[S])}this.hull=I.subarray(0,T),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(fu(m,g,x,w,_,M)<0){let I=y,T=x,O=w;y=b,x=_,w=M,b=I,_=T,M=O}let E=sU(m,g,x,w,_,M);this._cx=E.x,this._cy=E.y;for(let I=0;I<s;I++)this._dists[I]=Cv(t[2*I],t[2*I+1],E.x,E.y);hu(this._ids,this._dists,0,s-1),this._hullStart=p;let N=3;r[p]=n[b]=y,r[y]=n[p]=b,r[b]=n[y]=p,i[p]=0,i[y]=1,i[b]=2,o.fill(-1),o[this._hashKey(m,g)]=p,o[this._hashKey(x,w)]=y,o[this._hashKey(_,M)]=b,this.trianglesLen=0,this._addTriangle(p,y,b,-1,-1,-1);for(let I=0,T,O;I<this._ids.length;I++){let B=this._ids[I],S=t[2*B],A=t[2*B+1];if(I>0&&Math.abs(S-T)<=u8&&Math.abs(A-O)<=u8||(T=S,O=A,B===p||B===y||B===b))continue;let D=0;for(let $=0,U=this._hashKey(S,A);$<this._hashSize&&(D=o[(U+$)%this._hashSize],!(D!==-1&&D!==r[D]));$++);D=n[D];let L=D,k;for(;k=r[L],fu(S,A,t[2*L],t[2*L+1],t[2*k],t[2*k+1])>=0;)if(L=k,L===D){L=-1;break}if(L===-1)continue;let C=this._addTriangle(L,B,r[L],-1,-1,i[L]);i[B]=this._legalize(C+2),i[L]=C,N++;let R=r[L];for(;k=r[R],fu(S,A,t[2*R],t[2*R+1],t[2*k],t[2*k+1])<0;)C=this._addTriangle(R,B,k,i[B],-1,i[R]),i[B]=this._legalize(C+2),r[R]=R,N--,R=k;if(L===D)for(;k=n[L],fu(S,A,t[2*k],t[2*k+1],t[2*L],t[2*L+1])<0;)C=this._addTriangle(k,B,L,-1,i[L],i[k]),this._legalize(C+2),i[k]=C,r[L]=L,N--,L=k;this._hullStart=n[B]=L,r[L]=n[R]=B,r[B]=R,o[this._hashKey(S,A)]=B,o[this._hashKey(t[2*L],t[2*L+1])]=L}this.hull=new Uint32Array(N);for(let I=0,T=this._hullStart;I<N;I++)this.hull[I]=T,T=r[T];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,n){return Math.floor(rU(t-this._cx,n-this._cy)*this._hashSize)%this._hashSize}_legalize(t){let{_triangles:n,_halfedges:r,coords:i}=this,o=0,s=0;for(;;){let a=r[t],c=t-t%3;if(s=c+(t+2)%3,a===-1){if(o===0)break;t=_g[--o];continue}let l=a-a%3,u=c+(t+1)%3,f=l+(a+2)%3,h=n[s],d=n[t],p=n[u],y=n[f];if(iU(i[2*h],i[2*h+1],i[2*d],i[2*d+1],i[2*p],i[2*p+1],i[2*y],i[2*y+1])){n[t]=y,n[a]=h;let m=r[f];if(m===-1){let x=this._hullStart;do{if(this._hullTri[x]===f){this._hullTri[x]=t;break}x=this._hullPrev[x]}while(x!==this._hullStart)}this._link(t,m),this._link(a,r[s]),this._link(s,f);let g=l+(a+1)%3;o<_g.length&&(_g[o++]=g)}else{if(o===0)break;t=_g[--o]}}return s}_link(t,n){this._halfedges[t]=n,n!==-1&&(this._halfedges[n]=t)}_addTriangle(t,n,r,i,o,s){let a=this.trianglesLen;return this._triangles[a]=t,this._triangles[a+1]=n,this._triangles[a+2]=r,this._link(a,i),this._link(a+1,o),this._link(a+2,s),this.trianglesLen+=3,a}};function rU(e,t){let n=e/(Math.abs(e)+Math.abs(t));return(t>0?3-n:1+n)/4}function Cv(e,t,n,r){let i=e-n,o=t-r;return i*i+o*o}function iU(e,t,n,r,i,o,s,a){let c=e-s,l=t-a,u=n-s,f=r-a,h=i-s,d=o-a,p=c*c+l*l,y=u*u+f*f,b=h*h+d*d;return c*(f*b-y*d)-l*(u*b-y*h)+p*(u*d-f*h)<0}function oU(e,t,n,r,i,o){let s=n-e,a=r-t,c=i-e,l=o-t,u=s*s+a*a,f=c*c+l*l,h=.5/(s*l-a*c),d=(l*u-a*f)*h,p=(s*f-c*u)*h;return d*d+p*p}function sU(e,t,n,r,i,o){let s=n-e,a=r-t,c=i-e,l=o-t,u=s*s+a*a,f=c*c+l*l,h=.5/(s*l-a*c),d=e+(l*u-a*f)*h,p=t+(s*f-c*u)*h;return{x:d,y:p}}function hu(e,t,n,r){if(r-n<=20)for(let i=n+1;i<=r;i++){let o=e[i],s=t[o],a=i-1;for(;a>=n&&t[e[a]]>s;)e[a+1]=e[a--];e[a+1]=o}else{let i=n+r>>1,o=n+1,s=r;Od(e,i,o),t[e[n]]>t[e[r]]&&Od(e,n,r),t[e[o]]>t[e[r]]&&Od(e,o,r),t[e[n]]>t[e[o]]&&Od(e,n,o);let a=e[o],c=t[a];for(;;){do o++;while(t[e[o]]<c);do s--;while(t[e[s]]>c);if(s<o)break;Od(e,o,s)}e[n+1]=e[s],e[s]=a,r-o+1>=s-n?(hu(e,t,o,r),hu(e,t,n,s-1)):(hu(e,t,n,s-1),hu(e,t,o,r))}}function Od(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function aU(e){return e[0]}function cU(e){return e[1]}var Wr=class{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,n){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,n){this._+=`L${this._x1=+t},${this._y1=+n}`}arc(t,n,r){t=+t,n=+n,r=+r;let i=t+r,o=n;if(r<0)throw new Error("negative radius");this._x1===null?this._+=`M${i},${o}`:(Math.abs(this._x1-i)>1e-6||Math.abs(this._y1-o)>1e-6)&&(this._+="L"+i+","+o),r&&(this._+=`A${r},${r},0,1,1,${t-r},${n}A${r},${r},0,1,1,${this._x1=i},${this._y1=o}`)}rect(t,n,r,i){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${+r}v${+i}h${-r}Z`}value(){return this._||null}};var ga=class{constructor(){this._=[]}moveTo(t,n){this._.push([t,n])}closePath(){this._.push(this._[0].slice())}lineTo(t,n){this._.push([t,n])}value(){return this._.length?this._:null}};var Bd=class{constructor(t,[n,r,i,o]=[0,0,960,500]){if(!((i=+i)>=(n=+n))||!((o=+o)>=(r=+r)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(t.points.length*2),this.vectors=new Float64Array(t.points.length*2),this.xmax=i,this.xmin=n,this.ymax=o,this.ymin=r,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){let{delaunay:{points:t,hull:n,triangles:r},vectors:i}=this,o,s,a=this.circumcenters=this._circumcenters.subarray(0,r.length/3*2);for(let y=0,b=0,m=r.length,g,x;y<m;y+=3,b+=2){let w=r[y]*2,v=r[y+1]*2,_=r[y+2]*2,M=t[w],E=t[w+1],N=t[v],I=t[v+1],T=t[_],O=t[_+1],B=N-M,S=I-E,A=T-M,D=O-E,L=(B*D-S*A)*2;if(Math.abs(L)<1e-9){if(o===void 0){o=s=0;for(let C of n)o+=t[C*2],s+=t[C*2+1];o/=n.length,s/=n.length}let k=1e9*Math.sign((o-M)*D-(s-E)*A);g=(M+T)/2-k*D,x=(E+O)/2+k*A}else{let k=1/L,C=B*B+S*S,R=A*A+D*D;g=M+(D*C-S*R)*k,x=E+(B*R-A*C)*k}a[b]=g,a[b+1]=x}let c=n[n.length-1],l,u=c*4,f,h=t[2*c],d,p=t[2*c+1];i.fill(0);for(let y=0;y<n.length;++y)c=n[y],l=u,f=h,d=p,u=c*4,h=t[2*c],p=t[2*c+1],i[l+2]=i[u]=d-p,i[l+3]=i[u+1]=h-f}render(t){let n=t==null?t=new Wr:void 0,{delaunay:{halfedges:r,inedges:i,hull:o},circumcenters:s,vectors:a}=this;if(o.length<=1)return null;for(let u=0,f=r.length;u<f;++u){let h=r[u];if(h<u)continue;let d=Math.floor(u/3)*2,p=Math.floor(h/3)*2,y=s[d],b=s[d+1],m=s[p],g=s[p+1];this._renderSegment(y,b,m,g,t)}let c,l=o[o.length-1];for(let u=0;u<o.length;++u){c=l,l=o[u];let f=Math.floor(i[l]/3)*2,h=s[f],d=s[f+1],p=c*4,y=this._project(h,d,a[p+2],a[p+3]);y&&this._renderSegment(h,d,y[0],y[1],t)}return n&&n.value()}renderBounds(t){let n=t==null?t=new Wr:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),n&&n.value()}renderCell(t,n){let r=n==null?n=new Wr:void 0,i=this._clip(t);if(i===null||!i.length)return;n.moveTo(i[0],i[1]);let o=i.length;for(;i[0]===i[o-2]&&i[1]===i[o-1]&&o>1;)o-=2;for(let s=2;s<o;s+=2)(i[s]!==i[s-2]||i[s+1]!==i[s-1])&&n.lineTo(i[s],i[s+1]);return n.closePath(),r&&r.value()}*cellPolygons(){let{delaunay:{points:t}}=this;for(let n=0,r=t.length/2;n<r;++n){let i=this.cellPolygon(n);i&&(i.index=n,yield i)}}cellPolygon(t){let n=new ga;return this.renderCell(t,n),n.value()}_renderSegment(t,n,r,i,o){let s,a=this._regioncode(t,n),c=this._regioncode(r,i);a===0&&c===0?(o.moveTo(t,n),o.lineTo(r,i)):(s=this._clipSegment(t,n,r,i,a,c))&&(o.moveTo(s[0],s[1]),o.lineTo(s[2],s[3]))}contains(t,n,r){return n=+n,n!==n||(r=+r,r!==r)?!1:this.delaunay._step(t,n,r)===t}*neighbors(t){let n=this._clip(t);if(n)for(let r of this.delaunay.neighbors(t)){let i=this._clip(r);if(i){t:for(let o=0,s=n.length;o<s;o+=2)for(let a=0,c=i.length;a<c;a+=2)if(n[o]===i[a]&&n[o+1]===i[a+1]&&n[(o+2)%s]===i[(a+c-2)%c]&&n[(o+3)%s]===i[(a+c-1)%c]){yield r;break t}}}}_cell(t){let{circumcenters:n,delaunay:{inedges:r,halfedges:i,triangles:o}}=this,s=r[t];if(s===-1)return null;let a=[],c=s;do{let l=Math.floor(c/3);if(a.push(n[l*2],n[l*2+1]),c=c%3===2?c-2:c+1,o[c]!==t)break;c=i[c]}while(c!==s&&c!==-1);return a}_clip(t){if(t===0&&this.delaunay.hull.length===1)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];let n=this._cell(t);if(n===null)return null;let{vectors:r}=this,i=t*4;return this._simplify(r[i]||r[i+1]?this._clipInfinite(t,n,r[i],r[i+1],r[i+2],r[i+3]):this._clipFinite(t,n))}_clipFinite(t,n){let r=n.length,i=null,o,s,a=n[r-2],c=n[r-1],l,u=this._regioncode(a,c),f,h=0;for(let d=0;d<r;d+=2)if(o=a,s=c,a=n[d],c=n[d+1],l=u,u=this._regioncode(a,c),l===0&&u===0)f=h,h=0,i?i.push(a,c):i=[a,c];else{let p,y,b,m,g;if(l===0){if((p=this._clipSegment(o,s,a,c,l,u))===null)continue;[y,b,m,g]=p}else{if((p=this._clipSegment(a,c,o,s,u,l))===null)continue;[m,g,y,b]=p,f=h,h=this._edgecode(y,b),f&&h&&this._edge(t,f,h,i,i.length),i?i.push(y,b):i=[y,b]}f=h,h=this._edgecode(m,g),f&&h&&this._edge(t,f,h,i,i.length),i?i.push(m,g):i=[m,g]}if(i)f=h,h=this._edgecode(i[0],i[1]),f&&h&&this._edge(t,f,h,i,i.length);else if(this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return i}_clipSegment(t,n,r,i,o,s){let a=o<s;for(a&&([t,n,r,i,o,s]=[r,i,t,n,s,o]);;){if(o===0&&s===0)return a?[r,i,t,n]:[t,n,r,i];if(o&s)return null;let c,l,u=o||s;u&8?(c=t+(r-t)*(this.ymax-n)/(i-n),l=this.ymax):u&4?(c=t+(r-t)*(this.ymin-n)/(i-n),l=this.ymin):u&2?(l=n+(i-n)*(this.xmax-t)/(r-t),c=this.xmax):(l=n+(i-n)*(this.xmin-t)/(r-t),c=this.xmin),o?(t=c,n=l,o=this._regioncode(t,n)):(r=c,i=l,s=this._regioncode(r,i))}}_clipInfinite(t,n,r,i,o,s){let a=Array.from(n),c;if((c=this._project(a[0],a[1],r,i))&&a.unshift(c[0],c[1]),(c=this._project(a[a.length-2],a[a.length-1],o,s))&&a.push(c[0],c[1]),a=this._clipFinite(t,a))for(let l=0,u=a.length,f,h=this._edgecode(a[u-2],a[u-1]);l<u;l+=2)f=h,h=this._edgecode(a[l],a[l+1]),f&&h&&(l=this._edge(t,f,h,a,l),u=a.length);else this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(a=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return a}_edge(t,n,r,i,o){for(;n!==r;){let s,a;switch(n){case 5:n=4;continue;case 4:n=6,s=this.xmax,a=this.ymin;break;case 6:n=2;continue;case 2:n=10,s=this.xmax,a=this.ymax;break;case 10:n=8;continue;case 8:n=9,s=this.xmin,a=this.ymax;break;case 9:n=1;continue;case 1:n=5,s=this.xmin,a=this.ymin;break}(i[o]!==s||i[o+1]!==a)&&this.contains(t,s,a)&&(i.splice(o,0,s,a),o+=2)}return o}_project(t,n,r,i){let o=1/0,s,a,c;if(i<0){if(n<=this.ymin)return null;(s=(this.ymin-n)/i)<o&&(c=this.ymin,a=t+(o=s)*r)}else if(i>0){if(n>=this.ymax)return null;(s=(this.ymax-n)/i)<o&&(c=this.ymax,a=t+(o=s)*r)}if(r>0){if(t>=this.xmax)return null;(s=(this.xmax-t)/r)<o&&(a=this.xmax,c=n+(o=s)*i)}else if(r<0){if(t<=this.xmin)return null;(s=(this.xmin-t)/r)<o&&(a=this.xmin,c=n+(o=s)*i)}return[a,c]}_edgecode(t,n){return(t===this.xmin?1:t===this.xmax?2:0)|(n===this.ymin?4:n===this.ymax?8:0)}_regioncode(t,n){return(t<this.xmin?1:t>this.xmax?2:0)|(n<this.ymin?4:n>this.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let n=0;n<t.length;n+=2){let r=(n+2)%t.length,i=(n+4)%t.length;(t[n]===t[r]&&t[r]===t[i]||t[n+1]===t[r+1]&&t[r+1]===t[i+1])&&(t.splice(r,2),n-=2)}t.length||(t=null)}return t}};var lU=2*Math.PI,pu=Math.pow;function uU(e){return e[0]}function fU(e){return e[1]}function hU(e){let{triangles:t,coords:n}=e;for(let r=0;r<t.length;r+=3){let i=2*t[r],o=2*t[r+1],s=2*t[r+2];if((n[s]-n[i])*(n[o+1]-n[i+1])-(n[o]-n[i])*(n[s+1]-n[i+1])>1e-10)return!1}return!0}function dU(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}var Gr=class e{static from(t,n=uU,r=fU,i){return new e("length"in t?pU(t,n,r,i):Float64Array.from(mU(t,n,r,i)))}constructor(t){this._delaunator=new du(t),this.inedges=new Int32Array(t.length/2),this._hullIndex=new Int32Array(t.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){let t=this._delaunator,n=this.points;if(t.hull&&t.hull.length>2&&hU(t)){this.collinear=Int32Array.from({length:n.length/2},(h,d)=>d).sort((h,d)=>n[2*h]-n[2*d]||n[2*h+1]-n[2*d+1]);let c=this.collinear[0],l=this.collinear[this.collinear.length-1],u=[n[2*c],n[2*c+1],n[2*l],n[2*l+1]],f=1e-8*Math.hypot(u[3]-u[1],u[2]-u[0]);for(let h=0,d=n.length/2;h<d;++h){let p=dU(n[2*h],n[2*h+1],f);n[2*h]=p[0],n[2*h+1]=p[1]}this._delaunator=new du(n)}else delete this.collinear;let r=this.halfedges=this._delaunator.halfedges,i=this.hull=this._delaunator.hull,o=this.triangles=this._delaunator.triangles,s=this.inedges.fill(-1),a=this._hullIndex.fill(-1);for(let c=0,l=r.length;c<l;++c){let u=o[c%3===2?c-2:c+1];(r[c]===-1||s[u]===-1)&&(s[u]=c)}for(let c=0,l=i.length;c<l;++c)a[i[c]]=c;i.length<=2&&i.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=i[0],s[i[0]]=1,i.length===2&&(s[i[1]]=0,this.triangles[1]=i[1],this.triangles[2]=i[1]))}voronoi(t){return new Bd(this,t)}*neighbors(t){let{inedges:n,hull:r,_hullIndex:i,halfedges:o,triangles:s,collinear:a}=this;if(a){let f=a.indexOf(t);f>0&&(yield a[f-1]),f<a.length-1&&(yield a[f+1]);return}let c=n[t];if(c===-1)return;let l=c,u=-1;do{if(yield u=s[l],l=l%3===2?l-2:l+1,s[l]!==t)return;if(l=o[l],l===-1){let f=r[(i[t]+1)%r.length];f!==u&&(yield f);return}}while(l!==c)}find(t,n,r=0){if(t=+t,t!==t||(n=+n,n!==n))return-1;let i=r,o;for(;(o=this._step(r,t,n))>=0&&o!==r&&o!==i;)r=o;return o}_step(t,n,r){let{inedges:i,hull:o,_hullIndex:s,halfedges:a,triangles:c,points:l}=this;if(i[t]===-1||!l.length)return(t+1)%(l.length>>1);let u=t,f=pu(n-l[t*2],2)+pu(r-l[t*2+1],2),h=i[t],d=h;do{let p=c[d],y=pu(n-l[p*2],2)+pu(r-l[p*2+1],2);if(y<f&&(f=y,u=p),d=d%3===2?d-2:d+1,c[d]!==t)break;if(d=a[d],d===-1){if(d=o[(s[t]+1)%o.length],d!==p&&pu(n-l[d*2],2)+pu(r-l[d*2+1],2)<f)return d;break}}while(d!==h);return u}render(t){let n=t==null?t=new Wr:void 0,{points:r,halfedges:i,triangles:o}=this;for(let s=0,a=i.length;s<a;++s){let c=i[s];if(c<s)continue;let l=o[s]*2,u=o[c]*2;t.moveTo(r[l],r[l+1]),t.lineTo(r[u],r[u+1])}return this.renderHull(t),n&&n.value()}renderPoints(t,n){n===void 0&&(!t||typeof t.moveTo!="function")&&(n=t,t=null),n=n==null?2:+n;let r=t==null?t=new Wr:void 0,{points:i}=this;for(let o=0,s=i.length;o<s;o+=2){let a=i[o],c=i[o+1];t.moveTo(a+n,c),t.arc(a,c,n,0,lU)}return r&&r.value()}renderHull(t){let n=t==null?t=new Wr:void 0,{hull:r,points:i}=this,o=r[0]*2,s=r.length;t.moveTo(i[o],i[o+1]);for(let a=1;a<s;++a){let c=2*r[a];t.lineTo(i[c],i[c+1])}return t.closePath(),n&&n.value()}hullPolygon(){let t=new ga;return this.renderHull(t),t.value()}renderTriangle(t,n){let r=n==null?n=new Wr:void 0,{points:i,triangles:o}=this,s=o[t*=3]*2,a=o[t+1]*2,c=o[t+2]*2;return n.moveTo(i[s],i[s+1]),n.lineTo(i[a],i[a+1]),n.lineTo(i[c],i[c+1]),n.closePath(),r&&r.value()}*trianglePolygons(){let{triangles:t}=this;for(let n=0,r=t.length/3;n<r;++n)yield this.trianglePolygon(n)}trianglePolygon(t){let n=new ga;return this.renderTriangle(t,n),n.value()}};function pU(e,t,n,r){let i=e.length,o=new Float64Array(i*2);for(let s=0;s<i;++s){let a=e[s];o[s*2]=t.call(r,a,s,e),o[s*2+1]=n.call(r,a,s,e)}return o}function*mU(e,t,n,r){let i=0;for(let o of e)yield t.call(r,o,i,e),yield n.call(r,o,i,e),++i}function f8(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Cc(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function ro(e){return e=Cc(Math.abs(e)),e?e[1]:NaN}function h8(e,t){return function(n,r){for(var i=n.length,o=[],s=0,a=e[0],c=0;i>0&&a>0&&(c+a+1>r&&(a=Math.max(1,r-c)),o.push(n.substring(i-=a,i+a)),!((c+=a+1)>r));)a=e[s=(s+1)%e.length];return o.reverse().join(t)}}function d8(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var yU=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function io(e){if(!(t=yU.exec(e)))throw new Error("invalid format: "+e);var t;return new vg({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]})}io.prototype=vg.prototype;function vg(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+""}vg.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 p8(e){t:for(var t=e.length,n=1,r=-1,i;n<t;++n)switch(e[n]){case".":r=i=n;break;case"0":r===0&&(r=n),i=n;break;default:if(!+e[n])break t;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var kv;function m8(e,t){var n=Cc(e,t);if(!n)return e+"";var r=n[0],i=n[1],o=i-(kv=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,s=r.length;return o===s?r:o>s?r+new Array(o-s+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Cc(e,Math.max(0,t+o-1))[0]}function Rv(e,t){var n=Cc(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}var $v={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:f8,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)=>Rv(e*100,t),r:Rv,s:m8,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Uv(e){return e}var y8=Array.prototype.map,g8=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function b8(e){var t=e.grouping===void 0||e.thousands===void 0?Uv:h8(y8.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",o=e.numerals===void 0?Uv:d8(y8.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=io(f);var h=f.fill,d=f.align,p=f.sign,y=f.symbol,b=f.zero,m=f.width,g=f.comma,x=f.precision,w=f.trim,v=f.type;v==="n"?(g=!0,v="g"):$v[v]||(x===void 0&&(x=12),w=!0,v="g"),(b||h==="0"&&d==="=")&&(b=!0,h="0",d="=");var _=y==="$"?n:y==="#"&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",M=y==="$"?r:/[%p]/.test(v)?s:"",E=$v[v],N=/[defgprs%]/.test(v);x=x===void 0?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,x)):Math.max(0,Math.min(20,x));function I(T){var O=_,B=M,S,A,D;if(v==="c")B=E(T)+B,T="";else{T=+T;var L=T<0||1/T<0;if(T=isNaN(T)?c:E(Math.abs(T),x),w&&(T=p8(T)),L&&+T==0&&p!=="+"&&(L=!1),O=(L?p==="("?p:a:p==="-"||p==="("?"":p)+O,B=(v==="s"?g8[8+kv/3]:"")+B+(L&&p==="("?")":""),N){for(S=-1,A=T.length;++S<A;)if(D=T.charCodeAt(S),48>D||D>57){B=(D===46?i+T.slice(S+1):T.slice(S))+B,T=T.slice(0,S);break}}}g&&!b&&(T=t(T,1/0));var k=O.length+T.length+B.length,C=k<m?new Array(m-k+1).join(h):"";switch(g&&b&&(T=t(C+T,C.length?m-B.length:1/0),C=""),d){case"<":T=O+T+B+C;break;case"=":T=O+C+T+B;break;case"^":T=C.slice(0,k=C.length>>1)+O+T+B+C.slice(k);break;default:T=C+O+T+B;break}return o(T)}return I.toString=function(){return f+""},I}function u(f,h){var d=l((f=io(f),f.type="f",f)),p=Math.max(-8,Math.min(8,Math.floor(ro(h)/3)))*3,y=Math.pow(10,-p),b=g8[8+p/3];return function(m){return d(y*m)+b}}return{format:l,formatPrefix:u}}var Sg,Xr,Ig;Pv({thousands:",",grouping:[3],currency:["$",""]});function Pv(e){return Sg=b8(e),Xr=Sg.format,Ig=Sg.formatPrefix,Sg}function zv(e){return Math.max(0,-ro(Math.abs(e)))}function Vv(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(ro(t)/3)))*3-ro(Math.abs(e)))}function qv(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,ro(t)-ro(e))+1}var Q=1e-6,kc=1e-12,Mt=Math.PI,le=Mt/2,jv=Mt/4,nn=Mt*2,Fe=180/Mt,Pt=Mt/180,Lt=Math.abs,Hr=Math.atan,je=Math.atan2,K=Math.cos,Fd=Math.ceil,Mg=Math.exp;var Tg=Math.hypot,Rc=Math.log,Ag=Math.pow,Z=Math.sin,Bn=Math.sign||function(e){return e>0?1:e<0?-1:0},ue=Math.sqrt,mu=Math.tan;function Eg(e){return e>1?0:e<-1?Mt:Math.acos(e)}function be(e){return e>1?le:e<-1?-le:Math.asin(e)}function Ye(){}function Dg(e,t){e&&w8.hasOwnProperty(e.type)&&w8[e.type](e,t)}var x8={Feature:function(e,t){Dg(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r<i;)Dg(n[r].geometry,t)}},w8={Sphere:function(e,t){t.sphere()},Point:function(e,t){e=e.coordinates,t.point(e[0],e[1],e[2])},MultiPoint:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)e=n[r],t.point(e[0],e[1],e[2])},LineString:function(e,t){Yv(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)Yv(n[r],t,0)},Polygon:function(e,t){_8(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)_8(n[r],t)},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,i=n.length;++r<i;)Dg(n[r],t)}};function Yv(e,t,n){var r=-1,i=e.length-n,o;for(t.lineStart();++r<i;)o=e[r],t.point(o[0],o[1],o[2]);t.lineEnd()}function _8(e,t){var n=-1,r=e.length;for(t.polygonStart();++n<r;)Yv(e[n],t,1);t.polygonEnd()}function Ar(e,t){e&&x8.hasOwnProperty(e.type)?x8[e.type](e,t):Dg(e,t)}function Ld(e){return[je(e[1],e[0]),be(e[2])]}function oo(e){var t=e[0],n=e[1],r=K(n);return[r*K(t),r*Z(t),Z(n)]}function Cd(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function yu(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 Ng(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function kd(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Rd(e){var t=ue(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var $d,Og,Bg,Fg,Lg,Cg,kg,Rg,Wv,Gv,Xv,I8,M8,Gn,Xn,Hn,Ei={sphere:Ye,point:Hv,lineStart:v8,lineEnd:S8,polygonStart:function(){Ei.lineStart=xU,Ei.lineEnd=wU},polygonEnd:function(){Ei.lineStart=v8,Ei.lineEnd=S8}};function Hv(e,t){e*=Pt,t*=Pt;var n=K(t);Ud(n*K(e),n*Z(e),Z(t))}function Ud(e,t,n){++$d,Bg+=(e-Bg)/$d,Fg+=(t-Fg)/$d,Lg+=(n-Lg)/$d}function v8(){Ei.point=gU}function gU(e,t){e*=Pt,t*=Pt;var n=K(t);Gn=n*K(e),Xn=n*Z(e),Hn=Z(t),Ei.point=bU,Ud(Gn,Xn,Hn)}function bU(e,t){e*=Pt,t*=Pt;var n=K(t),r=n*K(e),i=n*Z(e),o=Z(t),s=je(ue((s=Xn*o-Hn*i)*s+(s=Hn*r-Gn*o)*s+(s=Gn*i-Xn*r)*s),Gn*r+Xn*i+Hn*o);Og+=s,Cg+=s*(Gn+(Gn=r)),kg+=s*(Xn+(Xn=i)),Rg+=s*(Hn+(Hn=o)),Ud(Gn,Xn,Hn)}function S8(){Ei.point=Hv}function xU(){Ei.point=_U}function wU(){T8(I8,M8),Ei.point=Hv}function _U(e,t){I8=e,M8=t,e*=Pt,t*=Pt,Ei.point=T8;var n=K(t);Gn=n*K(e),Xn=n*Z(e),Hn=Z(t),Ud(Gn,Xn,Hn)}function T8(e,t){e*=Pt,t*=Pt;var n=K(t),r=n*K(e),i=n*Z(e),o=Z(t),s=Xn*o-Hn*i,a=Hn*r-Gn*o,c=Gn*i-Xn*r,l=Tg(s,a,c),u=be(l),f=l&&-u/l;Wv.add(f*s),Gv.add(f*a),Xv.add(f*c),Og+=u,Cg+=u*(Gn+(Gn=r)),kg+=u*(Xn+(Xn=i)),Rg+=u*(Hn+(Hn=o)),Ud(Gn,Xn,Hn)}function Zv(e){$d=Og=Bg=Fg=Lg=Cg=kg=Rg=0,Wv=new bn,Gv=new bn,Xv=new bn,Ar(e,Ei);var t=+Wv,n=+Gv,r=+Xv,i=Tg(t,n,r);return i<kc&&(t=Cg,n=kg,r=Rg,Og<Q&&(t=Bg,n=Fg,r=Lg),i=Tg(t,n,r),i<kc)?[NaN,NaN]:[je(n,t)*Fe,be(r/i)*Fe]}function Pd(e,t){function n(r,i){return r=e(r,i),t(r[0],r[1])}return e.invert&&t.invert&&(n.invert=function(r,i){return r=t.invert(r,i),r&&e.invert(r[0],r[1])}),n}function Kv(e,t){return Lt(e)>Mt&&(e-=Math.round(e/nn)*nn),[e,t]}Kv.invert=Kv;function Qv(e,t,n){return(e%=nn)?t||n?Pd(E8(e),D8(t,n)):E8(e):t||n?D8(t,n):Kv}function A8(e){return function(t,n){return t+=e,Lt(t)>Mt&&(t-=Math.round(t/nn)*nn),[t,n]}}function E8(e){var t=A8(e);return t.invert=A8(-e),t}function D8(e,t){var n=K(e),r=Z(e),i=K(t),o=Z(t);function s(a,c){var l=K(c),u=K(a)*l,f=Z(a)*l,h=Z(c),d=h*n+u*r;return[je(f*i-d*o,u*n-h*r),be(d*i+f*o)]}return s.invert=function(a,c){var l=K(c),u=K(a)*l,f=Z(a)*l,h=Z(c),d=h*i-f*o;return[je(f*i+h*o,u*n+d*r),be(d*n-u*r)]},s}function N8(e){e=Qv(e[0]*Pt,e[1]*Pt,e.length>2?e[2]*Pt:0);function t(n){return n=e(n[0]*Pt,n[1]*Pt),n[0]*=Fe,n[1]*=Fe,n}return t.invert=function(n){return n=e.invert(n[0]*Pt,n[1]*Pt),n[0]*=Fe,n[1]*=Fe,n},t}function B8(e,t,n,r,i,o){if(n){var s=K(t),a=Z(t),c=r*n;i==null?(i=t+r*nn,o=t-c/2):(i=O8(s,i),o=O8(s,o),(r>0?i<o:i>o)&&(i+=r*nn));for(var l,u=i;r>0?u>o:u<o;u-=c)l=Ld([s,-a*K(u),-a*Z(u)]),e.point(l[0],l[1])}}function O8(e,t){t=oo(t),t[0]-=e,Rd(t);var n=Eg(-t[1]);return((-t[2]<0?-n:n)+nn-Q)%nn}function $g(){var e=[],t;return{point:function(n,r,i){t.push([n,r,i])},lineStart:function(){e.push(t=[])},lineEnd:Ye,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function gu(e,t){return Lt(e[0]-t[0])<Q&&Lt(e[1]-t[1])<Q}function Ug(e,t,n,r){this.x=e,this.z=t,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function Pg(e,t,n,r,i){var o=[],s=[],a,c;if(e.forEach(function(p){if(!((y=p.length-1)<=0)){var y,b=p[0],m=p[y],g;if(gu(b,m)){if(!b[2]&&!m[2]){for(i.lineStart(),a=0;a<y;++a)i.point((b=p[a])[0],b[1]);i.lineEnd();return}m[0]+=2*Q}o.push(g=new Ug(b,p,null,!0)),s.push(g.o=new Ug(b,null,g,!1)),o.push(g=new Ug(m,p,null,!1)),s.push(g.o=new Ug(m,null,g,!0))}}),!!o.length){for(s.sort(t),F8(o),F8(s),a=0,c=s.length;a<c;++a)s[a].e=n=!n;for(var l=o[0],u,f;;){for(var h=l,d=!0;h.v;)if((h=h.n)===l)return;u=h.z,i.lineStart();do{if(h.v=h.o.v=!0,h.e){if(d)for(a=0,c=u.length;a<c;++a)i.point((f=u[a])[0],f[1]);else r(h.x,h.n.x,1,i);h=h.n}else{if(d)for(u=h.p.z,a=u.length-1;a>=0;--a)i.point((f=u[a])[0],f[1]);else r(h.x,h.p.x,-1,i);h=h.p}h=h.o,u=h.z,d=!d}while(!h.v);i.lineEnd()}}}function F8(e){if(t=e.length){for(var t,n=0,r=e[0],i;++n<t;)r.n=i=e[n],i.p=r,r=i;r.n=i=e[0],i.p=r}}function Jv(e){return Lt(e[0])<=Mt?e[0]:Bn(e[0])*((Lt(e[0])+Mt)%nn-Mt)}function L8(e,t){var n=Jv(t),r=t[1],i=Z(r),o=[Z(n),-K(n),0],s=0,a=0,c=new bn;i===1?r=le+Q:i===-1&&(r=-le-Q);for(var l=0,u=e.length;l<u;++l)if(h=(f=e[l]).length)for(var f,h,d=f[h-1],p=Jv(d),y=d[1]/2+jv,b=Z(y),m=K(y),g=0;g<h;++g,p=w,b=_,m=M,d=x){var x=f[g],w=Jv(x),v=x[1]/2+jv,_=Z(v),M=K(v),E=w-p,N=E>=0?1:-1,I=N*E,T=I>Mt,O=b*_;if(c.add(je(O*N*Z(I),m*M+O*K(I))),s+=T?E+N*nn:E,T^p>=n^w>=n){var B=yu(oo(d),oo(x));Rd(B);var S=yu(o,B);Rd(S);var A=(T^E>=0?-1:1)*be(S[2]);(r>A||r===A&&(B[0]||B[1]))&&(a+=T^E>=0?1:-1)}}return(s<-Q||s<Q&&c<-kc)^a&1}function zg(e,t,n,r){return function(i){var o=t(i),s=$g(),a=t(s),c=!1,l,u,f,h={point:d,lineStart:y,lineEnd:b,polygonStart:function(){h.point=m,h.lineStart=g,h.lineEnd=x,u=[],l=[]},polygonEnd:function(){h.point=d,h.lineStart=y,h.lineEnd=b,u=Ql(u);var w=L8(l,r);u.length?(c||(i.polygonStart(),c=!0),Pg(u,SU,w,n,i)):w&&(c||(i.polygonStart(),c=!0),i.lineStart(),n(null,null,1,i),i.lineEnd()),c&&(i.polygonEnd(),c=!1),u=l=null},sphere:function(){i.polygonStart(),i.lineStart(),n(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function d(w,v){e(w,v)&&i.point(w,v)}function p(w,v){o.point(w,v)}function y(){h.point=p,o.lineStart()}function b(){h.point=d,o.lineEnd()}function m(w,v){f.push([w,v]),a.point(w,v)}function g(){a.lineStart(),f=[]}function x(){m(f[0][0],f[0][1]),a.lineEnd();var w=a.clean(),v=s.result(),_,M=v.length,E,N,I;if(f.pop(),l.push(f),f=null,!!M){if(w&1){if(N=v[0],(E=N.length-1)>0){for(c||(i.polygonStart(),c=!0),i.lineStart(),_=0;_<E;++_)i.point((I=N[_])[0],I[1]);i.lineEnd()}return}M>1&&w&2&&v.push(v.pop().concat(v.shift())),u.push(v.filter(vU))}}return h}}function vU(e){return e.length>1}function SU(e,t){return((e=e.x)[0]<0?e[1]-le-Q:le-e[1])-((t=t.x)[0]<0?t[1]-le-Q:le-t[1])}var t2=zg(function(){return!0},IU,TU,[-Mt,-le]);function IU(e){var t=NaN,n=NaN,r=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(o,s){var a=o>0?Mt:-Mt,c=Lt(o-t);Lt(c-Mt)<Q?(e.point(t,n=(n+s)/2>0?le:-le),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(a,n),e.point(o,n),i=0):r!==a&&c>=Mt&&(Lt(t-r)<Q&&(t-=r*Q),Lt(o-a)<Q&&(o-=a*Q),n=MU(t,n,o,s),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(a,n),i=0),e.point(t=o,n=s),r=a},lineEnd:function(){e.lineEnd(),t=n=NaN},clean:function(){return 2-i}}}function MU(e,t,n,r){var i,o,s=Z(e-n);return Lt(s)>Q?Hr((Z(t)*(o=K(r))*Z(n)-Z(r)*(i=K(t))*Z(e))/(i*o*s)):(t+r)/2}function TU(e,t,n,r){var i;if(e==null)i=n*le,r.point(-Mt,i),r.point(0,i),r.point(Mt,i),r.point(Mt,0),r.point(Mt,-i),r.point(0,-i),r.point(-Mt,-i),r.point(-Mt,0),r.point(-Mt,i);else if(Lt(e[0]-t[0])>Q){var o=e[0]<t[0]?Mt:-Mt;i=n*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(t[0],t[1])}function C8(e){var t=K(e),n=6*Pt,r=t>0,i=Lt(t)>Q;function o(u,f,h,d){B8(d,e,n,h,u,f)}function s(u,f){return K(u)*K(f)>t}function a(u){var f,h,d,p,y;return{lineStart:function(){p=d=!1,y=1},point:function(b,m){var g=[b,m],x,w=s(b,m),v=r?w?0:l(b,m):w?l(b+(b<0?Mt:-Mt),m):0;if(!f&&(p=d=w)&&u.lineStart(),w!==d&&(x=c(f,g),(!x||gu(f,x)||gu(g,x))&&(g[2]=1)),w!==d)y=0,w?(u.lineStart(),x=c(g,f),u.point(x[0],x[1])):(x=c(f,g),u.point(x[0],x[1],2),u.lineEnd()),f=x;else if(i&&f&&r^w){var _;!(v&h)&&(_=c(g,f,!0))&&(y=0,r?(u.lineStart(),u.point(_[0][0],_[0][1]),u.point(_[1][0],_[1][1]),u.lineEnd()):(u.point(_[1][0],_[1][1]),u.lineEnd(),u.lineStart(),u.point(_[0][0],_[0][1],3)))}w&&(!f||!gu(f,g))&&u.point(g[0],g[1]),f=g,d=w,h=v},lineEnd:function(){d&&u.lineEnd(),f=null},clean:function(){return y|(p&&d)<<1}}}function c(u,f,h){var d=oo(u),p=oo(f),y=[1,0,0],b=yu(d,p),m=Cd(b,b),g=b[0],x=m-g*g;if(!x)return!h&&u;var w=t*m/x,v=-t*g/x,_=yu(y,b),M=kd(y,w),E=kd(b,v);Ng(M,E);var N=_,I=Cd(M,N),T=Cd(N,N),O=I*I-T*(Cd(M,M)-1);if(!(O<0)){var B=ue(O),S=kd(N,(-I-B)/T);if(Ng(S,M),S=Ld(S),!h)return S;var A=u[0],D=f[0],L=u[1],k=f[1],C;D<A&&(C=A,A=D,D=C);var R=D-A,$=Lt(R-Mt)<Q,U=$||R<Q;if(!$&&k<L&&(C=L,L=k,k=C),U?$?L+k>0^S[1]<(Lt(S[0]-A)<Q?L:k):L<=S[1]&&S[1]<=k:R>Mt^(A<=S[0]&&S[0]<=D)){var G=kd(N,(-I+B)/T);return Ng(G,M),[S,Ld(G)]}}}function l(u,f){var h=r?e:Mt-e,d=0;return u<-h?d|=1:u>h&&(d|=2),f<-h?d|=4:f>h&&(d|=8),d}return zg(s,a,o,r?[0,-e]:[-Mt,e-Mt])}function k8(e,t,n,r,i,o){var s=e[0],a=e[1],c=t[0],l=t[1],u=0,f=1,h=c-s,d=l-a,p;if(p=n-s,!(!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=i-s,!(!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)}if(p=r-a,!(!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=o-a,!(!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)}return u>0&&(e[0]=s+u*h,e[1]=a+u*d),f<1&&(t[0]=s+f*h,t[1]=a+f*d),!0}}}}}var zd=1e9,Vg=-zd;function bu(e,t,n,r){function i(l,u){return e<=l&&l<=n&&t<=u&&u<=r}function o(l,u,f,h){var d=0,p=0;if(l==null||(d=s(l,f))!==(p=s(u,f))||c(l,u)<0^f>0)do h.point(d===0||d===3?e:n,d>1?r:t);while((d=(d+f+4)%4)!==p);else h.point(u[0],u[1])}function s(l,u){return Lt(l[0]-e)<Q?u>0?0:3:Lt(l[0]-n)<Q?u>0?2:1:Lt(l[1]-t)<Q?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),h=s(u,1);return f!==h?f-h: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=$g(),h,d,p,y,b,m,g,x,w,v,_,M={point:E,lineStart:O,lineEnd:B,polygonStart:I,polygonEnd:T};function E(A,D){i(A,D)&&u.point(A,D)}function N(){for(var A=0,D=0,L=d.length;D<L;++D)for(var k=d[D],C=1,R=k.length,$=k[0],U,G,J=$[0],et=$[1];C<R;++C)U=J,G=et,$=k[C],J=$[0],et=$[1],G<=r?et>r&&(J-U)*(r-G)>(et-G)*(e-U)&&++A:et<=r&&(J-U)*(r-G)<(et-G)*(e-U)&&--A;return A}function I(){u=f,h=[],d=[],_=!0}function T(){var A=N(),D=_&&A,L=(h=Ql(h)).length;(D||L)&&(l.polygonStart(),D&&(l.lineStart(),o(null,null,1,l),l.lineEnd()),L&&Pg(h,a,A,o,l),l.polygonEnd()),u=l,h=d=p=null}function O(){M.point=S,d&&d.push(p=[]),v=!0,w=!1,g=x=NaN}function B(){h&&(S(y,b),m&&w&&f.rejoin(),h.push(f.result())),M.point=E,w&&u.lineEnd()}function S(A,D){var L=i(A,D);if(d&&p.push([A,D]),v)y=A,b=D,m=L,v=!1,L&&(u.lineStart(),u.point(A,D));else if(L&&w)u.point(A,D);else{var k=[g=Math.max(Vg,Math.min(zd,g)),x=Math.max(Vg,Math.min(zd,x))],C=[A=Math.max(Vg,Math.min(zd,A)),D=Math.max(Vg,Math.min(zd,D))];k8(k,C,e,t,n,r)?(w||(u.lineStart(),u.point(k[0],k[1])),u.point(C[0],C[1]),L||u.lineEnd(),_=!1):L&&(u.lineStart(),u.point(A,D),_=!1)}g=A,x=D,w=L}return M}}function R8(e,t,n){var r=ke(e,t-Q,n).concat(t);return function(i){return r.map(function(o){return[i,o]})}}function $8(e,t,n){var r=ke(e,t-Q,n).concat(t);return function(i){return r.map(function(o){return[o,i]})}}function e2(){var e,t,n,r,i,o,s,a,c=10,l=c,u=90,f=360,h,d,p,y,b=2.5;function m(){return{type:"MultiLineString",coordinates:g()}}function g(){return ke(Fd(r/u)*u,n,u).map(p).concat(ke(Fd(a/f)*f,s,f).map(y)).concat(ke(Fd(t/c)*c,e,c).filter(function(x){return Lt(x%u)>Q}).map(h)).concat(ke(Fd(o/l)*l,i,l).filter(function(x){return Lt(x%f)>Q}).map(d))}return m.lines=function(){return g().map(function(x){return{type:"LineString",coordinates:x}})},m.outline=function(){return{type:"Polygon",coordinates:[p(r).concat(y(s).slice(1),p(n).reverse().slice(1),y(a).reverse().slice(1))]}},m.extent=function(x){return arguments.length?m.extentMajor(x).extentMinor(x):m.extentMinor()},m.extentMajor=function(x){return arguments.length?(r=+x[0][0],n=+x[1][0],a=+x[0][1],s=+x[1][1],r>n&&(x=r,r=n,n=x),a>s&&(x=a,a=s,s=x),m.precision(b)):[[r,a],[n,s]]},m.extentMinor=function(x){return arguments.length?(t=+x[0][0],e=+x[1][0],o=+x[0][1],i=+x[1][1],t>e&&(x=t,t=e,e=x),o>i&&(x=o,o=i,i=x),m.precision(b)):[[t,o],[e,i]]},m.step=function(x){return arguments.length?m.stepMajor(x).stepMinor(x):m.stepMinor()},m.stepMajor=function(x){return arguments.length?(u=+x[0],f=+x[1],m):[u,f]},m.stepMinor=function(x){return arguments.length?(c=+x[0],l=+x[1],m):[c,l]},m.precision=function(x){return arguments.length?(b=+x,h=R8(o,i,90),d=$8(t,e,b),p=R8(a,s,90),y=$8(r,n,b),m):b},m.extentMajor([[-180,-90+Q],[180,90-Q]]).extentMinor([[-180,-80-Q],[180,80+Q]])}function n2(){return e2()()}var Vd=e=>e;var r2=new bn,i2=new bn,U8,P8,o2,s2,ba={point:Ye,lineStart:Ye,lineEnd:Ye,polygonStart:function(){ba.lineStart=AU,ba.lineEnd=DU},polygonEnd:function(){ba.lineStart=ba.lineEnd=ba.point=Ye,r2.add(Lt(i2)),i2=new bn},result:function(){var e=r2/2;return r2=new bn,e}};function AU(){ba.point=EU}function EU(e,t){ba.point=z8,U8=o2=e,P8=s2=t}function z8(e,t){i2.add(s2*e-o2*t),o2=e,s2=t}function DU(){z8(U8,P8)}var a2=ba;var xu=1/0,qg=xu,qd=-xu,jg=qd,NU={point:OU,lineStart:Ye,lineEnd:Ye,polygonStart:Ye,polygonEnd:Ye,result:function(){var e=[[xu,qg],[qd,jg]];return qd=jg=-(qg=xu=1/0),e}};function OU(e,t){e<xu&&(xu=e),e>qd&&(qd=e),t<qg&&(qg=t),t>jg&&(jg=t)}var wu=NU;var c2=0,l2=0,jd=0,Yg=0,Wg=0,_u=0,u2=0,f2=0,Yd=0,j8,Y8,so,ao,Di={point:$c,lineStart:V8,lineEnd:q8,polygonStart:function(){Di.lineStart=LU,Di.lineEnd=CU},polygonEnd:function(){Di.point=$c,Di.lineStart=V8,Di.lineEnd=q8},result:function(){var e=Yd?[u2/Yd,f2/Yd]:_u?[Yg/_u,Wg/_u]:jd?[c2/jd,l2/jd]:[NaN,NaN];return c2=l2=jd=Yg=Wg=_u=u2=f2=Yd=0,e}};function $c(e,t){c2+=e,l2+=t,++jd}function V8(){Di.point=BU}function BU(e,t){Di.point=FU,$c(so=e,ao=t)}function FU(e,t){var n=e-so,r=t-ao,i=ue(n*n+r*r);Yg+=i*(so+e)/2,Wg+=i*(ao+t)/2,_u+=i,$c(so=e,ao=t)}function q8(){Di.point=$c}function LU(){Di.point=kU}function CU(){W8(j8,Y8)}function kU(e,t){Di.point=W8,$c(j8=so=e,Y8=ao=t)}function W8(e,t){var n=e-so,r=t-ao,i=ue(n*n+r*r);Yg+=i*(so+e)/2,Wg+=i*(ao+t)/2,_u+=i,i=ao*e-so*t,u2+=i*(so+e),f2+=i*(ao+t),Yd+=i*3,$c(so=e,ao=t)}var h2=Di;function Gg(e){this._context=e}Gg.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,nn);break}}},result:Ye};var p2=new bn,d2,G8,X8,Wd,Gd,Xg={point:Ye,lineStart:function(){Xg.point=RU},lineEnd:function(){d2&&H8(G8,X8),Xg.point=Ye},polygonStart:function(){d2=!0},polygonEnd:function(){d2=null},result:function(){var e=+p2;return p2=new bn,e}};function RU(e,t){Xg.point=H8,G8=Wd=e,X8=Gd=t}function H8(e,t){Wd-=e,Gd-=t,p2.add(ue(Wd*Wd+Gd*Gd)),Wd=e,Gd=t}var m2=Xg;var Z8,Hg,K8,Q8,vu=class{constructor(t){this._append=t==null?J8:$U(t),this._radius=4.5,this._=""}pointRadius(t){return this._radius=+t,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){this._line===0&&(this._+="Z"),this._point=NaN}point(t,n){switch(this._point){case 0:{this._append`M${t},${n}`,this._point=1;break}case 1:{this._append`L${t},${n}`;break}default:{if(this._append`M${t},${n}`,this._radius!==K8||this._append!==Hg){let r=this._radius,i=this._;this._="",this._append`m0,${r}a${r},${r} 0 1,1 0,${-2*r}a${r},${r} 0 1,1 0,${2*r}z`,K8=r,Hg=this._append,Q8=this._,this._=i}this._+=Q8;break}}}result(){let t=this._;return this._="",t.length?t:null}};function J8(e){let t=1;this._+=e[0];for(let n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function $U(e){let t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return J8;if(t!==Z8){let n=10**t;Z8=t,Hg=function(i){let o=1;this._+=i[0];for(let s=i.length;o<s;++o)this._+=Math.round(arguments[o]*n)/n+i[o]}}return Hg}function vn(e,t){let n=3,r=4.5,i,o;function s(a){return a&&(typeof r=="function"&&o.pointRadius(+r.apply(this,arguments)),Ar(a,i(o))),o.result()}return s.area=function(a){return Ar(a,i(a2)),a2.result()},s.measure=function(a){return Ar(a,i(m2)),m2.result()},s.bounds=function(a){return Ar(a,i(wu)),wu.result()},s.centroid=function(a){return Ar(a,i(h2)),h2.result()},s.projection=function(a){return arguments.length?(i=a==null?(e=null,Vd):(e=a).stream,s):e},s.context=function(a){return arguments.length?(o=a==null?(t=null,new vu(n)):new Gg(t=a),typeof r!="function"&&o.pointRadius(r),s):t},s.pointRadius=function(a){return arguments.length?(r=typeof a=="function"?a:(o.pointRadius(+a),+a),s):r},s.digits=function(a){if(!arguments.length)return n;if(a==null)n=null;else{let c=Math.floor(a);if(!(c>=0))throw new RangeError(`invalid digits: ${a}`);n=c}return t===null&&(o=new vu(n)),s},s.projection(e).digits(n).context(t)}function Uc(e){return{stream:Su(e)}}function Su(e){return function(t){var n=new y2;for(var r in e)n[r]=e[r];return n.stream=t,n}}function y2(){}y2.prototype={constructor:y2,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 g2(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),r!=null&&e.clipExtent(null),Ar(n,e.stream(wu)),t(wu.result()),r!=null&&e.clipExtent(r),e}function Xd(e,t,n){return g2(e,function(r){var i=t[1][0]-t[0][0],o=t[1][1]-t[0][1],s=Math.min(i/(r[1][0]-r[0][0]),o/(r[1][1]-r[0][1])),a=+t[0][0]+(i-s*(r[1][0]+r[0][0]))/2,c=+t[0][1]+(o-s*(r[1][1]+r[0][1]))/2;e.scale(150*s).translate([a,c])},n)}function Zg(e,t,n){return Xd(e,[[0,0],t],n)}function Kg(e,t,n){return g2(e,function(r){var i=+t,o=i/(r[1][0]-r[0][0]),s=(i-o*(r[1][0]+r[0][0]))/2,a=-o*r[0][1];e.scale(150*o).translate([s,a])},n)}function Qg(e,t,n){return g2(e,function(r){var i=+t,o=i/(r[1][1]-r[0][1]),s=-o*r[0][0],a=(i-o*(r[1][1]+r[0][1]))/2;e.scale(150*o).translate([s,a])},n)}var tE=16,UU=K(30*Pt);function b2(e,t){return+t?zU(e,t):PU(e)}function PU(e){return Su({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function zU(e,t){function n(r,i,o,s,a,c,l,u,f,h,d,p,y,b){var m=l-r,g=u-i,x=m*m+g*g;if(x>4*t&&y--){var w=s+h,v=a+d,_=c+p,M=ue(w*w+v*v+_*_),E=be(_/=M),N=Lt(Lt(_)-1)<Q||Lt(o-f)<Q?(o+f)/2:je(v,w),I=e(N,E),T=I[0],O=I[1],B=T-r,S=O-i,A=g*B-m*S;(A*A/x>t||Lt((m*B+g*S)/x-.5)>.3||s*h+a*d+c*p<UU)&&(n(r,i,o,s,a,c,T,O,N,w/=M,v/=M,_,y,b),b.point(T,O),n(T,O,N,w,v,_,l,u,f,h,d,p,y,b))}}return function(r){var i,o,s,a,c,l,u,f,h,d,p,y,b={point:m,lineStart:g,lineEnd:w,polygonStart:function(){r.polygonStart(),b.lineStart=v},polygonEnd:function(){r.polygonEnd(),b.lineStart=g}};function m(E,N){E=e(E,N),r.point(E[0],E[1])}function g(){f=NaN,b.point=x,r.lineStart()}function x(E,N){var I=oo([E,N]),T=e(E,N);n(f,h,u,d,p,y,f=T[0],h=T[1],u=E,d=I[0],p=I[1],y=I[2],tE,r),r.point(f,h)}function w(){b.point=m,r.lineEnd()}function v(){g(),b.point=_,b.lineEnd=M}function _(E,N){x(i=E,N),o=f,s=h,a=d,c=p,l=y,b.point=x}function M(){n(f,h,u,d,p,y,o,s,i,a,c,l,tE,r),b.lineEnd=w,w()}return b}}var VU=Su({point:function(e,t){this.stream.point(e*Pt,t*Pt)}});function qU(e){return Su({point:function(t,n){var r=e(t,n);return this.stream.point(r[0],r[1])}})}function jU(e,t,n,r,i){function o(s,a){return s*=r,a*=i,[t+e*s,n-e*a]}return o.invert=function(s,a){return[(s-t)/e*r,(n-a)/e*i]},o}function eE(e,t,n,r,i,o){if(!o)return jU(e,t,n,r,i);var s=K(o),a=Z(o),c=s*e,l=a*e,u=s/e,f=a/e,h=(a*n-s*t)/e,d=(a*t+s*n)/e;function p(y,b){return y*=r,b*=i,[c*y-l*b+t,n-l*y-c*b]}return p.invert=function(y,b){return[r*(u*y-f*b+h),i*(d-f*y-u*b)]},p}function Sn(e){return x2(function(){return e})()}function x2(e){var t,n=150,r=480,i=250,o=0,s=0,a=0,c=0,l=0,u,f=0,h=1,d=1,p=null,y=t2,b=null,m,g,x,w=Vd,v=.5,_,M,E,N,I;function T(A){return E(A[0]*Pt,A[1]*Pt)}function O(A){return A=E.invert(A[0],A[1]),A&&[A[0]*Fe,A[1]*Fe]}T.stream=function(A){return N&&I===A?N:N=VU(qU(u)(y(_(w(I=A)))))},T.preclip=function(A){return arguments.length?(y=A,p=void 0,S()):y},T.postclip=function(A){return arguments.length?(w=A,b=m=g=x=null,S()):w},T.clipAngle=function(A){return arguments.length?(y=+A?C8(p=A*Pt):(p=null,t2),S()):p*Fe},T.clipExtent=function(A){return arguments.length?(w=A==null?(b=m=g=x=null,Vd):bu(b=+A[0][0],m=+A[0][1],g=+A[1][0],x=+A[1][1]),S()):b==null?null:[[b,m],[g,x]]},T.scale=function(A){return arguments.length?(n=+A,B()):n},T.translate=function(A){return arguments.length?(r=+A[0],i=+A[1],B()):[r,i]},T.center=function(A){return arguments.length?(o=A[0]%360*Pt,s=A[1]%360*Pt,B()):[o*Fe,s*Fe]},T.rotate=function(A){return arguments.length?(a=A[0]%360*Pt,c=A[1]%360*Pt,l=A.length>2?A[2]%360*Pt:0,B()):[a*Fe,c*Fe,l*Fe]},T.angle=function(A){return arguments.length?(f=A%360*Pt,B()):f*Fe},T.reflectX=function(A){return arguments.length?(h=A?-1:1,B()):h<0},T.reflectY=function(A){return arguments.length?(d=A?-1:1,B()):d<0},T.precision=function(A){return arguments.length?(_=b2(M,v=A*A),S()):ue(v)},T.fitExtent=function(A,D){return Xd(T,A,D)},T.fitSize=function(A,D){return Zg(T,A,D)},T.fitWidth=function(A,D){return Kg(T,A,D)},T.fitHeight=function(A,D){return Qg(T,A,D)};function B(){var A=eE(n,0,0,h,d,f).apply(null,t(o,s)),D=eE(n,r-A[0],i-A[1],h,d,f);return u=Qv(a,c,l),M=Pd(t,D),E=Pd(u,M),_=b2(M,v),S()}function S(){return N=I=null,T}return function(){return t=e.apply(this,arguments),T.invert=t.invert&&O,B()}}function Iu(e){var t=0,n=Mt/3,r=x2(e),i=r(t,n);return i.parallels=function(o){return arguments.length?r(t=o[0]*Pt,n=o[1]*Pt):[t*Fe,n*Fe]},i}function nE(e){var t=K(e);function n(r,i){return[r*t,Z(i)/t]}return n.invert=function(r,i){return[r/t,be(i*t)]},n}function rE(e,t){var n=Z(e),r=(n+Z(t))/2;if(Lt(r)<Q)return nE(e);var i=1+n*(2*r-n),o=ue(i)/r;function s(a,c){var l=ue(i-2*r*Z(c))/r;return[l*Z(a*=r),o-l*K(a)]}return s.invert=function(a,c){var l=o-c,u=je(a,Lt(l))*Bn(l);return l*r<0&&(u-=Mt*Bn(a)*Bn(l)),[u/r,be((i-(a*a+l*l)*r*r)/(2*r))]},s}function xa(){return Iu(rE).scale(155.424).center([0,33.6442])}function Hd(){return xa().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function YU(e){var t=e.length;return{point:function(n,r){for(var i=-1;++i<t;)e[i].point(n,r)},sphere:function(){for(var n=-1;++n<t;)e[n].sphere()},lineStart:function(){for(var n=-1;++n<t;)e[n].lineStart()},lineEnd:function(){for(var n=-1;++n<t;)e[n].lineEnd()},polygonStart:function(){for(var n=-1;++n<t;)e[n].polygonStart()},polygonEnd:function(){for(var n=-1;++n<t;)e[n].polygonEnd()}}}function w2(){var e,t,n=Hd(),r,i=xa().rotate([154,0]).center([-2,58.5]).parallels([55,65]),o,s=xa().rotate([157,0]).center([-3,19.9]).parallels([8,18]),a,c,l={point:function(h,d){c=[h,d]}};function u(h){var d=h[0],p=h[1];return c=null,r.point(d,p),c||(o.point(d,p),c)||(a.point(d,p),c)}u.invert=function(h){var d=n.scale(),p=n.translate(),y=(h[0]-p[0])/d,b=(h[1]-p[1])/d;return(b>=.12&&b<.234&&y>=-.425&&y<-.214?i:b>=.166&&b<.234&&y>=-.214&&y<-.115?s:n).invert(h)},u.stream=function(h){return e&&t===h?e:e=YU([n.stream(t=h),i.stream(h),s.stream(h)])},u.precision=function(h){return arguments.length?(n.precision(h),i.precision(h),s.precision(h),f()):n.precision()},u.scale=function(h){return arguments.length?(n.scale(h),i.scale(h*.35),s.scale(h),u.translate(n.translate())):n.scale()},u.translate=function(h){if(!arguments.length)return n.translate();var d=n.scale(),p=+h[0],y=+h[1];return r=n.translate(h).clipExtent([[p-.455*d,y-.238*d],[p+.455*d,y+.238*d]]).stream(l),o=i.translate([p-.307*d,y+.201*d]).clipExtent([[p-.425*d+Q,y+.12*d+Q],[p-.214*d-Q,y+.234*d-Q]]).stream(l),a=s.translate([p-.205*d,y+.212*d]).clipExtent([[p-.214*d+Q,y+.166*d+Q],[p-.115*d-Q,y+.234*d-Q]]).stream(l),f()},u.fitExtent=function(h,d){return Xd(u,h,d)},u.fitSize=function(h,d){return Zg(u,h,d)},u.fitWidth=function(h,d){return Kg(u,h,d)},u.fitHeight=function(h,d){return Qg(u,h,d)};function f(){return e=t=null,u}return u.scale(1070)}function Jg(e){return function(t,n){var r=K(t),i=K(n),o=e(r*i);return o===1/0?[2,0]:[o*i*Z(t),o*Z(n)]}}function co(e){return function(t,n){var r=ue(t*t+n*n),i=e(r),o=Z(i),s=K(i);return[je(t*o,r*s),be(r&&n*o/r)]}}var _2=Jg(function(e){return ue(2/(1+e))});_2.invert=co(function(e){return 2*be(e/2)});function v2(){return Sn(_2).scale(124.75).clipAngle(180-.001)}var S2=Jg(function(e){return(e=Eg(e))&&e/Z(e)});S2.invert=co(function(e){return e});function I2(){return Sn(S2).scale(79.4188).clipAngle(180-.001)}function Mu(e,t){return[e,Rc(mu((le+t)/2))]}Mu.invert=function(e,t){return[e,2*Hr(Mg(t))-le]};function M2(){return T2(Mu).scale(961/nn)}function T2(e){var t=Sn(e),n=t.center,r=t.scale,i=t.translate,o=t.clipExtent,s=null,a,c,l;t.scale=function(f){return arguments.length?(r(f),u()):r()},t.translate=function(f){return arguments.length?(i(f),u()):i()},t.center=function(f){return arguments.length?(n(f),u()):n()},t.clipExtent=function(f){return arguments.length?(f==null?s=a=c=l=null:(s=+f[0][0],a=+f[0][1],c=+f[1][0],l=+f[1][1]),u()):s==null?null:[[s,a],[c,l]]};function u(){var f=Mt*r(),h=t(N8(t.rotate()).invert([0,0]));return o(s==null?[[h[0]-f,h[1]-f],[h[0]+f,h[1]+f]]:e===Mu?[[Math.max(h[0]-f,s),a],[Math.min(h[0]+f,c),l]]:[[s,Math.max(h[1]-f,a)],[c,Math.min(h[1]+f,l)]])}return u()}function tb(e){return mu((le+e)/2)}function iE(e,t){var n=K(e),r=e===t?Z(e):Rc(n/K(t))/Rc(tb(t)/tb(e)),i=n*Ag(tb(e),r)/r;if(!r)return Mu;function o(s,a){i>0?a<-le+Q&&(a=-le+Q):a>le-Q&&(a=le-Q);var c=i/Ag(tb(a),r);return[c*Z(r*s),i-c*K(r*s)]}return o.invert=function(s,a){var c=i-a,l=Bn(r)*ue(s*s+c*c),u=je(s,Lt(c))*Bn(c);return c*r<0&&(u-=Mt*Bn(s)*Bn(c)),[u/r,2*Hr(Ag(i/l,1/r))-le]},o}function A2(){return Iu(iE).scale(109.5).parallels([30,30])}function Tu(e,t){return[e,t]}Tu.invert=Tu;function E2(){return Sn(Tu).scale(152.63)}function oE(e,t){var n=K(e),r=e===t?Z(e):(n-K(t))/(t-e),i=n/r+e;if(Lt(r)<Q)return Tu;function o(s,a){var c=i-a,l=r*s;return[c*Z(l),i-c*K(l)]}return o.invert=function(s,a){var c=i-a,l=je(s,Lt(c))*Bn(c);return c*r<0&&(l-=Mt*Bn(s)*Bn(c)),[l/r,i-Bn(r)*ue(s*s+c*c)]},o}function D2(){return Iu(oE).scale(131.154).center([0,13.9389])}var Zd=1.340264,Kd=-.081106,Qd=893e-6,Jd=.003796,eb=ue(3)/2,WU=12;function N2(e,t){var n=be(eb*Z(t)),r=n*n,i=r*r*r;return[e*K(n)/(eb*(Zd+3*Kd*r+i*(7*Qd+9*Jd*r))),n*(Zd+Kd*r+i*(Qd+Jd*r))]}N2.invert=function(e,t){for(var n=t,r=n*n,i=r*r*r,o=0,s,a,c;o<WU&&(a=n*(Zd+Kd*r+i*(Qd+Jd*r))-t,c=Zd+3*Kd*r+i*(7*Qd+9*Jd*r),n-=s=a/c,r=n*n,i=r*r*r,!(Lt(s)<kc));++o);return[eb*e*(Zd+3*Kd*r+i*(7*Qd+9*Jd*r))/K(n),be(Z(n)/eb)]};function O2(){return Sn(N2).scale(177.158)}function B2(e,t){var n=K(t),r=K(e)*n;return[n*Z(e)/r,Z(t)/r]}B2.invert=co(Hr);function F2(){return Sn(B2).scale(144.049).clipAngle(60)}function L2(e,t){return[K(t)*Z(e),Z(t)]}L2.invert=co(be);function C2(){return Sn(L2).scale(249.5).clipAngle(90+Q)}function k2(e,t){var n=K(t),r=1+K(e)*n;return[n*Z(e)/r,Z(t)/r]}k2.invert=co(function(e){return 2*Hr(e)});function R2(){return Sn(k2).scale(250).clipAngle(142)}function $2(e,t){return[Rc(mu((le+t)/2)),-e]}$2.invert=function(e,t){return[-t,2*Hr(Mg(e))-le]};function U2(){var e=T2($2),t=e.center,n=e.rotate;return e.center=function(r){return arguments.length?t([-r[1],r[0]]):(r=t(),[r[1],-r[0]])},e.rotate=function(r){return arguments.length?n([r[0],r[1],r.length>2?r[2]+90:90]):(r=n(),[r[0],r[1],r[2]-90])},n([0,0,90]).scale(159.155)}function GU(e,t){return e.parent===t.parent?1:2}function XU(e){return e.reduce(HU,0)/e.length}function HU(e,t){return e+t.x}function ZU(e){return 1+e.reduce(KU,0)}function KU(e,t){return Math.max(e,t.y)}function QU(e){for(var t;t=e.children;)e=t[0];return e}function JU(e){for(var t;t=e.children;)e=t[t.length-1];return e}function nb(){var e=GU,t=1,n=1,r=!1;function i(o){var s,a=0;o.eachAfter(function(h){var d=h.children;d?(h.x=XU(d),h.y=ZU(d)):(h.x=s?a+=e(h,s):0,h.y=0,s=h)});var c=QU(o),l=JU(o),u=c.x-e(c,l)/2,f=l.x+e(l,c)/2;return o.eachAfter(r?function(h){h.x=(h.x-o.x)*t,h.y=(o.y-h.y)*n}:function(h){h.x=(h.x-u)/(f-u)*t,h.y=(1-(o.y?h.y/o.y:1))*n})}return i.separation=function(o){return arguments.length?(e=o,i):e},i.size=function(o){return arguments.length?(r=!1,t=+o[0],n=+o[1],i):r?null:[t,n]},i.nodeSize=function(o){return arguments.length?(r=!0,t=+o[0],n=+o[1],i):r?[t,n]:null},i}function tP(e){var t=0,n=e.children,r=n&&n.length;if(!r)t=1;else for(;--r>=0;)t+=n[r].value;e.value=t}function sE(){return this.eachAfter(tP)}function aE(e,t){let n=-1;for(let r of this)e.call(t,r,++n,this);return this}function cE(e,t){for(var n=this,r=[n],i,o,s=-1;n=r.pop();)if(e.call(t,n,++s,this),i=n.children)for(o=i.length-1;o>=0;--o)r.push(i[o]);return this}function lE(e,t){for(var n=this,r=[n],i=[],o,s,a,c=-1;n=r.pop();)if(i.push(n),o=n.children)for(s=0,a=o.length;s<a;++s)r.push(o[s]);for(;n=i.pop();)e.call(t,n,++c,this);return this}function uE(e,t){let n=-1;for(let r of this)if(e.call(t,r,++n,this))return r}function fE(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,r=t.children,i=r&&r.length;--i>=0;)n+=r[i].value;t.value=n})}function hE(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function dE(e){for(var t=this,n=eP(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var i=r.length;e!==n;)r.splice(i,0,e),e=e.parent;return r}function eP(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),i=null;for(e=n.pop(),t=r.pop();e===t;)i=e,e=n.pop(),t=r.pop();return i}function pE(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function mE(){return Array.from(this)}function yE(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function gE(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*bE(){var e=this,t,n=[e],r,i,o;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,r=e.children)for(i=0,o=r.length;i<o;++i)n.push(r[i]);while(n.length)}function P2(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=iP)):t===void 0&&(t=rP);for(var n=new wa(e),r,i=[n],o,s,a,c;r=i.pop();)if((s=t(r.data))&&(c=(s=Array.from(s)).length))for(r.children=s,a=c-1;a>=0;--a)i.push(o=s[a]=new wa(s[a])),o.parent=r,o.depth=r.depth+1;return n.eachBefore(z2)}function nP(){return P2(this).eachBefore(oP)}function rP(e){return e.children}function iP(e){return Array.isArray(e)?e[1]:null}function oP(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function z2(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function wa(e){this.data=e,this.depth=this.height=0,this.parent=null}wa.prototype=P2.prototype={constructor:wa,count:sE,each:aE,eachAfter:lE,eachBefore:cE,find:uE,sum:fE,sort:hE,path:dE,ancestors:pE,descendants:mE,leaves:yE,links:gE,copy:nP,[Symbol.iterator]:bE};function rb(e){return e==null?null:sP(e)}function sP(e){if(typeof e!="function")throw new Error;return e}var aP={depth:-1},xE={},V2={};function cP(e){return e.id}function lP(e){return e.parentId}function ib(){var e=cP,t=lP,n;function r(i){var o=Array.from(i),s=e,a=t,c,l,u,f,h,d,p,y,b=new Map;if(n!=null){let m=o.map((w,v)=>uP(n(w,v,i))),g=m.map(wE),x=new Set(m).add("");for(let w of g)x.has(w)||(x.add(w),m.push(w),g.push(wE(w)),o.push(V2));s=(w,v)=>m[v],a=(w,v)=>g[v]}for(u=0,c=o.length;u<c;++u)l=o[u],d=o[u]=new wa(l),(p=s(l,u,i))!=null&&(p+="")&&(y=d.id=p,b.set(y,b.has(y)?xE:d)),(p=a(l,u,i))!=null&&(p+="")&&(d.parent=p);for(u=0;u<c;++u)if(d=o[u],p=d.parent){if(h=b.get(p),!h)throw new Error("missing: "+p);if(h===xE)throw new Error("ambiguous: "+p);h.children?h.children.push(d):h.children=[d],d.parent=h}else{if(f)throw new Error("multiple roots");f=d}if(!f)throw new Error("no root");if(n!=null){for(;f.data===V2&&f.children.length===1;)f=f.children[0],--c;for(let m=o.length-1;m>=0&&(d=o[m],d.data===V2);--m)d.data=null}if(f.parent=aP,f.eachBefore(function(m){m.depth=m.parent.depth+1,--c}).eachBefore(z2),f.parent=null,c>0)throw new Error("cycle");return f}return r.id=function(i){return arguments.length?(e=rb(i),r):e},r.parentId=function(i){return arguments.length?(t=rb(i),r):t},r.path=function(i){return arguments.length?(n=rb(i),r):n},r}function uP(e){e=`${e}`;let t=e.length;return q2(e,t-1)&&!q2(e,t-2)&&(e=e.slice(0,-1)),e[0]==="/"?e:`/${e}`}function wE(e){let t=e.length;if(t<2)return"";for(;--t>1&&!q2(e,t););return e.slice(0,t)}function q2(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if(!(n&1))return!0}return!1}function fP(e,t){return e.parent===t.parent?1:2}function j2(e){var t=e.children;return t?t[0]:e.t}function Y2(e){var t=e.children;return t?t[t.length-1]:e.t}function hP(e,t,n){var r=n/(t.i-e.i);t.c-=r,t.s+=n,e.c+=r,t.z+=n,t.m+=n}function dP(e){for(var t=0,n=0,r=e.children,i=r.length,o;--i>=0;)o=r[i],o.z+=t,o.m+=t,t+=o.s+(n+=o.c)}function pP(e,t,n){return e.a.parent===t.parent?e.a:n}function ob(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}ob.prototype=Object.create(wa.prototype);function mP(e){for(var t=new ob(e,0),n,r=[t],i,o,s,a;n=r.pop();)if(o=n._.children)for(n.children=new Array(a=o.length),s=a-1;s>=0;--s)r.push(i=n.children[s]=new ob(o[s],s)),i.parent=n;return(t.parent=new ob(null,0)).children=[t],t}function Pc(){var e=fP,t=1,n=1,r=null;function i(l){var u=mP(l);if(u.eachAfter(o),u.parent.m=-u.z,u.eachBefore(s),r)l.eachBefore(c);else{var f=l,h=l,d=l;l.eachBefore(function(g){g.x<f.x&&(f=g),g.x>h.x&&(h=g),g.depth>d.depth&&(d=g)});var p=f===h?1:e(f,h)/2,y=p-f.x,b=t/(h.x+p+y),m=n/(d.depth||1);l.eachBefore(function(g){g.x=(g.x+y)*b,g.y=g.depth*m})}return l}function o(l){var u=l.children,f=l.parent.children,h=l.i?f[l.i-1]:null;if(u){dP(l);var d=(u[0].z+u[u.length-1].z)/2;h?(l.z=h.z+e(l._,h._),l.m=l.z-d):l.z=d}else h&&(l.z=h.z+e(l._,h._));l.parent.A=a(l,h,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 h=l,d=l,p=u,y=h.parent.children[0],b=h.m,m=d.m,g=p.m,x=y.m,w;p=Y2(p),h=j2(h),p&&h;)y=j2(y),d=Y2(d),d.a=l,w=p.z+g-h.z-b+e(p._,h._),w>0&&(hP(pP(p,l,f),l,w),b+=w,m+=w),g+=p.m,b+=h.m,x+=y.m,m+=d.m;p&&!Y2(d)&&(d.t=p,d.m+=g-m),h&&!j2(y)&&(y.t=h,y.m+=b-x,f=l)}return f}function c(l){l.x*=t,l.y=l.depth*n}return i.separation=function(l){return arguments.length?(e=l,i):e},i.size=function(l){return arguments.length?(r=!1,t=+l[0],n=+l[1],i):r?null:[t,n]},i.nodeSize=function(l){return arguments.length?(r=!0,t=+l[0],n=+l[1],i):r?[t,n]:null},i}var _E=23283064365386963e-26;function zc(e=Math.random()){let t=(0<=e&&e<1?e/_E:Math.abs(e))|0;return()=>(t=1664525*t+1013904223|0,_E*(t>>>0))}function We(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function tp(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 ep=Symbol("implicit");function Vc(){var e=new zn,t=[],n=[],r=ep;function i(o){let s=e.get(o);if(s===void 0){if(r!==ep)return r;e.set(o,s=t.push(o)-1)}return n[s%n.length]}return i.domain=function(o){if(!arguments.length)return t.slice();t=[],e=new zn;for(let s of o)e.has(s)||e.set(s,t.push(s)-1);return i},i.range=function(o){return arguments.length?(n=Array.from(o),i):n.slice()},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return Vc(t,n).unknown(r)},We.apply(i,arguments),i}function _a(){var e=Vc().unknown(void 0),t=e.domain,n=e.range,r=0,i=1,o,s,a=!1,c=0,l=0,u=.5;delete e.unknown;function f(){var h=t().length,d=i<r,p=d?i:r,y=d?r:i;o=(y-p)/Math.max(1,h-c+l*2),a&&(o=Math.floor(o)),p+=(y-p-o*(h-c))*u,s=o*(1-c),a&&(p=Math.round(p),s=Math.round(s));var b=ke(h).map(function(m){return p+o*m});return n(d?b.reverse():b)}return e.domain=function(h){return arguments.length?(t(h),f()):t()},e.range=function(h){return arguments.length?([r,i]=h,r=+r,i=+i,f()):[r,i]},e.rangeRound=function(h){return[r,i]=h,r=+r,i=+i,a=!0,f()},e.bandwidth=function(){return s},e.step=function(){return o},e.round=function(h){return arguments.length?(a=!!h,f()):a},e.padding=function(h){return arguments.length?(c=Math.min(1,l=+h),f()):c},e.paddingInner=function(h){return arguments.length?(c=Math.min(1,h),f()):c},e.paddingOuter=function(h){return arguments.length?(l=+h,f()):l},e.align=function(h){return arguments.length?(u=Math.max(0,Math.min(1,h)),f()):u},e.copy=function(){return _a(t(),[r,i]).round(a).paddingInner(c).paddingOuter(l).align(u)},We.apply(f(),arguments)}function vE(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return vE(t())},e}function W2(){return vE(_a.apply(null,arguments).paddingInner(1))}function G2(e){return function(){return e}}function Au(e){return+e}var SE=[0,1];function ur(e){return e}function X2(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:G2(isNaN(t)?NaN:.5)}function yP(e,t){var n;return e>t&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function gP(e,t,n){var r=e[0],i=e[1],o=t[0],s=t[1];return i<r?(r=X2(i,r),o=n(s,o)):(r=X2(r,i),o=n(o,s)),function(a){return o(r(a))}}function bP(e,t,n){var r=Math.min(e.length,t.length)-1,i=new Array(r),o=new Array(r),s=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++s<r;)i[s]=X2(e[s],e[s+1]),o[s]=n(t[s],t[s+1]);return function(a){var c=os(e,a,1,r)-1;return o[c](i[c](a))}}function lo(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function qc(){var e=SE,t=SE,n=Tr,r,i,o,s=ur,a,c,l;function u(){var h=Math.min(e.length,t.length);return s!==ur&&(s=yP(e[0],e[h-1])),a=h>2?bP:gP,c=l=null,f}function f(h){return h==null||isNaN(h=+h)?o:(c||(c=a(e.map(r),t,n)))(r(s(h)))}return f.invert=function(h){return s(i((l||(l=a(t,e.map(r),ge)))(h)))},f.domain=function(h){return arguments.length?(e=Array.from(h,Au),u()):e.slice()},f.range=function(h){return arguments.length?(t=Array.from(h),u()):t.slice()},f.rangeRound=function(h){return t=Array.from(h),n=Nc,u()},f.clamp=function(h){return arguments.length?(s=h?!0:ur,u()):s!==ur},f.interpolate=function(h){return arguments.length?(n=h,u()):n},f.unknown=function(h){return arguments.length?(o=h,f):o},function(h,d){return r=h,i=d,u()}}function np(){return qc()(ur,ur)}function H2(e,t,n,r){var i=Zl(e,t,n),o;switch(r=io(r??",f"),r.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(o=Vv(i,s))&&(r.precision=o),Ig(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=qv(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=zv(i))&&(r.precision=o-(r.type==="%")*2);break}}return Xr(r)}function ys(e){var t=e.domain;return e.ticks=function(n){var r=t();return xn(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return H2(i[0],i[i.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),i=0,o=r.length-1,s=r[i],a=r[o],c,l,u=10;for(a<s&&(l=s,s=a,a=l,l=i,i=o,o=l);u-- >0;){if(l=ss(s,a,n),l===c)return r[i]=s,r[o]=a,t(r);if(l>0)s=Math.floor(s/l)*l,a=Math.ceil(a/l)*l;else if(l<0)s=Math.ceil(s*l)/l,a=Math.floor(a*l)/l;else break;c=l}return e},e}function gs(){var e=np();return e.copy=function(){return lo(e,gs())},We.apply(e,arguments),ys(e)}function rp(e){var t;function n(r){return r==null||isNaN(r=+r)?t:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(e=Array.from(r,Au),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return rp(e).unknown(t)},e=arguments.length?Array.from(e,Au):[0,1],ys(n)}function ip(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],o=e[r],s;return o<i&&(s=n,n=r,r=s,s=i,i=o,o=s),e[n]=t.floor(i),e[r]=t.ceil(o),e}function IE(e){return Math.log(e)}function ME(e){return Math.exp(e)}function xP(e){return-Math.log(-e)}function wP(e){return-Math.exp(-e)}function _P(e){return isFinite(e)?+("1e"+e):e<0?0:e}function vP(e){return e===10?_P:e===Math.E?Math.exp:t=>Math.pow(e,t)}function SP(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 TE(e){return(t,n)=>-e(-t,n)}function Z2(e){let t=e(IE,ME),n=t.domain,r=10,i,o;function s(){return i=SP(r),o=vP(r),n()[0]<0?(i=TE(i),o=TE(o),e(xP,wP)):e(IE,ME),t}return t.base=function(a){return arguments.length?(r=+a,s()):r},t.domain=function(a){return arguments.length?(n(a),s()):n()},t.ticks=a=>{let c=n(),l=c[0],u=c[c.length-1],f=u<l;f&&([l,u]=[u,l]);let h=i(l),d=i(u),p,y,b=a==null?10:+a,m=[];if(!(r%1)&&d-h<b){if(h=Math.floor(h),d=Math.ceil(d),l>0){for(;h<=d;++h)for(p=1;p<r;++p)if(y=h<0?p/o(-h):p*o(h),!(y<l)){if(y>u)break;m.push(y)}}else for(;h<=d;++h)for(p=r-1;p>=1;--p)if(y=h>0?p/o(-h):p*o(h),!(y<l)){if(y>u)break;m.push(y)}m.length*2<b&&(m=xn(l,u,b))}else m=xn(h,d,Math.min(d-h,b)).map(o);return f?m.reverse():m},t.tickFormat=(a,c)=>{if(a==null&&(a=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=io(c)).precision==null&&(c.trim=!0),c=Xr(c)),a===1/0)return c;let l=Math.max(1,r*a/t.ticks().length);return u=>{let f=u/o(Math.round(i(u)));return f*r<r-.5&&(f*=r),f<=l?c(u):""}},t.nice=()=>n(ip(n(),{floor:a=>o(Math.floor(i(a))),ceil:a=>o(Math.ceil(i(a)))})),t}function op(){let e=Z2(qc()).domain([1,10]);return e.copy=()=>lo(e,op()).base(e.base()),We.apply(e,arguments),e}function AE(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function EE(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function K2(e){var t=1,n=e(AE(t),EE(t));return n.constant=function(r){return arguments.length?e(AE(t=+r),EE(t)):t},ys(n)}function sp(){var e=K2(qc());return e.copy=function(){return lo(e,sp()).constant(e.constant())},We.apply(e,arguments)}function DE(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function IP(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function MP(e){return e<0?-e*e:e*e}function Q2(e){var t=e(ur,ur),n=1;function r(){return n===1?e(ur,ur):n===.5?e(IP,MP):e(DE(n),DE(1/n))}return t.exponent=function(i){return arguments.length?(n=+i,r()):n},ys(t)}function ap(){var e=Q2(qc());return e.copy=function(){return lo(e,ap()).exponent(e.exponent())},We.apply(e,arguments),e}function cp(){var e=[],t=[],n=[],r;function i(){var s=0,a=Math.max(1,t.length);for(n=new Array(a-1);++s<a;)n[s-1]=K_(e,s/a);return o}function o(s){return s==null||isNaN(s=+s)?r:t[os(n,s)]}return o.invertExtent=function(s){var a=t.indexOf(s);return a<0?[NaN,NaN]:[a>0?n[a-1]:e[0],a<n.length?n[a]:e[e.length-1]]},o.domain=function(s){if(!arguments.length)return e.slice();e=[];for(let a of s)a!=null&&!isNaN(a=+a)&&e.push(a);return e.sort(qt),i()},o.range=function(s){return arguments.length?(t=Array.from(s),i()):t.slice()},o.unknown=function(s){return arguments.length?(r=s,o):r},o.quantiles=function(){return n.slice()},o.copy=function(){return cp().domain(e).range(t).unknown(r)},We.apply(o,arguments)}function lp(){var e=[.5],t=[0,1],n,r=1;function i(o){return o!=null&&o<=o?t[os(e,o,0,r)]:n}return i.domain=function(o){return arguments.length?(e=Array.from(o),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(o){return arguments.length?(t=Array.from(o),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(o){var s=t.indexOf(o);return[e[s-1],e[s]]},i.unknown=function(o){return arguments.length?(n=o,i):n},i.copy=function(){return lp().domain(e).range(t).unknown(n)},We.apply(i,arguments)}var J2=new Date,tS=new Date;function fe(e,t,n,r){function i(o){return e(o=arguments.length===0?new Date:new Date(+o)),o}return i.floor=o=>(e(o=new Date(+o)),o),i.ceil=o=>(e(o=new Date(o-1)),t(o,1),e(o),o),i.round=o=>{let s=i(o),a=i.ceil(o);return o-s<a-o?s:a},i.offset=(o,s)=>(t(o=new Date(+o),s==null?1:Math.floor(s)),o),i.range=(o,s,a)=>{let c=[];if(o=i.ceil(o),a=a==null?1:Math.floor(a),!(o<s)||!(a>0))return c;let l;do c.push(l=new Date(+o)),t(o,a),e(o);while(l<o&&o<s);return c},i.filter=o=>fe(s=>{if(s>=s)for(;e(s),!o(s);)s.setTime(s-1)},(s,a)=>{if(s>=s)if(a<0)for(;++a<=0;)for(;t(s,-1),!o(s););else for(;--a>=0;)for(;t(s,1),!o(s););}),n&&(i.count=(o,s)=>(J2.setTime(+o),tS.setTime(+s),e(J2),e(tS),Math.floor(n(J2,tS))),i.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?i.filter(r?s=>r(s)%o===0:s=>i.count(0,s)%o===0):i)),i}var up=fe(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);up.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?fe(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):up);var Zwt=up.range;var rn=fe(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*1e3)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds()),NE=rn.range;var bs=fe(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getMinutes()),TP=bs.range,xs=fe(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes()),AP=xs.range;var ws=fe(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()),EP=ws.range,_s=fe(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours()),DP=_s.range;var Zr=fe(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),NP=Zr.range,Wc=fe(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1),OP=Wc.range,Gc=fe(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>Math.floor(e/864e5)),BP=Gc.range;function Xc(e){return fe(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/6048e5)}var Er=Xc(0),va=Xc(1),sb=Xc(2),ab=Xc(3),fo=Xc(4),cb=Xc(5),lb=Xc(6),BE=Er.range,FP=va.range,LP=sb.range,CP=ab.range,kP=fo.range,RP=cb.range,$P=lb.range;function Hc(e){return fe(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/6048e5)}var Dr=Hc(0),Sa=Hc(1),ub=Hc(2),fb=Hc(3),ho=Hc(4),hb=Hc(5),db=Hc(6),FE=Dr.range,UP=Sa.range,PP=ub.range,zP=fb.range,VP=ho.range,qP=hb.range,jP=db.range;var vs=fe(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()),YP=vs.range,Ss=fe(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()),WP=Ss.range;var Fn=fe(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Fn.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:fe(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});var GP=Fn.range,Ln=fe(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());Ln.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:fe(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});var XP=Ln.range;function CE(e,t,n,r,i,o){let s=[[rn,1,1e3],[rn,5,5*1e3],[rn,15,15*1e3],[rn,30,30*1e3],[o,1,6e4],[o,5,5*6e4],[o,15,15*6e4],[o,30,30*6e4],[i,1,36e5],[i,3,3*36e5],[i,6,6*36e5],[i,12,12*36e5],[r,1,864e5],[r,2,2*864e5],[n,1,6048e5],[t,1,2592e6],[t,3,3*2592e6],[e,1,31536e6]];function a(l,u,f){let h=u<l;h&&([l,u]=[u,l]);let d=f&&typeof f.range=="function"?f:c(l,u,f),p=d?d.range(l,+u+1):[];return h?p.reverse():p}function c(l,u,f){let h=Math.abs(u-l)/f,d=is(([,,b])=>b).right(s,h);if(d===s.length)return e.every(Zl(l/31536e6,u/31536e6,f));if(d===0)return up.every(Math.max(Zl(l,u,f),1));let[p,y]=s[h/s[d-1][2]<s[d][2]/h?d-1:d];return p.every(y)}return[a,c]}var[eS,hp]=CE(Ln,Ss,Dr,Gc,_s,xs),[nS,rS]=CE(Fn,vs,Er,Zr,ws,bs);function iS(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 oS(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 dp(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function sS(e){var t=e.dateTime,n=e.date,r=e.time,i=e.periods,o=e.days,s=e.shortDays,a=e.months,c=e.shortMonths,l=pp(i),u=mp(i),f=pp(o),h=mp(o),d=pp(s),p=mp(s),y=pp(a),b=mp(a),m=pp(c),g=mp(c),x={a:L,A:k,b:C,B:R,c:null,d:zE,e:zE,f:bz,g:Ez,G:Nz,H:mz,I:yz,j:gz,L:WE,m:xz,M:wz,p:$,q:U,Q:jE,s:YE,S:_z,u:vz,U:Sz,V:Iz,w:Mz,W:Tz,x:null,X:null,y:Az,Y:Dz,Z:Oz,"%":qE},w={a:G,A:J,b:et,B:ot,c:null,d:VE,e:VE,f:Cz,g:Yz,G:Gz,H:Bz,I:Fz,j:Lz,L:XE,m:kz,M:Rz,p:j,q:nt,Q:jE,s:YE,S:$z,u:Uz,U:Pz,V:zz,w:Vz,W:qz,x:null,X:null,y:jz,Y:Wz,Z:Xz,"%":qE},v={a:I,A:T,b:O,B,c:S,d:UE,e:UE,f:fz,g:$E,G:RE,H:PE,I:PE,j:az,L:uz,m:sz,M:cz,p:N,q:oz,Q:dz,s:pz,S:lz,u:tz,U:ez,V:nz,w:JP,W:rz,x:A,X:D,y:$E,Y:RE,Z:iz,"%":hz};x.x=_(n,x),x.X=_(r,x),x.c=_(t,x),w.x=_(n,w),w.X=_(r,w),w.c=_(t,w);function _(z,X){return function(rt){var P=[],Bt=-1,ft=0,jt=z.length,Yt,tt,ne;for(rt instanceof Date||(rt=new Date(+rt));++Bt<jt;)z.charCodeAt(Bt)===37&&(P.push(z.slice(ft,Bt)),(tt=kE[Yt=z.charAt(++Bt)])!=null?Yt=z.charAt(++Bt):tt=Yt==="e"?" ":"0",(ne=X[Yt])&&(Yt=ne(rt,tt)),P.push(Yt),ft=Bt+1);return P.push(z.slice(ft,Bt)),P.join("")}}function M(z,X){return function(rt){var P=dp(1900,void 0,1),Bt=E(P,z,rt+="",0),ft,jt;if(Bt!=rt.length)return null;if("Q"in P)return new Date(P.Q);if("s"in P)return new Date(P.s*1e3+("L"in P?P.L:0));if(X&&!("Z"in P)&&(P.Z=0),"p"in P&&(P.H=P.H%12+P.p*12),P.m===void 0&&(P.m="q"in P?P.q:0),"V"in P){if(P.V<1||P.V>53)return null;"w"in P||(P.w=1),"Z"in P?(ft=oS(dp(P.y,0,1)),jt=ft.getUTCDay(),ft=jt>4||jt===0?Sa.ceil(ft):Sa(ft),ft=Wc.offset(ft,(P.V-1)*7),P.y=ft.getUTCFullYear(),P.m=ft.getUTCMonth(),P.d=ft.getUTCDate()+(P.w+6)%7):(ft=iS(dp(P.y,0,1)),jt=ft.getDay(),ft=jt>4||jt===0?va.ceil(ft):va(ft),ft=Zr.offset(ft,(P.V-1)*7),P.y=ft.getFullYear(),P.m=ft.getMonth(),P.d=ft.getDate()+(P.w+6)%7)}else("W"in P||"U"in P)&&("w"in P||(P.w="u"in P?P.u%7:"W"in P?1:0),jt="Z"in P?oS(dp(P.y,0,1)).getUTCDay():iS(dp(P.y,0,1)).getDay(),P.m=0,P.d="W"in P?(P.w+6)%7+P.W*7-(jt+5)%7:P.w+P.U*7-(jt+6)%7);return"Z"in P?(P.H+=P.Z/100|0,P.M+=P.Z%100,oS(P)):iS(P)}}function E(z,X,rt,P){for(var Bt=0,ft=X.length,jt=rt.length,Yt,tt;Bt<ft;){if(P>=jt)return-1;if(Yt=X.charCodeAt(Bt++),Yt===37){if(Yt=X.charAt(Bt++),tt=v[Yt in kE?X.charAt(Bt++):Yt],!tt||(P=tt(z,rt,P))<0)return-1}else if(Yt!=rt.charCodeAt(P++))return-1}return P}function N(z,X,rt){var P=l.exec(X.slice(rt));return P?(z.p=u.get(P[0].toLowerCase()),rt+P[0].length):-1}function I(z,X,rt){var P=d.exec(X.slice(rt));return P?(z.w=p.get(P[0].toLowerCase()),rt+P[0].length):-1}function T(z,X,rt){var P=f.exec(X.slice(rt));return P?(z.w=h.get(P[0].toLowerCase()),rt+P[0].length):-1}function O(z,X,rt){var P=m.exec(X.slice(rt));return P?(z.m=g.get(P[0].toLowerCase()),rt+P[0].length):-1}function B(z,X,rt){var P=y.exec(X.slice(rt));return P?(z.m=b.get(P[0].toLowerCase()),rt+P[0].length):-1}function S(z,X,rt){return E(z,t,X,rt)}function A(z,X,rt){return E(z,n,X,rt)}function D(z,X,rt){return E(z,r,X,rt)}function L(z){return s[z.getDay()]}function k(z){return o[z.getDay()]}function C(z){return c[z.getMonth()]}function R(z){return a[z.getMonth()]}function $(z){return i[+(z.getHours()>=12)]}function U(z){return 1+~~(z.getMonth()/3)}function G(z){return s[z.getUTCDay()]}function J(z){return o[z.getUTCDay()]}function et(z){return c[z.getUTCMonth()]}function ot(z){return a[z.getUTCMonth()]}function j(z){return i[+(z.getUTCHours()>=12)]}function nt(z){return 1+~~(z.getUTCMonth()/3)}return{format:function(z){var X=_(z+="",x);return X.toString=function(){return z},X},parse:function(z){var X=M(z+="",!1);return X.toString=function(){return z},X},utcFormat:function(z){var X=_(z+="",w);return X.toString=function(){return z},X},utcParse:function(z){var X=M(z+="",!0);return X.toString=function(){return z},X}}}var kE={"-":"",_:" ",0:"0"},on=/^\s*\d+/,ZP=/^%/,KP=/[\\^$*+?|[\]().{}]/g;function Kt(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",o=i.length;return r+(o<n?new Array(n-o+1).join(t)+i:i)}function QP(e){return e.replace(KP,"\\$&")}function pp(e){return new RegExp("^(?:"+e.map(QP).join("|")+")","i")}function mp(e){return new Map(e.map((t,n)=>[t.toLowerCase(),n]))}function JP(e,t,n){var r=on.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function tz(e,t,n){var r=on.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function ez(e,t,n){var r=on.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function nz(e,t,n){var r=on.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function rz(e,t,n){var r=on.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function RE(e,t,n){var r=on.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function $E(e,t,n){var r=on.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function iz(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function oz(e,t,n){var r=on.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function sz(e,t,n){var r=on.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function UE(e,t,n){var r=on.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function az(e,t,n){var r=on.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function PE(e,t,n){var r=on.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function cz(e,t,n){var r=on.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function lz(e,t,n){var r=on.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function uz(e,t,n){var r=on.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function fz(e,t,n){var r=on.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function hz(e,t,n){var r=ZP.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function dz(e,t,n){var r=on.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function pz(e,t,n){var r=on.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function zE(e,t){return Kt(e.getDate(),t,2)}function mz(e,t){return Kt(e.getHours(),t,2)}function yz(e,t){return Kt(e.getHours()%12||12,t,2)}function gz(e,t){return Kt(1+Zr.count(Fn(e),e),t,3)}function WE(e,t){return Kt(e.getMilliseconds(),t,3)}function bz(e,t){return WE(e,t)+"000"}function xz(e,t){return Kt(e.getMonth()+1,t,2)}function wz(e,t){return Kt(e.getMinutes(),t,2)}function _z(e,t){return Kt(e.getSeconds(),t,2)}function vz(e){var t=e.getDay();return t===0?7:t}function Sz(e,t){return Kt(Er.count(Fn(e)-1,e),t,2)}function GE(e){var t=e.getDay();return t>=4||t===0?fo(e):fo.ceil(e)}function Iz(e,t){return e=GE(e),Kt(fo.count(Fn(e),e)+(Fn(e).getDay()===4),t,2)}function Mz(e){return e.getDay()}function Tz(e,t){return Kt(va.count(Fn(e)-1,e),t,2)}function Az(e,t){return Kt(e.getFullYear()%100,t,2)}function Ez(e,t){return e=GE(e),Kt(e.getFullYear()%100,t,2)}function Dz(e,t){return Kt(e.getFullYear()%1e4,t,4)}function Nz(e,t){var n=e.getDay();return e=n>=4||n===0?fo(e):fo.ceil(e),Kt(e.getFullYear()%1e4,t,4)}function Oz(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Kt(t/60|0,"0",2)+Kt(t%60,"0",2)}function VE(e,t){return Kt(e.getUTCDate(),t,2)}function Bz(e,t){return Kt(e.getUTCHours(),t,2)}function Fz(e,t){return Kt(e.getUTCHours()%12||12,t,2)}function Lz(e,t){return Kt(1+Wc.count(Ln(e),e),t,3)}function XE(e,t){return Kt(e.getUTCMilliseconds(),t,3)}function Cz(e,t){return XE(e,t)+"000"}function kz(e,t){return Kt(e.getUTCMonth()+1,t,2)}function Rz(e,t){return Kt(e.getUTCMinutes(),t,2)}function $z(e,t){return Kt(e.getUTCSeconds(),t,2)}function Uz(e){var t=e.getUTCDay();return t===0?7:t}function Pz(e,t){return Kt(Dr.count(Ln(e)-1,e),t,2)}function HE(e){var t=e.getUTCDay();return t>=4||t===0?ho(e):ho.ceil(e)}function zz(e,t){return e=HE(e),Kt(ho.count(Ln(e),e)+(Ln(e).getUTCDay()===4),t,2)}function Vz(e){return e.getUTCDay()}function qz(e,t){return Kt(Sa.count(Ln(e)-1,e),t,2)}function jz(e,t){return Kt(e.getUTCFullYear()%100,t,2)}function Yz(e,t){return e=HE(e),Kt(e.getUTCFullYear()%100,t,2)}function Wz(e,t){return Kt(e.getUTCFullYear()%1e4,t,4)}function Gz(e,t){var n=e.getUTCDay();return e=n>=4||n===0?ho(e):ho.ceil(e),Kt(e.getUTCFullYear()%1e4,t,4)}function Xz(){return"+0000"}function qE(){return"%"}function jE(e){return+e}function YE(e){return Math.floor(+e/1e3)}var Eu,Du,ZE,po,KE;aS({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 aS(e){return Eu=sS(e),Du=Eu.format,ZE=Eu.parse,po=Eu.utcFormat,KE=Eu.utcParse,Eu}function Hz(e){return new Date(e)}function Zz(e){return e instanceof Date?+e:+new Date(+e)}function pb(e,t,n,r,i,o,s,a,c,l){var u=np(),f=u.invert,h=u.domain,d=l(".%L"),p=l(":%S"),y=l("%I:%M"),b=l("%I %p"),m=l("%a %d"),g=l("%b %d"),x=l("%B"),w=l("%Y");function v(_){return(c(_)<_?d:a(_)<_?p:s(_)<_?y:o(_)<_?b:r(_)<_?i(_)<_?m:g:n(_)<_?x:w)(_)}return u.invert=function(_){return new Date(f(_))},u.domain=function(_){return arguments.length?h(Array.from(_,Zz)):h().map(Hz)},u.ticks=function(_){var M=h();return e(M[0],M[M.length-1],_??10)},u.tickFormat=function(_,M){return M==null?v:l(M)},u.nice=function(_){var M=h();return(!_||typeof _.range!="function")&&(_=t(M[0],M[M.length-1],_??10)),_?h(ip(M,_)):u},u.copy=function(){return lo(u,pb(e,t,n,r,i,o,s,a,c,l))},u}function mb(){return We.apply(pb(nS,rS,Fn,vs,Er,Zr,ws,bs,rn,Du).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function yb(){return We.apply(pb(eS,hp,Ln,Ss,Dr,Wc,_s,xs,rn,po).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function yp(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function gb(){var e=0,t=.5,n=1,r=1,i,o,s,a,c,l=ur,u,f=!1,h;function d(y){return isNaN(y=+y)?h:(y=.5+((y=+u(y))-o)*(r*y<r*o?a:c),l(f?Math.max(0,Math.min(1,y)):y))}d.domain=function(y){return arguments.length?([e,t,n]=y,i=u(e=+e),o=u(t=+t),s=u(n=+n),a=i===o?0:.5/(o-i),c=o===s?0:.5/(s-o),r=o<i?-1:1,d):[e,t,n]},d.clamp=function(y){return arguments.length?(f=!!y,d):f},d.interpolator=function(y){return arguments.length?(l=y,d):l};function p(y){return function(b){var m,g,x;return arguments.length?([m,g,x]=b,l=to(y,[m,g,x]),d):[l(0),l(.5),l(1)]}}return d.range=p(Tr),d.rangeRound=p(Nc),d.unknown=function(y){return arguments.length?(h=y,d):h},function(y){return u=y,i=y(e),o=y(t),s=y(n),a=i===o?0:.5/(o-i),c=o===s?0:.5/(s-o),r=o<i?-1:1,d}}function gp(){var e=ys(gb()(ur));return e.copy=function(){return yp(e,gp())},tp.apply(e,arguments)}function bb(){var e=Z2(gb()).domain([.1,1,10]);return e.copy=function(){return yp(e,bb()).base(e.base())},tp.apply(e,arguments)}function xb(){var e=K2(gb());return e.copy=function(){return yp(e,xb()).constant(e.constant())},tp.apply(e,arguments)}function wb(){var e=Q2(gb());return e.copy=function(){return yp(e,wb()).exponent(e.exponent())},tp.apply(e,arguments)}function Y(e){for(var t=e.length/6|0,n=new Array(t),r=0;r<t;)n[r]="#"+e.slice(r*6,++r*6);return n}var cS=Y("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");var lS=Y("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666");var uS=Y("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666");var fS=Y("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");var hS=Y("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2");var dS=Y("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc");var pS=Y("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999");var mS=Y("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3");var yS=Y("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");var gS=Y("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");var ht=e=>dv(e[e.length-1]);var _b=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(Y),vb=ht(_b);var Sb=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(Y),Ib=ht(Sb);var Mb=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(Y),Tb=ht(Mb);var Ab=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(Y),Eb=ht(Ab);var bp=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(Y),Nu=ht(bp);var Db=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(Y),Nb=ht(Db);var xp=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(Y),Ou=ht(xp);var Ob=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(Y),Bb=ht(Ob);var Fb=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(Y),Lb=ht(Fb);var Cb=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(Y),kb=ht(Cb);var Rb=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(Y),$b=ht(Rb);var Ub=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(Y),Pb=ht(Ub);var zb=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(Y),Vb=ht(zb);var qb=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(Y),jb=ht(qb);var Yb=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(Y),Wb=ht(Yb);var Gb=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(Y),Xb=ht(Gb);var Hb=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(Y),Zb=ht(Hb);var Kb=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(Y),Qb=ht(Kb);var Jb=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(Y),tx=ht(Jb);var ex=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(Y),nx=ht(ex);var rx=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(Y),ix=ht(rx);var ox=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(Y),sx=ht(ox);var ax=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(Y),cx=ht(ax);var lx=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(Y),ux=ht(lx);var fx=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(Y),hx=ht(fx);var dx=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(Y),px=ht(dx);var mx=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(Y),yx=ht(mx);function gx(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 bx=ou(qn(300,.5,0),qn(-240,.5,1));var wx=ou(qn(-100,.75,.35),qn(80,1.5,.8)),_x=ou(qn(260,.75,.35),qn(80,1.5,.8)),xx=qn();function vx(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return xx.h=360*e-100,xx.s=1.5-1.5*t,xx.l=.8-.9*t,xx+""}var Sx=en(),Kz=Math.PI/3,Qz=Math.PI*2/3;function Ix(e){var t;return e=(.5-e)*Math.PI,Sx.r=255*(t=Math.sin(e))*t,Sx.g=255*(t=Math.sin(e+Kz))*t,Sx.b=255*(t=Math.sin(e+Qz))*t,Sx+""}function Mx(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 Tx(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}var Ax=Tx(Y("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),Ex=Tx(Y("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),Dx=Tx(Y("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),Nx=Tx(Y("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function Ge(e){return function(){return e}}var bS=Math.cos;var Bu=Math.min,wp=Math.sin,Qt=Math.sqrt,xS=1e-12,Zc=Math.PI,bIt=Zc/2,Fu=2*Zc;function Ox(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new ma(t)}var vIt=Array.prototype.slice;function Bx(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function QE(e){this._context=e}QE.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 Is(e){return new QE(e)}function Fx(e){return e[0]}function Lx(e){return e[1]}function _p(e,t){var n=Ge(!0),r=null,i=Is,o=null,s=Ox(a);e=typeof e=="function"?e:e===void 0?Fx:Ge(e),t=typeof t=="function"?t:t===void 0?Lx:Ge(t);function a(c){var l,u=(c=Bx(c)).length,f,h=!1,d;for(r==null&&(o=i(d=s())),l=0;l<=u;++l)!(l<u&&n(f=c[l],l,c))===h&&((h=!h)?o.lineStart():o.lineEnd()),h&&o.point(+e(f,l,c),+t(f,l,c));if(d)return o=null,d+""||null}return a.x=function(c){return arguments.length?(e=typeof c=="function"?c:Ge(+c),a):e},a.y=function(c){return arguments.length?(t=typeof c=="function"?c:Ge(+c),a):t},a.defined=function(c){return arguments.length?(n=typeof c=="function"?c:Ge(!!c),a):n},a.curve=function(c){return arguments.length?(i=c,r!=null&&(o=i(r)),a):i},a.context=function(c){return arguments.length?(c==null?r=o=null:o=i(r=c),a):r},a}function Lu(e,t,n){var r=null,i=Ge(!0),o=null,s=Is,a=null,c=Ox(l);e=typeof e=="function"?e:e===void 0?Fx:Ge(+e),t=typeof t=="function"?t:t===void 0?Ge(0):Ge(+t),n=typeof n=="function"?n:n===void 0?Lx:Ge(+n);function l(f){var h,d,p,y=(f=Bx(f)).length,b,m=!1,g,x=new Array(y),w=new Array(y);for(o==null&&(a=s(g=c())),h=0;h<=y;++h){if(!(h<y&&i(b=f[h],h,f))===m)if(m=!m)d=h,a.areaStart(),a.lineStart();else{for(a.lineEnd(),a.lineStart(),p=h-1;p>=d;--p)a.point(x[p],w[p]);a.lineEnd(),a.areaEnd()}m&&(x[h]=+e(b,h,f),w[h]=+t(b,h,f),a.point(r?+r(b,h,f):x[h],n?+n(b,h,f):w[h]))}if(g)return a=null,g+""||null}function u(){return _p().defined(i).curve(s).context(o)}return l.x=function(f){return arguments.length?(e=typeof f=="function"?f:Ge(+f),r=null,l):e},l.x0=function(f){return arguments.length?(e=typeof f=="function"?f:Ge(+f),l):e},l.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Ge(+f),l):r},l.y=function(f){return arguments.length?(t=typeof f=="function"?f:Ge(+f),n=null,l):t},l.y0=function(f){return arguments.length?(t=typeof f=="function"?f:Ge(+f),l):t},l.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Ge(+f),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(f){return arguments.length?(i=typeof f=="function"?f:Ge(!!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 Cx=class{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}};function wS(e){return new Cx(e,!0)}function _S(e){return new Cx(e,!1)}var Jz=Qt(3),vp={draw(e,t){let n=Qt(t+Bu(t/28,.75))*.59436,r=n/2,i=r*Jz;e.moveTo(0,n),e.lineTo(0,-n),e.moveTo(-i,-r),e.lineTo(i,r),e.moveTo(-i,r),e.lineTo(i,-r)}};var Ms={draw(e,t){let n=Qt(t/Zc);e.moveTo(n,0),e.arc(0,0,n,0,Fu)}};var Sp={draw(e,t){let n=Qt(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}};var JE=Qt(1/3),tV=JE*2,Ip={draw(e,t){let n=Qt(t/tV),r=n*JE;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}};var Mp={draw(e,t){let n=Qt(t)*.62625;e.moveTo(0,-n),e.lineTo(n,0),e.lineTo(0,n),e.lineTo(-n,0),e.closePath()}};var Tp={draw(e,t){let n=Qt(t-Bu(t/7,2))*.87559;e.moveTo(-n,0),e.lineTo(n,0),e.moveTo(0,n),e.lineTo(0,-n)}};var Ap={draw(e,t){let n=Qt(t),r=-n/2;e.rect(r,r,n,n)}};var Ep={draw(e,t){let n=Qt(t)*.4431;e.moveTo(n,n),e.lineTo(n,-n),e.lineTo(-n,-n),e.lineTo(-n,n),e.closePath()}};var eV=.8908130915292852,tD=wp(Zc/10)/wp(7*Zc/10),nV=wp(Fu/10)*tD,rV=-bS(Fu/10)*tD,Dp={draw(e,t){let n=Qt(t*eV),r=nV*n,i=rV*n;e.moveTo(0,-n),e.lineTo(r,i);for(let o=1;o<5;++o){let s=Fu*o/5,a=bS(s),c=wp(s);e.lineTo(c*n,-a*n),e.lineTo(a*r-c*i,c*r+a*i)}e.closePath()}};var vS=Qt(3),Np={draw(e,t){let n=-Qt(t/(vS*3));e.moveTo(0,n*2),e.lineTo(-vS*n,-n),e.lineTo(vS*n,-n),e.closePath()}};var iV=Qt(3),Op={draw(e,t){let n=Qt(t)*.6824,r=n/2,i=n*iV/2;e.moveTo(0,-n),e.lineTo(i,r),e.lineTo(-i,r),e.closePath()}};var Kr=-.5,Qr=Qt(3)/2,SS=1/Qt(12),oV=(SS/2+1)*3,Bp={draw(e,t){let n=Qt(t/oV),r=n/2,i=n*SS,o=r,s=n*SS+n,a=-o,c=s;e.moveTo(r,i),e.lineTo(o,s),e.lineTo(a,c),e.lineTo(Kr*r-Qr*i,Qr*r+Kr*i),e.lineTo(Kr*o-Qr*s,Qr*o+Kr*s),e.lineTo(Kr*a-Qr*c,Qr*a+Kr*c),e.lineTo(Kr*r+Qr*i,Kr*i-Qr*r),e.lineTo(Kr*o+Qr*s,Kr*s-Qr*o),e.lineTo(Kr*a+Qr*c,Kr*c-Qr*a),e.closePath()}};var Cu={draw(e,t){let n=Qt(t-Bu(t/6,1.7))*.6189;e.moveTo(-n,-n),e.lineTo(n,n),e.moveTo(-n,n),e.lineTo(n,-n)}};var kx=[Ms,Sp,Ip,Ap,Dp,Np,Bp],IS=[Ms,Tp,Cu,Op,vp,Ep,Mp];function Jr(){}function ku(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Fp(e){this._context=e}Fp.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:ku(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:ku(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function MS(e){return new Fp(e)}function eD(e){this._context=e}eD.prototype={areaStart:Jr,areaEnd:Jr,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:ku(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function TS(e){return new eD(e)}function nD(e){this._context=e}nD.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:ku(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function AS(e){return new nD(e)}function rD(e,t){this._basis=new Fp(e),this._beta=t}rD.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,n=e.length-1;if(n>0)for(var r=e[0],i=t[0],o=e[n]-r,s=t[n]-i,a=-1,c;++a<=n;)c=a/n,this._basis.point(this._beta*e[a]+(1-this._beta)*(r+c*o),this._beta*t[a]+(1-this._beta)*(i+c*s));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};var ES=function e(t){function n(r){return t===1?new Fp(r):new rD(r,t)}return n.beta=function(r){return e(+r)},n}(.85);function Ru(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function Rx(e,t){this._context=e,this._k=(1-t)/6}Rx.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:Ru(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:Ru(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 DS=function e(t){function n(r){return new Rx(r,t)}return n.tension=function(r){return e(+r)},n}(0);function $x(e,t){this._context=e,this._k=(1-t)/6}$x.prototype={areaStart:Jr,areaEnd:Jr,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:Ru(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 NS=function e(t){function n(r){return new $x(r,t)}return n.tension=function(r){return e(+r)},n}(0);function Ux(e,t){this._context=e,this._k=(1-t)/6}Ux.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:Ru(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 OS=function e(t){function n(r){return new Ux(r,t)}return n.tension=function(r){return e(+r)},n}(0);function Lp(e,t,n){var r=e._x1,i=e._y1,o=e._x2,s=e._y2;if(e._l01_a>xS){var a=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,c=3*e._l01_a*(e._l01_a+e._l12_a);r=(r*a-e._x0*e._l12_2a+e._x2*e._l01_2a)/c,i=(i*a-e._y0*e._l12_2a+e._y2*e._l01_2a)/c}if(e._l23_a>xS){var l=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,u=3*e._l23_a*(e._l23_a+e._l12_a);o=(o*l+e._x1*e._l23_2a-t*e._l12_2a)/u,s=(s*l+e._y1*e._l23_2a-n*e._l12_2a)/u}e._context.bezierCurveTo(r,i,o,s,e._x2,e._y2)}function iD(e,t){this._context=e,this._alpha=t}iD.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:Lp(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 BS=function e(t){function n(r){return t?new iD(r,t):new Rx(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function oD(e,t){this._context=e,this._alpha=t}oD.prototype={areaStart:Jr,areaEnd:Jr,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:Lp(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 FS=function e(t){function n(r){return t?new oD(r,t):new $x(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function sD(e,t){this._context=e,this._alpha=t}sD.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Lp(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 LS=function e(t){function n(r){return t?new sD(r,t):new Ux(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function aD(e){this._context=e}aD.prototype={areaStart:Jr,areaEnd:Jr,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 CS(e){return new aD(e)}function cD(e){return e<0?-1:1}function lD(e,t,n){var r=e._x1-e._x0,i=t-e._x1,o=(e._y1-e._y0)/(r||i<0&&-0),s=(n-e._y1)/(i||r<0&&-0),a=(o*i+s*r)/(r+i);return(cD(o)+cD(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(a))||0}function uD(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function kS(e,t,n){var r=e._x0,i=e._y0,o=e._x1,s=e._y1,a=(o-r)/3;e._context.bezierCurveTo(r+a,i+a*t,o-a,s-a*n,o,s)}function Px(e){this._context=e}Px.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:kS(this,this._t0,uD(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,kS(this,uD(this,n=lD(this,e,t)),n);break;default:kS(this,this._t0,n=lD(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function fD(e){this._context=new hD(e)}(fD.prototype=Object.create(Px.prototype)).point=function(e,t){Px.prototype.point.call(this,t,e)};function hD(e){this._context=e}hD.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,o){this._context.bezierCurveTo(t,e,r,n,o,i)}};function RS(e){return new Px(e)}function $S(e){return new fD(e)}function pD(e){this._context=e}pD.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=dD(e),i=dD(t),o=0,s=1;s<n;++o,++s)this._context.bezierCurveTo(r[0][o],i[0][o],r[1][o],i[1][o],e[s],t[s]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function dD(e){var t,n=e.length-1,r,i=new Array(n),o=new Array(n),s=new Array(n);for(i[0]=0,o[0]=2,s[0]=e[0]+2*e[1],t=1;t<n-1;++t)i[t]=1,o[t]=4,s[t]=4*e[t]+2*e[t+1];for(i[n-1]=2,o[n-1]=7,s[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=i[t]/o[t-1],o[t]-=r,s[t]-=r*s[t-1];for(i[n-1]=s[n-1]/o[n-1],t=n-2;t>=0;--t)i[t]=(s[t]-i[t+1])/o[t];for(o[n-1]=(e[n]+i[n-1])/2,t=0;t<n-1;++t)o[t]=2*e[t+1]-i[t+1];return[i,o]}function US(e){return new pD(e)}function zx(e,t){this._context=e,this._t=t}zx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function PS(e){return new zx(e,.5)}function zS(e){return new zx(e,0)}function VS(e){return new zx(e,1)}var Cp=e=>()=>e;function qS(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Nr(e,t,n){this.k=e,this.x=t,this.y=n}Nr.prototype={constructor:Nr,scale:function(e){return e===1?this:new Nr(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Nr(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 kp=new Nr(1,0,0);jS.prototype=Nr.prototype;function jS(e){for(;!e.__zoom;)if(!(e=e.parentNode))return kp;return e.__zoom}function Vx(e){e.stopImmediatePropagation()}function $u(e){e.preventDefault(),e.stopImmediatePropagation()}function sV(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function aV(){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 mD(){return this.__zoom||kp}function cV(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function lV(){return navigator.maxTouchPoints||"ontouchstart"in this}function uV(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s))}function YS(){var e=sV,t=aV,n=uV,r=cV,i=lV,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=xv,l=Ic("start","zoom","end"),u,f,h,d=500,p=150,y=0,b=10;function m(S){S.property("__zoom",mD).on("wheel.zoom",E,{passive:!1}).on("mousedown.zoom",N).on("dblclick.zoom",I).filter(i).on("touchstart.zoom",T).on("touchmove.zoom",O).on("touchend.zoom touchcancel.zoom",B).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(S,A,D,L){var k=S.selection?S.selection():S;k.property("__zoom",mD),S!==k?v(S,A,D,L):k.interrupt().each(function(){_(this,arguments).event(L).start().zoom(null,typeof A=="function"?A.apply(this,arguments):A).end()})},m.scaleBy=function(S,A,D,L){m.scaleTo(S,function(){var k=this.__zoom.k,C=typeof A=="function"?A.apply(this,arguments):A;return k*C},D,L)},m.scaleTo=function(S,A,D,L){m.transform(S,function(){var k=t.apply(this,arguments),C=this.__zoom,R=D==null?w(k):typeof D=="function"?D.apply(this,arguments):D,$=C.invert(R),U=typeof A=="function"?A.apply(this,arguments):A;return n(x(g(C,U),R,$),k,s)},D,L)},m.translateBy=function(S,A,D,L){m.transform(S,function(){return n(this.__zoom.translate(typeof A=="function"?A.apply(this,arguments):A,typeof D=="function"?D.apply(this,arguments):D),t.apply(this,arguments),s)},null,L)},m.translateTo=function(S,A,D,L,k){m.transform(S,function(){var C=t.apply(this,arguments),R=this.__zoom,$=L==null?w(C):typeof L=="function"?L.apply(this,arguments):L;return n(kp.translate($[0],$[1]).scale(R.k).translate(typeof A=="function"?-A.apply(this,arguments):-A,typeof D=="function"?-D.apply(this,arguments):-D),C,s)},L,k)};function g(S,A){return A=Math.max(o[0],Math.min(o[1],A)),A===S.k?S:new Nr(A,S.x,S.y)}function x(S,A,D){var L=A[0]-D[0]*S.k,k=A[1]-D[1]*S.k;return L===S.x&&k===S.y?S:new Nr(S.k,L,k)}function w(S){return[(+S[0][0]+ +S[1][0])/2,(+S[0][1]+ +S[1][1])/2]}function v(S,A,D,L){S.on("start.zoom",function(){_(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(L).end()}).tween("zoom",function(){var k=this,C=arguments,R=_(k,C).event(L),$=t.apply(k,C),U=D==null?w($):typeof D=="function"?D.apply(k,C):D,G=Math.max($[1][0]-$[0][0],$[1][1]-$[0][1]),J=k.__zoom,et=typeof A=="function"?A.apply(k,C):A,ot=c(J.invert(U).concat(G/J.k),et.invert(U).concat(G/et.k));return function(j){if(j===1)j=et;else{var nt=ot(j),z=G/nt[2];j=new Nr(z,U[0]-nt[0]*z,U[1]-nt[1]*z)}R.zoom(null,j)}})}function _(S,A,D){return!D&&S.__zooming||new M(S,A)}function M(S,A){this.that=S,this.args=A,this.active=0,this.sourceEvent=null,this.extent=t.apply(S,A),this.taps=0}M.prototype={event:function(S){return S&&(this.sourceEvent=S),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(S,A){return this.mouse&&S!=="mouse"&&(this.mouse[1]=A.invert(this.mouse[0])),this.touch0&&S!=="touch"&&(this.touch0[1]=A.invert(this.touch0[0])),this.touch1&&S!=="touch"&&(this.touch1[1]=A.invert(this.touch1[0])),this.that.__zoom=A,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(S){var A=Ut(this.that).datum();l.call(S,this.that,new qS(S,{sourceEvent:this.sourceEvent,target:m,type:S,transform:this.that.__zoom,dispatch:l}),A)}};function E(S,...A){if(!e.apply(this,arguments))return;var D=_(this,A).event(S),L=this.__zoom,k=Math.max(o[0],Math.min(o[1],L.k*Math.pow(2,r.apply(this,arguments)))),C=En(S);if(D.wheel)(D.mouse[0][0]!==C[0]||D.mouse[0][1]!==C[1])&&(D.mouse[1]=L.invert(D.mouse[0]=C)),clearTimeout(D.wheel);else{if(L.k===k)return;D.mouse=[C,L.invert(C)],eo(this),D.start()}$u(S),D.wheel=setTimeout(R,p),D.zoom("mouse",n(x(g(L,k),D.mouse[0],D.mouse[1]),D.extent,s));function R(){D.wheel=null,D.end()}}function N(S,...A){if(h||!e.apply(this,arguments))return;var D=S.currentTarget,L=_(this,A,!0).event(S),k=Ut(S.view).on("mousemove.zoom",U,!0).on("mouseup.zoom",G,!0),C=En(S,D),R=S.clientX,$=S.clientY;hd(S.view),Vx(S),L.mouse=[C,this.__zoom.invert(C)],eo(this),L.start();function U(J){if($u(J),!L.moved){var et=J.clientX-R,ot=J.clientY-$;L.moved=et*et+ot*ot>y}L.event(J).zoom("mouse",n(x(L.that.__zoom,L.mouse[0]=En(J,D),L.mouse[1]),L.extent,s))}function G(J){k.on("mousemove.zoom mouseup.zoom",null),dd(J.view,L.moved),$u(J),L.event(J).end()}}function I(S,...A){if(e.apply(this,arguments)){var D=this.__zoom,L=En(S.changedTouches?S.changedTouches[0]:S,this),k=D.invert(L),C=D.k*(S.shiftKey?.5:2),R=n(x(g(D,C),L,k),t.apply(this,A),s);$u(S),a>0?Ut(this).transition().duration(a).call(v,R,L,S):Ut(this).call(m.transform,R,L,S)}}function T(S,...A){if(e.apply(this,arguments)){var D=S.touches,L=D.length,k=_(this,A,S.changedTouches.length===L).event(S),C,R,$,U;for(Vx(S),R=0;R<L;++R)$=D[R],U=En($,this),U=[U,this.__zoom.invert(U),$.identifier],k.touch0?!k.touch1&&k.touch0[2]!==U[2]&&(k.touch1=U,k.taps=0):(k.touch0=U,C=!0,k.taps=1+!!u);u&&(u=clearTimeout(u)),C&&(k.taps<2&&(f=U[0],u=setTimeout(function(){u=null},d)),eo(this),k.start())}}function O(S,...A){if(this.__zooming){var D=_(this,A).event(S),L=S.changedTouches,k=L.length,C,R,$,U;for($u(S),C=0;C<k;++C)R=L[C],$=En(R,this),D.touch0&&D.touch0[2]===R.identifier?D.touch0[0]=$:D.touch1&&D.touch1[2]===R.identifier&&(D.touch1[0]=$);if(R=D.that.__zoom,D.touch1){var G=D.touch0[0],J=D.touch0[1],et=D.touch1[0],ot=D.touch1[1],j=(j=et[0]-G[0])*j+(j=et[1]-G[1])*j,nt=(nt=ot[0]-J[0])*nt+(nt=ot[1]-J[1])*nt;R=g(R,Math.sqrt(j/nt)),$=[(G[0]+et[0])/2,(G[1]+et[1])/2],U=[(J[0]+ot[0])/2,(J[1]+ot[1])/2]}else if(D.touch0)$=D.touch0[0],U=D.touch0[1];else return;D.zoom("touch",n(x(R,$,U),D.extent,s))}}function B(S,...A){if(this.__zooming){var D=_(this,A).event(S),L=S.changedTouches,k=L.length,C,R;for(Vx(S),h&&clearTimeout(h),h=setTimeout(function(){h=null},d),C=0;C<k;++C)R=L[C],D.touch0&&D.touch0[2]===R.identifier?delete D.touch0:D.touch1&&D.touch1[2]===R.identifier&&delete D.touch1;if(D.touch1&&!D.touch0&&(D.touch0=D.touch1,delete D.touch1),D.touch0)D.touch0[1]=this.__zoom.invert(D.touch0[0]);else if(D.end(),D.taps===2&&(R=En(R,this),Math.hypot(f[0]-R[0],f[1]-R[1])<b)){var $=Ut(this).on("dblclick.zoom");$&&$.apply(this,arguments)}}}return m.wheelDelta=function(S){return arguments.length?(r=typeof S=="function"?S:Cp(+S),m):r},m.filter=function(S){return arguments.length?(e=typeof S=="function"?S:Cp(!!S),m):e},m.touchable=function(S){return arguments.length?(i=typeof S=="function"?S:Cp(!!S),m):i},m.extent=function(S){return arguments.length?(t=typeof S=="function"?S:Cp([[+S[0][0],+S[0][1]],[+S[1][0],+S[1][1]]]),m):t},m.scaleExtent=function(S){return arguments.length?(o[0]=+S[0],o[1]=+S[1],m):[o[0],o[1]]},m.translateExtent=function(S){return arguments.length?(s[0][0]=+S[0][0],s[1][0]=+S[1][0],s[0][1]=+S[0][1],s[1][1]=+S[1][1],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(S){return arguments.length?(n=S,m):n},m.duration=function(S){return arguments.length?(a=+S,m):a},m.interpolate=function(S){return arguments.length?(c=S,m):c},m.on=function(){var S=l.on.apply(l,arguments);return S===l?m:S},m.clickDistance=function(S){return arguments.length?(y=(S=+S)*S,m):Math.sqrt(y)},m.tapDistance=function(S){return arguments.length?(b=+S,m):b},m}function Re(e){return e!=null&&!Number.isNaN(e)}function sn(e,t){return+Re(t)-+Re(e)||qt(e,t)}function Kc(e,t){return+Re(t)-+Re(e)||Pn(e,t)}function Rp(e){return e!=null&&`${e}`!=""}function Uu(e){return isFinite(e)?e:NaN}function Zn(e){return e>0&&isFinite(e)?e:NaN}function Ia(e){return e<0&&isFinite(e)?e:NaN}function qx(e,t){if(e instanceof Date||(e=new Date(+e)),isNaN(e))return typeof t=="function"?t(e):t;let n=e.getUTCHours(),r=e.getUTCMinutes(),i=e.getUTCSeconds(),o=e.getUTCMilliseconds();return`${fV(e.getUTCFullYear(),4)}-${Ts(e.getUTCMonth()+1,2)}-${Ts(e.getUTCDate(),2)}${n||r||i||o?`T${Ts(n,2)}:${Ts(r,2)}${i||o?`:${Ts(i,2)}${o?`.${Ts(o,3)}`:""}`:""}Z`:""}`}function fV(e){return e<0?`-${Ts(-e,6)}`:e>9999?`+${Ts(e,6)}`:Ts(e,4)}function Ts(e,t){return`${e}`.padStart(t,"0")}var hV=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function $p(e,t){return hV.test(e+="")?new Date(e):typeof t=="function"?t(e):t}var zu=1e3,Ta=zu*60,Aa=Ta*60,yo=Aa*24,mo=yo*7,Qc=yo*30,Ma=yo*365,WS=[["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",zu],["5 seconds",5*zu],["15 seconds",15*zu],["30 seconds",30*zu],["minute",Ta],["5 minutes",5*Ta],["15 minutes",15*Ta],["30 minutes",30*Ta],["hour",Aa],["3 hours",3*Aa],["6 hours",6*Aa],["12 hours",12*Aa],["day",yo],["2 days",2*yo],["week",mo],["2 weeks",2*mo],["month",Qc],["3 months",3*Qc],["6 months",6*Qc],["year",Ma],["2 years",2*Ma],["5 years",5*Ma],["10 years",10*Ma],["20 years",20*Ma],["50 years",50*Ma],["100 years",100*Ma]],GS=new Map([["second",zu],["minute",Ta],["hour",Aa],["day",yo],["monday",mo],["tuesday",mo],["wednesday",mo],["thursday",mo],["friday",mo],["saturday",mo],["sunday",mo],["week",mo],["month",Qc],["year",Ma]]),gD=new Map([["second",rn],["minute",bs],["hour",ws],["day",Zr],["monday",va],["tuesday",sb],["wednesday",ab],["thursday",fo],["friday",cb],["saturday",lb],["sunday",Er],["week",Er],["month",vs],["year",Fn]]),XS=new Map([["second",rn],["minute",xs],["hour",_s],["day",Gc],["monday",Sa],["tuesday",ub],["wednesday",fb],["thursday",ho],["friday",hb],["saturday",db],["sunday",Dr],["week",Dr],["month",Ss],["year",Ln]]),Vu=Symbol("intervalDuration"),Yx=Symbol("intervalType");for(let[e,t]of gD)t[Vu]=GS.get(e),t[Yx]="time";for(let[e,t]of XS)t[Vu]=GS.get(e),t[Yx]="utc";var Up=[["year",Ln,"utc"],["month",Ss,"utc"],["day",Gc,"utc",6*Qc],["hour",_s,"utc",3*yo],["minute",xs,"utc",6*Aa],["second",rn,"utc",30*Ta]],jx=[["year",Fn,"time"],["month",vs,"time"],["day",Zr,"time",6*Qc],["hour",ws,"time",3*yo],["minute",bs,"time",6*Aa],["second",rn,"time",30*Ta]],dV=[Up[0],jx[0],Up[1],jx[1],Up[2],jx[2],...Up.slice(3)];function Wx(e){let t=`${e}`.toLowerCase();t.endsWith("s")&&(t=t.slice(0,-1));let n=1,r=/^(?:(\d+)\s+)/.exec(t);switch(r&&(t=t.slice(r[0].length),n=+r[1]),t){case"quarter":t="month",n*=3;break;case"half":t="month",n*=6;break}let i=XS.get(t);if(!i)throw new Error(`unknown interval: ${e}`);if(n>1&&!i.every)throw new Error(`non-periodic interval: ${t}`);return[t,n]}function HS(e){return bD(Wx(e),"time")}function Pp(e){return bD(Wx(e),"utc")}function bD([e,t],n){let r=(n==="time"?gD:XS).get(e);return t>1&&(r=r.every(t),r[Vu]=GS.get(e)*t,r[Yx]=n),r}function ZS(e,t){if(!(t>1))return;let n=e[Vu];if(!WS.some(([,i])=>i===n)||n%yo===0&&yo<n&&n<Qc)return;let[r]=WS[is(([,i])=>Math.log(i)).center(WS,Math.log(n*t))];return(e[Yx]==="time"?HS:Pp)(r)}function yD(e,t,n){let r=t==="time"?Du:po;if(n==null)return r(e==="year"?"%Y":e==="month"?"%Y-%m":e==="day"?"%Y-%m-%d":e==="hour"||e==="minute"?"%Y-%m-%dT%H:%M":e==="second"?"%Y-%m-%dT%H:%M:%S":"%Y-%m-%dT%H:%M:%S.%L");let i=pV(n);switch(e){case"millisecond":return Pu(r(".%L"),r(":%M:%S"),i);case"second":return Pu(r(":%S"),r("%-I:%M"),i);case"minute":return Pu(r("%-I:%M"),r("%p"),i);case"hour":return Pu(r("%-I %p"),r("%b %-d"),i);case"day":return Pu(r("%-d"),r("%b"),i);case"month":return Pu(r("%b"),r("%Y"),i);case"year":return r("%Y")}throw new Error("unable to format time ticks")}function pV(e){return e==="left"||e==="right"?(t,n)=>`
|
|
12
|
+
${t}
|
|
13
|
+
${n}`:e==="top"?(t,n)=>`${n}
|
|
14
|
+
${t}`:(t,n)=>`${t}
|
|
15
|
+
${n}`}function mV(e){return e==="time"?jx:e==="utc"?Up:dV}function xD(e,t,n){let r=$t(U0(t,(i,o)=>Math.abs(o-i)));if(r<1e3)return yD("millisecond","utc",n);for(let[i,o,s,a]of mV(e)){if(r>a||i==="hour"&&!r)break;if(t.every(c=>o.floor(c)>=c))return yD(i,s,n)}}function Pu(e,t,n){return(r,i,o)=>{let s=e(r,i),a=t(r,i),c=i-As(o);return i!==c&&o[c]!==void 0&&a===t(o[c],c)?s:n(s,a)}}var Jc=Object.getPrototypeOf(Uint8Array),yV=Object.prototype.toString,KS=Symbol("reindex");function dt(e,t,n){let r=typeof t;return r==="string"?wD(e,QS(t),n):r==="function"?wD(e,t,n):r==="number"||t instanceof Date||r==="boolean"?Vt(e,an(t),n):typeof t?.transform=="function"?_D(t.transform(e),n):gV(_D(t,n),e?.[KS])}function gV(e,t){return t?Vp(e,t):e}function wD(e,t,n){return Vt(e,n?.prototype instanceof Jc?bV(t):t,n)}function _D(e,t){return t===void 0?Ue(e):e instanceof t?e:t.prototype instanceof Jc&&!(e instanceof Jc)?t.from(e,JS):t.from(e)}function bV(e){return(t,n)=>JS(e(t,n))}var Ea=[null],QS=e=>t=>t[e],ve={transform:Kn},W={transform:e=>e};var zp=()=>1,vD=()=>!0,$e=e=>e==null?e:`${e}`,Tt=e=>e==null?e:+e;var Es=e=>e?e[0]:void 0,Da=e=>e?e[1]:void 0,SD=e=>e?e[2]:void 0,an=e=>()=>e;function qu(e){let t=+`${e}`.slice(1)/100;return(n,r)=>Vn(n,t,r)}function Xe(e){return e instanceof Jc?e:Vt(e,JS,Float64Array)}function JS(e){return e==null?NaN:Number(e)}function ID(e){return Vt(e,tI)}function tI(e){return e instanceof Date&&!isNaN(e)?e:typeof e=="string"?$p(e):e==null||isNaN(e=+e)?void 0:new Date(e)}function Te(e,t){return e===void 0&&(e=t),e===null?[void 0,"none"]:Ba(e)?[void 0,e]:[e,void 0]}function ee(e,t){return e===void 0&&(e=t),e===null||typeof e=="number"?[void 0,e]:[e,void 0]}function eI(e,t,n){if(e!=null)return He(e,t,n)}function He(e,t,n){let r=`${e}`.toLowerCase();if(!n.includes(r))throw new Error(`invalid ${t}: ${e}`);return r}function Ue(e){return e==null||e instanceof Array||e instanceof Jc?e:Array.from(e)}function Vt(e,t,n=Array){return e==null?e:e instanceof n?e.map(t):n.from(e,t)}function Na(e,t=Array){return e instanceof t?e.slice():t.from(e)}function nI({x:e,x1:t,x2:n}){return e!==void 0||t!==void 0||n!==void 0}function rI({y:e,y1:t,y2:n}){return e!==void 0||t!==void 0||n!==void 0}function ju(e){return nI(e)||rI(e)||e.interval!==void 0}function cn(e){return e?.toString===yV}function go(e){return cn(e)&&(e.type!==void 0||e.domain!==void 0)}function Or(e){return cn(e)&&typeof e.transform!="function"}function bo(e){return Or(e)&&e.value===void 0&&e.channel===void 0}function iI(e,t,n,r=W){return t===void 0&&n===void 0?(t=0,n=e===void 0?r:e):t===void 0?t=e===void 0?0:e:n===void 0&&(n=e===void 0?0:e),[t,n]}function Le(e,t){return e===void 0&&t===void 0?[Es,Da]:[e,t]}function Cn({z:e,fill:t,stroke:n}={}){return e===void 0&&([e]=Te(t)),e===void 0&&([e]=Te(n)),e}function Kn(e){let t=e.length,n=new Uint32Array(t);for(let r=0;r<t;++r)n[r]=r;return n}function Vp(e,t){return Vt(t,n=>e[n],e.constructor)}function Yu(e){return e.length===1?(t,n)=>e(Vp(n,t)):e}function Ds(e,t,n){return e.subarray?e.subarray(t,n):e.slice(t,n)}function Ns(e){return e!==null&&typeof e=="object"?e.valueOf():e}function Gx(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 ln(e){let t;return[{transform:()=>t,label:Mn(e)},n=>t=n]}function In(e){return e==null?[e]:ln(e)}function Mn(e,t){return typeof e=="string"?e:e&&e.label!==void 0?e.label:t}function Wu(e,t){return{transform(n){let r=e.transform(n),i=t.transform(n);return Ae(r)||Ae(i)?Vt(r,(o,s)=>new Date((+r[s]+ +i[s])/2)):Vt(r,(o,s)=>(+r[s]+ +i[s])/2,Float64Array)},label:e.label}}function tl(e,t){let n=oI(t?.interval,t?.type);return n?Vt(e,n):e}function oI(e,t){let n=Gu(e,t);return n&&(r=>Re(r)?n.floor(r):r)}function Gu(e,t){if(e!=null){if(typeof e=="number"){0<e&&e<1&&Number.isInteger(1/e)&&(e=-1/e);let n=Math.abs(e);return e<0?{floor:r=>Math.floor(r*n)/n,offset:r=>(r*n+1)/n,range:(r,i)=>ke(Math.ceil(r*n),i*n).map(o=>o/n)}:{floor:r=>Math.floor(r/n)*n,offset:r=>r+n,range:(r,i)=>ke(Math.ceil(r/n),i/n).map(o=>o*n)}}if(typeof e=="string")return(t==="time"?HS:Pp)(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 xo(e,t){if(e=Gu(e,t),e&&typeof e.range!="function")throw new Error("invalid interval: missing range method");return e}function MD(e,t){if(e=xo(e,t),e&&typeof e.ceil!="function")throw new Error("invalid interval: missing ceil method");return e}function TD(e){return Oa(e)&&typeof e?.floor=="function"&&e.floor()instanceof Date}function Oa(e){return typeof e?.range=="function"}function ti(e){return e===void 0||Or(e)?e:{value:e}}function AD(e){return e==null?null:{transform:t=>dt(t,e,Float64Array),label:Mn(e)}}function ED(e){if(!Qn(e))return!1;for(let t of e)if(t!=null)return typeof t=="object"&&"0"in t&&"1"in t}function Qn(e){return e&&typeof e[Symbol.iterator]=="function"}function Xx(e){for(let t of e)if(t!=null)return typeof t!="object"||t instanceof Date}function Se(e){for(let t of e){if(t==null)continue;let n=typeof t;return n==="string"||n==="boolean"}}function Ae(e){for(let t of e)if(t!=null)return t instanceof Date}function DD(e){for(let t of e)if(t!=null)return typeof t=="string"&&isNaN(t)&&$p(t)}function ND(e){for(let t of e)if(t!=null){if(typeof t!="string")return!1;if(t.trim())return!isNaN(t)}}function Os(e){for(let t of e)if(t!=null)return typeof t=="number"}function Hx(e,t){let n;for(let r of e)if(r!=null){if(!t(r))return!1;n=!0}return n}var xV=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 Ba(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)||xV.has(e))}function OD(e){return typeof e=="number"&&(0<=e&&e<=1||isNaN(e))}function Jt(e){return e==null||Bs(e)}function Bs(e){return/^\s*none\s*$/i.test(e)}function BD(e){return/^\s*round\s*$/i.test(e)}function Zx(e,t){return eI(e,t,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function wo(e="middle"){return Zx(e,"frameAnchor")}function As(e){if(e==null)return;let t=e[0],n=e[e.length-1];return Pn(t,n)}function FD(e={},...t){let n=e;for(let r of t)for(let i in r)if(n[i]===void 0){let o=r[i];n===e?n={...n,[i]:o}:n[i]=o}return n}function wV(e){console.warn("named iterables are deprecated; please use an object instead");let t=new Set;return Object.fromEntries(Array.from(e,n=>{let{name:r}=n;if(r==null)throw new Error("missing name");let i=`${r}`;if(i==="__proto__")throw new Error(`illegal name: ${i}`);if(t.has(i))throw new Error(`duplicate name: ${i}`);return t.add(i),[r,n]}))}function qp(e){return Qn(e)?wV(e):e}var ei=Symbol("position"),Br=Symbol("color"),el=Symbol("radius"),nl=Symbol("length"),rl=Symbol("opacity"),Xu=Symbol("symbol"),LD=Symbol("projection"),ce=new Map([["x",ei],["y",ei],["fx",ei],["fy",ei],["r",el],["color",Br],["opacity",rl],["symbol",Xu],["length",nl],["projection",LD]]);function CD(e){return e===ei||e===LD}function kD(e){return e===ei||e===el||e===nl||e===rl}var sI=Math.sqrt(3),aI=2/sI,_V={draw(e,t){let n=Math.sqrt(t/Math.PI),r=n*aI,i=r/2;e.moveTo(0,r),e.lineTo(n,i),e.lineTo(n,-i),e.lineTo(0,-r),e.lineTo(-n,-i),e.lineTo(-n,i),e.closePath()}},cI=new Map([["asterisk",vp],["circle",Ms],["cross",Sp],["diamond",Ip],["diamond2",Mp],["hexagon",_V],["plus",Tp],["square",Ap],["square2",Ep],["star",Dp],["times",Cu],["triangle",Np],["triangle2",Op],["wye",Bp]]);function lI(e){return e&&typeof e.draw=="function"}function RD(e){return lI(e)?!0:typeof e!="string"?!1:cI.has(e.toLowerCase())}function Hu(e){if(e==null||lI(e))return e;let t=cI.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid symbol: ${e}`)}function $D(e){if(e==null||lI(e))return[void 0,e];if(typeof e=="string"){let t=cI.get(`${e}`.toLowerCase());if(t)return[void 0,t]}return[e,void 0]}function un({filter:e,sort:t,reverse:n,transform:r,initializer:i,...o}={},s){if(r===void 0&&(e!=null&&(r=hI(e)),t!=null&&!bo(t)&&(r=uI(r,pI(t))),n&&(r=uI(r,dI))),s!=null&&i!=null)throw new Error("transforms cannot be applied after initializers");return{...o,...(t===null||bo(t))&&{sort:t},transform:uI(r,s)}}function xe({filter:e,sort:t,reverse:n,initializer:r,...i}={},o){return r===void 0&&(e!=null&&(r=hI(e)),t!=null&&!bo(t)&&(r=fI(r,pI(t))),n&&(r=fI(r,dI))),{...i,...(t===null||bo(t))&&{sort:t},initializer:fI(r,o)}}function uI(e,t){return e==null?t===null?void 0:t:t==null?e===null?void 0:e:function(n,r,i){return{data:n,facets:r}=e.call(this,n,r,i),t.call(this,Ue(n),r,i)}}function fI(e,t){return e==null?t===null?void 0:t:t==null?e===null?void 0:e:function(n,r,i,...o){let s,a,c,l,u,f;return{data:a=n,facets:c=r,channels:s}=e.call(this,n,r,i,...o),{data:u=a,facets:f=c,channels:l}=t.call(this,a,c,{...i,...s},...o),{data:u,facets:f,channels:{...s,...l}}}}function Kx(e,t){return(e.initializer!=null?xe:un)(e,t)}function UD(e,t){return Kx(t,hI(e))}function hI(e){return(t,n)=>{let r=dt(t,e);return{data:t,facets:n.map(i=>i.filter(o=>r[o]))}}}function PD({sort:e,...t}={}){return{...Kx(t,dI),sort:bo(e)?e:null}}function dI(e,t){return{data:e,facets:t.map(n=>n.slice().reverse())}}function zD({seed:e,sort:t,...n}={}){return{...Kx(n,VD(e==null?Math.random:zc(e))),sort:bo(t)?t:null}}function Qx(e,{sort:t,...n}={}){return{...(Or(e)&&e.channel!==void 0?xe:Kx)(n,pI(e)),sort:bo(t)?t:null}}function pI(e){return(typeof e=="function"&&e.length!==1?vV:VD)(e)}function vV(e){return(t,n)=>{let r=(i,o)=>e(t[i],t[o]);return{data:t,facets:n.map(i=>i.slice().sort(r))}}}function VD(e){let t,n;({channel:t,value:e,order:n}={...ti(e)});let r=t?.startsWith("-");if(r&&(t=t.slice(1)),n===void 0&&(n=r?Kc:sn),typeof n!="function")switch(`${n}`.toLowerCase()){case"ascending":n=sn;break;case"descending":n=Kc;break;default:throw new Error(`invalid order: ${n}`)}return(i,o,s)=>{let a;if(t===void 0)a=dt(i,e);else{if(s===void 0)throw new Error("channel sort requires an initializer");if(a=s[t],!a)return{};a=a.value}let c=(l,u)=>n(a[l],a[u]);return{data:i,facets:o.map(l=>l.slice().sort(c))}}}function Yp(e,t){return Jx(null,null,e,t)}function La(e={y:"count"},t={}){let{x:n=W}=t;if(n==null)throw new Error("missing channel: x");return Jx(n,null,e,t)}function Ca(e={x:"count"},t={}){let{y:n=W}=t;if(n==null)throw new Error("missing channel: y");return Jx(null,n,e,t)}function Wp(e={fill:"count"},t={}){let{x:n,y:r}=t;if([n,r]=Le(n,r),n==null)throw new Error("missing channel: x");if(r==null)throw new Error("missing channel: y");return Jx(n,r,e,t)}function Jx(e,t,{data:n=n1,filter:r,sort:i,reverse:o,...s}={},a={}){s=yI(s,a),n=GD(n,W),i=i==null?void 0:YD("sort",i,a),r=r==null?void 0:WD("filter",r,a);let[c,l]=In(e),[u,f]=In(t),{z:h,fill:d,stroke:p,x1:y,x2:b,y1:m,y2:g,...x}=a,[w,v]=In(h),[_]=Te(d),[M]=Te(p),[E,N]=In(_),[I,T]=In(M);return{..."z"in a&&{z:w||h},..."fill"in a&&{fill:E||d},..."stroke"in a&&{stroke:I||p},...un(x,(O,B,S)=>{let A=tl(dt(O,e),S?.x),D=tl(dt(O,t),S?.y),L=dt(O,h),k=dt(O,_),C=dt(O,M),R=Gp(s,{z:L,fill:k,stroke:C}),$=[],U=[],G=A&&l([]),J=D&&f([]),et=L&&v([]),ot=k&&N([]),j=C&&T([]),nt=0;for(let z of s)z.initialize(O);i&&i.initialize(O),r&&r.initialize(O);for(let z of B){let X=[];for(let rt of s)rt.scope("facet",z);i&&i.scope("facet",z),r&&r.scope("facet",z);for(let[rt,P]of Fa(z,R))for(let[Bt,ft]of Fa(P,D))for(let[jt,Yt]of Fa(ft,A)){let tt={data:O};if(A&&(tt.x=jt),D&&(tt.y=Bt),!(r&&!r.reduce(Yt,tt))){X.push(nt++),U.push(n.reduceIndex(Yt,O,tt)),A&&G.push(jt),D&&J.push(Bt),L&&et.push(R===L?rt:L[Yt[0]]),k&&ot.push(R===k?rt:k[Yt[0]]),C&&j.push(R===C?rt:C[Yt[0]]);for(let ne of s)ne.reduce(Yt,tt);i&&i.reduce(Yt,tt)}}$.push(X)}return gI($,i,o),{data:U,facets:$}}),...!_o(s,"x")&&(c?{x:c}:{x1:y,x2:b}),...!_o(s,"y")&&(u?{y:u}:{y1:m,y2:g}),...Object.fromEntries(s.map(({name:O,output:B})=>[O,B]))}}function _o(e,...t){for(let{name:n}of e)if(t.includes(n))return!0;return!1}function mI(e,t,n=t1){let r=Object.entries(e);return t.title!=null&&e.title===void 0&&r.push(["title",EV]),t.href!=null&&e.href===void 0&&r.push(["href",r1]),r.filter(([,i])=>i!==void 0).map(([i,o])=>o===null?SV(i):n(i,o,t))}function t1(e,t,n,r=e1){let i;cn(t)&&"reduce"in t&&(i=t.scale,t=t.reduce);let o=r(e,t,n),[s,a]=ln(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 SV(e){return{name:e,initialize(){},scope(){},reduce(){}}}function e1(e,t,n,r=Zu){let i=Gx(e,n),o=r(t,i),s,a;return{label:Mn(o===jp?null:i,o.label),initialize(c){s=i===void 0?c:dt(c,i),o.scope==="data"&&(a=o.reduceIndex(Kn(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 Fa(e,t){return t?Zi(tn(e,n=>t[n]),Es):[[,e]]}function Zu(e,t,n=IV){if(e==null)return n(e);if(typeof e.reduceIndex=="function")return e;if(typeof e.reduce=="function"&&cn(e))return TV(e);if(typeof e=="function")return AV(e);if(/^p\d{2}$/i.test(e))return Fs(qu(e));switch(`${e}`.toLowerCase()){case"first":return r1;case"last":return DV;case"identity":return n1;case"count":return jp;case"distinct":return NV;case"sum":return t==null?jp:OV;case"proportion":return jD(t,"data");case"proportion-facet":return jD(t,"facet");case"deviation":return Fs(qr);case"min":return Fs(oe);case"min-index":return Fs(k0);case"max":return Fs($t);case"max-index":return Fs(C0);case"mean":return qD(as);case"median":return qD(Ti);case"variance":return Fs(ca);case"mode":return Fs(Jl)}return n(e)}function IV(e){throw new Error(`invalid reduce: ${e}`)}function yI(e,t){return mI(e,t,YD)}function YD(e,t,n){return t1(e,t,n,WD)}function WD(e,t,n){return e1(e,t,n,GD)}function GD(e,t){return Zu(e,t,MV)}function MV(e){switch(`${e}`.toLowerCase()){case"x":return BV;case"y":return FV}throw new Error(`invalid group reduce: ${e}`)}function Gp(e,t){for(let n in t){let r=t[n];if(r!==void 0&&!e.some(i=>i.name===n))return r}}function gI(e,t,n){if(t){let r=t.output.transform(),i=(o,s)=>sn(r[o],r[s]);e.forEach(o=>o.sort(i))}n&&e.forEach(r=>r.reverse())}function TV(e){return console.warn("deprecated reduce interface; implement reduceIndex instead."),{...e,reduceIndex:e.reduce.bind(e)}}function AV(e){return{reduceIndex(t,n,r){return e(Vp(n,t),r)}}}function Fs(e){return{reduceIndex(t,n){return e(t,r=>n[r])}}}function qD(e){return{reduceIndex(t,n){let r=e(t,i=>n[i]);return Ae(n)?new Date(r):r}}}var n1={reduceIndex(e,t){return Vp(t,e)}},r1={reduceIndex(e,t){return t[e[0]]}},EV={reduceIndex(e,t){let r=Zi(Mi(e,o=>o.length,o=>t[o]),Da),i=r.slice(-5).reverse();if(i.length<r.length){let o=r.slice(0,-4);i[4]=[`\u2026 ${o.length.toLocaleString("en-US")} more`,wn(o,Da)]}return i.map(([o,s])=>`${o} (${s.toLocaleString("en-US")})`).join(`
|
|
16
|
+
`)}},DV={reduceIndex(e,t){return t[e[e.length-1]]}},jp={label:"Frequency",reduceIndex(e){return e.length}},NV={label:"Distinct",reduceIndex(e,t){let n=new Ir;for(let r of e)n.add(t[r]);return n.size}},OV=Fs(wn);function jD(e,t){return e==null?{scope:t,label:"Frequency",reduceIndex:(n,r,i=1)=>n.length/i}:{scope:t,reduceIndex:(n,r,i=1)=>wn(n,o=>r[o])/i}}var BV={reduceIndex(e,t,{x:n}){return n}},FV={reduceIndex(e,t,{y:n}){return n}};function XD(e){if(typeof e!="function")throw new Error(`invalid test function: ${e}`);return{reduceIndex(t,n,{data:r}){return n[t.find(i=>e(r[i],i,r))]}}}function Ku(e,{scale:t,type:n,value:r,filter:i,hint:o,label:s=Mn(r)},a){return o===void 0&&typeof r?.transform=="function"&&(o=r.hint),xI(a,{scale:t,type:n,value:dt(e,r),label:s,filter:i,hint:o})}function i1(e,t){return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,Ku(t,r,n)]))}function Qu(e,t){let n=Object.fromEntries(Object.entries(e).map(([r,{scale:i,value:o}])=>{let s=i==null?null:t[i];return[r,s==null?o:Vt(o,s)]}));return n.channels=e,n}function xI(e,t){let{scale:n,value:r}=t;if(n===!0||n==="auto")switch(e){case"fill":case"stroke":case"color":t.scale=n!==!0&&Hx(r,Ba)?null:"color";break;case"fillOpacity":case"strokeOpacity":case"opacity":t.scale=n!==!0&&Hx(r,OD)?null:"opacity";break;case"symbol":n!==!0&&Hx(r,RD)?(t.scale=null,t.value=Vt(r,Hu)):t.scale="symbol";break;default:t.scale=ce.has(e)?e:null;break}else if(n===!1)t.scale=null;else if(n!=null&&!ce.has(n))throw new Error(`unknown scale: ${n}`);return t}function ZD(e,t,n,r,i){let{order:o,reverse:s,reduce:a=!0,limit:c}=i;for(let l in i){if(!ce.has(l))continue;let{value:u,order:f=o,reverse:h=s,reduce:d=a,limit:p=c}=ti(i[l]),y=u?.startsWith("-");if(y&&(u=u.slice(1)),f=f===void 0?y!==(u==="width"||u==="height")?QD:KD:kV(f),d==null||d===!1)continue;let b=l==="fx"||l==="fy"?CV(t,r[l]):LV(n,l);if(!b)throw new Error(`missing channel for scale: ${l}`);let m=b.value,[g=0,x=1/0]=Qn(p)?p:p<0?[p]:[0,p];if(u==null)b.domain=()=>{let w=Array.from(new Ir(m));return h&&(w=w.reverse()),(g!==0||x!==1/0)&&(w=w.slice(g,x)),w};else{let w=u==="data"?e:u==="height"?HD(n,"y1","y2"):u==="width"?HD(n,"x1","x2"):bI(n,u,u==="y"?"y2":u==="x"?"x2":void 0),v=Zu(d===!0?"max":d,w);b.domain=()=>{let _=X_(Kn(m),M=>v.reduceIndex(M,w),M=>m[M]);return f&&_.sort(f),h&&_.reverse(),(g!==0||x!==1/0)&&(_=_.slice(g,x)),_.map(Es)}}}}function LV(e,t){for(let n in e){let r=e[n];if(r.scale===t)return r}}function CV(e,t){let n=e.original;if(n===e)return t;let r=t.value,i=t.value=[];for(let o=0;o<n.length;++o){let s=r[n[o][0]];for(let a of e[o])i[a]=s}return t}function HD(e,t,n){let r=bI(e,t),i=bI(e,n);return Vt(i,(o,s)=>Math.abs(o-r[s]),Float64Array)}function bI(e,t,n){let r=e[t];if(!r&&n!==void 0&&(r=e[n]),r)return r.value;throw new Error(`missing channel: ${t}`)}function kV(e){if(e==null||typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"ascending":return KD;case"descending":return QD}throw new Error(`invalid order: ${e}`)}function KD([e,t],[n,r]){return sn(t,r)||sn(e,n)}function QD([e,t],[n,r]){return Kc(t,r)||sn(e,n)}function Xp(e,t){let n=e[t];if(n){for(;n.source;)n=n.source;return n.source===null?null:n}}function o1(e){let t,n;return(...r)=>((n?.length!==r.length||n.some((i,o)=>i!==r[o]))&&(n=r,t=e(...r)),t)}var RV=o1(e=>new Intl.NumberFormat(e)),$V=o1((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{month:t}})),UV=o1((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{weekday:t}}));function PV(e="en-US"){let t=RV(e);return n=>n!=null&&!isNaN(n)?t.format(n):void 0}function JD(e="en-US",t="short"){let n=$V(e,t);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2e3,+r)))?n.format(r):void 0}function t5(e="en-US",t="short"){let n=UV(e,t);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2001,0,+r)))?n.format(r):void 0}function wI(e){return qx(e,"Invalid Date")}function zV(e="en-US"){let t=PV(e);return n=>(n instanceof Date?wI:typeof n=="number"?t:$e)(n)}var Ni=zV();var _I=0,vI;function e5(){let e=_I;return _I=0,vI=void 0,e}function kn(e){e!==vI&&(vI=e,console.warn(e),++_I)}var Ee=(typeof window<"u"?window.devicePixelRatio>1:typeof it>"u")?0:.5,VV=0;function s1(){return`plot-clip-${++VV}`}function a1(e,{title:t,href:n,ariaLabel:r,ariaDescription:i,ariaHidden:o,target:s,fill:a,fillOpacity:c,stroke:l,strokeWidth:u,strokeOpacity:f,strokeLinejoin:h,strokeLinecap:d,strokeMiterlimit:p,strokeDasharray:y,strokeDashoffset:b,opacity:m,mixBlendMode:g,imageFilter:x,paintOrder:w,pointerEvents:v,shapeRendering:_,channels:M},{ariaLabel:E,fill:N="currentColor",fillOpacity:I,stroke:T="none",strokeOpacity:O,strokeWidth:B,strokeLinecap:S,strokeLinejoin:A,strokeMiterlimit:D,paintOrder:L}){N===null&&(a=null,c=null),T===null&&(l=null,f=null),Jt(N)?!Jt(T)&&(!Jt(a)||M?.fill)&&(T="none"):Jt(T)&&(!Jt(l)||M?.stroke)&&(N="none");let[k,C]=Te(a,N),[R,$]=ee(c,I),[U,G]=Te(l,T),[J,et]=ee(f,O),[ot,j]=ee(m);Bs(G)||(u===void 0&&(u=B),d===void 0&&(d=S),h===void 0&&(h=A),p===void 0&&!BD(h)&&(p=D),!Bs(C)&&w===void 0&&(w=L));let[nt,z]=ee(u);return N!==null&&(e.fill=se(C,"currentColor"),e.fillOpacity=Hp($,1)),T!==null&&(e.stroke=se(G,"none"),e.strokeWidth=Hp(z,1),e.strokeOpacity=Hp(et,1),e.strokeLinejoin=se(h,"miter"),e.strokeLinecap=se(d,"butt"),e.strokeMiterlimit=Hp(p,4),e.strokeDasharray=se(y,"none"),e.strokeDashoffset=se(b,"0")),e.target=$e(s),e.ariaLabel=$e(E),e.ariaDescription=$e(i),e.ariaHidden=$e(o),e.opacity=Hp(j,1),e.mixBlendMode=se(g,"normal"),e.imageFilter=se(x,"none"),e.paintOrder=se(w,"normal"),e.pointerEvents=se(v,"auto"),e.shapeRendering=se(_,"auto"),{title:{value:t,optional:!0,filter:null},href:{value:n,optional:!0,filter:null},ariaLabel:{value:r,optional:!0,filter:null},fill:{value:k,scale:"auto",optional:!0},fillOpacity:{value:R,scale:"auto",optional:!0},stroke:{value:U,scale:"auto",optional:!0},strokeOpacity:{value:J,scale:"auto",optional:!0},strokeWidth:{value:nt,optional:!0},opacity:{value:ot,scale:"auto",optional:!0}}}function qV(e,t){t&&e.filter(n=>Rp(t[n])).append("title").call(YV,t)}function jV(e,t){t&&e.filter(([n])=>Rp(t[n])).append("title").call(WV,t)}function YV(e,t){t&&e.text(n=>Ni(t[n]))}function WV(e,t){t&&e.text(([n])=>Ni(t[n]))}function Gt(e,{target:t,tip:n},{ariaLabel:r,title:i,fill:o,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:l,opacity:u,href:f}){r&&ut(e,"aria-label",h=>r[h]),o&&ut(e,"fill",h=>o[h]),s&&ut(e,"fill-opacity",h=>s[h]),a&&ut(e,"stroke",h=>a[h]),c&&ut(e,"stroke-opacity",h=>c[h]),l&&ut(e,"stroke-width",h=>l[h]),u&&ut(e,"opacity",h=>u[h]),f&&n5(e,h=>f[h],t),n||qV(e,i)}function il(e,{target:t,tip:n},{ariaLabel:r,title:i,fill:o,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:l,opacity:u,href:f}){r&&ut(e,"aria-label",([h])=>r[h]),o&&ut(e,"fill",([h])=>o[h]),s&&ut(e,"fill-opacity",([h])=>s[h]),a&&ut(e,"stroke",([h])=>a[h]),c&&ut(e,"stroke-opacity",([h])=>c[h]),l&&ut(e,"stroke-width",([h])=>l[h]),u&&ut(e,"opacity",([h])=>u[h]),f&&n5(e,([h])=>f[h],t),n||jV(e,i)}function GV({ariaLabel:e,title:t,fill:n,fillOpacity:r,stroke:i,strokeOpacity:o,strokeWidth:s,opacity:a,href:c},{tip:l}){return[e,l?void 0:t,n,r,i,o,s,a,c].filter(u=>u!==void 0)}function Zp(e,t,n){let r=tn(e,i=>t[i]);return n===void 0&&r.size>1+e.length>>1&&kn("Warning: the implicit z channel has high cardinality. This may occur when the fill or stroke channel is associated with quantitative data rather than ordinal or categorical data. You can suppress this warning by setting the z option explicitly; if this data represents a single series, set z to null."),r.values()}function*c1(e,t,n,r){let{z:i}=n,{z:o}=r,s=GV(r,n),a=[...t,...s];for(let c of o?Zp(e,o,i):[e]){let l,u;t:for(let f of c){for(let h of a)if(!Re(h[f])){u&&u.push(-1);continue t}if(l===void 0){u&&(yield u),l=s.map(h=>Ns(h[f])),u=[f];continue}u.push(f);for(let h=0;h<s.length;++h)if(Ns(s[h][f])!==l[h]){yield u,l=s.map(p=>Ns(p[f])),u=[f];continue t}}u&&(yield u)}}function l1(e){return e===!0?e="frame":e===!1?e=null:e!=null&&(e=He(e,"clip",["frame","sphere"])),e}function XV(e,t,n,r){let i,{clip:o=r.clip}=t;switch(o){case"frame":{let{width:s,height:a,marginLeft:c,marginRight:l,marginTop:u,marginBottom:f}=n,h=s1();i=`url(#${h})`,e=at("svg:g",r).call(d=>d.append("svg:clipPath").attr("id",h).append("rect").attr("x",c).attr("y",u).attr("width",s-l-c).attr("height",a-u-f)).each(function(){this.appendChild(e.node()),e.node=()=>this});break}case"sphere":{let{projection:s}=r;if(!s)throw new Error('the "sphere" clip option requires a projection');let a=s1();i=`url(#${a})`,e.append("clipPath").attr("id",a).append("path").attr("d",vn(s)({type:"Sphere"}));break}}ut(e,"aria-label",t.ariaLabel),ut(e,"aria-description",t.ariaDescription),ut(e,"aria-hidden",t.ariaHidden),ut(e,"clip-path",i)}function Ot(e,t,n,r){XV(e,t,n,r),ut(e,"fill",t.fill),ut(e,"fill-opacity",t.fillOpacity),ut(e,"stroke",t.stroke),ut(e,"stroke-width",t.strokeWidth),ut(e,"stroke-opacity",t.strokeOpacity),ut(e,"stroke-linejoin",t.strokeLinejoin),ut(e,"stroke-linecap",t.strokeLinecap),ut(e,"stroke-miterlimit",t.strokeMiterlimit),ut(e,"stroke-dasharray",t.strokeDasharray),ut(e,"stroke-dashoffset",t.strokeDashoffset),ut(e,"shape-rendering",t.shapeRendering),ut(e,"filter",t.imageFilter),ut(e,"paint-order",t.paintOrder);let{pointerEvents:i=r.pointerSticky===!1?"none":void 0}=t;ut(e,"pointer-events",i)}function At(e,t){HV(e,"mix-blend-mode",t.mixBlendMode),ut(e,"opacity",t.opacity)}function n5(e,t,n){e.each(function(r){let i=t(r);if(i!=null){let o=this.ownerDocument.createElementNS(jr.svg,"a");o.setAttribute("fill","inherit"),o.setAttributeNS(jr.xlink,"href",i),n!=null&&o.setAttribute("target",n),this.parentNode.insertBefore(o,this).appendChild(this)}})}function ut(e,t,n){n!=null&&e.attr(t,n)}function HV(e,t,n){n!=null&&e.style(t,n)}function _t(e,t,{x:n,y:r},i=Ee,o=Ee){i+=t.dx,o+=t.dy,n?.bandwidth&&(i+=n.bandwidth()/2),r?.bandwidth&&(o+=r.bandwidth()/2),(i||o)&&e.attr("transform",`translate(${i},${o})`)}function se(e,t){if((e=$e(e))!==t)return e}function Hp(e,t){if((e=Tt(e))!==t)return e}var ZV=/^-?([_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 Ju(e){if(e===void 0)return"plot-d6a7b5";if(e=`${e}`,!ZV.test(e))throw new Error(`invalid class name: ${e}`);return e}function tf(e,t){if(typeof t=="string")e.property("style",t);else if(t!=null)for(let n of e)Object.assign(n.style,t)}function fn({frameAnchor:e},{width:t,height:n,marginTop:r,marginRight:i,marginBottom:o,marginLeft:s}){return[/left$/.test(e)?s:/right$/.test(e)?t-i:(s+t-i)/2,/^top/.test(e)?r:/^bottom/.test(e)?n-o:(r+n-o)/2]}function ka(e={}){let{document:t=typeof window<"u"?window.document:void 0,clip:n}=e;return{document:t,clip:l1(n)}}function at(e,{document:t}){return Ut(ls(e).call(t.documentElement))}var i5=Math.PI,Ls=2*i5,r5=.618;function o5({projection:e,inset:t=0,insetTop:n=t,insetRight:r=t,insetBottom:i=t,insetLeft:o=t}={},s){if(e==null)return;if(typeof e.stream=="function")return e;let a,c,l="frame";if(cn(e)){let v;if({type:e,domain:c,inset:v,insetTop:n=v!==void 0?v:n,insetRight:r=v!==void 0?v:r,insetBottom:i=v!==void 0?v:i,insetLeft:o=v!==void 0?v:o,clip:l=l,...a}=e,e==null)return}typeof e!="function"&&({type:e}=s5(e));let{width:u,height:f,marginLeft:h,marginRight:d,marginTop:p,marginBottom:y}=s,b=u-h-d-o-r,m=f-p-y-n-i;if(e=e?.({width:b,height:m,clip:l,...a}),e==null)return;l=KV(l,h,p,u-d,f-y);let g=h+o,x=p+n,w;if(c!=null){let[[v,_],[M,E]]=vn(e).bounds(c),N=Math.min(b/(M-v),m/(E-_));N>0?(g-=(N*(v+M)-b)/2,x-=(N*(_+E)-m)/2,w=Object.assign(Uc({point(I,T){this.stream.point(I*N+g,T*N+x)}}),{invert:([I,T])=>[(I-g)/N,(T-x)/N]})):kn("Warning: the projection could not be fit to the specified domain; using the default scale.")}return w??=g===0&&x===0?a5():Object.assign(Uc({point(v,_){this.stream.point(v+g,_+x)}}),{invert:([v,_])=>[v-g,_-x]}),{stream:v=>e.stream(w.stream(l(v))),invert:v=>e.invert(w.invert(v))}}function s5(e){switch(`${e}`.toLowerCase()){case"albers-usa":return Oi(w2,.7463,.4673);case"albers":return u1(Hd,.7463,.4673);case"azimuthal-equal-area":return Oi(v2,4,4);case"azimuthal-equidistant":return Oi(I2,Ls,Ls);case"conic-conformal":return u1(A2,Ls,Ls);case"conic-equal-area":return u1(xa,6.1702,2.9781);case"conic-equidistant":return u1(D2,7.312,3.6282);case"equal-earth":return Oi(O2,5.4133,2.6347);case"equirectangular":return Oi(E2,Ls,i5);case"gnomonic":return Oi(F2,3.4641,3.4641);case"identity":return{type:a5};case"reflect-y":return{type:QV};case"mercator":return Oi(M2,Ls,Ls);case"orthographic":return Oi(C2,2,2);case"stereographic":return Oi(R2,2,2);case"transverse-mercator":return Oi(U2,Ls,Ls);default:throw new Error(`unknown projection type: ${e}`)}}function KV(e,t,n,r,i){if(e===!1||e==null||typeof e=="number")return o=>o;switch(e===!0&&(e="frame"),`${e}`.toLowerCase()){case"frame":return bu(t,n,r,i);default:throw new Error(`unknown projection clip type: ${e}`)}}function Oi(e,t,n){return{type:({width:r,height:i,rotate:o,precision:s=.15,clip:a})=>{let c=e();return s!=null&&c.precision?.(s),o!=null&&c.rotate?.(o),typeof a=="number"&&c.clipAngle?.(a),c.scale(Math.min(r/t,i/n)),c.translate([r/2,i/2]),c},aspectRatio:n/t}}function u1(e,t,n){let{type:r,aspectRatio:i}=Oi(e,t,n);return{type:o=>{let{parallels:s,domain:a,width:c,height:l}=o,u=r(o);return s!=null&&(u.parallels(s),a===void 0&&u.fitSize([c,l],{type:"Sphere"})),u},aspectRatio:i}}var a5=an({stream:e=>e,invert:e=>e}),QV=an(Object.assign(Uc({point(e,t){this.stream.point(e,-t)}}),{invert:([e,t])=>[e,-t]}));function SI(e,t,n,r){let i=n[e],o=n[t],s=i.length,a=n[e]=new Float64Array(s).fill(NaN),c=n[t]=new Float64Array(s).fill(NaN),l,u=r.stream({point(f,h){a[l]=f,c[l]=h}});for(l=0;l<s;++l)u.point(i[l],o[l])}function c5({projection:e}={}){return e==null?!1:typeof e.stream=="function"?!0:(cn(e)&&(e=e.type),e!=null)}function l5(e){if(typeof e?.stream=="function")return r5;if(cn(e)&&(e=e.type),e!=null){if(typeof e!="function"){let{aspectRatio:t}=s5(e);if(t)return t}return r5}}function Ra(e,t,{projection:n}){let{x:r,y:i}=e,o={};return r&&(o.x=r),i&&(o.y=i),o=Qu(o,t),n&&r?.scale==="x"&&i?.scale==="y"&&SI("x","y",o,n),r&&(o.x=Xe(o.x)),i&&(o.y=Xe(o.y)),o}function u5(e){let t=[],n=[],r={scale:"x",value:t},i={scale:"y",value:n},o={point(s,a){t.push(s),n.push(a)},lineStart(){},lineEnd(){},polygonStart(){},polygonEnd(){},sphere(){}};for(let s of e.value)Ar(s,o);return[r,i]}var JV=["#4269d0","#efb118","#ff725c","#6cc5b0","#3ca951","#ff8ab7","#a463f2","#97bbf5","#9c6b4e","#9498a0"],m5=new Map([["accent",lS],["category10",cS],["dark2",uS],["observable10",JV],["paired",fS],["pastel1",hS],["pastel2",dS],["set1",pS],["set2",mS],["set3",yS],["tableau10",gS]]);function y5(e){return e!=null&&m5.has(`${e}`.toLowerCase())}var f5=new Map([...m5,["brbg",Cs(_b,vb)],["prgn",Cs(Sb,Ib)],["piyg",Cs(Mb,Tb)],["puor",Cs(Ab,Eb)],["rdbu",Cs(bp,Nu)],["rdgy",Cs(Db,Nb)],["rdylbu",Cs(xp,Ou)],["rdylgn",Cs(Ob,Bb)],["spectral",Cs(Fb,Lb)],["burd",h5(bp,Nu)],["buylrd",h5(xp,Ou)],["blues",hn(ox,sx)],["greens",hn(ax,cx)],["greys",hn(lx,ux)],["oranges",hn(mx,yx)],["purples",hn(fx,hx)],["reds",hn(dx,px)],["turbo",ks(Mx)],["viridis",ks(Ax)],["magma",ks(Ex)],["inferno",ks(Dx)],["plasma",ks(Nx)],["cividis",ks(gx)],["cubehelix",ks(bx)],["warm",ks(wx)],["cool",ks(_x)],["bugn",hn(Cb,kb)],["bupu",hn(Rb,$b)],["gnbu",hn(Ub,Pb)],["orrd",hn(zb,Vb)],["pubu",hn(Yb,Wb)],["pubugn",hn(qb,jb)],["purd",hn(Gb,Xb)],["rdpu",hn(Hb,Zb)],["ylgn",hn(Jb,tx)],["ylgnbu",hn(Kb,Qb)],["ylorbr",hn(ex,nx)],["ylorrd",hn(rx,ix)],["rainbow",d5(vx)],["sinebow",d5(Ix)]]);function hn(e,t){return({length:n})=>n===1?[e[3][1]]:n===2?[e[3][1],e[3][2]]:(n=Math.max(3,Math.floor(n)),n>9?Dn(t,n):e[n])}function Cs(e,t){return({length:n})=>n===2?[e[3][0],e[3][2]]:(n=Math.max(3,Math.floor(n)),n>11?Dn(t,n):e[n])}function h5(e,t){return({length:n})=>n===2?[e[3][2],e[3][0]]:(n=Math.max(3,Math.floor(n)),n>11?Dn(r=>t(1-r),n):e[n].slice().reverse())}function ks(e){return({length:t})=>Dn(e,Math.max(2,Math.floor(t)))}function d5(e){return({length:t})=>Dn(e,Math.floor(t)+1).slice(0,-1)}function II(e){let t=`${e}`.toLowerCase();if(!f5.has(t))throw new Error(`unknown ordinal scheme: ${t}`);return f5.get(t)}function Kp(e,t){let n=II(e),r=typeof n=="function"?n({length:t}):n;return r.length!==t?r.slice(0,t):r}function g5(e,t="greys"){let n=new Set,[r,i]=Kp(t,2);for(let o of e)if(o!=null)if(o===!0)n.add(i);else if(o===!1)n.add(r);else return;return[...n]}var p5=new Map([["brbg",vb],["prgn",Ib],["piyg",Tb],["puor",Eb],["rdbu",Nu],["rdgy",Nb],["rdylbu",Ou],["rdylgn",Bb],["spectral",Lb],["burd",e=>Nu(1-e)],["buylrd",e=>Ou(1-e)],["blues",sx],["greens",cx],["greys",ux],["purples",hx],["reds",px],["oranges",yx],["turbo",Mx],["viridis",Ax],["magma",Ex],["inferno",Dx],["plasma",Nx],["cividis",gx],["cubehelix",bx],["warm",wx],["cool",_x],["bugn",kb],["bupu",$b],["gnbu",Pb],["orrd",Vb],["pubugn",jb],["pubu",Wb],["purd",Xb],["rdpu",Zb],["ylgnbu",Qb],["ylgn",tx],["ylorbr",nx],["ylorrd",ix],["rainbow",vx],["sinebow",Ix]]);function ef(e){let t=`${e}`.toLowerCase();if(!p5.has(t))throw new Error(`unknown quantitative scheme: ${t}`);return p5.get(t)}var tq=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function b5(e){return e!=null&&tq.has(`${e}`.toLowerCase())}var TI=e=>t=>e(1-t),MI=[0,1],x5=new Map([["number",ge],["rgb",Yr],["hsl",wv],["hcl",_v],["lab",ig]]);function AI(e){let t=`${e}`.toLowerCase();if(!x5.has(t))throw new Error(`unknown interpolator: ${t}`);return x5.get(t)}function rf(e,t,n,{type:r,nice:i,clamp:o,zero:s,domain:a=A5(e,n),unknown:c,round:l,scheme:u,interval:f,range:h=ce.get(e)===el?iq(n,a):ce.get(e)===nl?oq(n,a):ce.get(e)===rl?MI:void 0,interpolate:d=ce.get(e)===Br?u==null&&h!==void 0?Yr:ef(u!==void 0?u:r==="cyclical"?"rainbow":"turbo"):l?Nc:ge,reverse:p}){if(f=xo(f,r),(r==="cyclical"||r==="sequential")&&(r="linear"),typeof d!="function"&&(d=AI(d)),p=!!p,h!==void 0){let y=(a=Ue(a)).length,b=(h=Ue(h)).length;if(y!==b){if(d.length===1)throw new Error("invalid piecewise interpolator");d=to(d,h),h=void 0}}if(d.length===1?(p&&(d=TI(d),p=!1),h===void 0&&(h=Float64Array.from(a,(y,b)=>b/(a.length-1)),h.length===2&&(h=MI)),t.interpolate((h===MI?an:Qp)(d))):t.interpolate(d),s){let[y,b]=ie(a);(y>0||b<0)&&(a=Na(a),As(a)!==Math.sign(y)?a[a.length-1]=0:a[0]=0)}return p&&(a=ua(a)),t.domain(a).unknown(c),i&&(t.nice(eq(i,r)),a=t.domain()),h!==void 0&&t.range(h),o&&t.clamp(o),{type:r,domain:a,range:h,scale:t,interpolate:d,interval:f}}function eq(e,t){return e===!0?void 0:typeof e=="number"?e:MD(e,t)}function w5(e,t,n){return rf(e,gs(),t,n)}function _5(e,t,n){return EI(e,t,{...n,exponent:.5})}function EI(e,t,{exponent:n=1,...r}){return rf(e,ap().exponent(n),t,{...r,type:"pow"})}function v5(e,t,{base:n=10,domain:r=sq(t),...i}){return rf(e,op().base(n),t,{...i,domain:r})}function S5(e,t,{constant:n=1,...r}){return rf(e,sp().constant(n),t,r)}function I5(e,t,{range:n,quantiles:r=n===void 0?5:(n=[...n]).length,n:i=r,scheme:o="rdylbu",domain:s=aq(t),unknown:a,interpolate:c,reverse:l}){return n===void 0&&(n=c!==void 0?Dn(c,i):ce.get(e)===Br?Kp(o,i):void 0),s.length>0&&(s=cp(s,n===void 0?{length:i}:n).quantiles()),f1(e,t,{domain:s,range:n,reverse:l,unknown:a})}function M5(e,t,{range:n,n:r=n===void 0?5:(n=[...n]).length,scheme:i="rdylbu",domain:o=A5(e,t),unknown:s,interpolate:a,reverse:c}){let[l,u]=ie(o),f;return n===void 0?(f=xn(l,u,r),f[0]<=l&&f.splice(0,1),f[f.length-1]>=u&&f.pop(),r=f.length+1,n=a!==void 0?Dn(a,r):ce.get(e)===Br?Kp(i,r):void 0):(f=Dn(ge(l,u),r+1).slice(1,-1),l instanceof Date&&(f=f.map(h=>new Date(h)))),As(Ue(o))<0&&f.reverse(),f1(e,t,{domain:f,range:n,reverse:c,unknown:s})}function f1(e,t,{domain:n=[0],unknown:r,scheme:i="rdylbu",interpolate:o,range:s=o!==void 0?Dn(o,n.length+1):ce.get(e)===Br?Kp(i,n.length+1):void 0,reverse:a}){n=Ue(n);let c=As(n);if(!isNaN(c)&&!nq(n,c))throw new Error(`the ${e} scale has a non-monotonic domain`);return a&&(s=ua(s)),{type:"threshold",scale:lp(c<0?ua(n):n,s===void 0?[]:s).unknown(r),domain:n,range:s}}function nq(e,t){for(let n=1,r=e.length,i=e[0];n<r;++n){let o=Pn(i,i=e[n]);if(o!==0&&o!==t)return!1}return!0}function T5(e){return{type:"identity",scale:kD(ce.get(e))?rp():t=>t}}function nf(e,t=Uu){return e.length?[oe(e,({value:n})=>n===void 0?n:oe(n,t)),$t(e,({value:n})=>n===void 0?n:$t(n,t))]:[0,1]}function A5(e,t){let n=ce.get(e);return(n===el||n===rl||n===nl?rq:nf)(t)}function rq(e){return[0,e.length?$t(e,({value:t})=>t===void 0?t:$t(t,Uu)):1]}function iq(e,t){let n=e.find(({radius:s})=>s!==void 0);if(n!==void 0)return[0,n.radius];let r=Vn(e,.5,({value:s})=>s===void 0?NaN:Vn(s,.25,Zn)),i=t.map(s=>3*Math.sqrt(s/r)),o=30/$t(i);return o<1?i.map(s=>s*o):i}function oq(e,t){let n=Ti(e,({value:o})=>o===void 0?NaN:Ti(o,Math.abs)),r=t.map(o=>12*o/n),i=60/$t(r);return i<1?r.map(o=>o*i):r}function sq(e){for(let{value:t}of e)if(t!==void 0)for(let n of t){if(n>0)return nf(e,Zn);if(n<0)return nf(e,Ia)}return[1,10]}function aq(e){let t=[];for(let{value:n}of e)if(n!==void 0)for(let r of n)t.push(r);return t}function Qp(e){return(t,n)=>r=>e(t+r*(n-t))}function h1(e,t,n,r,{type:i,nice:o,clamp:s,domain:a=nf(r),unknown:c,pivot:l=0,scheme:u,range:f,symmetric:h=!0,interpolate:d=ce.get(e)===Br?u==null&&f!==void 0?Yr:ef(u!==void 0?u:"rdbu"):ge,reverse:p}){l=+l,a=Ue(a);let[y,b]=a;if(a.length>2&&kn(`Warning: the diverging ${e} scale domain contains extra elements.`),Pn(y,b)<0&&([y,b]=[b,y],p=!p),y=Math.min(y,l),b=Math.max(b,l),typeof d!="function"&&(d=AI(d)),f!==void 0&&(d=d.length===1?Qp(d)(...f):to(d,f)),p&&(d=TI(d)),h){let m=n.apply(l),g=m-n.apply(y),x=n.apply(b)-m;g<x?y=n.invert(m-x):g>x&&(b=n.invert(m+g))}return t.domain([y,l,b]).unknown(c).interpolator(d),s&&t.clamp(s),o&&t.nice(o),{type:i,domain:[y,b],pivot:l,interpolate:d,scale:t}}function E5(e,t,n){return h1(e,gp(),cq,t,n)}function D5(e,t,n){return DI(e,t,{...n,exponent:.5})}function DI(e,t,{exponent:n=1,...r}){return h1(e,wb().exponent(n=+n),fq(n),t,{...r,type:"diverging-pow"})}function N5(e,t,{base:n=10,pivot:r=1,domain:i=nf(t,r<0?Ia:Zn),...o}){return h1(e,bb().base(n=+n),lq,t,{domain:i,pivot:r,...o})}function O5(e,t,{constant:n=1,...r}){return h1(e,xb().constant(n=+n),hq(n),t,r)}var cq={apply(e){return e},invert(e){return e}},lq={apply:Math.log,invert:Math.exp},uq={apply(e){return Math.sign(e)*Math.sqrt(Math.abs(e))},invert(e){return Math.sign(e)*(e*e)}};function fq(e){return e===.5?uq:{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 hq(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 B5(e,t,n,r){return rf(e,t,n,r)}function F5(e,t,n){return B5(e,mb(),t,n)}function L5(e,t,n){return B5(e,yb(),t,n)}var of=Symbol("ordinal");function k5(e,t,n,{type:r,interval:i,domain:o,range:s,reverse:a,hint:c}){return i=xo(i,r),o===void 0&&(o=z5(n,i,e)),(r==="categorical"||r===of)&&(r="ordinal"),a&&(o=ua(o)),o=t.domain(o).domain(),s!==void 0&&(typeof s=="function"&&(s=s(o)),t.range(s)),{type:r,domain:o,range:s,scale:t,hint:c,interval:i}}function R5(e,t,{type:n,interval:r,domain:i,range:o,scheme:s,unknown:a,...c}){r=xo(r,n),i===void 0&&(i=z5(t,r,e));let l;if(ce.get(e)===Xu)l=dq(t),o=o===void 0?pq(l):Vt(o,Hu);else if(ce.get(e)===Br&&(o===void 0&&(n==="ordinal"||n===of)&&(o=g5(i,s),o!==void 0&&(s=void 0)),s===void 0&&o===void 0&&(s=n==="ordinal"?"turbo":"observable10"),s!==void 0))if(o!==void 0){let u=ef(s),f=o[0],h=o[1]-o[0];o=({length:d})=>Dn(p=>u(f+h*p),d)}else o=II(s);if(a===ep)throw new Error(`implicit unknown on ${e} scale is not supported`);return k5(e,Vc().unknown(a),t,{...c,type:n,domain:i,range:o,hint:l})}function $5(e,t,{align:n=.5,padding:r=.5,...i}){return P5(W2().align(n).padding(r),t,i,e)}function U5(e,t,{align:n=.5,padding:r=.1,paddingInner:i=r,paddingOuter:o=e==="fx"||e==="fy"?0:r,...s}){return P5(_a().align(n).paddingInner(i).paddingOuter(o),t,s,e)}function P5(e,t,n,r){let{round:i}=n;return i!==void 0&&e.round(i=!!i),e=k5(r,e,t,n),e.round=i,e}function z5(e,t,n){let r=new Ir;for(let{value:i,domain:o}of e){if(o!==void 0)return o();if(i!==void 0)for(let s of i)r.add(s)}if(t!==void 0){let[i,o]=ie(r).map(t.floor,t);return t.range(i,t.offset(o))}if(r.size>1e4&&ce.get(n)===ei)throw new Error(`implicit ordinal domain of ${n} scale has more than 10,000 values`);return Zi(r,sn)}function C5(e,t){let n;for(let{hint:r}of e){let i=r?.[t];if(i!==void 0){if(n===void 0)n=i;else if(n!==i)return}}return n}function dq(e){return{fill:C5(e,"fill"),stroke:C5(e,"stroke")}}function pq(e){return Jt(e.fill)?IS:kx}function Jp(e,{label:t,inset:n=0,insetTop:r=n,insetRight:i=n,insetBottom:o=n,insetLeft:s=n,round:a,nice:c,clamp:l,zero:u,align:f,padding:h,projection:d,facet:{label:p=t}={},...y}={}){let b={};for(let[m,g]of e){let x=y[m],w=H5(m,g,{round:ce.get(m)===ei?a:void 0,nice:c,clamp:l,zero:u,align:f,padding:h,projection:d,...x});if(w){let{label:v=m==="fx"||m==="fy"?p:t,percent:_,transform:M,inset:E,insetTop:N=E!==void 0?E:m==="y"?r:0,insetRight:I=E!==void 0?E:m==="x"?i:0,insetBottom:T=E!==void 0?E:m==="y"?o:0,insetLeft:O=E!==void 0?E:m==="x"?s:0}=x||{};if(M==null)M=void 0;else if(typeof M!="function")throw new Error("invalid scale transform; not a function");w.percent=!!_,w.label=v===void 0?mq(g,w):v,w.transform=M,m==="x"||m==="fx"?(w.insetLeft=+O,w.insetRight=+I):(m==="y"||m==="fy")&&(w.insetTop=+N,w.insetBottom=+T),b[m]=w}}return b}function OI(e){let t={},n={scales:t};for(let[r,i]of Object.entries(e)){let{scale:o,type:s,interval:a,label:c}=i;t[r]=K5(i),n[r]=o,o.type=s,a!=null&&(o.interval=a),c!=null&&(o.label=c)}return n}function W5(e,t){let{x:n,y:r,fx:i,fy:o}=e,s=i||o?m1(t):t;i&&V5(i,s),o&&q5(o,s);let a=i||o?BI(e,t):t;n&&V5(n,a),r&&q5(r,a)}function mq(e=[],t){let n;for(let{label:r}of e)if(r!==void 0){if(n===void 0)n=r;else if(n!==r)return}if(n!==void 0)return!vo(t)&&t.percent&&(n=`${n} (%)`),{inferred:!0,toString:()=>n}}function p1(e){return Math.sign(As(e.domain()))*Math.sign(As(e.range()))}function m1(e){let{marginTop:t,marginRight:n,marginBottom:r,marginLeft:i,width:o,height:s,facet:{marginTop:a,marginRight:c,marginBottom:l,marginLeft:u}}=e;return{marginTop:Math.max(t,a),marginRight:Math.max(n,c),marginBottom:Math.max(r,l),marginLeft:Math.max(i,u),width:o,height:s}}function BI({fx:e,fy:t},n){let{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=m1(n);return{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:e?e.scale.bandwidth()+s+i:a,height:t?t.scale.bandwidth()+r+o:c,facet:{width:a,height:c}}}function V5(e,t){if(e.range===void 0){let{insetLeft:n,insetRight:r}=e,{width:i,marginLeft:o=0,marginRight:s=0}=t,a=o+n,c=i-s-r;e.range=[a,Math.max(a,c)],vo(e)||(e.range=X5(e)),e.scale.range(e.range)}G5(e)}function q5(e,t){if(e.range===void 0){let{insetTop:n,insetBottom:r}=e,{height:i,marginTop:o=0,marginBottom:s=0}=t,a=o+n,c=i-s-r;e.range=[Math.max(a,c),a],vo(e)?e.range.reverse():e.range=X5(e),e.scale.range(e.range)}G5(e)}function G5(e){e.round===void 0&&bq(e)&&yq(e)<=30&&e.scale.round(!0)}function yq({scale:e}){let t=e.domain().length,[n,r]=e.range(),i=e.paddingInner?e.paddingInner():1,o=e.paddingOuter?e.paddingOuter():e.padding(),s=t-i,a=Math.abs(r-n)/Math.max(1,s+o*2);return(a-Math.floor(a))*s}function X5(e){let t=e.scale.domain().length+FI(e);if(!(t>2))return e.range;let[n,r]=e.range;return Array.from({length:t},(i,o)=>n+o/(t-1)*(r-n))}function y1(e,t,n){return H5(e,n===void 0?void 0:[{hint:n}],{...t})}function H5(e,t=[],n={}){let r=gq(e,t,n);if(n.type===void 0&&n.domain===void 0&&n.range===void 0&&n.interval==null&&e!=="fx"&&e!=="fy"&&vo({type:r})){let i=t.map(({value:o})=>o).filter(o=>o!==void 0);i.some(Ae)?kn(`Warning: some data associated with the ${e} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${sf(r)}" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can specify the interval of the ${e} scale (e.g., d3.utcDay), or you can suppress this warning by setting the type of the ${e} scale to "${sf(r)}".`):i.some(DD)?kn(`Warning: some data associated with the ${e} scale are strings that appear to be dates (e.g., YYYY-MM-DD). If these strings represent dates, you should parse them to Date objects. Dates are typically associated with a "utc" or "time" scale rather than a "${sf(r)}" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can suppress this warning by setting the type of the ${e} scale to "${sf(r)}".`):i.some(ND)&&kn(`Warning: some data associated with the ${e} scale are strings that appear to be numbers. If these strings represent numbers, you should parse or coerce them to numbers. Numbers are typically associated with a "linear" scale rather than a "${sf(r)}" scale. If you want to treat this data as ordinal, you can specify the interval of the ${e} scale (e.g., 1 for integers), or you can suppress this warning by setting the type of the ${e} scale to "${sf(r)}".`)}switch(n.type=r,r){case"diverging":case"diverging-sqrt":case"diverging-pow":case"diverging-log":case"diverging-symlog":case"cyclical":case"sequential":case"linear":case"sqrt":case"threshold":case"quantile":case"pow":case"log":case"symlog":n=d1(t,n,Xe);break;case"identity":switch(ce.get(e)){case ei:n=d1(t,n,Xe);break;case Xu:n=d1(t,n,xq);break}break;case"utc":case"time":n=d1(t,n,ID);break}switch(r){case"diverging":return E5(e,t,n);case"diverging-sqrt":return D5(e,t,n);case"diverging-pow":return DI(e,t,n);case"diverging-log":return N5(e,t,n);case"diverging-symlog":return O5(e,t,n);case"categorical":case"ordinal":case of:return R5(e,t,n);case"cyclical":case"sequential":case"linear":return w5(e,t,n);case"sqrt":return _5(e,t,n);case"threshold":return f1(e,t,n);case"quantile":return I5(e,t,n);case"quantize":return M5(e,t,n);case"pow":return EI(e,t,n);case"log":return v5(e,t,n);case"symlog":return S5(e,t,n);case"utc":return L5(e,t,n);case"time":return F5(e,t,n);case"point":return $5(e,t,n);case"band":return U5(e,t,n);case"identity":return T5(e);case void 0:return;default:throw new Error(`unknown scale type: ${r}`)}}function sf(e){return typeof e=="symbol"?e.description:e}function j5(e){return typeof e=="string"?`${e}`.toLowerCase():e}var Y5={toString:()=>"projection"};function gq(e,t,{type:n,domain:r,range:i,scheme:o,pivot:s,projection:a}){if(n=j5(n),e==="fx"||e==="fy")return"band";(e==="x"||e==="y")&&a!=null&&(n=Y5);for(let l of t){let u=j5(l.type);if(u!==void 0){if(n===void 0)n=u;else if(n!==u)throw new Error(`scale incompatible with channel: ${n} !== ${u}`)}}if(n===Y5)return;if(n!==void 0)return n;if(r===void 0&&!t.some(({value:l})=>l!==void 0))return;let c=ce.get(e);if(c===el)return"sqrt";if(c===rl||c===nl)return"linear";if(c===Xu)return"ordinal";if((r||i||[]).length>2)return NI(c);if(r!==void 0){if(Se(r))return NI(c);if(Ae(r))return"utc"}else{let l=t.map(({value:u})=>u).filter(u=>u!==void 0);if(l.some(Se))return NI(c);if(l.some(Ae))return"utc"}if(c===Br){if(s!=null||b5(o))return"diverging";if(y5(o))return"categorical"}return"linear"}function NI(e){switch(e){case ei:return"point";case Br:return of;default:return"ordinal"}}function vo({type:e}){return e==="ordinal"||e==="point"||e==="band"||e===of}function FI({type:e}){return e==="threshold"}function bq({type:e}){return e==="point"||e==="band"}function Jn(e){if(e===void 0)return!0;let t=e.domain(),n=e(t[0]);for(let r=1,i=t.length;r<i;++r)if(e(t[r])-n)return!1;return!0}function d1(e,{domain:t,...n},r){for(let i of e)i.value!==void 0&&(t===void 0&&(t=i.value?.domain),i.value=r(i.value));return{domain:t===void 0?t:r(t),...n}}function xq(e){return Vt(e,Hu)}function So(e={}){let t;for(let n in e)if(ce.has(n)&&go(e[n])){if(t!==void 0)throw new Error("ambiguous scale definition; multiple scales found");t=K5(y1(n,e[n]))}if(t===void 0)throw new Error("invalid scale definition; no scale found");return t}function Z5(e){return t=>{if(!ce.has(t=`${t}`))throw new Error(`unknown scale: ${t}`);return e[t]}}function K5({scale:e,type:t,domain:n,range:r,interpolate:i,interval:o,transform:s,percent:a,pivot:c}){if(t==="identity")return{type:"identity",apply:u=>u,invert:u=>u};let l=e.unknown?e.unknown():void 0;return{type:t,domain:Na(n),...r!==void 0&&{range:Na(r)},...s!==void 0&&{transform:s},...a&&{percent:a},...l!==void 0&&{unknown:l},...o!==void 0&&{interval:o},...i!==void 0&&{interpolate:i},...e.clamp&&{clamp:e.clamp()},...c!==void 0&&{pivot:c,symmetric:!1},...e.base&&{base:e.base()},...e.exponent&&{exponent:e.exponent()},...e.constant&&{constant:e.constant()},...e.align&&{align:e.align(),round:e.round()},...e.padding&&(e.paddingInner?{paddingInner:e.paddingInner(),paddingOuter:e.paddingOuter()}:{padding:e.padding()}),...e.bandwidth&&{bandwidth:e.bandwidth(),step:e.step()},apply:u=>e(u),...e.invert&&{invert:u=>e.invert(u)}}}function J5(e,t,n={}){let r=.5-Ee,i=.5+Ee,o=.5+Ee,s=.5-Ee;for(let{marginTop:y,marginRight:b,marginBottom:m,marginLeft:g}of t)y>r&&(r=y),b>i&&(i=b),m>o&&(o=m),g>s&&(s=g);let{margin:a,marginTop:c=a!==void 0?a:r,marginRight:l=a!==void 0?a:i,marginBottom:u=a!==void 0?a:o,marginLeft:f=a!==void 0?a:s}=n;c=+c,l=+l,u=+u,f=+f;let{width:h=640,height:d=wq(e,n,{width:h,marginTopDefault:r,marginRightDefault:i,marginBottomDefault:o,marginLeftDefault:s})+Math.max(0,c-r+u-o)}=n;h=+h,d=+d;let p={width:h,height:d,marginTop:c,marginRight:l,marginBottom:u,marginLeft:f};if(e.fx||e.fy){let{margin:y,marginTop:b=y!==void 0?y:c,marginRight:m=y!==void 0?y:l,marginBottom:g=y!==void 0?y:u,marginLeft:x=y!==void 0?y:f}=n.facet??{};b=+b,m=+m,g=+g,x=+x,p.facet={marginTop:b,marginRight:m,marginBottom:g,marginLeft:x}}return p}function wq({x:e,y:t,fy:n,fx:r},{projection:i,aspectRatio:o},{width:s,marginTopDefault:a,marginRightDefault:c,marginBottomDefault:l,marginLeftDefault:u}){let f=n?n.scale.domain().length:1,h=l5(i);if(h){let p=r?r.scale.domain().length:1,y=(1.1*f-.1)/(1.1*p-.1)*h,b=Math.max(.1,Math.min(10,y));return Math.round((s-u-c)*b+a+l)}let d=t?vo(t)?t.scale.domain().length:Math.max(7,17/f):1;if(o!=null){if(o=+o,!(isFinite(o)&&o>0))throw new Error(`invalid aspectRatio: ${o}`);let p=Q5("y",t)/(Q5("x",e)*o),y=r?r.scale.bandwidth():1,b=n?n.scale.bandwidth():1,m=y*(s-u-c)-e.insetLeft-e.insetRight;return(p*m+t.insetTop+t.insetBottom)/b+a+l}return!!(t||n)*Math.max(1,Math.min(60,d*f))*20+!!r*30+60}function Q5(e,t){if(!t)throw new Error(`aspectRatio requires ${e} scale`);let{type:n,domain:r}=t,i;switch(n){case"linear":case"utc":case"time":i=Number;break;case"pow":{let a=t.scale.exponent();i=c=>Math.pow(c,a);break}case"log":i=Math.log;break;case"point":case"band":return r.length;default:throw new Error(`unsupported ${e} scale for aspectRatio: ${n}`)}let[o,s]=ie(r);return Math.abs(i(s)-i(o))}function eN(e,t){let{fx:n,fy:r}=Jp(e,t),i=n?.scale.domain(),o=r?.scale.domain();return i&&o?B0(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 nN(e,{x:t,y:n}){return t&&=$I(t),n&&=$I(n),e.filter(t&&n?r=>t.has(r.x)&&n.has(r.y):t?r=>t.has(r.x):r=>n.has(r.y)).sort(t&&n?(r,i)=>t.get(r.x)-t.get(i.x)||n.get(r.y)-n.get(i.y):t?(r,i)=>t.get(r.x)-t.get(i.x):(r,i)=>n.get(r.y)-n.get(i.y))}function b1(e,{fx:t,fy:n}){let r=Kn(e),i=t?.value,o=n?.value;return t&&n?Mi(r,s=>(s.fx=i[s[0]],s.fy=o[s[0]],s),s=>i[s],s=>o[s]):t?Mi(r,s=>(s.fx=i[s[0]],s),s=>i[s]):Mi(r,s=>(s.fy=o[s[0]],s),s=>o[s])}function rN(e,t,{marginTop:n,marginLeft:r}){return e&&t?({x:i,y:o})=>`translate(${e(i)-r},${t(o)-n})`:e?({x:i})=>`translate(${e(i)-r},0)`:({y:i})=>`translate(0,${t(i)-n})`}function iN(e){let t=[],n=new Uint32Array(wn(e,r=>r.length));for(let r of e){let i=0;for(let o of e)r!==o&&(n.set(o,i),i+=o.length);t.push(n.slice(0,i))}return t}var _q=new Map([["top",LI],["right",RI],["bottom",CI],["left",kI],["top-left",g1(LI,kI)],["top-right",g1(LI,RI)],["bottom-left",g1(CI,kI)],["bottom-right",g1(CI,RI)],["top-empty",Sq],["right-empty",Tq],["bottom-empty",Iq],["left-empty",Mq],["empty",Aq]]);function oN(e){if(e==null)return null;let t=_q.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid facet anchor: ${e}`)}var tN=new WeakMap;function $I(e){let t=tN.get(e);return t||tN.set(e,t=new zn(Vt(e,(n,r)=>[n,r]))),t}function $a(e,t){return $I(e).get(t)}function vq(e,t,n){return t=Ns(t),n=Ns(n),e.find(r=>Object.is(Ns(r.x),t)&&Object.is(Ns(r.y),n))}function x1(e,t,n){return vq(e,t,n)?.empty}function LI(e,{y:t},{y:n}){return t?$a(t,n)===0:!0}function CI(e,{y:t},{y:n}){return t?$a(t,n)===t.length-1:!0}function kI(e,{x:t},{x:n}){return t?$a(t,n)===0:!0}function RI(e,{x:t},{x:n}){return t?$a(t,n)===t.length-1:!0}function Sq(e,{y:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=$a(t,r);if(o>0)return x1(e,n,t[o-1])}function Iq(e,{y:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=$a(t,r);if(o<t.length-1)return x1(e,n,t[o+1])}function Mq(e,{x:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=$a(t,n);if(o>0)return x1(e,t[o-1],r)}function Tq(e,{x:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=$a(t,n);if(o<t.length-1)return x1(e,t[o+1],r)}function Aq(e,t,{empty:n}){return n}function g1(e,t){return function(){return e.apply(null,arguments)&&t.apply(null,arguments)}}function w1(e,{channels:{fx:t,fy:n},groups:r}){return t&&n?e.map(({x:i,y:o})=>r.get(i)?.get(o)??[]):t?e.map(({x:i})=>r.get(i)??[]):e.map(({y:i})=>r.get(i)??[])}var xt=class{constructor(t,n={},r={},i){let{facet:o="auto",facetAnchor:s,fx:a,fy:c,sort:l,dx:u=0,dy:f=0,margin:h=0,marginTop:d=h,marginRight:p=h,marginBottom:y=h,marginLeft:b=h,clip:m=i?.clip,channels:g,tip:x,render:w}=r;if(this.data=t,this.sort=bo(l)?l:null,this.initializer=xe(r).initializer,this.transform=this.initializer?r.transform:un(r).transform,o===null||o===!1?this.facet=null:(this.facet=He(o===!0?"include":o,"facet",["auto","include","exclude","super"]),this.fx=t===Ea&&typeof a=="string"?[a]:a,this.fy=t===Ea&&typeof c=="string"?[c]:c),this.facetAnchor=oN(s),n=qp(n),g!==void 0&&(n={...Eq(g),...n}),i!==void 0&&(n={...a1(this,r,i),...n}),this.channels=Object.fromEntries(Object.entries(n).map(([v,_])=>{if(Or(_.value)){let{value:M,label:E=_.label,scale:N=_.scale}=_.value;_={..._,label:E,scale:N,value:M}}if(t===Ea&&typeof _.value=="string"){let{value:M}=_;_={..._,value:[M]}}return[v,_]}).filter(([v,{value:_,optional:M}])=>{if(_!=null)return!0;if(M)return!1;throw new Error(`missing channel value: ${v}`)})),this.dx=+u,this.dy=+f,this.marginTop=+d,this.marginRight=+p,this.marginBottom=+y,this.marginLeft=+b,this.clip=l1(m),this.tip=Dq(x),this.facet==="super"){if(a||c)throw new Error("super-faceting cannot use fx or fy");for(let v in this.channels){let{scale:_}=n[v];if(!(_!=="x"&&_!=="y"))throw new Error("super-faceting cannot use x or y")}}w!=null&&(this.render=af(w,this.render))}initialize(t,n,r){let i=Ue(this.data);t===void 0&&i!=null&&(t=[Kn(i)]);let o=t;this.transform!=null&&({facets:t,data:i}=this.transform(i,t,r),i=Ue(i)),t!==void 0&&(t.original=o);let s=i1(this.channels,i);return this.sort!=null&&ZD(i,t,s,n,this.sort),{data:i,facets:t,channels:s}}filter(t,n,r){for(let i in n){let{filter:o=Re}=n[i];if(o!==null){let s=r[i];t=t.filter(a=>o(s[a]))}}return t}project(t,n,r){for(let i in t)if(t[i].scale==="x"&&/^x|x$/.test(i)){let o=i.replace(/^x|x$/,"y");o in t&&t[o].scale==="y"&&SI(i,o,n,r.projection)}}scale(t,n,r){let i=Qu(t,n);return r.projection&&this.project(t,i,r),i}};function Ze(...e){return e.plot=xt.prototype.plot,e}function af(e,t){if(e==null)return t===null?void 0:t;if(t==null)return e===null?void 0:e;if(typeof e!="function")throw new TypeError(`invalid render transform: ${e}`);if(typeof t!="function")throw new TypeError(`invalid render transform: ${t}`);return function(n,r,i,o,s,a){return e.call(this,n,r,i,o,s,(c,l,u,f,h)=>t.call(this,c,l,u,f,h,a))}}function Eq(e){return Object.fromEntries(Object.entries(qp(e)).map(([t,n])=>(n=typeof n=="string"?{value:n,label:t}:ti(n),n.filter===void 0&&n.scale==null&&(n={...n,filter:null}),[t,n])))}function Dq(e){return e===!0?"xy":e===!1||e==null?null:typeof e=="string"?He(e,"tip",["x","y","xy"]):e}function Bi(e,t){return e?.tip===!0?{...e,tip:t}:cn(e?.tip)&&e.tip.pointer===void 0?{...e,tip:{...e.tip,pointer:t}}:e}var sN=new WeakMap;function UI(e,t,{x:n,y:r,px:i,py:o,maxRadius:s=40,channels:a,render:c,...l}={}){return s=+s,i!=null&&(n??=null,a={...a,px:{value:i,scale:"x"}}),o!=null&&(r??=null,a={...a,py:{value:o,scale:"y"}}),{x:n,y:r,channels:a,...l,render:af(function(u,f,h,d,p,y){p={...p,pointerSticky:!1};let b=p.ownerSVGElement,{data:m}=p.getMarkState(this),g=sN.get(b);g||sN.set(b,g={sticky:!1,roots:[],renders:[]});let x=g.renders.push(G)-1,{x:w,y:v,fx:_,fy:M}=f,E=_?_(u.fx)-d.marginLeft:0,N=M?M(u.fy)-d.marginTop:0;w?.bandwidth&&(E+=w.bandwidth()/2),v?.bandwidth&&(N+=v.bandwidth()/2);let I=u.fi!=null,T;if(I){let j=g.facetStates;j||(g.facetStates=j=new Map),T=j.get(this),T||j.set(this,T=new Map)}let[O,B]=fn(this,d),{px:S,py:A}=h,D=S?j=>S[j]:PI(h,O),L=A?j=>A[j]:zI(h,B),k,C,R,$;function U(j,nt){if(I)if($&&($=cancelAnimationFrame($)),j==null)T.delete(u.fi);else{T.set(u.fi,nt),$=requestAnimationFrame(()=>{$=null;for(let[z,X]of T)if(X<nt||X===nt&&z<u.fi){j=null;break}G(j)});return}G(j)}function G(j){if(k===j&&R===g.sticky)return;k=j,R=p.pointerSticky=g.sticky;let nt=k==null?[]:[k];I&&(nt.fx=u.fx,nt.fy=u.fy,nt.fi=u.fi);let z=y(nt,f,h,d,p);if(C){if(I){let X=C.parentNode,rt=C.getAttribute("transform"),P=z.getAttribute("transform");rt?z.setAttribute("transform",rt):z.removeAttribute("transform"),P?X.setAttribute("transform",P):X.removeAttribute("transform"),z.removeAttribute("aria-label"),z.removeAttribute("aria-description"),z.removeAttribute("aria-hidden")}C.replaceWith(z)}return g.roots[x]=C=z,k==null&&T?.size>1||p.dispatchValue(k==null?null:m[k]),z}function J(j){if(g.sticky||j.pointerType==="mouse"&&j.buttons===1)return;let[nt,z]=En(j);nt-=E,z-=N;let X=nt<d.marginLeft||nt>d.width-d.marginRight?1:e,rt=z<d.marginTop||z>d.height-d.marginBottom?1:t,P=null,Bt=s*s;for(let ft of u){let jt=X*(D(ft)-nt),Yt=rt*(L(ft)-z),tt=jt*jt+Yt*Yt;tt<=Bt&&(P=ft,Bt=tt)}if(P!=null&&(e!==1||t!==1)){let ft=D(P)-nt,jt=L(P)-z;Bt=ft*ft+jt*jt}U(P,Bt)}function et(j){j.pointerType==="mouse"&&k!=null&&(g.sticky&&g.roots.some(nt=>nt?.contains(j.target))||(g.sticky?(g.sticky=!1,g.renders.forEach(nt=>nt(null))):(g.sticky=!0,G(k)),j.stopImmediatePropagation()))}function ot(j){j.pointerType==="mouse"&&(g.sticky||U(null))}return b.addEventListener("pointerenter",J),b.addEventListener("pointermove",J),b.addEventListener("pointerdown",et),b.addEventListener("pointerleave",ot),G(null)},c)}}function cf(e){return UI(1,1,e)}function lf(e){return UI(1,.01,e)}function ol(e){return UI(.01,1,e)}function PI({x1:e,x2:t,x:n=e},r){return e&&t?i=>(e[i]+t[i])/2:n?i=>n[i]:()=>r}function zI({y1:e,y2:t,y:n=e},r){return e&&t?i=>(e[i]+t[i])/2:n?i=>n[i]:()=>r}function _1(e){return vo(e)&&e.interval===void 0?void 0:"tabular-nums"}function aN(e,t){let{label:n=e.label,tickSize:r=6,width:i=240,height:o=44+r,marginTop:s=18,marginRight:a=0,marginBottom:c=16+r,marginLeft:l=0,style:u,ticks:f=(i-l-a)/64,tickFormat:h,fontVariant:d=_1(e),round:p=!0,opacity:y,className:b}=t,m=ka(t);b=Ju(b),y=ee(y)[1],h===null&&(h=()=>null);let g=at("svg",m).attr("class",`${b}-ramp`).attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("width",i).attr("height",o).attr("viewBox",`0 0 ${i} ${o}`).call(O=>O.append("style").text(`:where(.${b}-ramp) {
|
|
17
|
+
display: block;
|
|
18
|
+
height: auto;
|
|
19
|
+
height: intrinsic;
|
|
20
|
+
max-width: 100%;
|
|
21
|
+
overflow: visible;
|
|
22
|
+
}
|
|
23
|
+
:where(.${b}-ramp text) {
|
|
24
|
+
white-space: pre;
|
|
25
|
+
}`)).call(tf,u),x=O=>O.selectAll(".tick line").attr("y1",s+c-o),w,v=p?(O,B)=>O.rangeRound(B):(O,B)=>O.range(B),{type:_,domain:M,range:E,interpolate:N,scale:I,pivot:T}=e;if(N){let O=E===void 0?N:to(N.length===1?Qp(N):N,E);w=v(I.copy(),Dn(ge(l,i-a),Math.min(M.length+(T!==void 0),E===void 0?1/0:E.length)));let B=256,S=m.document.createElement("canvas");S.width=B,S.height=1;let A=S.getContext("2d");for(let D=0,L=B-1;D<B;++D)A.fillStyle=O(D/L),A.fillRect(D,0,1,1);g.append("image").attr("opacity",y).attr("x",l).attr("y",s).attr("width",i-l-a).attr("height",o-s-c).attr("preserveAspectRatio","none").attr("xlink:href",S.toDataURL())}else if(_==="threshold"){let O=M,B=h===void 0?S=>S:typeof h=="string"?Xr(h):h;w=v(gs().domain([-1,E.length-1]),[l,i-a]),g.append("g").attr("fill-opacity",y).selectAll().data(E).enter().append("rect").attr("x",(S,A)=>w(A-1)).attr("y",s).attr("width",(S,A)=>w(A)-w(A-1)).attr("height",o-s-c).attr("fill",S=>S),f=Vt(O,(S,A)=>A),h=S=>B(O[S],S)}else w=v(_a().domain(M),[l,i-a]),g.append("g").attr("fill-opacity",y).selectAll().data(M).enter().append("rect").attr("x",w).attr("y",s).attr("width",Math.max(0,w.bandwidth()-1)).attr("height",o-s-c).attr("fill",I),x=()=>{};return g.append("g").attr("transform",`translate(0,${o-c})`).call(ev(w).ticks(Array.isArray(f)?null:f,typeof h=="string"?h:void 0).tickFormat(typeof h=="function"?h:void 0).tickSize(r).tickValues(Array.isArray(f)?f:null)).attr("font-size",null).attr("font-family",null).attr("font-variant",se(d,"normal")).call(x).call(O=>O.select(".domain").remove()),n!==void 0&&g.append("text").attr("x",l).attr("y",s-6).attr("fill","currentColor").attr("font-weight","bold").text(n),g.node()}var uf=Math.PI/180;function Fi(e,{marker:t,markerStart:n=t,markerMid:r=t,markerEnd:i=t}={}){e.markerStart=VI(n),e.markerMid=VI(r),e.markerEnd=VI(i)}function VI(e){if(e==null||e===!1)return null;if(e===!0)return lN;if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"none":return null;case"arrow":return cN("auto");case"arrow-reverse":return cN("auto-start-reverse");case"dot":return Nq;case"circle":case"circle-fill":return lN;case"circle-stroke":return Oq;case"tick":return qI("auto");case"tick-x":return qI(90);case"tick-y":return qI(0)}throw new Error(`invalid marker: ${e}`)}function cN(e){return(t,n)=>at("svg:marker",n).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("orient",e).attr("fill","none").attr("stroke",t).attr("stroke-width",1.5).attr("stroke-linecap","round").attr("stroke-linejoin","round").call(r=>r.append("path").attr("d","M-1.5,-3l3,3l-3,3")).node()}function Nq(e,t){return at("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",e).attr("stroke","none").call(n=>n.append("circle").attr("r",2.5)).node()}function lN(e,t){return at("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",e).attr("stroke","var(--plot-background)").attr("stroke-width",1.5).call(n=>n.append("circle").attr("r",3)).node()}function Oq(e,t){return at("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill","var(--plot-background)").attr("stroke",e).attr("stroke-width",1.5).call(n=>n.append("circle").attr("r",3)).node()}function qI(e){return(t,n)=>at("svg:marker",n).attr("viewBox","-3 -3 6 6").attr("markerWidth",6).attr("markerHeight",6).attr("orient",e).attr("stroke",t).call(r=>r.append("path").attr("d","M0,-3v6")).node()}var Bq=0;function Rs(e,t,{stroke:n},r){return fN(e,t,n&&(i=>n[i]),r)}function uN(e,t,{stroke:n},r){return fN(e,t,n&&(([i])=>n[i]),r)}function fN(e,{markerStart:t,markerMid:n,markerEnd:r,stroke:i},o=()=>i,s){let a=new Map;function c(l){return function(u){let f=o(u),h=a.get(l);h||a.set(l,h=new Map);let d=h.get(f);if(!d){let p=this.parentNode.insertBefore(l(f,s),this),y=`plot-marker-${++Bq}`;p.setAttribute("id",y),h.set(f,d=`url(#${y})`)}return d}}t&&e.attr("marker-start",c(t)),n&&e.attr("marker-mid",c(n)),r&&e.attr("marker-end",c(r))}function sl({inset:e,insetLeft:t,insetRight:n,...r}={}){return[t,n]=hN(e,t,n),{inset:e,insetLeft:t,insetRight:n,...r}}function al({inset:e,insetTop:t,insetBottom:n,...r}={}){return[t,n]=hN(e,t,n),{inset:e,insetTop:t,insetBottom:n,...r}}function hN(e,t,n){return e===void 0&&t===void 0&&n===void 0?Ee?[1,0]:[.5,.5]:[t,n]}function dN(e,{interval:t}){return e={...ti(e)},e.interval=Gu(e.interval===void 0?t:e.interval),e}function v1(e,t,n,r){let{[e]:i,[`${e}1`]:o,[`${e}2`]:s}=n,{value:a,interval:c}=dN(i,n);if(a==null||c==null&&!r)return n;let l=Mn(i);if(c==null){let d,p={transform:y=>d||(d=dt(y,a)),label:l};return{...n,[e]:void 0,[`${e}1`]:o===void 0?p:o,[`${e}2`]:s===void 0&&!(o===s&&r)?p:s}}let u,f;function h(d){return f!==void 0&&d===u?f:f=Vt(dt(u=d,a),p=>c.floor(p))}return t({...n,[e]:void 0,[`${e}1`]:o===void 0?{transform:h,label:l}:o,[`${e}2`]:s===void 0?{transform:d=>h(d).map(p=>c.offset(p)),label:l}:s})}function pN(e,t,n){let{[e]:r}=n,{value:i,interval:o}=dN(r,n);return i==null||o==null?n:t({...n,[e]:{label:Mn(r),transform:s=>{let a=Vt(dt(s,i),l=>o.floor(l)),c=a.map(l=>o.offset(l));return a.map(Ae(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 jI(e={}){return v1("x",sl,e,!0)}function YI(e={}){return v1("y",al,e,!0)}function S1(e={}){return v1("x",sl,e)}function I1(e={}){return v1("y",al,e)}function M1(e={}){return pN("x",sl,e)}function T1(e={}){return pN("y",al,e)}var mN={ariaLabel:"rule",fill:null,stroke:"currentColor"},tm=class extends xt{constructor(t,n={}){let{x:r,y1:i,y2:o,inset:s=0,insetTop:a=s,insetBottom:c=s}=n;super(t,{x:{value:r,scale:"x",optional:!0},y1:{value:i,scale:"y",optional:!0},y2:{value:o,scale:"y",optional:!0}},Bi(n,"x"),mN),this.insetTop=Tt(a),this.insetBottom=Tt(c),Fi(this,n)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y1:l,y2:u}=r,{width:f,height:h,marginTop:d,marginRight:p,marginLeft:y,marginBottom:b}=i,{insetTop:m,insetBottom:g}=this;return at("svg:g",o).call(Ot,this,i,o).call(_t,this,{x:c&&s},Ee,0).call(x=>x.selectAll().data(t).enter().append("line").call(At,this).attr("x1",c?w=>c[w]:(y+f-p)/2).attr("x2",c?w=>c[w]:(y+f-p)/2).attr("y1",l&&!Jn(a)?w=>l[w]+m:d+m).attr("y2",u&&!Jn(a)?a.bandwidth?w=>u[w]+a.bandwidth()-g:w=>u[w]-g:h-b-g).call(Gt,this,r).call(Rs,this,r,o)).node()}},em=class extends xt{constructor(t,n={}){let{x1:r,x2:i,y:o,inset:s=0,insetRight:a=s,insetLeft:c=s}=n;super(t,{y:{value:o,scale:"y",optional:!0},x1:{value:r,scale:"x",optional:!0},x2:{value:i,scale:"x",optional:!0}},Bi(n,"y"),mN),this.insetRight=Tt(a),this.insetLeft=Tt(c),Fi(this,n)}render(t,n,r,i,o){let{x:s,y:a}=n,{y:c,x1:l,x2:u}=r,{width:f,height:h,marginTop:d,marginRight:p,marginLeft:y,marginBottom:b}=i,{insetLeft:m,insetRight:g}=this;return at("svg:g",o).call(Ot,this,i,o).call(_t,this,{y:c&&a},0,Ee).call(x=>x.selectAll().data(t).enter().append("line").call(At,this).attr("x1",l&&!Jn(s)?w=>l[w]+m:y+m).attr("x2",u&&!Jn(s)?s.bandwidth?w=>u[w]+s.bandwidth()-g:w=>u[w]-g:f-p-g).attr("y1",c?w=>c[w]:(d+h-b)/2).attr("y2",c?w=>c[w]:(d+h-b)/2).call(Gt,this,r).call(Rs,this,r,o)).node()}};function Fr(e,t){let{x:n=W,y:r,y1:i,y2:o,...s}=I1(t);return[i,o]=yN(r,i,o),new tm(e,{...s,x:n,y1:i,y2:o})}function Lr(e,t){let{y:n=W,x:r,x1:i,x2:o,...s}=S1(t);return[i,o]=yN(r,i,o),new em(e,{...s,y:n,x1:i,x2:o})}function yN(e,t,n){if(e==null){if(t===void 0){if(n!==void 0)return[0,n]}else if(n===void 0)return[0,t]}else{if(t===void 0)return n===void 0?[0,e]:[e,n];if(n===void 0)return[e,t]}return[t,n]}function Ua(e,...t){let n=t.length;for(let r=0,i=!0;r<n;++r)typeof t[r]!="function"&&(i&&(e=e.slice(),i=!1),e.splice(r,2,e[r]+t[r]+e[r+1]),t.splice(r,1),--r,--n);return r=>{let i=e[0];for(let o=0;o<n;++o)i+=t[o](r)+e[o+1];return i}}var Fq={ariaLabel:"text",strokeLinejoin:"round",strokeWidth:3,paintOrder:"stroke"},_N="\xAD",ll=class extends xt{constructor(t,n={}){let{x:r,y:i,text:o=Qn(t)&&Xx(t)?W:ve,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:h,fontFamily:d=h?"ui-monospace, monospace":void 0,fontSize:p,fontStyle:y,fontVariant:b,fontWeight:m,rotate:g}=n,[x,w]=ee(g,0),[v,_]=Rq(p);if(super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},fontSize:{value:v,optional:!0},rotate:{value:AD(x),optional:!0},text:{value:o,filter:Rp,optional:!0}},n,Fq),this.rotate=w,this.textAnchor=se(a,"middle"),this.lineAnchor=He(c,"lineAnchor",["top","middle","bottom"]),this.lineHeight=+l,this.lineWidth=+u,this.textOverflow=GI(f),this.monospace=!!h,this.fontFamily=$e(d),this.fontSize=_,this.fontStyle=$e(y),this.fontVariant=$e(b),this.fontWeight=$e(m),this.frameAnchor=wo(s),!(this.lineWidth>=0))throw new Error(`invalid lineWidth: ${u}`);this.splitLines=HI(this),this.clipLine=ZI(this)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,rotate:u,text:f,title:h,fontSize:d}=r,{rotate:p}=this,[y,b]=fn(this,i);return at("svg:g",o).call(Ot,this,i,o).call(XI,this,f,i).call(_t,this,{x:c&&s,y:l&&a}).call(m=>m.selectAll().data(t).enter().append("text").call(At,this).call(Lq,this,f,h).attr("transform",Ua`translate(${c?g=>c[g]:y},${l?g=>l[g]:b})${u?g=>` rotate(${u[g]})`:p?` rotate(${p})`:""}`).call(ut,"font-size",d&&(g=>d[g])).call(Gt,this,r)).node()}};function GI(e){return e==null?null:He(e,"textOverflow",["clip","ellipsis","clip-start","clip-end","ellipsis-start","ellipsis-middle","ellipsis-end"]).replace(/^(clip|ellipsis)$/,"$1-end")}function Lq(e,t,n,r){if(!n)return;let{lineAnchor:i,lineHeight:o,textOverflow:s,splitLines:a,clipLine:c}=t;e.each(function(l){let u=a(Ni(n[l])??"").map(c),f=u.length,h=i==="top"?.71:i==="bottom"?1-f:(164-f*100)/200;if(f>1){let d=0;for(let p=0;p<f;++p){if(++d,!u[p])continue;let y=this.ownerDocument.createElementNS(jr.svg,"tspan");y.setAttribute("x",0),p===d-1?y.setAttribute("y",`${(h+p)*o}em`):y.setAttribute("dy",`${d*o}em`),y.textContent=u[p],this.appendChild(y),d=0}}else h&&this.setAttribute("y",`${h*o}em`),this.textContent=u[0];if(s&&!r&&u[0]!==n[l]){let d=this.ownerDocument.createElementNS(jr.svg,"title");d.textContent=n[l],this.appendChild(d)}})}function Io(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Le(t,n)),new ll(e,{...r,x:t,y:n})}function A1(e,{x:t=W,...n}={}){return new ll(e,T1({...n,x:t}))}function E1(e,{y:t=W,...n}={}){return new ll(e,M1({...n,y:t}))}function XI(e,t,n){ut(e,"text-anchor",t.textAnchor),ut(e,"font-family",t.fontFamily),ut(e,"font-size",t.fontSize),ut(e,"font-style",t.fontStyle),ut(e,"font-variant",t.fontVariant===void 0?Cq(n):t.fontVariant),ut(e,"font-weight",t.fontWeight)}function Cq(e){return e&&(Os(e)||Ae(e))?"tabular-nums":void 0}var kq=new Set(["inherit","initial","revert","unset","xx-small","x-small","small","medium","large","x-large","xx-large","xxx-large","larger","smaller"]);function Rq(e){return e==null||typeof e=="number"?[void 0,e]:typeof e!="string"?[e,void 0]:(e=e.trim().toLowerCase(),kq.has(e)||/^[+-]?\d*\.?\d+(e[+-]?\d+)?(\w*|%)$/.test(e)?[void 0,e]:[e,void 0])}function $q(e,t,n){let r=[],i,o=0;for(let[s,a,c]of Uq(e)){if(i===void 0&&(i=s),o>i&&n(e,i,a)>t&&(r.push(e.slice(i,o)+(e[o-1]===_N?"-":"")),i=s),c){r.push(e.slice(i,a)),i=void 0;continue}o=a}return r}function*Uq(e){let t=0,n=0,r=e.length;for(;n<r;){let i=1;switch(e[n]){case _N:case"-":++n,yield[t,n,!1],t=n;break;case" ":for(yield[t,n,!1];e[++n]===" ";);t=n;break;case"\r":e[n+1]===`
|
|
26
|
+
`&&++i;case`
|
|
27
|
+
`:yield[t,n,!0],n+=i,t=n;break;default:++n;break}}yield[t,n,!0]}var gN={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 D1(e,t=0,n=e.length){let r=0;for(let i=t;i<n;i=ff(e,i))r+=gN[e[i]]??(SN(e,i)?120:gN.e);return r}function N1(e,t=0,n=e.length){let r=0;for(let i=t;i<n;i=ff(e,i))r+=SN(e,i)?126:63;return r}function HI({monospace:e,lineWidth:t,textOverflow:n}){if(n!=null||t==1/0)return o=>o.split(/\r\n?|\n/g);let r=e?N1:D1,i=t*100;return o=>$q(o,i,r)}function ZI({monospace:e,lineWidth:t,textOverflow:n}){if(n==null||t==1/0)return o=>o;let r=e?N1:D1,i=t*100;switch(n){case"clip-start":return o=>xN(o,i,r,"");case"clip-end":return o=>bN(o,i,r,"");case"ellipsis-start":return o=>xN(o,i,r,cl);case"ellipsis-middle":return o=>Pq(o,i,r,cl);case"ellipsis-end":return o=>bN(o,i,r,cl)}}var cl="\u2026";function ul(e,t,n,r){let i=[],o=0;for(let s=0,a=0,c=e.length;s<c;s=a){a=ff(e,s);let l=n(e,s,a);if(o+l>t){for(o+=r;o>t&&s>0;)a=s,s=i.pop(),o-=n(e,s,a);return[s,t-o]}o+=l,i.push(s)}return[-1,0]}function bN(e,t,n,r){e=e.trim();let i=n(r),[o]=ul(e,t,n,i);return o<0?e:e.slice(0,o).trimEnd()+r}function Pq(e,t,n,r){e=e.trim();let i=n(e);if(i<=t)return e;let o=n(r)/2,[s,a]=ul(e,t/2,n,o),[c]=ul(e,i-t/2-a+o,n,-o);return c<0?r:e.slice(0,s).trimEnd()+r+e.slice(ff(e,c)).trimStart()}function xN(e,t,n,r){e=e.trim();let i=n(e);if(i<=t)return e;let o=n(r),[s]=ul(e,i-t+o,n,-o);return s<0?r:r+e.slice(ff(e,s)).trimStart()}var WI=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,wN=/\p{Extended_Pictographic}/uy;function ff(e,t){return t+=zq(e,t)?2:1,qq(e,t)&&(t=WI.lastIndex),Vq(e,t)?ff(e,t+1):t}function vN(e,t){return e.charCodeAt(t)<128}function zq(e,t){let n=e.charCodeAt(t);if(n>=55296&&n<56320){let r=e.charCodeAt(t+1);return r>=56320&&r<57344}return!1}function Vq(e,t){return e.charCodeAt(t)===8205}function qq(e,t){return vN(e,t)?!1:(WI.lastIndex=t,WI.test(e))}function SN(e,t){return vN(e,t)?!1:(wN.lastIndex=t,wN.test(e))}var IN={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},MN=3.5,jq=MN*5,TN={draw(e,t,n){let r=t*n/jq;e.moveTo(0,0),e.lineTo(0,-t),e.moveTo(-r,r-t),e.lineTo(0,-t),e.lineTo(r,r-t)}},AN={draw(e,t,n){e.moveTo(-n,0),e.lineTo(0,-t),e.lineTo(n,0)}},Yq=new Map([["arrow",TN],["spike",AN]]);function Wq(e){return e&&typeof e.draw=="function"}function Gq(e){if(Wq(e))return e;let t=Yq.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid shape: ${e}`)}var fl=class extends xt{constructor(t,n={}){let{x:r,y:i,r:o=MN,length:s,rotate:a,shape:c=TN,anchor:l="middle",frameAnchor:u}=n,[f,h]=ee(s,12),[d,p]=ee(a,0);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},length:{value:f,scale:"length",optional:!0},rotate:{value:d,optional:!0}},n,IN),this.r=+o,this.length=h,this.rotate=p,this.shape=Gq(c),this.anchor=He(l,"anchor",["start","middle","end"]),this.frameAnchor=wo(u)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,length:u,rotate:f}=r,{length:h,rotate:d,anchor:p,shape:y,r:b}=this,[m,g]=fn(this,i);return at("svg:g",o).call(Ot,this,i,o).call(_t,this,{x:c&&s,y:l&&a}).call(x=>x.selectAll().data(t).enter().append("path").call(At,this).attr("transform",Ua`translate(${c?w=>c[w]:m},${l?w=>l[w]:g})${f?w=>` rotate(${f[w]})`:d?` rotate(${d})`:""}${p==="start"?"":p==="end"?u?w=>` translate(0,${u[w]})`:` translate(0,${h})`:u?w=>` translate(0,${u[w]/2})`:` translate(0,${h/2})`}`).attr("d",u?w=>{let v=Yn();return y.draw(v,u[w],b),v}:(()=>{let w=Yn();return y.draw(w,h,b),w})()).call(Gt,this,r)).node()}};function KI(e,t={}){let{x:n,y:r,...i}=t;return t.frameAnchor===void 0&&([n,r]=Le(n,r)),new fl(e,{...i,x:n,y:r})}function O1(e,t={}){let{x:n=W,...r}=t;return new fl(e,{...r,x:n})}function B1(e,t={}){let{y:n=W,...r}=t;return new fl(e,{...r,y:n})}function EN(e,t={}){let{shape:n=AN,stroke:r=IN.stroke,strokeWidth:i=1,fill:o=r,fillOpacity:s=.3,anchor:a="start",...c}=t;return KI(e,{...c,shape:n,stroke:r,strokeWidth:i,fill:o,fillOpacity:s,anchor:a})}function Pa(e,t){return arguments.length<2&&!Qn(e)&&(t=e,e=null),t===void 0&&(t={}),[e,t]}function F1({anchor:e}={},t){return e===void 0?t[0]:He(e,"anchor",t)}function DN(e){return F1(e,["left","right"])}function NN(e){return F1(e,["right","left"])}function ON(e){return F1(e,["bottom","top"])}function BN(e){return F1(e,["top","bottom"])}function nm(){let[e,t]=Pa(...arguments);return FN("y",DN(t),e,t)}function L1(){let[e,t]=Pa(...arguments);return FN("fy",NN(t),e,t)}function rm(){let[e,t]=Pa(...arguments);return LN("x",ON(t),e,t)}function C1(){let[e,t]=Pa(...arguments);return LN("fx",BN(t),e,t)}function FN(e,t,n,{color:r="currentColor",opacity:i=1,stroke:o=r,strokeOpacity:s=i,strokeWidth:a=1,fill:c=r,fillOpacity:l=i,textAnchor:u,textStroke:f,textStrokeOpacity:h,textStrokeWidth:d,tickSize:p=e==="y"?6:0,tickPadding:y,tickRotate:b,x:m,margin:g,marginTop:x=g===void 0?20:g,marginRight:w=g===void 0?t==="right"?40:0:g,marginBottom:v=g===void 0?20:g,marginLeft:_=g===void 0?t==="left"?40:0:g,label:M,labelAnchor:E,labelArrow:N,labelOffset:I,...T}){return p=Tt(p),y=Tt(y),b=Tt(b),E!==void 0&&(E=He(E,"labelAnchor",["center","top","bottom"])),N=VN(N),Ze(p&&!Jt(o)?Xq(e,t,n,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:y,tickRotate:b,x:m,...T}):null,Jt(c)?null:Zq(e,t,n,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:h,strokeWidth:d,textAnchor:u,tickSize:p,tickPadding:y,tickRotate:b,x:m,marginTop:x,marginRight:w,marginBottom:v,marginLeft:_,...T}),!Jt(c)&&M!==null?Io([],$N({fill:c,fillOpacity:l,...T},function(O,B,S,A,D){let L=A[e],{marginTop:k,marginRight:C,marginBottom:R,marginLeft:$}=e==="y"&&D.inset||D,U=E??(L.bandwidth?"center":"top"),G=I??(t==="right"?C:$)-3;return U==="center"?(this.textAnchor=void 0,this.lineAnchor=t==="right"?"bottom":"top",this.frameAnchor=t,this.rotate=-90):(this.textAnchor=t==="right"?"end":"start",this.lineAnchor=U,this.frameAnchor=`${U}-${t}`,this.rotate=0),this.dy=U==="top"?3-k:U==="bottom"?R-3:0,this.dx=t==="right"?G:-G,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[zN(e,L,{anchor:t,label:M,labelAnchor:U,labelArrow:N})]}}}})):null)}function LN(e,t,n,{color:r="currentColor",opacity:i=1,stroke:o=r,strokeOpacity:s=i,strokeWidth:a=1,fill:c=r,fillOpacity:l=i,textAnchor:u,textStroke:f,textStrokeOpacity:h,textStrokeWidth:d,tickSize:p=e==="x"?6:0,tickPadding:y,tickRotate:b,y:m,margin:g,marginTop:x=g===void 0?t==="top"?30:0:g,marginRight:w=g===void 0?20:g,marginBottom:v=g===void 0?t==="bottom"?30:0:g,marginLeft:_=g===void 0?20:g,label:M,labelAnchor:E,labelArrow:N,labelOffset:I,...T}){return p=Tt(p),y=Tt(y),b=Tt(b),E!==void 0&&(E=He(E,"labelAnchor",["center","left","right"])),N=VN(N),Ze(p&&!Jt(o)?Hq(e,t,n,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:y,tickRotate:b,y:m,...T}):null,Jt(c)?null:Kq(e,t,n,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:h,strokeWidth:d,textAnchor:u,tickSize:p,tickPadding:y,tickRotate:b,y:m,marginTop:x,marginRight:w,marginBottom:v,marginLeft:_,...T}),!Jt(c)&&M!==null?Io([],$N({fill:c,fillOpacity:l,...T},function(O,B,S,A,D){let L=A[e],{marginTop:k,marginRight:C,marginBottom:R,marginLeft:$}=e==="x"&&D.inset||D,U=E??(L.bandwidth?"center":"right"),G=I??(t==="top"?k:R)-3;return U==="center"?(this.frameAnchor=t,this.textAnchor=void 0):(this.frameAnchor=`${t}-${U}`,this.textAnchor=U==="right"?"end":"start"),this.lineAnchor=t,this.dy=t==="top"?-G:G,this.dx=U==="right"?C-3:U==="left"?3-$:0,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[zN(e,L,{anchor:t,label:M,labelAnchor:U,labelArrow:N})]}}}})):null)}function Xq(e,t,n,{strokeWidth:r=1,strokeLinecap:i=null,strokeLinejoin:o=null,facetAnchor:s=t+(e==="y"?"-empty":""),frameAnchor:a=t,tickSize:c,inset:l=0,insetLeft:u=l,insetRight:f=l,dx:h=0,y:d=e==="y"?void 0:null,...p}){return hf(B1,e,t,`${e}-axis tick`,n,{strokeWidth:r,strokeLinecap:i,strokeLinejoin:o,facetAnchor:s,frameAnchor:a,y:d,...p,dx:t==="left"?+h-Ee+ +u:+h+Ee-f,anchor:"start",length:c,shape:t==="left"?ej:nj})}function Hq(e,t,n,{strokeWidth:r=1,strokeLinecap:i=null,strokeLinejoin:o=null,facetAnchor:s=t+(e==="x"?"-empty":""),frameAnchor:a=t,tickSize:c,inset:l=0,insetTop:u=l,insetBottom:f=l,dy:h=0,x:d=e==="x"?void 0:null,...p}){return hf(O1,e,t,`${e}-axis tick`,n,{strokeWidth:r,strokeLinejoin:o,strokeLinecap:i,facetAnchor:s,frameAnchor:a,x:d,...p,dy:t==="bottom"?+h-Ee-f:+h+Ee+ +u,anchor:"start",length:c,shape:t==="bottom"?Jq:tj})}function Zq(e,t,n,{facetAnchor:r=t+(e==="y"?"-empty":""),frameAnchor:i=t,tickSize:o,tickRotate:s=0,tickPadding:a=Math.max(3,9-o)+(Math.abs(s)>60?4*Math.cos(s*uf):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:h=0,insetLeft:d=h,insetRight:p=h,dx:y=0,y:b=e==="y"?void 0:null,...m}){return hf(E1,e,t,`${e}-axis tick label`,n,{facetAnchor:r,frameAnchor:i,text:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,y:b,...m,dx:t==="left"?+y-o-a+ +d:+y+ +o+ +a-p},function(g,x,w,v,_){f===void 0&&(this.fontVariant=PN(g)),c===void 0&&(_.text=UN(g,x,w,v,t))})}function Kq(e,t,n,{facetAnchor:r=t+(e==="x"?"-empty":""),frameAnchor:i=t,tickSize:o,tickRotate:s=0,tickPadding:a=Math.max(3,9-o)+(Math.abs(s)>=10?4*Math.cos(s*uf):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:h=0,insetTop:d=h,insetBottom:p=h,dy:y=0,x:b=e==="x"?void 0:null,...m}){return hf(A1,e,t,`${e}-axis tick label`,n,{facetAnchor:r,frameAnchor:i,text:c===void 0?null:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,x:b,...m,dy:t==="bottom"?+y+ +o+ +a-p:+y-o-a+ +d},function(g,x,w,v,_){f===void 0&&(this.fontVariant=PN(g)),c===void 0&&(_.text=UN(g,x,w,v,t))})}function k1(){let[e,t]=Pa(...arguments);return CN("y",DN(t),e,t)}function R1(){let[e,t]=Pa(...arguments);return CN("fy",NN(t),e,t)}function $1(){let[e,t]=Pa(...arguments);return kN("x",ON(t),e,t)}function U1(){let[e,t]=Pa(...arguments);return kN("fx",BN(t),e,t)}function CN(e,t,n,{y:r=e==="y"?void 0:null,x:i=null,x1:o=t==="left"?i:null,x2:s=t==="right"?i:null,...a}){return hf(Lr,e,t,`${e}-grid`,n,{y:r,x1:o,x2:s,...RN(a)})}function kN(e,t,n,{x:r=e==="x"?void 0:null,y:i=null,y1:o=t==="top"?i:null,y2:s=t==="bottom"?i:null,...a}){return hf(Fr,e,t,`${e}-grid`,n,{x:r,y1:o,y2:s,...RN(a)})}function RN({color:e="currentColor",opacity:t=.1,stroke:n=e,strokeOpacity:r=t,strokeWidth:i=1,...o}){return{stroke:n,strokeOpacity:r,strokeWidth:i,...o}}function $N({fill:e,fillOpacity:t,fontFamily:n,fontSize:r,fontStyle:i,fontVariant:o,fontWeight:s,monospace:a,pointerEvents:c,shapeRendering:l,clip:u=!1},f){return[,e]=Te(e),[,t]=ee(t),{facet:"super",x:null,y:null,fill:e,fillOpacity:t,fontFamily:n,fontSize:r,fontStyle:i,fontVariant:o,fontWeight:s,monospace:a,pointerEvents:c,shapeRendering:l,clip:u,initializer:f}}function hf(e,t,n,r,i,o,s){let a;function c(f,h,d,p,y,b){let m=f==null&&(t==="fx"||t==="fy"),{[t]:g}=p;if(!g)throw new Error(`missing scale: ${t}`);let x=g.domain(),{interval:w,ticks:v,tickFormat:_,tickSpacing:M=t==="x"?80:35}=o;if(typeof v=="string"&&qN(g)&&(w=v,v=void 0),v===void 0&&(v=xo(w,g.type)??Qq(g,M)),f==null){if(Qn(v))f=Ue(v);else if(Oa(v))f=QI(v,...ie(x));else if(g.interval){let N=g.interval;if(g.ticks){let[I,T]=ie(x),O=(T-I)/N[Vu];N=ZS(N,O/v)??N,f=QI(N,I,T)}else{f=x;let I=f.length;N=ZS(N,I/v)??N,N!==g.interval&&(f=QI(N,...ie(f)))}if(N===g.interval){let I=Math.round(f.length/v);I>1&&(f=f.filter((T,O)=>O%I===0))}}else g.ticks?f=g.ticks(v):f=x;if(!g.ticks&&f.length&&f!==x){let N=new Ir(x);f=f.filter(I=>N.has(I)),f.length||kn(`Warning: the ${t}-axis ticks appear to not align with the scale domain, resulting in no ticks. Try different ticks?`)}t==="y"||t==="x"?h=[Kn(f)]:a[t]={scale:t,value:W}}s?.call(this,g,f,v,_,a);let E=Object.fromEntries(Object.entries(a).map(([N,I])=>[N,{...I,value:dt(f,I.value)}]));return m&&(h=b.filterFacets(f,E)),{data:f,facets:h,channels:E}}let l=xe(o).initializer,u=e(i,xe({...o,initializer:c},l));return i==null?(a=u.channels,u.channels={}):a={},u.ariaLabel=r,u.clip===void 0&&(u.clip=!1),u}function Qq(e,t){let[n,r]=ie(e.range());return(r-n)/t}function UN(e,t,n,r,i){return{value:im(e,t,n,r,i)}}function im(e,t,n,r,i){return typeof r=="function"?r:r===void 0&&t&&Ae(t)?xD(e.type,t,i)??Ni:e.tickFormat?e.tickFormat(typeof n=="number"?n:null,r):r===void 0?Ni:typeof r=="string"?(Ae(e.domain())?po:Xr)(r):an(r)}function QI(e,t,n){return e.range(t,e.offset(e.floor(n)))}var Jq={draw(e,t){e.moveTo(0,0),e.lineTo(0,t)}},tj={draw(e,t){e.moveTo(0,0),e.lineTo(0,-t)}},ej={draw(e,t){e.moveTo(0,0),e.lineTo(-t,0)}},nj={draw(e,t){e.moveTo(0,0),e.lineTo(t,0)}};function PN(e){return e.bandwidth&&!e.interval?void 0:"tabular-nums"}function zN(e,t,{anchor:n,label:r=t.label,labelAnchor:i,labelArrow:o}={}){if(!(r==null||r.inferred&&qN(t)&&/^(date|time|year)$/i.test(r))){if(r=String(r),o==="auto"&&(o=(!t.bandwidth||t.interval)&&!/[↑↓→←]/.test(r)),!o)return r;if(o===!0){let s=p1(t);s&&(o=/x$/.test(e)||i==="center"?/x$/.test(e)===s<0?"left":"right":s<0?"up":"down")}switch(o){case"left":return`\u2190 ${r}`;case"right":return`${r} \u2192`;case"up":return n==="right"?`${r} \u2191`:`\u2191 ${r}`;case"down":return n==="right"?`${r} \u2193`:`\u2193 ${r}`}return r}}function VN(e="auto"){return Jt(e)?!1:typeof e=="boolean"?e:He(e,"labelArrow",["auto","up","right","down","left"])}function qN(e){return Ae(e.domain())}function jN(e,t){if(t==null)return t;let n=e(t);if(!n)throw new Error(`scale not found: ${t}`);return n}function YN(e,{opacity:t,...n}={}){if(!vo(e)&&!FI(e))throw new Error(`swatches legend requires ordinal or threshold color scale (not ${e.type})`);return GN(e,n,(r,i,o,s)=>r.append("svg").attr("width",o).attr("height",s).attr("fill",i.scale).attr("fill-opacity",ee(t)[1]).append("rect").attr("width","100%").attr("height","100%"))}function WN(e,{fill:t=e.hint?.fill!==void 0?e.hint.fill:"none",fillOpacity:n=1,stroke:r=e.hint?.stroke!==void 0?e.hint.stroke:Jt(t)?"currentColor":"none",strokeOpacity:i=1,strokeWidth:o=1.5,r:s=4.5,...a}={},c){let[l,u]=Te(t),[f,h]=Te(r),d=jN(c,l),p=jN(c,f),y=s*s*Math.PI;return n=ee(n)[1],i=ee(i)[1],o=ee(o)[1],GN(e,a,(b,m,g,x)=>b.append("svg").attr("viewBox","-8 -8 16 16").attr("width",g).attr("height",x).attr("fill",l==="color"?w=>d.scale(w):u).attr("fill-opacity",n).attr("stroke",f==="color"?w=>p.scale(w):h).attr("stroke-opacity",i).attr("stroke-width",o).append("path").attr("d",w=>{let v=Yn();return e.scale(w).draw(v,y),v}))}function GN(e,t={},n){let{columns:r,tickFormat:i,fontVariant:o=_1(e),swatchSize:s=15,swatchWidth:a=s,swatchHeight:c=s,marginLeft:l=0,className:u,style:f,width:h}=t,d=ka(t);u=Ju(u),i=im(e.scale,e.domain,void 0,i);let p=at("div",d).attr("class",`${u}-swatches ${u}-swatches-${r!=null?"columns":"wrap"}`),y;return r!=null?(y=`: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",r).selectAll().data(e.domain).enter().append("div").attr("class",`${u}-swatch`).call(n,e,a,c).call(b=>b.append("div").attr("class",`${u}-swatch-label`).attr("title",i).text(i))):(y=`:where(.${u}-swatches-wrap) {
|
|
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(n,e,a,c).append(function(){return this.ownerDocument.createTextNode(i.apply(this,arguments))})),p.call(b=>b.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
|
+
${y}`)).style("margin-left",l?`${+l}px`:null).style("width",h===void 0?null:`${+h}px`).style("font-variant",se(o,"normal")).call(tf,f).node()}var P1=new Map([["symbol",WN],["color",ZN],["opacity",rj]]);function XN(e={}){for(let[t,n]of P1){let r=e[t];if(go(r)){let i=ka(e),o;if(t==="symbol"){let{fill:s,stroke:a=s===void 0&&go(e.color)?"color":void 0}=e;o={fill:s,stroke:a}}return n(y1(t,r,o),JI(i,r,e),s=>go(e[s])?y1(s,e[s]):null)}}throw new Error("unknown legend type; no scale found")}function HN(e,t,n={}){return(r,i)=>{if(!P1.has(r))throw new Error(`unknown legend type: ${r}`);if(r in e)return P1.get(r)(e[r],JI(t,n[r],i),o=>e[o])}}function JI({className:e,...t},{label:n,ticks:r,tickFormat:i}={},o){return FD(o,{className:e,...t},{label:n,ticks:r,tickFormat:i})}function ZN(e,{legend:t=!0,...n}){if(t===!0&&(t=e.type==="ordinal"?"swatches":"ramp"),e.domain!==void 0)switch(`${t}`.toLowerCase()){case"swatches":return YN(e,n);case"ramp":return aN(e,n);default:throw new Error(`unknown legend type: ${t}`)}}function rj({type:e,interpolate:t,...n},{legend:r=!0,color:i=en(0,0,0),...o}){if(!t)throw new Error(`${e} opacity scales are not supported`);if(r===!0&&(r="ramp"),`${r}`.toLowerCase()!=="ramp")throw new Error(`${r} opacity legends are not supported`);return ZN({type:e,...n,interpolate:ij(i)},{legend:r,...o})}function ij(e){let{r:t,g:n,b:r}=en(e)||en(0,0,0);return i=>`rgba(${t},${n},${r},${i})`}function KN(e,t,n){let r=[];for(let[i,o]of P1){let s=n[i];if(s?.legend&&i in e){let a=o(e[i],JI(t,e[i],s),c=>e[c]);a!=null&&r.push(a)}}return r}var oj={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},sj={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1},om=class extends xt{constructor(t={}){let{anchor:n=null,inset:r=0,insetTop:i=r,insetRight:o=r,insetBottom:s=r,insetLeft:a=r,rx:c,ry:l}=t;super(Ea,void 0,t,n==null?oj:sj),this.anchor=eI(n,"anchor",["top","right","bottom","left"]),this.insetTop=Tt(i),this.insetRight=Tt(o),this.insetBottom=Tt(s),this.insetLeft=Tt(a),this.rx=Tt(c),this.ry=Tt(l)}render(t,n,r,i,o){let{marginTop:s,marginRight:a,marginBottom:c,marginLeft:l,width:u,height:f}=i,{anchor:h,insetTop:d,insetRight:p,insetBottom:y,insetLeft:b,rx:m,ry:g}=this,x=l+b,w=u-a-p,v=s+d,_=f-c-y;return at(h?"svg:line":"svg:rect",o).datum(0).call(Ot,this,i,o).call(At,this).call(Gt,this,r).call(_t,this,{}).call(h==="left"?M=>M.attr("x1",x).attr("x2",x).attr("y1",v).attr("y2",_):h==="right"?M=>M.attr("x1",w).attr("x2",w).attr("y1",v).attr("y2",_):h==="top"?M=>M.attr("x1",x).attr("x2",w).attr("y1",v).attr("y2",v):h==="bottom"?M=>M.attr("x1",x).attr("x2",w).attr("y1",_).attr("y2",_):M=>M.attr("x",x).attr("y",v).attr("width",w-x).attr("height",_-v).attr("rx",m).attr("ry",g)).node()}};function df(e){return new om(e)}var tM={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},aj=new Set(["geometry","href","src","ariaLabel","scales"]),sm=class extends xt{constructor(t,n={}){n.tip&&(n={...n,tip:!1}),n.title===void 0&&Qn(t)&&Xx(t)&&(n={...n,title:W});let{x:r,y:i,x1:o,x2:s,y1:a,y2:c,anchor:l,preferredAnchor:u="bottom",monospace:f,fontFamily:h=f?"ui-monospace, monospace":void 0,fontSize:d,fontStyle:p,fontVariant:y,fontWeight:b,lineHeight:m=1,lineWidth:g=20,frameAnchor:x,format:w,textAnchor:v="start",textOverflow:_,textPadding:M=8,title:E,pointerSize:N=12,pathFilter:I="drop-shadow(0 3px 4px rgba(0,0,0,0.2))"}=n;super(t,{x:{value:o!=null&&s!=null?null:r,scale:"x",optional:!0},y:{value:a!=null&&c!=null?null:i,scale:"y",optional:!0},x1:{value:o,scale:"x",optional:s==null},y1:{value:a,scale:"y",optional:c==null},x2:{value:s,scale:"x",optional:o==null},y2:{value:c,scale:"y",optional:a==null},title:{value:E,optional:!0}},n,tM),this.anchor=Zx(l,"anchor"),this.preferredAnchor=Zx(u,"preferredAnchor"),this.frameAnchor=wo(x),this.textAnchor=se(v,"middle"),this.textPadding=+M,this.pointerSize=+N,this.pathFilter=$e(I),this.lineHeight=+m,this.lineWidth=+g,this.textOverflow=GI(_),this.monospace=!!f,this.fontFamily=$e(h),this.fontSize=Tt(d),this.fontStyle=$e(p),this.fontVariant=$e(y),this.fontWeight=$e(b);for(let T in tM)T in this.channels&&(this[T]=tM[T]);this.splitLines=HI(this),this.clipLine=ZI(this),this.format={...w}}render(t,n,r,i,o){let s=this,{x:a,y:c,fx:l,fy:u}=n,{ownerSVGElement:f,document:h}=o,{anchor:d,monospace:p,lineHeight:y,lineWidth:b}=this,{textPadding:m,pointerSize:g,pathFilter:x}=this,{marginTop:w,marginLeft:v}=i,{x1:_,y1:M,x2:E,y2:N,x:I=_??E,y:T=M??N}=r,O=l?l(t.fx)-v:0,B=u?u(t.fy)-w:0,[S,A]=fn(this,i),D=PI(r,S),L=zI(r,A),k=p?N1:D1,C=k(cl),R,$;"title"in r?(R=r.channels,$=hj):(R=fj.call(this,r,n),$=dj);let U=at("svg:g",o).call(Ot,this,i,o).call(XI,this).call(_t,this,{x:I&&a,y:T&&c}).call(et=>et.selectAll().data(t).enter().append("g").attr("transform",ot=>`translate(${Math.round(D(ot))},${Math.round(L(ot))})`).call(At,this).call(ot=>ot.append("path").attr("filter",x)).call(ot=>ot.append("text").each(function(j){let nt=Ut(this);this.setAttribute("fill","currentColor"),this.setAttribute("fill-opacity",1),this.setAttribute("stroke","none");let z=$.call(s,j,t,R,n,r);if(typeof z=="string")for(let X of s.splitLines(z))G(nt,{value:s.clipLine(X)});else{let X=new Set;for(let rt of z){let{label:P=""}=rt;P&&X.has(P)||(X.add(P),G(nt,rt))}}})));function G(et,{label:ot,value:j,color:nt,opacity:z}){ot??="",j??="";let X=nt!=null||z!=null,rt,P=b*100,[Bt]=ul(ot,P,k,C);if(Bt>=0)ot=ot.slice(0,Bt).trimEnd()+cl,rt=j.trim(),j="";else{(ot||!j&&!X)&&(j=" "+j);let[jt]=ul(j,P-k(ot),k,C);jt>=0&&(rt=j.trim(),j=j.slice(0,jt).trimEnd()+cl)}let ft=et.append("tspan").attr("x",0).attr("dy",`${y}em`).text("\u200B");ot&&ft.append("tspan").attr("font-weight","bold").text(ot),j&&ft.append(()=>h.createTextNode(j)),X&&ft.append("tspan").text(" \u25A0").attr("fill",nt).attr("fill-opacity",z).style("user-select","none"),rt&&ft.append("title").text(rt)}function J(){let{width:et,height:ot}=i.facet??i;U.selectChildren().each(function(j){let{x:nt,width:z,height:X}=this.getBBox();z=Math.round(z),X=Math.round(X);let rt=d;if(rt===void 0){let ft=D(j)+O,jt=L(j)+B,Yt=ft+z+g+m*2<et,tt=ft-z-g-m*2>0,ne=jt+X+g+m*2<ot,hr=jt-X-g-m*2>0;rt=Yt&&tt?ne&&hr?s.preferredAnchor:hr?"bottom":"top":ne&&hr?Yt?"left":"right":(Yt||tt)&&(ne||hr)?`${hr?"bottom":"top"}-${Yt?"left":"right"}`:s.preferredAnchor}let P=this.firstChild,Bt=this.lastChild;if(P.setAttribute("d",uj(rt,g,m,z,X)),nt)for(let ft of Bt.childNodes)ft.setAttribute("x",-nt);Bt.setAttribute("y",`${+cj(rt,Bt.childNodes.length,y).toFixed(6)}em`),Bt.setAttribute("transform",`translate(${lj(rt,g,m,z,X)})`)}),U.attr("visibility",null)}return t.length&&(U.attr("visibility","hidden"),f.isConnected?Promise.resolve().then(J):typeof requestAnimationFrame<"u"&&requestAnimationFrame(J)),U.node()}};function V1(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Le(t,n)),new sm(e,{...r,x:t,y:n})}function cj(e,t,n){return/^top(?:-|$)/.test(e)?.94-n:-.29-t*n}function lj(e,t,n,r,i){switch(e){case"middle":return[-r/2,i/2];case"top-left":return[n,t+n];case"top":return[-r/2,t/2+n];case"top-right":return[-r-n,t+n];case"right":return[-t/2-r-n,i/2];case"bottom-left":return[n,-t-n];case"bottom":return[-r/2,-t/2-n];case"bottom-right":return[-r-n,-t-n];case"left":return[n+t/2,i/2]}}function uj(e,t,n,r,i){let o=r+n*2,s=i+n*2;switch(e){case"middle":return`M${-o/2},${-s/2}h${o}v${s}h${-o}z`;case"top-left":return`M0,0l${t},${t}h${o-t}v${s}h${-o}z`;case"top":return`M0,0l${t/2},${t/2}h${(o-t)/2}v${s}h${-o}v${-s}h${(o-t)/2}z`;case"top-right":return`M0,0l${-t},${t}h${t-o}v${s}h${o}z`;case"right":return`M0,0l${-t/2},${-t/2}v${t/2-s/2}h${-o}v${s}h${o}v${t/2-s/2}z`;case"bottom-left":return`M0,0l${t},${-t}h${o-t}v${-s}h${-o}z`;case"bottom":return`M0,0l${t/2},${-t/2}h${(o-t)/2}v${-s}h${-o}v${s}h${(o-t)/2}z`;case"bottom-right":return`M0,0l${-t},${-t}h${t-o}v${-s}h${o}z`;case"left":return`M0,0l${t/2},${-t/2}v${t/2-s/2}h${o}v${s}h${-o}v${t/2-s/2}z`}}function fj({channels:e},t){let n={},r=this.format;r=QN(r,e,"x"),r=QN(r,e,"y"),this.format=r;for(let i in r){let o=r[i];if(!(o===null||o===!1))if(i==="fx"||i==="fy")n[i]=!0;else{let s=Xp(e,i);s&&(n[i]=s)}}for(let i in e){if(i in n||i in r||aj.has(i))continue;let o=Xp(e,i);o&&(n[i]=o)}this.facet&&(t.fx&&!("fx"in r)&&(n.fx=!0),t.fy&&!("fy"in r)&&(n.fy=!0));for(let i in n){let o=this.format[i];if(typeof o=="string"){let s=n[i]?.value??t[i]?.domain()??[];this.format[i]=(Ae(s)?po:Xr)(o)}else if(o===void 0||o===!0){let s=t[i];this.format[i]=s?.bandwidth?im(s,s.domain()):Ni}}return n}function QN(e,t,n){if(!(n in e))return e;let r=`${n}1`,i=`${n}2`;if((r in e||!(r in t))&&(i in e||!(i in t)))return e;let o=Object.entries(e),s=e[n];return o.splice(o.findIndex(([a])=>a===n)+1,0,[r,s],[i,s]),Object.fromEntries(o)}function hj(e,t,{title:n}){return Ni(n.value[e],e)}function*dj(e,t,n,r,i){for(let o in n){if(o==="fx"||o==="fy"){yield{label:z1(r,n,o),value:this.format[o](t[o],e)};continue}if(o==="x1"&&"x2"in n||o==="y1"&&"y2"in n)continue;let s=n[o];if(o==="x2"&&"x1"in n)yield{label:tO(r,n,"x"),value:JN(this.format.x2,n.x1,s,e)};else if(o==="y2"&&"y1"in n)yield{label:tO(r,n,"y"),value:JN(this.format.y2,n.y1,s,e)};else{let a=s.value[e],c=s.scale;if(!Re(a)&&c==null)continue;yield{label:z1(r,n,o),value:this.format[o](a,e),color:c==="color"?i[o][e]:null,opacity:c==="opacity"?i[o][e]:null}}}}function JN(e,t,n,r){return n.hint?.length?`${e(n.value[r]-t.value[r],r)}`:`${e(t.value[r],r)}\u2013${e(n.value[r],r)}`}function tO(e,t,n){let r=z1(e,t,`${n}1`,n),i=z1(e,t,`${n}2`,n);return r===i?r:`${r}\u2013${i}`}function z1(e,t,n,r=n){let i=t[n],o=e[i?.scale??n];return String(o?.label??i?.label??r)}function cm(e={}){let{facet:t,style:n,title:r,subtitle:i,caption:o,ariaLabel:s,ariaDescription:a}=e,c=Ju(e.className),l=e.marks===void 0?[]:nO(e.marks);l.push(...wj(l));let u=bj(t,e),f=new Map;for(let C of l){let R=rO(C,u,e);R&&f.set(C,R)}let h=new Map;u&&am(h,[u],e),am(h,f,e);let d=nO(_j(l,h,e));for(let C of d){let R=rO(C,u,e);R&&f.set(C,R)}l.unshift(...d);let p=eN(h,e);if(p!==void 0){let C=u?w1(p,u):void 0;for(let $ of l){if($.facet===null||$.facet==="super")continue;let U=f.get($);U!==void 0&&(U.facetsIndex=$.fx!=null||$.fy!=null?w1(p,U):C)}let R=new Set;for(let{facetsIndex:$}of f.values())$?.forEach((U,G)=>{U?.length>0&&R.add(G)});p.forEach(0<R.size&&R.size<p.length?($,U)=>$.empty=!R.has(U):$=>$.empty=!1);for(let $ of l)if($.facet==="exclude"){let U=f.get($);U!==void 0&&(U.facetsIndex=iN(U.facetsIndex))}}for(let C of ce.keys())go(e[C])&&C!=="fx"&&C!=="fy"&&h.set(C,[]);let y=new Map;for(let C of l){if(y.has(C))throw new Error("duplicate mark; each mark must be unique");let{facetsIndex:R,channels:$}=f.get(C)??{},{data:U,facets:G,channels:J}=C.initialize(R,$,e);rM(J,e),y.set(C,{data:U,facets:G,channels:J})}let b=Jp(am(h,y,e),e),m=J5(b,l,e);W5(b,m);let g=OI(b),{fx:x,fy:w}=g,v=x||w?BI(b,m):m,_=x||w?Ej(g,m):m,M=ka(e),E=M.document,N=ls("svg").call(E.documentElement),I=N;M.ownerSVGElement=N,M.className=c,M.projection=o5(e,v),M.filterFacets=(C,R)=>w1(p,{channels:R,groups:b1(C,R)}),M.getMarkState=C=>{let R=y.get(C),$=f.get(C);return{...R,channels:{...R.channels,...$?.channels}}},M.dispatchValue=C=>{I.value!==C&&(I.value=C,I.dispatchEvent(new Event("input",{bubbles:!0})))};let T=new Set;for(let[C,R]of y)if(C.initializer!=null){let $=C.facet==="super"?_:v,U=C.initializer(R.data,R.facets,R.channels,g,$,M);if(U.data!==void 0&&(R.data=U.data),U.facets!==void 0&&(R.facets=U.facets),U.channels!==void 0){let{fx:G,fy:J,...et}=U.channels;gj(et),Object.assign(R.channels,et);for(let ot of Object.values(et)){let{scale:j}=ot;j!=null&&!CD(ce.get(j))&&(sO(ot,e),T.add(j))}(G!=null||J!=null)&&f.set(C,!0)}}if(T.size){let C=new Map;am(C,y,e,G=>T.has(G)),am(h,y,e,G=>T.has(G));let R=Aj(Jp(C,e),b),{scales:$,...U}=OI(R);Object.assign(b,R),Object.assign(g,U),Object.assign(g.scales,$)}let O,B;p!==void 0&&(O={x:x?.domain(),y:w?.domain()},p=nN(p,O),B=rN(x,w,m));for(let[C,R]of y)R.values=C.scale(R.channels,g,M);let{width:S,height:A}=m;Ut(N).attr("class",c).attr("fill","currentColor").attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("text-anchor","middle").attr("width",S).attr("height",A).attr("viewBox",`0 0 ${S} ${A}`).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(tf,n);for(let C of l){let{channels:R,values:$,facets:U}=y.get(C);if(p===void 0||C.facet==="super"){let G=null;if(U&&(G=U[0],G=C.filter(G,R,$),G.length===0))continue;let J=C.render(G,g,$,_,M);if(J==null)continue;N.appendChild(J)}else{let G;for(let J of p){if(!(C.facetAnchor?.(p,O,J)??!J.empty))continue;let et=null;if(U){let j=f.has(C);if(et=U[j?J.i:0],et=C.filter(et,R,$),et.length===0)continue;!j&&et===U[0]&&(et=Ds(et)),et.fx=J.x,et.fy=J.y,et.fi=J.i}let ot=C.render(et,g,$,v,M);if(ot!=null){(G??=Ut(N).append("g")).append(()=>ot).datum(J);for(let j of["aria-label","aria-description","aria-hidden","transform"])ot.hasAttribute(j)&&(G.attr(j,ot.getAttribute(j)),ot.removeAttribute(j))}}G?.selectChildren().attr("transform",B)}}let D=KN(b,M,e),{figure:L=r!=null||i!=null||o!=null||D.length>0}=e;L&&(I=E.createElement("figure"),I.className=`${c}-figure`,I.style.maxWidth="initial",r!=null&&I.append(eO(E,r,"h2")),i!=null&&I.append(eO(E,i,"h3")),I.append(...D,N),o!=null&&I.append(pj(E,o))),I.scale=Z5(g.scales),I.legend=HN(b,M,e),I.projection=M.projection;let k=e5();return k>0&&Ut(N).append("text").attr("x",S).attr("y",20).attr("dy","-1em").attr("text-anchor","end").attr("font-family","initial").text("\u26A0\uFE0F").append("title").text(`${k.toLocaleString("en-US")} warning${k===1?"":"s"}. Please check the console.`),I}function eO(e,t,n){if(t.ownerDocument)return t;let r=e.createElement(n);return r.append(t),r}function pj(e,t){let n=e.createElement("figcaption");return n.append(t),n}function mj({marks:e=[],...t}={}){return cm({...t,marks:[...e,this]})}xt.prototype.plot=mj;function nO(e){return e.flat(1/0).filter(t=>t!=null).map(yj)}function yj(e){return typeof e.render=="function"?e:new nM(e)}var nM=class extends xt{constructor(t){if(typeof t!="function")throw new TypeError("invalid mark; missing render function");super(),this.render=t}render(){}};function rM(e,t){for(let n in e)sO(e[n],t);return e}function sO(e,t){let{scale:n,transform:r=!0}=e;if(n==null||!r)return;let{type:i,percent:o,interval:s,transform:a=o?c=>c*100:oI(s,i)}=t[n]??{};a!=null&&(e.value=Vt(e.value,a),e.transform=!1)}function gj(e){for(let t in e)xI(t,e[t])}function am(e,t,n,r=vD){for(let{channels:i}of t.values())for(let o in i){let s=i[o],{scale:a}=s;if(a!=null&&r(a))if(a==="projection"){if(!c5(n)){let c=n.x?.domain===void 0,l=n.y?.domain===void 0;if(c||l){let[u,f]=u5(s);c&&eM(e,"x",u),l&&eM(e,"y",f)}}}else eM(e,a,s)}return e}function eM(e,t,n){let r=e.get(t);r!==void 0?r.push(n):e.set(t,[n])}function bj(e,t){if(e==null)return;let{x:n,y:r}=e;if(n==null&&r==null)return;let i=Ue(e.data);if(i==null)throw new Error("missing facet data");let o={};n!=null&&(o.fx=Ku(i,{value:n,scale:"fx"})),r!=null&&(o.fy=Ku(i,{value:r,scale:"fy"})),rM(o,t);let s=b1(i,o);return{channels:o,groups:s,data:e.data}}function rO(e,t,n){if(e.facet===null||e.facet==="super")return;let{fx:r,fy:i}=e;if(r!=null||i!=null){let c=Ue(e.data??r??i);if(c===void 0)throw new Error(`missing facet data in ${e.ariaLabel}`);if(c===null)return;let l={};return r!=null&&(l.fx=Ku(c,{value:r,scale:"fx"})),i!=null&&(l.fy=Ku(c,{value:i,scale:"fy"})),rM(l,n),{channels:l,groups:b1(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)&&Ue(e.data)?.length===a.length&&kn(`Warning: the ${e.ariaLabel} mark appears to use faceted data, but isn\u2019t faceted. The mark data has the same length as the facet data and the mark facet option is "auto", but the mark data and facet data are distinct. If this mark should be faceted, set the mark facet option to true; otherwise, suppress this warning by setting the mark facet option to false.`)}function xj(e,t={}){return xe({...t,x:null,y:null},(n,r,i,o,s,a)=>a.getMarkState(e))}function wj(e){let t=[];for(let n of e){let r=n.tip;if(r){r===!0?r={}:typeof r=="string"&&(r={pointer:r});let{pointer:i,preferredAnchor:o}=r;i=/^x$/i.test(i)?lf:/^y$/i.test(i)?ol:cf,r=i(xj(n,r)),r.title=null,o===void 0&&(r.preferredAnchor=i===ol?"left":"bottom");let s=V1(n.data,r);s.facet=n.facet,s.facetAnchor=n.facetAnchor,t.push(s)}}return t}function _j(e,t,n){let{projection:r,x:i={},y:o={},fx:s={},fy:a={},axis:c,grid:l,facet:u={},facet:{axis:f=c,grid:h}=u,x:{axis:d=c,grid:p=d===null?null:l}=i,y:{axis:y=c,grid:b=y===null?null:l}=o,fx:{axis:m=f,grid:g=m===null?null:h}=s,fy:{axis:x=f,grid:w=x===null?null:h}=a}=n;(r||!go(i)&&!iO("x",e))&&(d=p=null),(r||!go(o)&&!iO("y",e))&&(y=b=null),t.has("fx")||(m=g=null),t.has("fy")||(x=w=null),d===void 0&&(d=!Y1(e,"x")),y===void 0&&(y=!Y1(e,"y")),m===void 0&&(m=!Y1(e,"fx")),x===void 0&&(x=!Y1(e,"fy")),d===!0&&(d="bottom"),y===!0&&(y="left"),m===!0&&(m=d==="top"||d===null?"bottom":"top"),x===!0&&(x=y==="right"||y===null?"left":"right");let v=[];return j1(v,w,R1,a),q1(v,x,L1,"right","left",u,a),j1(v,g,U1,s),q1(v,m,C1,"top","bottom",u,s),j1(v,b,k1,o),q1(v,y,nm,"left","right",n,o),j1(v,p,$1,i),q1(v,d,rm,"bottom","top",n,i),v}function q1(e,t,n,r,i,o,s){if(!t)return;let a=vj(t);s=Sj(a?r:t,o,s);let{line:c}=s;(n===nm||n===rm)&&c&&!Bs(c)&&e.push(df(Ij(s))),e.push(n(s)),a&&e.push(n({...s,anchor:i,label:null}))}function j1(e,t,n,r){!t||Bs(t)||e.push(n(Mj(t,r)))}function vj(e){return/^\s*both\s*$/i.test(e)}function Sj(e,t,{line:n=t.line,ticks:r,tickSize:i,tickSpacing:o,tickPadding:s,tickFormat:a,tickRotate:c,fontVariant:l,ariaLabel:u,ariaDescription:f,label:h=t.label,labelAnchor:d,labelArrow:p=t.labelArrow,labelOffset:y}){return{anchor:e,line:n,ticks:r,tickSize:i,tickSpacing:o,tickPadding:s,tickFormat:a,tickRotate:c,fontVariant:l,ariaLabel:u,ariaDescription:f,label:h,labelAnchor:d,labelArrow:p,labelOffset:y}}function Ij(e){let{anchor:t,line:n}=e;return{anchor:t,facetAnchor:t+"-empty",stroke:n===!0?void 0:n}}function Mj(e,{stroke:t=Ba(e)?e:void 0,ticks:n=Tj(e)?e:void 0,tickSpacing:r,ariaLabel:i,ariaDescription:o}){return{stroke:t,ticks:n,tickSpacing:r,ariaLabel:i,ariaDescription:o}}function Tj(e){switch(typeof e){case"number":return!0;case"string":return!Ba(e)}return Qn(e)||typeof e?.range=="function"}function Y1(e,t){let n=`${t}-axis `;return e.some(r=>r.ariaLabel?.startsWith(n))}function iO(e,t){for(let n of t)for(let r in n.channels){let{scale:i}=n.channels[r];if(i===e||i==="projection")return!0}return!1}function Aj(e,t){for(let n in e){let r=e[n],i=t[n];r.label===void 0&&i&&(r.label=i.label)}return e}function Ej({fx:e,fy:t},n){let{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=m1(n),l=e&&oO(e),u=t&&oO(t);return{marginTop:t?u[0]:r,marginRight:e?a-l[1]:i,marginBottom:t?c-u[1]:o,marginLeft:e?l[0]:s,inset:{marginTop:n.marginTop,marginRight:n.marginRight,marginBottom:n.marginBottom,marginLeft:n.marginLeft},width:a,height:c}}function oO(e){let t=e.domain(),n=e(t[0]),r=e(t[t.length-1]);return r<n&&([n,r]=[r,n]),[n,r+e.bandwidth()]}var Dj=new Map([["basis",MS],["basis-closed",TS],["basis-open",AS],["bundle",ES],["bump-x",wS],["bump-y",_S],["cardinal",DS],["cardinal-closed",NS],["cardinal-open",OS],["catmull-rom",BS],["catmull-rom-closed",FS],["catmull-rom-open",LS],["linear",Is],["linear-closed",CS],["monotone-x",RS],["monotone-y",$S],["natural",US],["step",PS],["step-after",VS],["step-before",zS]]);function lm(e=Is,t){if(typeof e=="function")return e;let n=Dj.get(`${e}`.toLowerCase());if(!n)throw new Error(`unknown curve: ${e}`);if(t!==void 0){if("beta"in n)return n.beta(t);if("tension"in n)return n.tension(t);if("alpha"in n)return n.alpha(t)}return n}function W1(e=za,t){return typeof e!="function"&&`${e}`.toLowerCase()==="auto"?za:lm(e,t)}function za(e){return Is(e)}function Mo(e={y:"count"},t={}){[e,t]=oM(e,t);let{x:n,y:r}=t;return iM(G1(n,t,W),null,null,r,e,sl(t))}function To(e={x:"count"},t={}){[e,t]=oM(e,t);let{x:n,y:r}=t;return iM(null,G1(r,t,W),n,null,e,al(t))}function $s(e={fill:"count"},t={}){[e,t]=oM(e,t);let{x:n,y:r}=Nj(t);return iM(n,r,null,null,e,sl(al(t)))}function lO(e,t,n={}){if(n?.interval==null)return n;let{reduce:r=r1}=n,i={filter:null};return n[t]!=null&&(i[t]=r),n[`${t}1`]!=null&&(i[`${t}1`]=r),n[`${t}2`]!=null&&(i[`${t}2`]=r),e(i,n)}function pf(e={}){return lO(Mo,"y",Bi(e,"x"))}function mf(e={}){return lO(To,"x",Bi(e,"y"))}function iM(e,t,n,r,{data:i=n1,filter:o=jp,sort:s,reverse:a,...c}={},l={}){e=aO(e),t=aO(t),c=Oj(c,l),i=hO(i,W),s=s==null?void 0:uO("sort",s,l),o=o==null?void 0:fO("filter",o,l),n!=null&&_o(c,"x","x1","x2")&&(n=null),r!=null&&_o(c,"y","y1","y2")&&(r=null);let[u,f]=In(e),[h,d]=In(e),[p,y]=In(t),[b,m]=In(t),[g,x]=n!=null?[n,"x"]:r!=null?[r,"y"]:[],[w,v]=In(g),{x:_,y:M,z:E,fill:N,stroke:I,x1:T,x2:O,y1:B,y2:S,domain:A,cumulative:D,thresholds:L,interval:k,...C}=l,[R,$]=In(E),[U]=Te(N),[G]=Te(I),[J,et]=In(U),[ot,j]=In(G);return{..."z"in l&&{z:R||E},..."fill"in l&&{fill:J||N},..."stroke"in l&&{stroke:ot||I},...un(C,(nt,z,X)=>{let rt=tl(dt(nt,g),X?.[x]),P=dt(nt,E),Bt=dt(nt,U),ft=dt(nt,G),jt=Gp(c,{z:P,fill:Bt,stroke:ft}),Yt=[],tt=[],ne=rt&&v([]),hr=P&&$([]),Ci=Bt&&et([]),RF=ft&&j([]),y3=e&&f([]),$F=e&&d([]),g3=t&&y([]),UF=t&&m([]),PF=Lj(e,t,nt),zF=0;for(let xl of c)xl.initialize(nt);s&&s.initialize(nt),o&&o.initialize(nt);for(let xl of z){let b3=[];for(let zf of c)zf.scope("facet",xl);s&&s.scope("facet",xl),o&&o.scope("facet",xl);for(let[zf,VF]of Fa(xl,jt))for(let[qF,zm]of Fa(VF,rt))for(let[ki,Za]of PF(zm))if(!(o&&!o.reduce(ki,Za))){b3.push(zF++),tt.push(i.reduceIndex(ki,nt,Za)),rt&&ne.push(qF),P&&hr.push(jt===P?zf:P[(ki.length>0?ki:zm)[0]]),Bt&&Ci.push(jt===Bt?zf:Bt[(ki.length>0?ki:zm)[0]]),ft&&RF.push(jt===ft?zf:ft[(ki.length>0?ki:zm)[0]]),y3&&(y3.push(Za.x1),$F.push(Za.x2)),g3&&(g3.push(Za.y1),UF.push(Za.y2));for(let jF of c)jF.reduce(ki,Za);s&&s.reduce(ki)}Yt.push(b3)}return gI(Yt,s,a),{data:tt,facets:Yt}}),...!_o(c,"x")&&(u?{x1:u,x2:h,x:Wu(u,h)}:{x:_,x1:T,x2:O}),...!_o(c,"y")&&(p?{y1:p,y2:b,y:Wu(p,b)}:{y:M,y1:B,y2:S}),...w&&{[x]:w},...Object.fromEntries(c.map(({name:nt,output:z})=>[nt,z]))}}function oM({cumulative:e,domain:t,thresholds:n,interval:r,...i},o){return[i,{cumulative:e,domain:t,thresholds:n,interval:r,...o}]}function G1(e,{cumulative:t,domain:n,thresholds:r,interval:i},o){return e={...ti(e)},e.domain===void 0&&(e.domain=n),e.cumulative===void 0&&(e.cumulative=t),e.thresholds===void 0&&(e.thresholds=r),e.interval===void 0&&(e.interval=i),e.value===void 0&&(e.value=o),e.thresholds=sM(e.thresholds,e.interval),e}function Nj(e){let{x:t,y:n}=e;return t=G1(t,e),n=G1(n,e),[t.value,n.value]=Le(t.value,n.value),{x:t,y:n}}function aO(e){if(e==null)return;let{value:t,cumulative:n,domain:r=ie,thresholds:i}=e,o=s=>{let a=dt(s,t),c;if(Ae(a)||Fj(i)){a=Vt(a,tI,Float64Array);let[u,f]=typeof r=="function"?r(a):r,h=typeof i=="function"&&!Oa(i)?i(a,u,f):i;typeof h=="number"&&(h=hp(u,f,h)),Oa(h)&&(r===ie&&(u=h.floor(u),f=h.offset(h.floor(f))),h=h.range(u,h.offset(f))),c=h}else{a=Xe(a);let[u,f]=typeof r=="function"?r(a):r,h=typeof i=="function"&&!Oa(i)?i(a,u,f):i;if(typeof h=="number")if(r===ie){let d=ss(u,f,h);if(isFinite(d))if(d>0){let p=Math.round(u/d),y=Math.round(f/d);p*d<=u||--p,y*d>f||++y;let b=y-p+1;h=new Float64Array(b);for(let m=0;m<b;++m)h[m]=(p+m)*d}else if(d<0){d=-d;let p=Math.round(u*d),y=Math.round(f*d);p/d<=u||--p,y/d>f||++y;let b=y-p+1;h=new Float64Array(b);for(let m=0;m<b;++m)h[m]=(p+m)/d}else h=[u];else h=[u]}else h=xn(u,f,h);else Oa(h)&&(r===ie&&(u=h.floor(u),f=h.offset(h.floor(f))),h=h.range(u,h.offset(f)));c=h}let l=[];if(c.length===1)l.push([c[0],c[0]]);else for(let u=1;u<c.length;++u)l.push([c[u-1],c[u]]);return l.bin=(n<0?kj:n>0?Cj:aM)(l,c,a),l};return o.label=Mn(t),o}function sM(e,t,n=cO){if(e===void 0)return t===void 0?n:xo(t);if(typeof e=="string"){switch(e.toLowerCase()){case"freedman-diaconis":return $0;case"scott":return ad;case"sturges":return la;case"auto":return cO}return Pp(e)}return e}function Oj(e,t){return mI(e,t,uO)}function uO(e,t,n){return t1(e,t,n,fO)}function fO(e,t,n){return e1(e,t,n,hO)}function hO(e,t){return Zu(e,t,Bj)}function Bj(e){switch(`${e}`.toLowerCase()){case"x":return Rj;case"x1":return Uj;case"x2":return Pj;case"y":return $j;case"y1":return zj;case"y2":return Vj}throw new Error(`invalid bin reduce: ${e}`)}function cO(e,t,n){return Math.min(200,ad(e,t,n))}function Fj(e){return TD(e)||Qn(e)&&Ae(e)}function Lj(e,t,n){let r=e?.(n),i=t?.(n);return r&&i?function*(o){let s=r.bin(o);for(let[a,[c,l]]of r.entries()){let u=i.bin(s[a]);for(let[f,[h,d]]of i.entries())yield[u[f],{data:n,x1:c,y1:h,x2:l,y2:d}]}}:r?function*(o){let s=r.bin(o);for(let[a,[c,l]]of r.entries())yield[s[a],{data:n,x1:c,x2:l}]}:function*(o){let s=i.bin(o);for(let[a,[c,l]]of i.entries())yield[s[a],{data:n,y1:c,y2:l}]}}function aM(e,t,n){return t=Xe(t),r=>{let i=e.map(()=>[]);for(let o of r)i[os(t,n[o])-1]?.push(o);return i}}function Cj(e,t,n){let r=aM(e,t,n);return i=>{let o=r(i);for(let s=1,a=o.length;s<a;++s){let c=o[s-1],l=o[s];for(let u of c)l.push(u)}return o}}function kj(e,t,n){let r=aM(e,t,n);return i=>{let o=r(i);for(let s=o.length-2;s>=0;--s){let a=o[s+1],c=o[s];for(let l of a)c.push(l)}return o}}function dO(e,t){let n=(+e+ +t)/2;return e instanceof Date?new Date(n):n}var Rj={reduceIndex(e,t,{x1:n,x2:r}){return dO(n,r)}},$j={reduceIndex(e,t,{y1:n,y2:r}){return dO(n,r)}},Uj={reduceIndex(e,t,{x1:n}){return n}},Pj={reduceIndex(e,t,{x2:n}){return n}},zj={reduceIndex(e,t,{y1:n}){return n}},Vj={reduceIndex(e,t,{y2:n}){return n}};function yf(e={}){return nI(e)?e:{...e,x:W}}function gf(e={}){return rI(e)?e:{...e,y:W}}function pO(e,t){if(t.length===1)return{data:e,facets:t};let n=e.length,r=new Uint8Array(n),i=0;for(let a of t)for(let c of a)r[c]&&++i,r[c]=1;if(i===0)return{data:e,facets:t};e=Na(e);let o=e[KS]=new Uint32Array(n+i);t=t.map(a=>Na(a,Uint32Array));let s=n;r.fill(0);for(let a of t)for(let c=0,l=a.length;c<l;++c){let u=a[c];r[u]?(a[c]=s,e[s]=e[u],o[s]=u,++s):o[u]=u,r[u]=1}return{data:e,facets:t}}function cM(e={},t={}){arguments.length===1&&([e,t]=wf(e));let{y1:n,y:r=n,x:i,...o}=t,[s,a,c,l]=_f(r,i,"y","x",e,o);return{...s,y1:n,y:a,x1:c,x2:l,x:Wu(c,l)}}function gO(e={},t={}){arguments.length===1&&([e,t]=wf(e));let{y1:n,y:r=n,x:i}=t,[o,s,a]=_f(r,i,"y","x",e,t);return{...o,y1:n,y:s,x:a}}function bO(e={},t={}){arguments.length===1&&([e,t]=wf(e));let{y1:n,y:r=n,x:i}=t,[o,s,,a]=_f(r,i,"y","x",e,t);return{...o,y1:n,y:s,x:a}}function lM(e={},t={}){arguments.length===1&&([e,t]=wf(e));let{x1:n,x:r=n,y:i,...o}=t,[s,a,c,l]=_f(r,i,"x","y",e,o);return{...s,x1:n,x:a,y1:c,y2:l,y:Wu(c,l)}}function xO(e={},t={}){arguments.length===1&&([e,t]=wf(e));let{x1:n,x:r=n,y:i}=t,[o,s,a]=_f(r,i,"x","y",e,t);return{...o,x1:n,x:s,y:a}}function wO(e={},t={}){arguments.length===1&&([e,t]=wf(e));let{x1:n,x:r=n,y:i}=t,[o,s,,a]=_f(r,i,"x","y",e,t);return{...o,x1:n,x:s,y:a}}function bf({x:e,x1:t,x2:n,...r}={}){return r=Bi(r,"y"),t===void 0&&n===void 0?cM({x:e,...r}):([t,n]=iI(e,t,n),{...r,x1:t,x2:n})}function xf({y:e,y1:t,y2:n,...r}={}){return r=Bi(r,"x"),t===void 0&&n===void 0?lM({y:e,...r}):([t,n]=iI(e,t,n),{...r,y1:t,y2:n})}function wf(e){let{offset:t,order:n,reverse:r,...i}=e;return[{offset:t,order:n,reverse:r},i]}var qj={length:!0};function _f(e,t=zp,n,r,{offset:i,order:o,reverse:s},a){if(t===null)throw new Error(`stack requires ${r}`);let c=Cn(a),[l,u]=In(e),[f,h]=ln(t),[d,p]=ln(t);return f.hint=d.hint=qj,i=jj(i),o=Gj(o,i,r),[un(a,(y,b,m)=>{({data:y,facets:b}=pO(y,b));let g=e==null?void 0:u(tl(dt(y,e),m?.[n])),x=dt(y,t,Float64Array),w=dt(y,c),v=o&&o(y,g,x,w),_=y.length,M=h(new Float64Array(_)),E=p(new Float64Array(_)),N=[];for(let I of b){let T=g?Array.from(tn(I,O=>g[O]).values()):[I];if(v)for(let O of T)O.sort(v);for(let O of T){let B=0,S=0;s&&O.reverse();for(let A of O){let D=x[A];D<0?B=E[A]=(M[A]=B)+D:D>0?S=E[A]=(M[A]=S)+D:E[A]=M[A]=S}}N.push(T)}return i&&i(N,M,E,w),{data:y,facets:b}}),l,f,d]}function jj(e){if(e!=null){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"expand":case"normalize":return Yj;case"center":case"silhouette":return Wj;case"wiggle":return vO}throw new Error(`unknown offset: ${e}`)}}function _O(e,t){let n=0,r=0;for(let i of e){let o=t[i];o<n&&(n=o),o>r&&(r=o)}return[n,r]}function Yj(e,t,n){for(let r of e)for(let i of r){let[o,s]=_O(i,n);for(let a of i){let c=1/(s-o||1);t[a]=c*(t[a]-o),n[a]=c*(n[a]-o)}}}function Wj(e,t,n){for(let r of e){for(let i of r){let[o,s]=_O(i,n);for(let a of i){let c=(s+o)/2;t[a]-=c,n[a]-=c}}SO(r,t,n)}IO(e,t,n)}function vO(e,t,n,r){for(let i of e){let o=new zn,s=0;for(let a of i){let c=-1,l=a.map(d=>Math.abs(n[d]-t[d])),u=a.map(d=>{c=r?r[d]:++c;let p=n[d]-t[d],y=o.has(c)?p-o.get(c):0;return o.set(c,p),y}),f=[0,...F0(u)];for(let d of a)t[d]+=s,n[d]+=s;let h=wn(l);h&&(s-=wn(l,(d,p)=>(u[p]/2+f[p])*d)/h)}SO(i,t,n)}IO(e,t,n)}function SO(e,t,n){let r=oe(e,i=>oe(i,o=>t[o]));for(let i of e)for(let o of i)t[o]-=r,n[o]-=r}function IO(e,t,n){let r=e.length;if(r===1)return;let i=e.map(a=>a.flat()),o=i.map(a=>(oe(a,c=>t[c])+$t(a,c=>n[c]))/2),s=oe(o);for(let a=0;a<r;a++){let c=s-o[a];for(let l of i[a])t[l]+=c,n[l]+=c}}function Gj(e,t,n){if(e===void 0&&t===vO)return mO(sn);if(e!=null){if(typeof e=="string"){let r=e.startsWith("-"),i=r?Kc:sn;switch((r?e.slice(1):e).toLowerCase()){case"value":case n:return Xj(i);case"z":return Hj(i);case"sum":return Zj(i);case"appearance":return Kj(i);case"inside-out":return mO(i)}return yO(QS(e))}if(typeof e=="function")return(e.length===1?yO:Qj)(e);if(Array.isArray(e))return Jj(e);throw new Error(`invalid order: ${e}`)}}function Xj(e){return(t,n,r)=>(i,o)=>e(r[i],r[o])}function Hj(e){return(t,n,r,i)=>(o,s)=>e(i[o],i[s])}function Zj(e){return X1(e,(t,n,r,i)=>Hl(Kn(t),o=>wn(o,s=>r[s]),o=>i[o]))}function Kj(e){return X1(e,(t,n,r,i)=>Hl(Kn(t),o=>n[Sc(o,s=>r[s])],o=>i[o]))}function mO(e){return X1(e,(t,n,r,i)=>{let o=Kn(t),s=Hl(o,f=>n[Sc(f,h=>r[h])],f=>i[f]),a=Mi(o,f=>wn(f,h=>r[h]),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 yO(e){return t=>{let n=dt(t,e);return(r,i)=>sn(n[r],n[i])}}function Qj(e){return t=>(n,r)=>e(t[n],t[r])}function Jj(e){return X1(sn,()=>e)}function X1(e,t){return(n,r,i,o)=>{if(!o)throw new Error("missing channel: z");let s=new zn(t(n,r,i,o).map((a,c)=>[a,c]));return(a,c)=>e(s.get(o[a]),s.get(o[c]))}}var tY={ariaLabel:"area",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},hl=class extends xt{constructor(t,n={}){let{x1:r,y1:i,x2:o,y2:s,z:a,curve:c,tension:l}=n;super(t,{x1:{value:r,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0},z:{value:Cn(n),optional:!0}},n,tY),this.z=a,this.curve=lm(c,l)}filter(t){return t}render(t,n,r,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a}=r;return at("svg:g",o).call(Ot,this,i,o).call(_t,this,n,0,0).call(u=>u.selectAll().data(c1(t,[s,a,c,l],this,r)).enter().append("path").call(At,this).call(il,this,r).attr("d",Lu().curve(this.curve).defined(f=>f>=0).x0(f=>s[f]).y0(f=>a[f]).x1(f=>c[f]).y1(f=>l[f]))).node()}};function um(e,t){return t===void 0?Us(e,{x:Es,y:Da}):new hl(e,t)}function Va(e,t){let{y:n=ve,...r}=mf(t);return new hl(e,bf(yf({...r,y1:n,y2:void 0})))}function Us(e,t){let{x:n=ve,...r}=pf(t);return new hl(e,xf(gf({...r,x1:n,x2:void 0})))}var eY={ariaLabel:"link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},fm=class extends xt{constructor(t,n={}){let{x1:r,y1:i,x2:o,y2:s,curve:a,tension:c}=n;super(t,{x1:{value:r,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},n,eY),this.curve=W1(a,c),Fi(this,n)}project(t,n,r){this.curve!==za&&super.project(t,n,r)}render(t,n,r,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a}=r,{curve:u}=this;return at("svg:g",o).call(Ot,this,i,o).call(_t,this,n).call(f=>f.selectAll().data(t).enter().append("path").call(At,this).attr("d",u===za&&o.projection?nY(o.projection,s,a,c,l):h=>{let d=Yn(),p=u(d);return p.lineStart(),p.point(s[h],a[h]),p.point(c[h],l[h]),p.lineEnd(),d}).call(Gt,this,r).call(Rs,this,r,o)).node()}};function nY(e,t,n,r,i){let o=vn(e);return t=Xe(t),n=Xe(n),r=Xe(r),i=Xe(i),s=>o({type:"LineString",coordinates:[[t[s],n[s]],[r[s],i[s]]]})}function H1(e,{x:t,x1:n,x2:r,y:i,y1:o,y2:s,...a}={}){return[n,r]=hm(t,n,r),[o,s]=hm(i,o,s),new fm(e,{...a,x1:n,x2:r,y1:o,y2:s})}function hm(e,t,n){if(e===void 0){if(t===void 0){if(n!==void 0)return[n]}else if(n===void 0)return[t]}else{if(t===void 0)return n===void 0?[e]:[e,n];if(n===void 0)return[e,t]}return[t,n]}var rY={ariaLabel:"arrow",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:1,strokeWidth:1.5},dm=class extends xt{constructor(t,n={}){let{x1:r,y1:i,x2:o,y2:s,bend:a=0,headAngle:c=60,headLength:l=8,inset:u=0,insetStart:f=u,insetEnd:h=u,sweep:d}=n;super(t,{x1:{value:r,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},n,rY),this.bend=a===!0?22.5:Math.max(-90,Math.min(90,a)),this.headAngle=+c,this.headLength=+l,this.insetStart=+f,this.insetEnd=+h,this.sweep=iY(d)}render(t,n,r,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a,SW:u}=r,{strokeWidth:f,bend:h,headAngle:d,headLength:p,insetStart:y,insetEnd:b}=this,m=u?w=>u[w]:an(f===void 0?1:f),g=d*uf/2,x=p/1.5;return at("svg:g",o).call(Ot,this,i,o).call(_t,this,n).call(w=>w.selectAll().data(t).enter().append("path").call(At,this).attr("d",v=>{let _=s[v],M=a[v],E=c[v],N=l[v],I=Math.hypot(E-_,N-M);if(I<=y+b)return null;let T=Math.atan2(N-M,E-_),O=Math.min(x*m(v),I/3),B=this.sweep(_,M,E,N)*h*uf,S=Math.hypot(I/Math.tan(B),I)/2;if(y||b)if(S<1e5){let J=Math.sign(B),[et,ot]=oY([_,M],[E,N],S,J);if(y&&([_,M]=MO([et,ot,S],[_,M,y],-J*Math.sign(y))),b){let[j,nt]=MO([et,ot,S],[E,N,b],J*Math.sign(b));T+=Math.atan2(nt-ot,j-et)-Math.atan2(N-ot,E-et),E=j,N=nt}}else{let J=E-_,et=N-M,ot=Math.hypot(J,et);y&&(_+=J/ot*y,M+=et/ot*y),b&&(E-=J/ot*b,N-=et/ot*b)}let A=T+B,D=A+g,L=A-g,k=E-O*Math.cos(D),C=N-O*Math.sin(D),R=E-O*Math.cos(L),$=N-O*Math.sin(L),U=S<1e5?`A${S},${S} 0,0,${B>0?1:0} `:"L",G=O?`M${k},${C}L${E},${N}L${R},${$}`:"";return`M${_},${M}${U}${E},${N}${G}`}).call(Gt,this,r)).node()}};function iY(e=1){if(typeof e=="number")return an(Math.sign(e));if(typeof e=="function")return(t,n,r,i)=>Math.sign(e(t,n,r,i));switch(He(e,"sweep",["+x","-x","+y","-y"])){case"+x":return(t,n,r)=>qt(t,r);case"-x":return(t,n,r)=>Pn(t,r);case"+y":return(t,n,r,i)=>qt(n,i);case"-y":return(t,n,r,i)=>Pn(n,i)}}function oY([e,t],[n,r],i,o){let s=n-e,a=r-t,c=Math.hypot(s,a),l=o*Math.sqrt(i*i-c*c/4)/c;return[(e+n)/2-a*l,(t+r)/2+s*l]}function MO([e,t,n],[r,i,o],s){let a=r-e,c=i-t,l=Math.hypot(a,c),u=(a*a+c*c-o*o+n*n)/(2*l),f=s*Math.sqrt(n*n-u*u);return[e+(a*u+c*f)/l,t+(c*u-a*f)/l]}function TO(e,{x:t,x1:n,x2:r,y:i,y1:o,y2:s,...a}={}){return[n,r]=hm(t,n,r),[o,s]=hm(i,o,s),new dm(e,{...a,x1:n,x2:r,y1:o,y2:s})}var vf=class extends xt{constructor(t,n,r={},i){super(t,n,r,i);let{inset:o=0,insetTop:s=o,insetRight:a=o,insetBottom:c=o,insetLeft:l=o,rx:u,ry:f}=r;this.insetTop=Tt(s),this.insetRight=Tt(a),this.insetBottom=Tt(c),this.insetLeft=Tt(l),this.rx=se(u,"auto"),this.ry=se(f,"auto")}render(t,n,r,i,o){let{rx:s,ry:a}=this;return at("svg:g",o).call(Ot,this,i,o).call(this._transform,this,n).call(c=>c.selectAll().data(t).enter().append("rect").call(At,this).attr("x",this._x(n,r,i)).attr("width",this._width(n,r,i)).attr("y",this._y(n,r,i)).attr("height",this._height(n,r,i)).call(ut,"rx",s).call(ut,"ry",a).call(Gt,this,r)).node()}_x(t,{x:n},{marginLeft:r}){let{insetLeft:i}=this;return n?o=>n[o]+i:r+i}_y(t,{y:n},{marginTop:r}){let{insetTop:i}=this;return n?o=>n[o]+i:r+i}_width({x:t},{x:n},{marginRight:r,marginLeft:i,width:o}){let{insetLeft:s,insetRight:a}=this,c=n&&t?t.bandwidth():o-r-i;return Math.max(0,c-s-a)}_height({y:t},{y:n},{marginTop:r,marginBottom:i,height:o}){let{insetTop:s,insetBottom:a}=this,c=n&&t?t.bandwidth():o-r-i;return Math.max(0,c-s-a)}},AO={ariaLabel:"bar"},pm=class extends vf{constructor(t,n={}){let{x1:r,x2:i,y:o}=n;super(t,{x1:{value:r,scale:"x"},x2:{value:i,scale:"x"},y:{value:o,scale:"y",type:"band",optional:!0}},n,AO)}_transform(t,n,{x:r}){t.call(_t,n,{x:r},0,0)}_x({x:t},{x1:n,x2:r},{marginLeft:i}){let{insetLeft:o}=this;return Jn(t)?i+o:s=>Math.min(n[s],r[s])+o}_width({x:t},{x1:n,x2:r},{marginRight:i,marginLeft:o,width:s}){let{insetLeft:a,insetRight:c}=this;return Jn(t)?s-i-o-a-c:l=>Math.max(0,Math.abs(r[l]-n[l])-a-c)}},mm=class extends vf{constructor(t,n={}){let{x:r,y1:i,y2:o}=n;super(t,{y1:{value:i,scale:"y"},y2:{value:o,scale:"y"},x:{value:r,scale:"x",type:"band",optional:!0}},n,AO)}_transform(t,n,{y:r}){t.call(_t,n,{y:r},0,0)}_y({y:t},{y1:n,y2:r},{marginTop:i}){let{insetTop:o}=this;return Jn(t)?i+o:s=>Math.min(n[s],r[s])+o}_height({y:t},{y1:n,y2:r},{marginTop:i,marginBottom:o,height:s}){let{insetTop:a,insetBottom:c}=this;return Jn(t)?s-i-o-a-c:l=>Math.max(0,Math.abs(r[l]-n[l])-a-c)}};function Ao(e,t={}){return ju(t)||(t={...t,y:ve,x2:W}),new pm(e,bf(S1(yf(t))))}function Eo(e,t={}){return ju(t)||(t={...t,x:ve,y2:W}),new mm(e,xf(I1(gf(t))))}var sY={ariaLabel:"cell"},dl=class extends vf{constructor(t,{x:n,y:r,...i}={}){super(t,{x:{value:n,scale:"x",type:"band",optional:!0},y:{value:r,scale:"y",type:"band",optional:!0}},i,sY)}_transform(t,n){t.call(_t,n,{},0,0)}};function qa(e,{x:t,y:n,...r}={}){return[t,n]=Le(t,n),new dl(e,{...r,x:t,y:n})}function EO(e,{x:t=ve,fill:n,stroke:r,...i}={}){return n===void 0&&Te(r)[0]===void 0&&(n=W),new dl(e,{...i,x:t,fill:n,stroke:r})}function DO(e,{y:t=ve,fill:n,stroke:r,...i}={}){return n===void 0&&Te(r)[0]===void 0&&(n=W),new dl(e,{...i,y:t,fill:n,stroke:r})}var aY={ariaLabel:"dot",fill:"none",stroke:"currentColor",strokeWidth:1.5};function ym(e){return e.sort===void 0&&e.reverse===void 0?Qx({channel:"-r"},e):e}var pl=class extends xt{constructor(t,n={}){let{x:r,y:i,r:o,rotate:s,symbol:a=Ms,frameAnchor:c}=n,[l,u]=ee(s,0),[f,h]=$D(a),[d,p]=ee(o,f==null?3:4.5);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:d,scale:"r",filter:Zn,optional:!0},rotate:{value:l,optional:!0},symbol:{value:f,scale:"auto",optional:!0}},ym(n),aY),this.r=p,this.rotate=u,this.symbol=h,this.frameAnchor=wo(c);let{channels:y}=this,{symbol:b}=y;if(b){let{fill:m,stroke:g}=y;b.hint={fill:m?m.value===b.value?"color":"currentColor":this.fill??"currentColor",stroke:g?g.value===b.value?"color":"currentColor":this.stroke??"none"}}}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,r:u,rotate:f,symbol:h}=r,{r:d,rotate:p,symbol:y}=this,[b,m]=fn(this,i),g=y===Ms,x=u?void 0:d*d*Math.PI;return Ia(d)&&(t=[]),at("svg:g",o).call(Ot,this,i,o).call(_t,this,{x:c&&s,y:l&&a}).call(w=>w.selectAll().data(t).enter().append(g?"circle":"path").call(At,this).call(g?v=>{v.attr("cx",c?_=>c[_]:b).attr("cy",l?_=>l[_]:m).attr("r",u?_=>u[_]:d)}:v=>{v.attr("transform",Ua`translate(${c?_=>c[_]:b},${l?_=>l[_]:m})${f?_=>` rotate(${f[_]})`:p?` rotate(${p})`:""}`).attr("d",u&&h?_=>{let M=Yn();return h[_].draw(M,u[_]*u[_]*Math.PI),M}:u?_=>{let M=Yn();return y.draw(M,u[_]*u[_]*Math.PI),M}:h?_=>{let M=Yn();return h[_].draw(M,x),M}:(()=>{let _=Yn();return y.draw(_,x),_})())}).call(Gt,this,r)).node()}};function ni(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Le(t,n)),new pl(e,{...r,x:t,y:n})}function NO(e,{x:t=W,...n}={}){return new pl(e,T1({...n,x:t}))}function OO(e,{y:t=W,...n}={}){return new pl(e,M1({...n,y:t}))}function BO(e,t){return ni(e,{...t,symbol:"circle"})}function FO(e,t){return ni(e,{...t,symbol:"hexagon"})}var cY={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},ml=class extends xt{constructor(t,n={}){let{x:r,y:i,z:o,curve:s,tension:a}=n;super(t,{x:{value:r,scale:"x"},y:{value:i,scale:"y"},z:{value:Cn(n),optional:!0}},n,cY),this.z=o,this.curve=W1(s,a),Fi(this,n)}filter(t){return t}project(t,n,r){this.curve!==za&&super.project(t,n,r)}render(t,n,r,i,o){let{x:s,y:a}=r,{curve:c}=this;return at("svg:g",o).call(Ot,this,i,o).call(_t,this,n).call(l=>l.selectAll().data(c1(t,[s,a],this,r)).enter().append("path").call(At,this).call(il,this,r).call(uN,this,r,o).attr("d",c===za&&o.projection?lY(o.projection,s,a):_p().curve(c).defined(u=>u>=0).x(u=>s[u]).y(u=>a[u]))).node()}};function lY(e,t,n){let r=vn(e);return t=Xe(t),n=Xe(n),i=>{let o=[],s=[o];for(let a of i)a===-1?(o=[],s.push(o)):o.push([t[a],n[a]]);return r({type:"MultiLineString",coordinates:s})}}function yl(e,{x:t,y:n,...r}={}){return[t,n]=Le(t,n),new ml(e,{...r,x:t,y:n})}function ja(e,{x:t=W,y:n=ve,...r}={}){return new ml(e,mf({...r,x:t,y:n}))}function Ya(e,{x:t=ve,y:n=W,...r}={}){return new ml(e,pf({...r,x:t,y:n}))}var uY={ariaLabel:"rect"},gl=class extends xt{constructor(t,n={}){let{x1:r,y1:i,x2:o,y2:s,inset:a=0,insetTop:c=a,insetRight:l=a,insetBottom:u=a,insetLeft:f=a,rx:h,ry:d}=n;super(t,{x1:{value:r,scale:"x",type:r!=null&&o==null?"band":void 0,optional:!0},y1:{value:i,scale:"y",type:i!=null&&s==null?"band":void 0,optional:!0},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},n,uY),this.insetTop=Tt(c),this.insetRight=Tt(l),this.insetBottom=Tt(u),this.insetLeft=Tt(f),this.rx=se(h,"auto"),this.ry=se(d,"auto")}render(t,n,r,i,o){let{x:s,y:a}=n,{x1:c,y1:l,x2:u,y2:f}=r,{marginTop:h,marginRight:d,marginBottom:p,marginLeft:y,width:b,height:m}=i,{projection:g}=o,{insetTop:x,insetRight:w,insetBottom:v,insetLeft:_,rx:M,ry:E}=this,N=(s?.bandwidth?s.bandwidth():0)-_-w,I=(a?.bandwidth?a.bandwidth():0)-x-v;return at("svg:g",o).call(Ot,this,i,o).call(_t,this,{},0,0).call(T=>T.selectAll().data(t).enter().append("rect").call(At,this).attr("x",c&&(g||!Jn(s))?u?O=>Math.min(c[O],u[O])+_:O=>c[O]+_:y+_).attr("y",l&&(g||!Jn(a))?f?O=>Math.min(l[O],f[O])+x:O=>l[O]+x:h+x).attr("width",c&&(g||!Jn(s))?u?O=>Math.max(0,Math.abs(u[O]-c[O])+N):N:b-d-y-w-_).attr("height",l&&(g||!Jn(a))?f?O=>Math.max(0,Math.abs(l[O]-f[O])+I):I:m-h-p-x-v).call(ut,"rx",M).call(ut,"ry",E).call(Gt,this,r)).node()}};function gm(e,t){return new gl(e,jI(YI(t)))}function Sf(e,t={}){return ju(t)||(t={...t,y:ve,x2:W,interval:1}),new gl(e,bf(YI(yf(t))))}function If(e,t={}){return ju(t)||(t={...t,x:ve,y2:W,interval:1}),new gl(e,xf(jI(gf(t))))}function fM(e,t){t=fY(t);let{x:n,y:r,color:i,size:o}=t,s=Z1(e,n),a=Z1(e,r),c=Z1(e,i),l=Z1(e,o),{fx:u,fy:f,x:{value:h,reduce:d,zero:p,...y},y:{value:b,reduce:m,zero:g,...x},color:{value:w,color:v,reduce:_},size:{value:M,reduce:E},mark:N}=t;if(d===void 0&&(d=m==null&&h==null&&M==null&&b!=null?"count":null),m===void 0&&(m=d==null&&b==null&&M==null&&h!=null?"count":null),E===void 0&&M==null&&_==null&&d==null&&m==null&&(h==null||Se(s))&&(b==null||Se(a))&&(E="count"),p===void 0&&(p=K1(d)?!0:void 0),g===void 0&&(g=K1(m)?!0:void 0),h==null&&b==null)throw new Error("must specify x or y");if(d!=null&&b==null)throw new Error("reducing x requires y");if(m!=null&&h==null)throw new Error("reducing y requires x");N===void 0&&(N=M!=null||E!=null?"dot":K1(d)||K1(m)||_!=null?"bar":h!=null&&b!=null?Se(s)||Se(a)||d==null&&m==null&&!bm(s)&&!bm(a)?"dot":"line":h!=null||b!=null?"rule":null);let I,T,O;switch(N){case"dot":O=ni,T="stroke";break;case"line":O=s&&a||d!=null||m!=null?g||m!=null||s&&bm(s)?Ya:p||d!=null||a&&bm(a)?ja:yl:s?ja:Ya,T="stroke",CO(c)&&(I=null);break;case"area":O=!(g||m!=null)&&(p||d!=null||a&&bm(a))?Va:Us,T="fill",CO(c)&&(I=null);break;case"rule":O=s?Fr:Lr,T="stroke";break;case"bar":O=d!=null?Se(a)?LO(d)&&s&&Se(s)?qa:Ao:Sf:m!=null?Se(s)?LO(m)&&a&&Se(a)?qa:Eo:If:_!=null||E!=null?s&&Se(s)&&a&&Se(a)?qa:s&&Se(s)?Eo:a&&Se(a)?Ao:gm:s&&Os(s)&&!(a&&Os(a))?Ao:a&&Os(a)&&!(s&&Os(s))?Eo:qa,T="fill";break;default:throw new Error(`invalid mark: ${N}`)}let B={fx:u,fy:f,x:s??void 0,y:a??void 0,[T]:c??v,z:I,r:l??void 0,tip:!0},S,A={[T]:_??void 0,r:E??void 0};if(d!=null&&m!=null)throw new Error("cannot reduce both x and y");return m!=null?(A.y=m,S=Se(s)?La:Mo):d!=null?(A.x=d,S=Se(a)?Ca:To):(_!=null||E!=null)&&(s&&a?S=Se(s)&&Se(a)?Wp:Se(s)?To:Se(a)?Mo:$s:s?S=Se(s)?La:Mo:a&&(S=Se(a)?Ca:To)),(S===$s||S===Mo)&&(B.x={value:s,...y}),(S===$s||S===To)&&(B.y={value:a,...x}),p===void 0&&(p=s&&!(S===$s||S===Mo)&&(O===Ao||O===Va||O===Sf||O===Lr)),g===void 0&&(g=a&&!(S===$s||S===To)&&(O===Eo||O===Us||O===If||O===Fr)),{fx:u??null,fy:f??null,x:{value:h??null,reduce:d??null,zero:!!p,...y},y:{value:b??null,reduce:m??null,zero:!!g,...x},color:{value:w??null,reduce:_??null,...v!==void 0&&{color:v}},size:{value:M??null,reduce:E??null},mark:N,markImpl:kO[O],markOptions:B,transformImpl:kO[S],transformOptions:A,colorMode:T}}function RO(e,t){let n=fM(e,t),{fx:r,fy:i,x:{zero:o},y:{zero:s},markOptions:a,transformOptions:c,colorMode:l}=n,u=uM[n.markImpl],f=uM[n.transformImpl],h=r!=null||i!=null?df({strokeOpacity:.1}):null,d=[o?Fr([0]):null,s?Lr([0]):null],p=u(e,f?f(c,a):a);return l==="stroke"?Ze(h,d,p):Ze(h,p,d)}function bm(e){let t,n;for(let r of e){if(r==null)continue;if(t===void 0){t=r;continue}let i=Math.sign(qt(t,r));if(i){if(n!==void 0&&i!==n)return!1;t=r,n=i}}return!0}function fY({x:e,y:t,color:n,size:r,fx:i,fy:o,mark:s}={}){return Or(e)||(e=Mf(e)),Or(t)||(t=Mf(t)),Or(n)||(n=Ba(n)?{color:n}:Mf(n)),Or(r)||(r=Mf(r)),Or(i)&&({value:i}=Mf(i)),Or(o)&&({value:o}=Mf(o)),s!=null&&(s=`${s}`.toLowerCase()),{x:e,y:t,color:n,size:r,fx:i,fy:o,mark:s}}function Z1(e,t){let n=dt(e,t.value);return n&&(n.label=Mn(t.value)),n}function Mf(e){return hY(e)?{reduce:e}:{value:e}}function K1(e){return/^(?:distinct|count|sum|proportion)$/i.test(e)}function LO(e){return/^(?:first|last|mode)$/i.test(e)}function hY(e){if(e==null)return!1;if(typeof e.reduceIndex=="function"||typeof e.reduce=="function"&&cn(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 CO(e){return e?new Ir(e).size>e.length>>1:!1}var uM={dot:ni,line:yl,lineX:ja,lineY:Ya,areaX:Va,areaY:Us,ruleX:Fr,ruleY:Lr,barX:Ao,barY:Eo,rect:gm,rectX:Sf,rectY:If,cell:qa,bin:$s,binX:Mo,binY:To,group:Wp,groupX:La,groupY:Ca},kO=Object.fromEntries(Object.entries(uM).map(([e,t])=>[t,e]));function Tf(e,t={}){let{x:n,x1:r,x2:i}=t;n===void 0&&r===void 0&&i===void 0&&(t={...t,x:n=W});let o={};return n!=null&&(o.x=e),r!=null&&(o.x1=e),i!=null&&(o.x2=e),fr(o,t)}function Af(e,t={}){let{y:n,y1:r,y2:i}=t;n===void 0&&r===void 0&&i===void 0&&(t={...t,y:n=W});let o={};return n!=null&&(o.y=e),r!=null&&(o.y1=e),i!=null&&(o.y2=e),fr(o,t)}function fr(e={},t={}){let n=Cn(t),r=Object.entries(e).map(([i,o])=>{let s=Gx(i,t);if(s==null)throw new Error(`missing channel: ${i}`);let[a,c]=ln(s);return{key:i,input:s,output:a,setOutput:c,map:dY(o)}});return{...un(t,(i,o)=>{let s=dt(i,n),a=r.map(({input:l})=>dt(i,l)),c=r.map(({setOutput:l})=>l(new Array(i.length)));for(let l of o)for(let u of s?tn(l,f=>s[f]).values():[l])r.forEach(({map:f},h)=>f.mapIndex(u,a[h],c[h]));return{data:i,facets:o}}),...Object.fromEntries(r.map(({key:i,output:o})=>[i,o]))}}function dY(e){if(e==null)throw new Error("missing map");if(typeof e.mapIndex=="function")return e;if(typeof e.map=="function"&&cn(e))return pY(e);if(typeof e=="function")return hM(Yu(e));switch(`${e}`.toLowerCase()){case"cumsum":return yY;case"rank":return hM((t,n)=>cd(t,r=>n[r]));case"quantile":return hM((t,n)=>mY(t,r=>n[r]))}throw new Error(`invalid map: ${e}`)}function pY(e){return console.warn("deprecated map interface; implement mapIndex instead."),{mapIndex:e.map.bind(e)}}function mY(e,t){let n=Hi(e,t)-1;return cd(e,t).map(r=>r/n)}function hM(e){return{mapIndex(t,n,r){let i=e(t,n);if(i.length!==t.length)throw new Error("map function returned a mismatched length");for(let o=0,s=t.length;o<s;++o)r[t[o]]=i[o]}}}var yY={mapIndex(e,t,n){let r=0;for(let i of e)n[i]=r+=t[i]}};function $O(e={},t){return arguments.length===1&&(t=e),Tf(Ef(e),t)}function UO(e={},t){return arguments.length===1&&(t=e),Af(Ef(e),t)}function Ef(e={}){typeof e=="number"&&(e={k:e});let{k:t,reduce:n,shift:r,anchor:i,strict:o}=e;if(i===void 0&&r!==void 0&&(i=bY(r),kn(`Warning: the shift option is deprecated; please use anchor "${i}" instead.`)),!((t=Math.floor(t))>0))throw new Error(`invalid k: ${t}`);return xY(n)(t,gY(i,t),o)}function gY(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 bY(e){switch(`${e}`.toLowerCase()){case"centered":return"middle";case"leading":return"start";case"trailing":return"end"}throw new Error(`invalid shift: ${e}`)}function xY(e="mean"){if(typeof e=="string"){if(/^p\d{2}$/i.test(e))return Q1(qu(e));switch(e.toLowerCase()){case"deviation":return Q1(qr);case"max":return J1((t,n)=>$t(t,r=>n[r]));case"mean":return wY;case"median":return Q1(Ti);case"min":return J1((t,n)=>oe(t,r=>n[r]));case"mode":return J1((t,n)=>Jl(t,r=>n[r]));case"sum":return PO;case"variance":return Q1(ca);case"difference":return SY;case"ratio":return IY;case"first":return MY;case"last":return TY}}if(typeof e!="function")throw new Error(`invalid reduce: ${e}`);return J1(Yu(e))}function Q1(e){return(t,n,r)=>r?{mapIndex(i,o,s){let a=l=>o[l]==null?NaN:+o[l],c=0;for(let l=0;l<t-1;++l)isNaN(a(l))&&++c;for(let l=0,u=i.length-t+1;l<u;++l)isNaN(a(l+t-1))&&++c,s[i[l+n]]=c===0?e(Ds(i,l,l+t),a):NaN,isNaN(a(l))&&--c}}:{mapIndex(i,o,s){let a=c=>o[c]==null?NaN:+o[c];for(let c=-n;c<0;++c)s[i[c+n]]=e(Ds(i,0,c+t),a);for(let c=0,l=i.length-n;c<l;++c)s[i[c+n]]=e(Ds(i,c,c+t),a)}}}function J1(e){return(t,n,r)=>r?{mapIndex(i,o,s){let a=0;for(let c=0;c<t-1;++c)a+=Re(o[i[c]]);for(let c=0,l=i.length-t+1;c<l;++c)a+=Re(o[i[c+t-1]]),a===t&&(s[i[c+n]]=e(Ds(i,c,c+t),o)),a-=Re(o[i[c]])}}:{mapIndex(i,o,s){for(let a=-n;a<0;++a)s[i[a+n]]=e(Ds(i,0,a+t),o);for(let a=0,c=i.length-n;a<c;++a)s[i[a+n]]=e(Ds(i,a,a+t),o)}}}function PO(e,t,n){return n?{mapIndex(r,i,o){let s=0,a=0;for(let c=0;c<e-1;++c){let l=i[r[c]];l===null||isNaN(l)?++s:a+=+l}for(let c=0,l=r.length-e+1;c<l;++c){let u=i[r[c]],f=i[r[c+e-1]];f===null||isNaN(f)?++s:a+=+f,o[r[c+t]]=s===0?a:NaN,u===null||isNaN(u)?--s:a-=+u}}}:{mapIndex(r,i,o){let s=0,a=r.length;for(let c=0,l=Math.min(a,e-t-1);c<l;++c)s+=+i[r[c]]||0;for(let c=-t,l=a-t;c<l;++c)s+=+i[r[c+e-1]]||0,o[r[c+t]]=s,s-=+i[r[c]]||0}}}function wY(e,t,n){if(n){let r=PO(e,t,n);return{mapIndex(i,o,s){r.mapIndex(i,o,s);for(let a=0,c=i.length-e+1;a<c;++a)s[i[a+t]]/=e}}}else return{mapIndex(r,i,o){let s=0,a=0,c=r.length;for(let l=0,u=Math.min(c,e-t-1);l<u;++l){let f=i[r[l]];f!==null&&!isNaN(f=+f)&&(s+=f,++a)}for(let l=-t,u=c-t;l<u;++l){let f=i[r[l+e-1]],h=i[r[l]];f!==null&&!isNaN(f=+f)&&(s+=f,++a),o[r[l+t]]=s/a,h!==null&&!isNaN(h=+h)&&(s-=h,--a)}}}}function _Y(e,t,n,r){for(let i=n+r;n<i;++n){let o=e[t[n]];if(Re(o))return o}}function vY(e,t,n,r){for(let i=n+r-1;i>=n;--i){let o=e[t[i]];if(Re(o))return o}}function zO(e,t,n,r){for(let i=n+r;n<i;++n){let o=e[t[n]];if(o!==null&&!isNaN(o=+o))return o}}function VO(e,t,n,r){for(let i=n+r-1;i>=n;--i){let o=e[t[i]];if(o!==null&&!isNaN(o=+o))return o}}function SY(e,t,n){return n?{mapIndex(r,i,o){for(let s=0,a=r.length-e;s<a;++s){let c=i[r[s]],l=i[r[s+e-1]];o[r[s+t]]=c===null||l===null?NaN:l-c}}}:{mapIndex(r,i,o){for(let s=-t,a=r.length-e+t+1;s<a;++s)o[r[s+t]]=VO(i,r,s,e)-zO(i,r,s,e)}}}function IY(e,t,n){return n?{mapIndex(r,i,o){for(let s=0,a=r.length-e;s<a;++s){let c=i[r[s]],l=i[r[s+e-1]];o[r[s+t]]=c===null||l===null?NaN:l/c}}}:{mapIndex(r,i,o){for(let s=-t,a=r.length-e+t+1;s<a;++s)o[r[s+t]]=VO(i,r,s,e)/zO(i,r,s,e)}}}function MY(e,t,n){return n?{mapIndex(r,i,o){for(let s=0,a=r.length-e;s<a;++s)o[r[s+t]]=i[r[s]]}}:{mapIndex(r,i,o){for(let s=-t,a=r.length-e+t+1;s<a;++s)o[r[s+t]]=_Y(i,r,s,e)}}}function TY(e,t,n){return n?{mapIndex(r,i,o){for(let s=0,a=r.length-e;s<a;++s)o[r[s+t]]=i[r[s+e-1]]}}:{mapIndex(r,i,o){for(let s=-t,a=r.length-e+t+1;s<a;++s)o[r[s+t]]=vY(i,r,s,e)}}}var Ps={n:20,k:2,color:"currentColor",opacity:.2,strict:!0,anchor:"end"};function qO(e,{x:t=W,y:n,k:r=Ps.k,color:i=Ps.color,opacity:o=Ps.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return Ze(Jt(s)?null:Va(e,fr({x1:Wa({k:-r,...f}),x2:Wa({k:r,...f})},{x1:t,x2:t,y:n,fill:s,fillOpacity:a,...f})),Jt(c)?null:ja(e,fr({x:Wa(f)},{x:t,y:n,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function jO(e,{x:t,y:n=W,k:r=Ps.k,color:i=Ps.color,opacity:o=Ps.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return Ze(Jt(s)?null:Us(e,fr({y1:Wa({k:-r,...f}),y2:Wa({k:r,...f})},{x:t,y1:n,y2:n,fill:s,fillOpacity:a,...f})),Jt(c)?null:Ya(e,fr({y:Wa(f)},{x:t,y:n,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function Wa({n:e=Ps.n,k:t=0,strict:n=Ps.strict,anchor:r=Ps.anchor}={}){return Ef({k:e,reduce:i=>as(i)+t*(qr(i)||0),strict:n,anchor:r})}var AY={ariaLabel:"tick",fill:null,stroke:"currentColor"},tw=class extends xt{constructor(t,n,r){super(t,n,r,AY),Fi(this,r)}render(t,n,r,i,o){return at("svg:g",o).call(Ot,this,i,o).call(this._transform,this,n).call(s=>s.selectAll().data(t).enter().append("line").call(At,this).attr("x1",this._x1(n,r,i)).attr("x2",this._x2(n,r,i)).attr("y1",this._y1(n,r,i)).attr("y2",this._y2(n,r,i)).call(Gt,this,r).call(Rs,this,r,o)).node()}},xm=class extends tw{constructor(t,n={}){let{x:r,y:i,inset:o=0,insetTop:s=o,insetBottom:a=o}=n;super(t,{x:{value:r,scale:"x"},y:{value:i,scale:"y",type:"band",optional:!0}},n),this.insetTop=Tt(s),this.insetBottom=Tt(a)}_transform(t,n,{x:r}){t.call(_t,n,{x:r},Ee,0)}_x1(t,{x:n}){return r=>n[r]}_x2(t,{x:n}){return r=>n[r]}_y1({y:t},{y:n},{marginTop:r}){let{insetTop:i}=this;return n&&t?o=>n[o]+i:r+i}_y2({y:t},{y:n},{height:r,marginBottom:i}){let{insetBottom:o}=this;return n&&t?s=>n[s]+t.bandwidth()-o:r-i-o}},wm=class extends tw{constructor(t,n={}){let{x:r,y:i,inset:o=0,insetRight:s=o,insetLeft:a=o}=n;super(t,{y:{value:i,scale:"y"},x:{value:r,scale:"x",type:"band",optional:!0}},n),this.insetRight=Tt(s),this.insetLeft=Tt(a)}_transform(t,n,{y:r}){t.call(_t,n,{y:r},0,Ee)}_x1({x:t},{x:n},{marginLeft:r}){let{insetLeft:i}=this;return n&&t?o=>n[o]+i:r+i}_x2({x:t},{x:n},{width:r,marginRight:i}){let{insetRight:o}=this;return n&&t?s=>n[s]+t.bandwidth()-o:r-i-o}_y1(t,{y:n}){return r=>n[r]}_y2(t,{y:n}){return r=>n[r]}};function ew(e,{x:t=W,...n}={}){return new xm(e,{...n,x:t})}function nw(e,{y:t=W,...n}={}){return new wm(e,{...n,y:t})}function YO(e,{x:t=W,y:n=null,fill:r="#ccc",fillOpacity:i,stroke:o="currentColor",strokeOpacity:s,strokeWidth:a=2,sort:c,...l}={}){let u=n!=null?Ca:Yp;return Ze(Lr(e,u({x1:dM,x2:pM},{x:t,y:n,stroke:o,strokeOpacity:s,...l})),Ao(e,u({x1:"p25",x2:"p75"},{x:t,y:n,fill:r,fillOpacity:i,...l})),ew(e,u({x:"p50"},{x:t,y:n,stroke:o,strokeOpacity:s,strokeWidth:a,sort:c,...l})),ni(e,fr({x:GO},{x:t,y:n,z:n,stroke:o,strokeOpacity:s,...l})))}function WO(e,{y:t=W,x:n=null,fill:r="#ccc",fillOpacity:i,stroke:o="currentColor",strokeOpacity:s,strokeWidth:a=2,sort:c,...l}={}){let u=n!=null?La:Yp;return Ze(Fr(e,u({y1:dM,y2:pM},{x:n,y:t,stroke:o,strokeOpacity:s,...l})),Eo(e,u({y1:"p25",y2:"p75"},{x:n,y:t,fill:r,fillOpacity:i,...l})),nw(e,u({y:"p50"},{x:n,y:t,stroke:o,strokeOpacity:s,strokeWidth:a,sort:c,...l})),ni(e,fr({y:GO},{x:n,y:t,z:n,stroke:o,strokeOpacity:s,...l})))}function GO(e){let t=dM(e),n=pM(e);return e.map(r=>r<t||r>n?r:NaN)}function dM(e){let t=XO(e)*2.5-HO(e)*1.5;return oe(e,n=>n>=t?n:NaN)}function pM(e){let t=HO(e)*2.5-XO(e)*1.5;return $t(e,n=>n<=t?n:NaN)}function XO(e){return Vn(e,.25)}function HO(e){return Vn(e,.75)}var EY={ariaLabel:"raster",stroke:null,pixelSize:1};function Df(e,t){let n=+e;if(isNaN(n))throw new Error(`invalid ${t}: ${e}`);return n}function ZO(e,t){let n=Math.floor(e);if(isNaN(n))throw new Error(`invalid ${t}: ${e}`);return n}var vm=class extends xt{constructor(t,n,r={},i){let{width:o,height:s,x:a,y:c,x1:l=a==null?0:void 0,y1:u=c==null?0:void 0,x2:f=a==null?o:void 0,y2:h=c==null?s:void 0,pixelSize:d=i.pixelSize,blur:p=0,interpolate:y}=r;if(o!=null&&(o=ZO(o,"width")),s!=null&&(s=ZO(s,"height")),l!=null&&(l=Df(l,"x1")),u!=null&&(u=Df(u,"y1")),f!=null&&(f=Df(f,"x2")),h!=null&&(h=Df(h,"y2")),a==null&&(l==null||f==null))throw new Error("missing x");if(c==null&&(u==null||h==null))throw new Error("missing y");t!=null&&o!=null&&s!=null&&(a===void 0&&l!=null&&f!=null&&(a=kY(l,f,o,s)),c===void 0&&u!=null&&h!=null&&(c=RY(u,h,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:h==null?null:[h],scale:"y",optional:!0,filter:null},...n},r,i),this.width=o,this.height=s,this.pixelSize=Df(d,"pixelSize"),this.blur=Df(p,"blur"),this.interpolate=a==null||c==null?null:DY(y)}},Sm=class extends vm{constructor(t,n={}){let{imageRendering:r}=n;if(t==null){let{fill:i,fillOpacity:o}=n;ee(o)[0]!==void 0&&(n=rw("fillOpacity",n)),Te(i)[0]!==void 0&&(n=rw("fill",n))}super(t,void 0,n,EY),this.imageRendering=se(r,"auto")}scale(t,{color:n,...r},i){return super.scale(t,r,i)}render(t,n,r,i,o){let s=n[r.channels.fill?.scale]??(A=>A),{x:a,y:c}=r,{document:l}=o,[u,f,h,d]=QO(r,i,o),p=h-u,y=d-f,{pixelSize:b,width:m=Math.round(Math.abs(p)/b),height:g=Math.round(Math.abs(y)/b)}=this,x=m*g,{fill:w,fillOpacity:v}=r,_=0;if(this.interpolate){let A=m/p,D=g/y,L=Vt(a,C=>(C-u)*A,Float64Array),k=Vt(c,C=>(C-f)*D,Float64Array);w&&(w=this.interpolate(t,m,g,L,k,w)),v&&(v=this.interpolate(t,m,g,L,k,v))}else this.data==null&&t&&(_=t.fi*x);let M=l.createElement("canvas");M.width=m,M.height=g;let E=M.getContext("2d"),N=E.createImageData(m,g),I=N.data,{r:T,g:O,b:B}=en(this.fill)??{r:0,g:0,b:0},S=(this.fillOpacity??1)*255;for(let A=0;A<x;++A){let D=A<<2;if(w){let L=s(w[A+_]);if(L==null){I[D+3]=0;continue}({r:T,g:O,b:B}=en(L))}v&&(S=v[A+_]*255),I[D+0]=T,I[D+1]=O,I[D+2]=B,I[D+3]=S}return this.blur>0&&W_(N,this.blur),E.putImageData(N,0,0),at("svg:g",o).call(Ot,this,i,o).call(_t,this,n).call(A=>A.append("image").attr("transform",`translate(${u},${f}) scale(${Math.sign(h-u)},${Math.sign(d-f)})`).attr("width",Math.abs(p)).attr("height",Math.abs(y)).attr("preserveAspectRatio","none").call(ut,"image-rendering",this.imageRendering).call(At,this).attr("xlink:href",M.toDataURL())).node()}};function mM(e,t,n){arguments.length<3&&(n=t,t=null);let{x:r,y:i,[e]:o,...s}=n;return r===void 0&&i===void 0&&ED(t)&&(r=Es,i=Da,o===void 0&&(o=SD)),[t,{...s,x:r,y:i,[e]:o}]}function KO(){let[e,t]=mM("fill",...arguments);return new Sm(e,e==null||t.fill!==void 0||t.fillOpacity!==void 0?t:{...t,fill:W})}function QO({x1:e,y1:t,x2:n,y2:r},i,{projection:o}){let{width:s,height:a,marginTop:c,marginRight:l,marginBottom:u,marginLeft:f}=i;return[e&&o==null?e[0]:f,t&&o==null?t[0]:c,n&&o==null?n[0]:s-l,r&&o==null?r[0]:a-u]}function yM({x1:e,y1:t,x2:n,y2:r},i,o,s){let a={};return e&&(a.x1=e),t&&(a.y1=t),n&&(a.x2=n),r&&(a.y2=r),QO(Qu(a,i),o,s)}function rw(e,t={}){let{[e]:n}=t;if(typeof n!="function")throw new Error(`invalid ${e}: not a function`);return xe({...t,[e]:void 0},function(r,i,o,s,a,c){let{x:l,y:u}=s;if(!l)throw new Error("missing scale: x");if(!u)throw new Error("missing scale: y");let[f,h,d,p]=yM(o,s,a,c),y=d-f,b=p-h,{pixelSize:m}=this,{width:g=Math.round(Math.abs(y)/m),height:x=Math.round(Math.abs(b)/m)}=t,w=new Array(g*x*(i?i.length:1)),v=y/g,_=b/x,M=0;for(let E of i??[void 0])for(let N=.5;N<x;++N)for(let I=.5;I<g;++I,++M)w[M]=n(l.invert(f+I*v),u.invert(h+N*_),E);return{data:w,facets:i,channels:{[e]:{value:w,scale:"auto"}}}})}function DY(e){if(typeof e=="function")return e;if(e==null)return iw;switch(`${e}`.toLowerCase()){case"none":return iw;case"nearest":return bM;case"barycentric":return gM();case"random-walk":return xM()}throw new Error(`invalid interpolate: ${e}`)}function iw(e,t,n,r,i,o){let s=new Array(t*n);for(let a of e)r[a]<0||r[a]>=t||i[a]<0||i[a]>=n||(s[Math.floor(i[a])*t+Math.floor(r[a])]=o[a]);return s}function gM({random:e=zc(42)}={}){return(t,n,r,i,o,s)=>{let{points:a,triangles:c,hull:l}=Gr.from(t,d=>i[d],d=>o[d]),u=new s.constructor(n*r).fill(NaN),f=new Uint8Array(n*r),h=CY(s,e);for(let d=0;d<c.length;d+=3){let p=c[d],y=c[d+1],b=c[d+2],m=a[2*p],g=a[2*y],x=a[2*b],w=a[2*p+1],v=a[2*y+1],_=a[2*b+1],M=Math.min(m,g,x),E=Math.max(m,g,x),N=Math.min(w,v,_),I=Math.max(w,v,_),T=(v-_)*(m-x)+(w-_)*(x-g);if(!T)continue;let O=s[t[p]],B=s[t[y]],S=s[t[b]];for(let A=Math.floor(M);A<E;++A)for(let D=Math.floor(N);D<I;++D){if(A<0||A>=n||D<0||D>=r)continue;let L=A+.5,k=D+.5,C=((v-_)*(L-x)+(k-_)*(x-g))/T;if(C<0)continue;let R=((_-w)*(L-x)+(k-_)*(m-x))/T;if(R<0)continue;let $=1-C-R;if($<0)continue;let U=A+n*D;u[U]=h(O,C,B,R,S,$,A,D),f[U]=1}}return NY(u,f,i,o,s,n,r,l,t,h),u}}function NY(e,t,n,r,i,o,s,a,c,l){n=Float64Array.from(a,d=>n[c[d]]),r=Float64Array.from(a,d=>r[c[d]]),i=Array.from(a,d=>i[c[d]]);let u=n.length,f=Array.from({length:u},(d,p)=>BY(p,n,r)),h=0;for(let d=0;d<s;++d){let p=d+.5;for(let y=0;y<o;++y){let b=y+o*d;if(!t[b]){let m=y+.5;for(let g=0;g<u;++g){let x=(u+h+(g%2?(g+1)/2:-g/2))%u;if(f[x](m,p)){let w=OY(n.at(x-1),r.at(x-1),n[x],r[x],m,p);e[b]=l(i.at(x-1),w,i[x],1-w,i[x],0,y,d),h=x;break}}}}}}function OY(e,t,n,r,i,o){let s=n-e,a=r-t,c=s*(n-i)+a*(r-o),l=s*(i-e)+a*(o-t);return c>0&&l>0?c/(c+l):+(c>l)}function _m(e,t,n,r){return e*r-n*t}function BY(e,t,n){let r=t.length,i=t.at(e-2),o=n.at(e-2),s=t.at(e-1),a=n.at(e-1),c=t[e],l=n[e],u=t.at(e+1-r),f=n.at(e+1-r),h=s-c,d=a-l,p=i-s,y=o-a,b=c-u,m=l-f,g=Math.hypot(h,d),x=Math.hypot(p,y),w=Math.hypot(b,m);return(v,_)=>{let M=v-s,E=_-a,N=v-c,I=_-l;return _m(M,E,N,I)>-1e-6&&_m(M,E,h,d)*x-_m(M,E,p,y)*g>-1e-6&&_m(N,I,b,m)*g-_m(N,I,h,d)*w<=0}}function bM(e,t,n,r,i,o){let s=new o.constructor(t*n),a=Gr.from(e,u=>r[u],u=>i[u]),c,l;for(let u=.5,f=0;u<n;++u){l=c;for(let h=.5;h<t;++h,++f)l=a.find(h,u,l),h===.5&&(c=l),s[f]=o[e[l]]}return s}function xM({random:e=zc(42),minDistance:t=.5,maxSteps:n=2}={}){return(r,i,o,s,a,c)=>{let l=new c.constructor(i*o),u=Gr.from(r,p=>s[p],p=>a[p]),f,h,d;for(let p=.5,y=0;p<o;++p){h=f;for(let b=.5;b<i;++b,++y){let m=b,g=p;d=h=u.find(m,g,h),b===.5&&(f=h);let x,w=0;for(;(x=Math.hypot(s[r[d]]-m,a[r[d]]-g))>t&&w<n;){let v=e(b,p,w)*2*Math.PI;m+=Math.cos(v)*x,g+=Math.sin(v)*x,d=u.find(m,g,d),++w}l[y]=c[r[d]]}}return l}}function FY(e,t,n,r,i,o){return t*e+r*n+o*i}function LY(e){return(t,n,r,i,o,s,a,c)=>{let l=e(a,c);return l<n?t:l<n+i?r:o}}function CY(e,t){return Os(e)||Ae(e)?FY:LY(t)}function kY(e,t,n){return{transform(r){let i=r.length,o=new Float64Array(i),s=(t-e)/n,a=e+s/2;for(let c=0;c<i;++c)o[c]=c%n*s+a;return o}}}function RY(e,t,n,r){return{transform(i){let o=i.length,s=new Float64Array(o),a=(t-e)/r,c=e+a/2;for(let l=0;l<o;++l)s[l]=Math.floor(l/n)%r*a+c;return s}}}var JO={ariaLabel:"contour",fill:"none",stroke:"currentColor",strokeMiterlimit:1,pixelSize:2},Im=class extends vm{constructor(t,{smooth:n=!0,value:r,...i}={}){let o=a1({},i,JO);if(r===void 0){for(let a in o)if(o[a].value!=null){if(r!==void 0)throw new Error("ambiguous contour value");r=i[a],i[a]="value"}}if(r!=null){let a={transform:c=>c.map(l=>l.value),label:Mn(r)};for(let c in o)i[c]==="value"&&(i[c]=a)}if(t==null){if(r==null)throw new Error("missing contour value");i=rw("value",{value:r,...i}),r=null}else{let{interpolate:a}=i;r===void 0&&(r=W),a===void 0&&(i.interpolate="nearest")}super(t,{value:{value:r,optional:!0}},$Y(i),JO);let s={geometry:{value:W}};for(let a in this.channels){let c=this.channels[a],{scale:l}=c;l==="x"||l==="y"||a==="value"||(s[a]=c,delete this.channels[a])}this.contourChannels=s,this.smooth=!!n}filter(t,{x:n,y:r,value:i,...o},s){return super.filter(t,o,s)}render(t,n,r,i,o){let{geometry:s}=r,a=vn();return at("svg:g",o).call(Ot,this,i,o).call(_t,this,n).call(c=>{c.selectAll().data(t).enter().append("path").call(At,this).attr("d",l=>a(s[l])).call(Gt,this,r)}).node()}};function $Y({thresholds:e,interval:t,...n}){return e=sM(e,t,la),xe(n,function(r,i,o,s,a,c){let[l,u,f,h]=yM(o,s,a,c),d=f-l,p=h-u,{pixelSize:y,width:b=Math.round(Math.abs(d)/y),height:m=Math.round(Math.abs(p)/y)}=this,g=b/d,x=m/p,w=o.value.value,v=[];if(this.interpolate){let{x:I,y:T}=Ra(o,s,c),O=Vt(I,D=>(D-l)*g,Float64Array),B=Vt(T,D=>(D-u)*x,Float64Array),S=[o.x,o.y,o.value],A=[O,B,w];for(let D of i){let L=this.filter(D,S,A);v.push(this.interpolate(L,b,m,O,B,w))}}else if(i){let I=b*m,T=i.length;for(let O=0;O<T;++O)v.push(w.slice(O*I,O*I+I))}else v.push(w);if(this.blur>0)for(let I of v)rd({data:I,width:b,height:m},this.blur);let _=UY(e,w,...PY(v));if(_===null)throw new Error(`unsupported thresholds: ${e}`);let{contour:M}=ya().size([b,m]).smooth(this.smooth),E=[],N=[];for(let I of v)N.push(ke(E.length,E.push(...Vt(_,T=>M(I,T)))));for(let{coordinates:I}of E)for(let T of I)for(let O of T)for(let B of O)B[0]=B[0]/g+l,B[1]=B[1]/x+u;return{data:E,facets:N,channels:i1(this.contourChannels,E)}})}function UY(e,t,n,r){if(typeof e?.range=="function")return e.range(e.floor(n),r);if(typeof e=="function"&&(e=e(t,n,r)),typeof e!="number")return Ue(e);let i=xn(...Kl(n,r,e),e);for(;i[i.length-1]>=r;)i.pop();for(;i[1]<n;)i.shift();return i}function eB(){return new Im(...mM("value",...arguments))}function PY(e){return[oe(e,t=>oe(t,tB)),$t(e,t=>$t(t,tB))]}function tB(e){return isFinite(e)?e:NaN}function iB(e,t){return wM(cf,e,t)}function oB(e,t={}){return wM(lf,e,t)}function sB(e,t={}){return wM(ol,e,t)}function wM(e,t,n={}){let{x:r,y:i,maxRadius:o}=n,s=e({px:r,py:i,maxRadius:o}),a=[];r!=null&&a.push(Fr(t,nB("x",{...s,inset:-6},n))),i!=null&&a.push(Lr(t,nB("y",{...s,inset:-6},n))),r!=null&&a.push(Io(t,rB("x",{...s,dy:9,frameAnchor:"bottom",lineAnchor:"top"},n))),i!=null&&a.push(Io(t,rB("y",{...s,dx:-9,frameAnchor:"left",textAnchor:"end"},n)));for(let c of a)c.ariaLabel=`crosshair ${c.ariaLabel}`;return Ze(...a)}function aB(e,{channels:t,...n},{facet:r,facetAnchor:i,fx:o,fy:s,[e]:a,channels:c,transform:l,initializer:u}){return{...n,facet:r,facetAnchor:i,fx:o,fy:s,[e]:a,channels:{...t,...c},transform:l,initializer:zY(e,u)}}function zY(e,t){return t==null?t:function(n,r,{x:i,y:o,px:s,py:a,...c},...l){let{channels:{x:u,y:f,...h}={},...d}=t.call(this,n,r,{...c,x:s,y:a},...l);return{channels:{...h,...u&&{px:u,...e==="x"&&{x:u}},...f&&{py:f,...e==="y"&&{y:f}}},...d}}}function nB(e,t,n){let{color:r="currentColor",opacity:i=.2,ruleStroke:o=r,ruleStrokeOpacity:s=i,ruleStrokeWidth:a}=n;return{...aB(e,t,n),stroke:o,strokeOpacity:s,strokeWidth:a}}function rB(e,t,n){let{color:r="currentColor",textFill:i=r,textFillOpacity:o,textStroke:s="var(--plot-background)",textStrokeOpacity:a,textStrokeWidth:c=5}=n;return{...aB(e,t,VY(e,n)),fill:i,fillOpacity:o,stroke:s,strokeOpacity:a,strokeWidth:c}}function VY(e,t){return xe(t,(n,r,i)=>({channels:{text:{value:Xp(i,e)?.value}}}))}var qY={ariaLabel:"delaunay link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},jY={ariaLabel:"delaunay mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},YY={ariaLabel:"hull",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:1},WY={ariaLabel:"voronoi",fill:"none",stroke:"currentColor",strokeMiterlimit:1},GY={ariaLabel:"voronoi mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},_M=class extends xt{constructor(t,n={}){let{x:r,y:i,z:o,curve:s,tension:a}=n;super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},z:{value:o,optional:!0}},n,qY),this.curve=lm(s,a),Fi(this,n)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,z:u}=r,{curve:f}=this,[h,d]=fn(this,i),p=c?g=>c[g]:an(h),y=l?g=>l[g]:an(d),b=this;function m(g){let x=-1,w=[],v={};for(let S in r)v[S]=[];let _=[],M=[],E=[],N=[];function I(S,A){S=g[S],A=g[A],w.push(++x),_[x]=p(S),E[x]=y(S),M[x]=p(A),N[x]=y(A);for(let D in r)v[D].push(r[D][A])}let{halfedges:T,hull:O,triangles:B}=Gr.from(g,p,y);for(let S=0;S<T.length;++S){let A=T[S];A>S&&I(B[S],B[A])}for(let S=0;S<O.length;++S)I(O[S],O[(S+1)%O.length]);Ut(this).selectAll().data(w).enter().append("path").call(At,b).attr("d",S=>{let A=Yn(),D=f(A);return D.lineStart(),D.point(_[S],E[S]),D.point(M[S],N[S]),D.lineEnd(),A}).call(Gt,b,v).call(Rs,b,v,o)}return at("svg:g",o).call(Ot,this,i,o).call(_t,this,{x:c&&s,y:l&&a}).call(u?g=>g.selectAll().data(tn(t,x=>u[x]).values()).enter().append("g").each(m):g=>g.datum(t).each(m)).node()}},Mm=class extends xt{constructor(t,n={},r,i=({z:o})=>o){let{x:o,y:s}=n;super(t,{x:{value:o,scale:"x",optional:!0},y:{value:s,scale:"y",optional:!0},z:{value:i(n),optional:!0}},n,r)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,z:u}=r,[f,h]=fn(this,i),d=c?m=>c[m]:an(f),p=l?m=>l[m]:an(h),y=this;function b(m){let g=Gr.from(m,d,p);Ut(this).append("path").datum(m[0]).call(At,y).attr("d",y._render(g,i)).call(Gt,y,r)}return at("svg:g",o).call(Ot,this,i,o).call(_t,this,{x:c&&s,y:l&&a}).call(u?m=>m.selectAll().data(tn(t,g=>u[g]).values()).enter().append("g").each(b):m=>m.datum(t).each(b)).node()}},vM=class extends Mm{constructor(t,n={}){super(t,n,jY),this.fill="none"}_render(t){return t.render()}},SM=class extends Mm{constructor(t,n={}){super(t,n,YY,Cn)}_render(t){return t.renderHull()}},IM=class extends xt{constructor(t,n={}){let{x:r,y:i,z:o}=n;super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},z:{value:o,optional:!0}},n,WY)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,z:u}=r,[f,h]=fn(this,i),d=c?m=>c[m]:an(f),p=l?m=>l[m]:an(h),y=this;function b(m){let g=Gr.from(m,d,p),x=cB(g,i);Ut(this).selectAll().data(m).enter().append("path").call(At,y).attr("d",(w,v)=>x.renderCell(v)).call(Gt,y,r)}return at("svg:g",o).call(Ot,this,i,o).call(_t,this,{x:c&&s,y:l&&a}).call(u?m=>m.selectAll().data(tn(t,g=>u[g]).values()).enter().append("g").each(b):m=>m.datum(t).each(b)).node()}},MM=class extends Mm{constructor(t,n){super(t,n,GY),this.fill="none"}_render(t,n){return cB(t,n).render()}};function cB(e,t){let{width:n,height:r,marginTop:i,marginRight:o,marginBottom:s,marginLeft:a}=t;return e.voronoi([a,i,n-o,r-s])}function Tm(e,t,{x:n,y:r,...i}={}){return[n,r]=Le(n,r),new e(t,{...i,x:n,y:r})}function lB(e,t){return Tm(_M,e,t)}function uB(e,t){return Tm(vM,e,t)}function fB(e,t){return Tm(SM,e,t)}function hB(e,t){return Tm(IM,e,t)}function dB(e,t){return Tm(MM,e,t)}var XY={ariaLabel:"density",fill:"none",stroke:"currentColor",strokeMiterlimit:1},Am=class extends xt{constructor(t,{x:n,y:r,z:i,weight:o,fill:s,stroke:a,...c}={}){let l=pB(s)&&(s="currentColor",!0),u=pB(a)&&(a="currentColor",!0);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:r,scale:"y",optional:!0},z:{value:Cn({z:i,fill:s,stroke:a}),optional:!0},weight:{value:o,optional:!0}},ZY({...c,fill:s,stroke:a},l,u),XY),l&&(this.fill=void 0),u&&(this.stroke=void 0),this.z=i}filter(t){return t}render(t,n,r,i,o){let{contours:s}=r,a=vn();return at("svg:g",o).call(Ot,this,i,o).call(_t,this,{}).call(c=>c.selectAll().data(t).enter().append("path").call(At,this).call(Gt,this,r).attr("d",l=>a(s[l]))).node()}};function mB(e,{x:t,y:n,...r}={}){return[t,n]=Le(t,n),new Am(e,{...r,x:t,y:n})}var HY=new Set(["x","y","z","weight"]);function ZY(e,t,n){let{bandwidth:i,thresholds:o}=e;return i=i===void 0?20:+i,o=o===void 0?20:typeof o?.[Symbol.iterator]=="function"?Xe(o):+o,xe(e,function(s,a,c,l,u,f){let h=c.weight?Xe(c.weight.value):null,d=c.z?.value,{z:p}=this,[y,b]=fn(this,u),{width:m,height:g}=u,{x,y:w}=Ra(c,l,f),v=Object.fromEntries(Object.entries(c).filter(([B])=>!HY.has(B)).map(([B,S])=>[B,{...S,value:[]}])),_=t&&[],M=n&&[],E=Lv().x(x?B=>x[B]:y).y(w?B=>w[B]:b).weight(h?B=>h[B]:1).size([m,g]).bandwidth(i),N=[];for(let B of a){let S=[];N.push(S);for(let A of d?Zp(B,d,p):[B]){let D=E.contours(A);S.push([A,D])}}let I=o;if(!(I instanceof Jc)){let B=0;for(let S of N)for(let[,A]of S){let D=A.max;D>B&&(B=D)}I=Float64Array.from({length:o-1},(S,A)=>B*100*(A+1)/o)}let T=[],O=[];for(let B of N){let S=[];T.push(S);for(let[A,D]of B)for(let L of I){S.push(O.length),O.push(D(L/100)),_&&_.push(L),M&&M.push(L);for(let k in v)v[k].value.push(c[k].value[A[0]])}}return _&&_.push(0),M&&M.push(0),{data:s,facets:T,channels:{...v,..._&&{fill:{value:_,scale:"color"}},...M&&{stroke:{value:M,scale:"color"}},contours:{value:O}}}})}function pB(e){return/^density$/i.test(e)}function bB(e,{x1:t,x2:n,y1:r,y2:i,x:o=t===void 0&&n===void 0?ve:void 0,y:s=r===void 0&&i===void 0?W:void 0,fill:a,positiveFill:c="#3ca951",negativeFill:l="#4269d0",fillOpacity:u=1,positiveFillOpacity:f=u,negativeFillOpacity:h=u,stroke:d,strokeOpacity:p,z:y=Te(d)[0],clip:b,tip:m,render:g,...x}={}){return[t,n]=yB(o,t,n),[r,i]=yB(s,r,i),t===n&&r===i&&(r=Ga(0)),{tip:m}=Bi({tip:m},"x"),Ze(Jt(c)?null:Object.assign(um(e,{x1:t,x2:n,y1:r,y2:i,z:y,fill:c,fillOpacity:f,render:af(g,gB(!0)),clip:b,...x}),{ariaLabel:"positive difference"}),Jt(l)?null:Object.assign(um(e,{x1:t,x2:n,y1:r,y2:i,z:y,fill:l,fillOpacity:h,render:af(g,gB(!1)),clip:b,...x}),{ariaLabel:"negative difference"}),yl(e,{x:n,y:i,z:y,stroke:d,strokeOpacity:p,tip:m,clip:!0,...x}))}function yB(e,t,n){return t===void 0&&n===void 0?t=n=Ga(e):t===void 0?(n=Ga(n),t=e===void 0?n:Ga(e)):n===void 0?(t=Ga(t),n=e===void 0?t:Ga(e)):(t=Ga(t),n=Ga(n)),[t,n]}function Ga(e){let t,{value:n,label:r=Mn(n)}=ti(e);return{transform:i=>t||(t=dt(i,n)),label:r}}function gB(e){return(t,n,r,i,o,s)=>{let{x1:a,x2:c}=r,{height:l}=i,u=new Float32Array(a.length),f=new Float32Array(c.length);(e===p1(n.y)<0?u:f).fill(l);let h=s(t,n,{...r,x2:a,y2:f},i,o),d=s(t,n,{...r,x1:c,y1:u},i,o),p=h.querySelector("g")??h,y=d.querySelector("g")??d;for(let b=0;p.firstChild;b+=2){let m=s1(),g=at("svg:clipPath",o).attr("id",m).node();g.appendChild(p.firstChild),y.childNodes[b].setAttribute("clip-path",`url(#${m})`),y.insertBefore(g,y.childNodes[b])}return d}}var KY={ariaLabel:"geo",fill:"none",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Em=class extends xt{constructor(t,n={}){let[r,i]=ee(n.r,3);super(t,{geometry:{value:n.geometry,scale:"projection"},r:{value:r,scale:"r",filter:Zn,optional:!0}},ym(n),KY),this.r=i}render(t,n,r,i,o){let{geometry:s,r:a}=r,c=vn(o.projection??QY(n)),{r:l}=this;return Ia(l)?t=[]:l!==void 0&&c.pointRadius(l),at("svg:g",o).call(Ot,this,i,o).call(_t,this,n).call(u=>{u.selectAll().data(t).enter().append("path").call(At,this).attr("d",a?f=>c.pointRadius(a[f])(s[f]):f=>c(s[f])).call(Gt,this,r)}).node()}};function QY({x:e,y:t}){if(e||t)return e??=n=>n,t??=n=>n,Uc({point(n,r){this.stream.point(e(n),t(r))}})}function ow(e,{geometry:t=W,...n}={}){switch(e?.type){case"FeatureCollection":e=e.features;break;case"GeometryCollection":e=e.geometries;break;case"Feature":case"LineString":case"MultiLineString":case"MultiPoint":case"MultiPolygon":case"Point":case"Polygon":case"Sphere":e=[e];break}return new Em(e,{geometry:t,...n})}function xB({strokeWidth:e=1.5,...t}={}){return ow({type:"Sphere"},{strokeWidth:e,...t})}function wB({strokeOpacity:e=.1,...t}={}){return ow(n2(),{strokeOpacity:e,...t})}var Nf=.5,Of=0;function _B(e={fill:"count"},{binWidth:t,...n}={}){let{z:r}=n;return t=t===void 0?20:Tt(t),e=yI(e,n),_o(e,"fill")&&(n.channels={...n.channels,fill:{value:[]}}),n.symbol===void 0&&(n.symbol="hexagon"),n.r===void 0&&!_o(e,"r")&&(n.r=t/2),xe(n,(i,o,s,a,c,l)=>{let{x:u,y:f,z:h,fill:d,stroke:p,symbol:y}=s;if(u===void 0)throw new Error("missing channel: x");if(f===void 0)throw new Error("missing channel: y");({x:u,y:f}=Ra(s,a,l)),h=h?h.value:dt(i,r),d=d?.value,p=p?.value,y=y?.value;let b=Gp(e,{z:h,fill:d,stroke:p,symbol:y}),m=h&&[],g=d&&[],x=p&&[],w=y&&[],v=[],_=[],M=[],E=-1;for(let O of e)O.initialize(i);for(let O of o){let B=[];for(let S of e)S.scope("facet",O);for(let[S,A]of Fa(O,b))for(let{index:D,extent:L}of JY(i,A,u,f,t)){B.push(++E),_.push(L.x),M.push(L.y),h&&m.push(b===h?S:h[D[0]]),d&&g.push(b===d?S:d[D[0]]),p&&x.push(b===p?S:p[D[0]]),y&&w.push(b===y?S:y[D[0]]);for(let k of e)k.reduce(D,L)}v.push(B)}let N=s.x.scale,I=s.y.scale,T={x:{value:_,source:a[N]?{value:Vt(_,a[N].invert),scale:N}:null},y:{value:M,source:a[I]?{value:Vt(M,a[I].invert),scale:I}:null},...h&&{z:{value:m}},...d&&{fill:{value:g,scale:"auto"}},...p&&{stroke:{value:x,scale:"auto"}},...y&&{symbol:{value:w,scale:"auto"}},...Object.fromEntries(e.map(({name:O,output:B})=>[O,{scale:"auto",label:B.label,radius:O==="r"?t/2:void 0,value:B.transform()}]))};return{data:i,facets:v,channels:T}})}function JY(e,t,n,r,i){let o=i*(1.5/sI),s=new Map;for(let a of t){let c=n[a],l=r[a];if(isNaN(c)||isNaN(l))continue;let u=Math.round(l=(l-Of)/o),f=Math.round(c=(c-Nf)/i-(u&1)/2),h=l-u;if(Math.abs(h)*3>1){let y=c-f,b=f+(c<f?-1:1)/2,m=u+(l<u?-1:1),g=c-b,x=l-m;y*y+h*h>g*g+x*x&&(f=b+(u&1?1:-1)/2,u=m)}let d=`${f},${u}`,p=s.get(d);p===void 0&&(p={index:[],extent:{data:e,x:(f+(u&1)/2)*i+Nf,y:u*o+Of}},s.set(d,p)),p.index.push(a)}return s.values()}var tW={ariaLabel:"hexgrid",fill:"none",stroke:"currentColor",strokeOpacity:.1};function vB(e){return new Dm(e)}var Dm=class extends xt{constructor({binWidth:t=20,clip:n=!0,...r}={}){super(Ea,void 0,{clip:n,...r},tW),this.binWidth=Tt(t)}render(t,n,r,i,o){let{binWidth:s}=this,{marginTop:a,marginRight:c,marginBottom:l,marginLeft:u,width:f,height:h}=i,d=u-Nf,p=f-c-Nf,y=a-Of,b=h-l-Of,m=s/2,g=m*aI,x=g/2,w=m*2,v=g*1.5,_=Math.floor(d/w),M=Math.ceil(p/w),E=Math.floor((y+x)/v),N=Math.ceil((b-x)/v)+1,I=`m0,${Xa(-g)}l${Xa(m)},${Xa(x)}v${Xa(g)}l${Xa(-m)},${Xa(x)}`,T=I;for(let O=E;O<N;++O)for(let B=_;B<M;++B)T+=`M${Xa(B*w+(O&1)*m)},${Xa(O*v)}${I}`;return at("svg:g",o).datum(0).call(Ot,this,i,o).call(_t,this,{},Ee+Nf,Ee+Of).call(O=>O.append("path").call(At,this).call(Gt,this,r).attr("d",T)).node()}};function Xa(e){return Math.round(e*1e3)/1e3}var eW={ariaLabel:"image",fill:null,stroke:null};function nW(e){return/^\.*\//.test(e)}function rW(e){return/^(blob|data|file|http|https):/i.test(e)}function iW(e){return typeof e=="string"&&(nW(e)||rW(e))?[void 0,e]:[e,void 0]}var Nm=class extends xt{constructor(t,n={}){let{x:r,y:i,r:o,width:s,height:a,rotate:c,src:l,preserveAspectRatio:u,crossOrigin:f,frameAnchor:h,imageRendering:d}=n;o==null&&(o=void 0),o===void 0&&s===void 0&&a===void 0?s=a=16:s===void 0&&a!==void 0?s=a:a===void 0&&s!==void 0&&(a=s);let[p,y]=iW(l),[b,m]=ee(o),[g,x]=ee(s,m!==void 0?m*2:void 0),[w,v]=ee(a,m!==void 0?m*2:void 0),[_,M]=ee(c,0);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:b,scale:"r",filter:Zn,optional:!0},width:{value:g,filter:Zn,optional:!0},height:{value:w,filter:Zn,optional:!0},rotate:{value:_,optional:!0},src:{value:p,optional:!0}},ym(n),eW),this.src=y,this.width=x,this.rotate=M,this.height=v,this.r=m,this.preserveAspectRatio=se(u,"xMidYMid"),this.crossOrigin=$e(f),this.frameAnchor=wo(h),this.imageRendering=se(d,"auto")}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,width:u,height:f,r:h,rotate:d,src:p}=r,{r:y,width:b,height:m,rotate:g}=this,[x,w]=fn(this,i);return at("svg:g",o).call(Ot,this,i,o).call(_t,this,{x:c&&s,y:l&&a}).call(v=>v.selectAll().data(t).enter().append("image").call(At,this).attr("x",SB(c,u,h,x,b,y)).attr("y",SB(l,f,h,w,m,y)).attr("width",u?_=>u[_]:b!==void 0?b:h?_=>h[_]*2:y*2).attr("height",f?_=>f[_]:m!==void 0?m:h?_=>h[_]*2:y*2).attr("transform",d?_=>`rotate(${d[_]})`:g?`rotate(${g})`:null).attr("transform-origin",d||g?Ua`${c?_=>c[_]:x}px ${l?_=>l[_]:w}px`:null).call(ut,"href",p?_=>p[_]:this.src).call(ut,"preserveAspectRatio",this.preserveAspectRatio).call(ut,"crossorigin",this.crossOrigin).call(ut,"image-rendering",this.imageRendering).call(ut,"clip-path",h?_=>`circle(${h[_]}px)`:y!==void 0?`circle(${y}px)`:null).call(Gt,this,r)).node()}};function SB(e,t,n,r,i,o){return t&&e?s=>e[s]-t[s]/2:t?s=>r-t[s]/2:e&&i!==void 0?s=>e[s]-i/2:i!==void 0?r-i/2:n&&e?s=>e[s]-n[s]:n?s=>r-n[s]:e?s=>e[s]-o:r-o}function IB(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Le(t,n)),new Nm(e,{...r,x:t,y:n})}function oW(e,t,n){var r=1e-8,i=t-1,o=n-1,s=0,a,c,l,u,f,h,d,p,y,b,m;if(e<=0)return 0;if(e>=1)return 1;for(t>=1&&n>=1?(l=e<.5?e:1-e,u=Math.sqrt(-2*Math.log(l)),d=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,e<.5&&(d=-d),p=(d*d-3)/6,y=2/(1/(2*t-1)+1/(2*n-1)),b=d*Math.sqrt(p+y)/y-(1/(2*n-1)-1/(2*t-1))*(p+5/6-2/(3*y)),d=t/(t+n*Math.exp(2*b))):(a=Math.log(t/(t+n)),c=Math.log(n/(t+n)),u=Math.exp(t*a)/t,f=Math.exp(n*c)/n,b=u+f,e<u/b?d=Math.pow(t*b*e,1/t):d=1-Math.pow(n*b*(1-e),1/n)),m=-Bf(t)-Bf(n)+Bf(t+n);s<10;s++){if(d===0||d===1)return d;if(h=sW(d,t,n)-e,u=Math.exp(i*Math.log(d)+o*Math.log(1-d)+m),f=h/u,d-=u=f/(1-.5*Math.min(1,f*(i/d-o/(1-d)))),d<=0&&(d=.5*(d+u)),d>=1&&(d=.5*(d+u+1)),Math.abs(u)<r*d&&s>0)break}return d}function sW(e,t,n){var r=e===0||e===1?0:Math.exp(Bf(t+n)-Bf(t)-Bf(n)+t*Math.log(e)+n*Math.log(1-e));return e<0||e>1?!1:e<(t+1)/(t+n+2)?r*MB(e,t,n)/t:1-r*MB(1-e,n,t)/n}function MB(e,t,n){var r=1e-30,i=1,o=t+n,s=t+1,a=t-1,c=1,l=1-o*e/s,u,f,h,d;for(Math.abs(l)<r&&(l=r),l=1/l,d=l;i<=100&&(u=2*i,f=i*(n-i)*e/((a+u)*(t+u)),l=1+f*l,Math.abs(l)<r&&(l=r),c=1+f/c,Math.abs(c)<r&&(c=r),l=1/l,d*=l*c,f=-(t+i)*(o+i)*e/((t+u)*(s+u)),l=1+f*l,Math.abs(l)<r&&(l=r),c=1+f/c,Math.abs(c)<r&&(c=r),l=1/l,h=l*c,d*=h,!(Math.abs(h-1)<3e-7));i++);return d}function Bf(e){var t=0,n=[76.18009172947146,-86.5053203294167,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],r=1.000000000190015,i,o,s;for(s=(o=i=e)+5.5,s-=(i+.5)*Math.log(s);t<6;t++)r+=n[t]/++o;return Math.log(2.506628274631*r/i)-s}function TB(e,t){var n=oW(2*Math.min(e,1-e),.5*t,.5);return n=Math.sqrt(t*(1-n)/n),e>.5?n:-n}var aW={ariaLabel:"linear-regression",fill:"currentColor",fillOpacity:.1,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},sw=class extends xt{constructor(t,n={}){let{x:r,y:i,z:o,ci:s=.95,precision:a=4}=n;if(super(t,{x:{value:r,scale:"x"},y:{value:i,scale:"y"},z:{value:Cn(n),optional:!0}},n,aW),this.z=o,this.ci=+s,this.precision=+a,!(0<=this.ci&&this.ci<1))throw new Error(`invalid ci; not in [0, 1): ${s}`);if(!(this.precision>0))throw new Error(`invalid precision: ${a}`)}render(t,n,r,i,o){let{x:s,y:a,z:c}=r,{ci:l}=this;return at("svg:g",o).call(Ot,this,i,o).call(_t,this,n).call(u=>u.selectAll().data(c?Zp(t,c,this.z):[t]).enter().call(f=>f.append("path").attr("fill","none").call(At,this).call(il,this,{...r,fill:null,fillOpacity:null}).attr("d",h=>this._renderLine(h,s,a)).call(l&&!Bs(this.fill)?h=>h.select(cW).attr("stroke","none").call(At,this).call(il,this,{...r,stroke:null,strokeOpacity:null,strokeWidth:null}).attr("d",d=>this._renderBand(d,s,a)):()=>{}))).node()}};function cW(){return this.parentNode.insertBefore(this.ownerDocument.createElementNS(jr.svg,"path"),this)}var TM=class extends sw{constructor(t,n){super(t,n)}_renderBand(t,n,r){let{ci:i,precision:o}=this,[s,a]=ie(t,u=>r[u]),c=aw(t,r,n),l=DB(t,r,n,(1-i)/2,c);return Lu().y(u=>u).x0(u=>l(u,-1)).x1(u=>l(u,1))(ke(s,a-o/2,o).concat(a))}_renderLine(t,n,r){let[i,o]=ie(t,a=>r[a]),s=aw(t,r,n);return`M${s(i)},${i}L${s(o)},${o}`}},AM=class extends sw{constructor(t,n){super(t,n)}_renderBand(t,n,r){let{ci:i,precision:o}=this,[s,a]=ie(t,u=>n[u]),c=aw(t,n,r),l=DB(t,n,r,(1-i)/2,c);return Lu().x(u=>u).y0(u=>l(u,-1)).y1(u=>l(u,1))(ke(s,a-o/2,o).concat(a))}_renderLine(t,n,r){let[i,o]=ie(t,a=>n[a]),s=aw(t,n,r);return`M${i},${s(i)}L${o},${s(o)}`}};function AB(e,{y:t=ve,x:n=W,stroke:r,fill:i=Jt(r)?"currentColor":r,...o}={}){return new TM(e,mf({...o,x:n,y:t,fill:i,stroke:r}))}function EB(e,{x:t=ve,y:n=W,stroke:r,fill:i=Jt(r)?"currentColor":r,...o}={}){return new AM(e,pf({...o,x:t,y:n,fill:i,stroke:r}))}function aw(e,t,n){let r=0,i=0,o=0,s=0;for(let u of e){let f=t[u],h=n[u];r+=f,i+=h,o+=f*h,s+=f*f}let a=e.length,c=(a*o-r*i)/(a*s-r*r),l=(i-c*r)/a;return u=>c*u+l}function DB(e,t,n,r,i){let o=wn(e,u=>t[u])/e.length,s=0,a=0;for(let u of e)s+=(t[u]-o)**2,a+=(n[u]-i(t[u]))**2;let c=Math.sqrt(a/(e.length-2)),l=TB(r,e.length-2);return(u,f)=>{let h=i(u),d=c*Math.sqrt(1/e.length+(u-o)**2/s);return h+f*l*d}}function Om({path:e=W,delimiter:t,frameAnchor:n,treeLayout:r=Pc,treeSort:i,treeSeparation:o,treeAnchor:s,treeFilter:a,...c}={}){s=fw(s),i=BB(i),a!=null&&(a=DM(a)),n===void 0&&(n=s.frameAnchor);let l=FB(t),u=PB(c,DM),[f,h]=ln(),[d,p]=ln();return{x:f,y:d,frameAnchor:n,...un(c,(y,b)=>{let m=l(dt(y,e)),g=h([]),x=p([]),w=-1,v=[],_=[],M=ib().path(N=>m[N]),E=r();E.nodeSize&&E.nodeSize([1,1]),E.separation&&o!==void 0&&E.separation(o??zp);for(let N of u)N[lw]=N[$B]([]);for(let N of b){let I=[],T=M(N.filter(O=>m[O]!=null)).each(O=>O.data=y[O.data]);i!=null&&T.sort(i),E(T);for(let O of T.descendants())if(!(a!=null&&!a(O))){I.push(++w),v[w]=O.data,s.position(O,w,g,x);for(let B of u)B[lw][w]=B[UB](O)}_.push(I)}return{data:v,facets:_}}),...Object.fromEntries(u)}}function uw({path:e=W,delimiter:t,curve:n="bump-x",stroke:r="#555",strokeWidth:i=1.5,strokeOpacity:o=.5,treeLayout:s=Pc,treeSort:a,treeSeparation:c,treeAnchor:l,treeFilter:u,...f}={}){l=fw(l),a=BB(a),u!=null&&(u=OB(u)),f={curve:n,stroke:r,strokeWidth:i,strokeOpacity:o,...f};let h=FB(t),d=PB(f,OB),[p,y]=ln(),[b,m]=ln(),[g,x]=ln(),[w,v]=ln();return{x1:p,x2:b,y1:g,y2:w,...un(f,(_,M)=>{let E=h(dt(_,e)),N=y([]),I=m([]),T=x([]),O=v([]),B=-1,S=[],A=[],D=ib().path(k=>E[k]),L=s();L.nodeSize&&L.nodeSize([1,1]),L.separation&&c!==void 0&&L.separation(c??zp);for(let k of d)k[lw]=k[$B]([]);for(let k of M){let C=[],R=D(k.filter($=>E[$]!=null)).each($=>$.data=_[$.data]);a!=null&&R.sort(a),L(R);for(let{source:$,target:U}of R.links())if(!(u!=null&&!u(U,$))){C.push(++B),S[B]=U.data,l.position($,B,N,T),l.position(U,B,I,O);for(let G of d)G[lw][B]=G[UB](U,$)}A.push(C)}return{data:S,facets:A}}),...Object.fromEntries(d)}}function fw(e="left"){switch(`${e}`.trim().toLowerCase()){case"left":return lW;case"right":return uW}throw new Error(`invalid tree anchor: ${e}`)}var lW={frameAnchor:"left",dx:6,position({x:e,y:t},n,r,i){r[n]=t,i[n]=-e}},uW={frameAnchor:"right",dx:-6,position({x:e,y:t},n,r,i){r[n]=-t,i[n]=-e}};function BB(e){return e==null||typeof e=="function"?e:`${e}`.trim().toLowerCase().startsWith("node:")?NB(DM(e)):NB(fW(e))}function NB(e){return(t,n)=>sn(e(t),e(n))}function fW(e){return t=>t.data?.[e]}function FB(e="/"){if(e=`${e}`,e==="/")return n=>n;if(e.length!==1)throw new Error("delimiter must be exactly one character");let t=e.charCodeAt(0);return n=>n.map(r=>hW(r,t))}var EM=92,LB=47;function hW(e,t){if(t===EM)throw new Error("delimiter cannot be backslash");let n=!1;for(let r=0,i=e.length;r<i;++r){switch(e.charCodeAt(r)){case EM:if(!n){n=!0;continue}break;case t:n?(e=e.slice(0,r-1)+e.slice(r),--r,--i):e=e.slice(0,r)+"/"+e.slice(r+1);break;case LB:n?(e=e.slice(0,r)+"\\\\"+e.slice(r),r+=2,i+=2):(e=e.slice(0,r)+"\\"+e.slice(r),++r,++i);break}n=!1}return e}function dW(e){let t=!1;for(let n=0,r=e.length;n<r;++n){switch(e.charCodeAt(n)){case EM:if(!t){t=!0;continue}case LB:t&&(e=e.slice(0,n-1)+e.slice(n),--n,--r);break}t=!1}return e}function CB(e){return cn(e)&&typeof e.node=="function"}function pW(e){return cn(e)&&typeof e.link=="function"}function DM(e){if(CB(e))return e.node;if(e=`${e}`.trim().toLowerCase(),!!e.startsWith("node:")){switch(e){case"node:name":return OM;case"node:path":return NM;case"node:internal":return kB;case"node:external":return RB;case"node:depth":return BM;case"node:height":return FM}throw new Error(`invalid node value: ${e}`)}}function OB(e){if(CB(e))return e.node;if(pW(e))return e.link;if(e=`${e}`.trim().toLowerCase(),!(!e.startsWith("node:")&&!e.startsWith("parent:"))){switch(e){case"parent:name":return cw(OM);case"parent:path":return cw(NM);case"parent:depth":return cw(BM);case"parent:height":return cw(FM);case"node:name":return OM;case"node:path":return NM;case"node:internal":return kB;case"node:external":return RB;case"node:depth":return BM;case"node:height":return FM}throw new Error(`invalid link value: ${e}`)}}function NM(e){return e.id}function OM(e){return mW(e.id)}function BM(e){return e.depth}function FM(e){return e.height}function kB(e){return!!e.children}function RB(e){return!e.children}function cw(e){return(t,n)=>n==null?void 0:e(n)}function mW(e){let t=e.length;for(;--t>0&&!yW(e,t););return dW(e.slice(t+1))}function yW(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if(!(n&1))return!0}return!1}var $B=2,UB=3,lw=4;function PB(e,t){let n=[];for(let r in e){let i=e[r],o=t(i);o!==void 0&&n.push([r,...ln(i),o])}return n}function LM(e,{fill:t,stroke:n,strokeWidth:r,strokeOpacity:i,strokeLinejoin:o,strokeLinecap:s,strokeMiterlimit:a,strokeDasharray:c,strokeDashoffset:l,marker:u,markerStart:f=u,markerEnd:h=u,dot:d=Jt(f)&&Jt(h),text:p="node:name",textStroke:y="var(--plot-background)",title:b="node:path",dx:m,dy:g,textAnchor:x,treeLayout:w=Pc,textLayout:v=w===Pc||w===nb?"mirrored":"normal",tip:_,...M}={}){if(m===void 0&&(m=fw(M.treeAnchor).dx),x!==void 0)throw new Error("textAnchor is not a configurable tree option");v=He(v,"textLayout",["mirrored","normal"]);function E(N){return Io(e,Om({treeLayout:w,text:p,fill:t===void 0?"currentColor":t,stroke:y,dx:m,dy:g,title:b,...N,...M}))}return Ze(H1(e,uw({treeLayout:w,markerStart:f,markerEnd:h,stroke:n!==void 0?n:t===void 0?"node:internal":t,strokeWidth:r,strokeOpacity:i,strokeLinejoin:o,strokeLinecap:s,strokeMiterlimit:a,strokeDasharray:c,strokeDashoffset:l,...M})),d?ni(e,Om({treeLayout:w,fill:t===void 0?"node:internal":t,title:b,tip:_,...M})):null,p!=null?v==="mirrored"?[E({textAnchor:"start",treeFilter:"node:external"}),E({textAnchor:"end",treeFilter:"node:internal",dx:-m})]:E():null)}function zB(e,t){return LM(e,{...t,treeLayout:nb})}function VB({geometry:e=W,...t}={}){return xe({...t,x:null,y:null},(n,r,i,o,s,{projection:a})=>{let c=dt(n,e),l=c.length,u=new Float64Array(l),f=new Float64Array(l),h=vn(a);for(let d=0;d<l;++d)[u[d],f[d]]=h.centroid(c[d]);return{data:n,facets:r,channels:{x:{value:u,scale:a==null?"x":null,source:null},y:{value:f,scale:a==null?"y":null,source:null}}}})}function qB({geometry:e=W,...t}={}){let n;return{...t,x:{transform:r=>Float64Array.from(n=dt(dt(r,e),Zv),([i])=>i)},y:{transform:()=>Float64Array.from(n,([,r])=>r)}}}var tF=KF(JB(),1);var IW=({marginLeft:e})=>[1,e],MW=({width:e,marginRight:t})=>[-1,e-t],TW=({width:e,marginLeft:t,marginRight:n})=>[0,(t+e-n)/2],AW=({marginTop:e})=>[1,e],EW=({height:e,marginBottom:t})=>[-1,e-t],DW=({height:e,marginTop:t,marginBottom:n})=>[0,(t+e-n)/2];function eF(e){return typeof e=="string"?{anchor:e}:e}function nF(e={},t={}){arguments.length===1&&([e,t]=iF(e));let{anchor:n="left",padding:r=1,r:i=t.r}=eF(e);switch(`${n}`.toLowerCase()){case"left":n=IW;break;case"right":n=MW;break;case"middle":n=TW;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return oF("x","y",n,Tt(r),i,t)}function rF(e={},t={}){arguments.length===1&&([e,t]=iF(e));let{anchor:n="bottom",padding:r=1,r:i=t.r}=eF(e);switch(`${n}`.toLowerCase()){case"top":n=AW;break;case"bottom":n=EW;break;case"middle":n=DW;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return oF("y","x",n,Tt(r),i,t)}function iF(e){let{anchor:t,padding:n,...r}=e,{r:i}=r;return[{anchor:t,padding:n,r:i},r]}function oF(e,t,n,r,i,o){if(i!=null&&typeof i!="number"){let{channels:s,sort:a,reverse:c}=o;s=qp(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 xe(o,function(s,a,c,l,u,f){let{[t]:h,r:d}=c;if(!c[t])throw new Error(`missing channel: ${t}`);({[t]:h}=Ra(c,l,f));let p=d?void 0:i!==void 0?Tt(i):this.r!==void 0?this.r:3;d&&(d=dt(d.value,l[d.scale]||W,Float64Array));let[y,b]=n(u),m=y?OW:NW,g=new Float64Array(h.length),x=d?w=>d[w]:()=>p;for(let w of a){let v=(0,tF.default)();w=w.filter(d?M=>Uu(h[M])&&Zn(d[M]):M=>Uu(h[M]));let _=new Float64Array(2*w.length+2);for(let M of w){let E=x(M),N=y?E+r:0,I=h[M]-E,T=h[M]+E,O=2;v.queryInterval(I-r,T+r,([,,S])=>{let A=g[S]-N,D=h[M]-h[S],L=r+(d?d[M]+d[S]:2*p),k=Math.sqrt(L*L-D*D);_[O++]=A-k,_[O++]=A+k});let B=_.slice(0,O);y&&(B=B.filter(S=>S>=0));t:for(let S of B.sort(m)){for(let A=0;A<O;A+=2)if(_[A]+1e-6<S&&S<_[A+1]-1e-6)continue t;g[M]=S+N;break}v.insert([I,T,M])}}y||(y=1);for(let w of a)for(let v of w)g[v]=g[v]*y+b;return{data:s,facets:a,channels:{[e]:{value:g,source:null},[t]:{value:h,source:c[t]},...d&&{r:{value:d,source:c.r}}}}})}function NW(e,t){return Math.abs(e)-Math.abs(t)}function OW(e,t){return e-t}function aF(e,t){return arguments.length===1&&({basis:e,...t}=e),Tf(pw(e),t)}function cF(e,t){return arguments.length===1&&({basis:e,...t}=e),Af(pw(e),t)}function pw(e){if(e===void 0)return sF;if(typeof e=="function")return mw(Yu(e));if(/^p\d{2}$/i.test(e))return kf(qu(e));switch(`${e}`.toLowerCase()){case"deviation":return LW;case"first":return sF;case"last":return FW;case"max":return CW;case"mean":return kW;case"median":return RW;case"min":return $W;case"sum":return UW;case"extent":return BW}throw new Error(`invalid basis: ${e}`)}function mw(e){return{mapIndex(t,n,r){let i=+e(t,n);for(let o of t)r[o]=n[o]===null?NaN:n[o]/i}}}function kf(e){return mw((t,n)=>e(t,r=>n[r]))}var BW={mapIndex(e,t,n){let[r,i]=ie(e,s=>t[s]),o=i-r;for(let s of e)n[s]=t[s]===null?NaN:(t[s]-r)/o}},sF=mw((e,t)=>{for(let n=0;n<e.length;++n){let r=t[e[n]];if(Re(r))return r}}),FW=mw((e,t)=>{for(let n=e.length-1;n>=0;--n){let r=t[e[n]];if(Re(r))return r}}),LW={mapIndex(e,t,n){let r=as(e,o=>t[o]),i=qr(e,o=>t[o]);for(let o of e)n[o]=t[o]===null?NaN:i?(t[o]-r)/i:0}},CW=kf($t),kW=kf(as),RW=kf(Ti),$W=kf(oe),UW=kf(wn);function lF(e,t){return PW("x",e,t)}function PW(e,t,n={}){let r,i=1;if(typeof t=="number")i=t,r=(l,u)=>+l+u;else{if(typeof t=="string"){let l=t.startsWith("-")?-1:1;[t,i]=Wx(t.replace(/^[+-]/,"")),i*=l}t=Gu(t),r=(l,u)=>t.offset(l,u)}let o=`${e}1`,s=`${e}2`,a=fr({[o]:l=>l.map(u=>r(u,i)),[s]:l=>l},n),c=a[s].transform;return a[s].transform=()=>{let l=c(),[u,f]=ie(l);return l.domain=i<0?[u,r(f,i)]:[r(u,i),f],l},a}function uF(e,t={}){if(typeof e=="string")switch(e.toLowerCase()){case"first":return PM(t);case"last":return zM(t)}if(typeof e=="function")return Ha(null,e,t);let n,r;for(n in e){if(r!==void 0)throw new Error("ambiguous selector; multiple inputs");r=zW(e[n])}if(r===void 0)throw new Error(`invalid selector: ${e}`);return Ha(n,r,t)}function zW(e){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"min":return VM;case"max":return qM}throw new Error(`unknown selector: ${e}`)}function PM(e){return Ha(null,VW,e)}function zM(e){return Ha(null,qW,e)}function fF(e){return Ha("x",VM,e)}function hF(e){return Ha("y",VM,e)}function dF(e){return Ha("x",qM,e)}function pF(e){return Ha("y",qM,e)}function*VW(e){yield e[0]}function*qW(e){yield e[e.length-1]}function*VM(e,t){yield P0(e,n=>t[n])}function*qM(e,t){yield Sc(e,n=>t[n])}function Ha(e,t,n){if(e!=null){if(n[e]==null)throw new Error(`missing channel: ${e}`);e=n[e]}let r=Cn(n);return un(n,(i,o)=>{let s=dt(i,r),a=dt(i,e),c=[];for(let l of o){let u=[];for(let f of s?tn(l,h=>s[h]).values():[l])for(let h of t(f,a))u.push(h);c.push(u)}return{data:i,facets:c}})}var jW=new Map([["style","style"],["width","width"],["height","height"],["margin","margin"],["marginLeft","marginLeft"],["marginRight","marginRight"],["marginTop","marginTop"],["marginBottom","marginBottom"],["align","align"],["aspectRatio","aspectRatio"],["axis","axis"],["inset","inset"],["grid","grid"],["label","label"],["padding","padding"],["round","round"],["xScale","x.type"],["xDomain","x.domain"],["xRange","x.range"],["xNice","x.nice"],["xInset","x.inset"],["xInsetLeft","x.insetLeft"],["xInsetRight","x.insetRight"],["xClamp","x.clamp"],["xRound","x.round"],["xAlign","x.align"],["xPadding","x.padding"],["xPaddingInner","x.paddingInner"],["xPaddingOuter","x.paddingOuter"],["xAxis","x.axis"],["xTicks","x.ticks"],["xTickSize","x.tickSize"],["xTickSpacing","x.tickSpacing"],["xTickPadding","x.tickPadding"],["xTickFormat","x.tickFormat"],["xTickRotate","x.tickRotate"],["xGrid","x.grid"],["xLine","x.line"],["xLabel","x.label"],["xLabelAnchor","x.labelAnchor"],["xLabelOffset","x.labelOffset"],["xFontVariant","x.fontVariant"],["xAriaLabel","x.ariaLabel"],["xAriaDescription","x.ariaDescription"],["xReverse","x.reverse"],["xZero","x.zero"],["yScale","y.type"],["yDomain","y.domain"],["yRange","y.range"],["yNice","y.nice"],["yInset","y.inset"],["yInsetTop","y.insetTop"],["yInsetBottom","y.insetBottom"],["yClamp","y.clamp"],["yRound","y.round"],["yAlign","y.align"],["yPadding","y.padding"],["yPaddingInner","y.paddingInner"],["yPaddingOuter","y.paddingOuter"],["yAxis","y.axis"],["yTicks","y.ticks"],["yTickSize","y.tickSize"],["yTickSpacing","y.tickSpacing"],["yTickPadding","y.tickPadding"],["yTickFormat","y.tickFormat"],["yTickRotate","y.tickRotate"],["yGrid","y.grid"],["yLine","y.line"],["yLabel","y.label"],["yLabelAnchor","y.labelAnchor"],["yLabelOffset","y.labelOffset"],["yFontVariant","y.fontVariant"],["yAriaLabel","y.ariaLabel"],["yAriaDescription","y.ariaDescription"],["yReverse","y.reverse"],["yZero","y.zero"],["facetMargin","facet.margin"],["facetMarginTop","facet.marginTop"],["facetMarginBottom","facet.marginBottom"],["facetMarginLeft","facet.marginLeft"],["facetMarginRight","facet.marginRight"],["facetGrid","facet.grid"],["facetLabel","facet.label"],["fxDomain","fx.domain"],["fxRange","fx.range"],["fxNice","fx.nice"],["fxInset","fx.inset"],["fxInsetLeft","fx.insetLeft"],["fxInsetRight","fx.insetRight"],["fxRound","fx.round"],["fxAlign","fx.align"],["fxPadding","fx.padding"],["fxPaddingInner","fx.paddingInner"],["fxPaddingOuter","fx.paddingOuter"],["fxAxis","fx.axis"],["fxTicks","fx.ticks"],["fxTickSize","fx.tickSize"],["fxTickSpacing","fx.tickSpacing"],["fxTickPadding","fx.tickPadding"],["fxTickFormat","fx.tickFormat"],["fxTickRotate","fx.tickRotate"],["fxGrid","fx.grid"],["fxLine","fx.line"],["fxLabel","fx.label"],["fxLabelAnchor","fx.labelAnchor"],["fxLabelOffset","fx.labelOffset"],["fxFontVariant","fx.fontVariant"],["fxAriaLabel","fx.ariaLabel"],["fxAriaDescription","fx.ariaDescription"],["fxReverse","fx.reverse"],["fyDomain","fy.domain"],["fyRange","fy.range"],["fyNice","fy.mice"],["fyInset","fy,inset"],["fyInsetTop","fy.insetTop"],["fyInsetBottom","fy.insetBottom"],["fyRound","fy.round"],["fyAlign","fy.align"],["fyPadding","fy.padding"],["fyPaddingInner","fy.paddingInner"],["fyPaddingOuter","fy.paddingOuter"],["fyAxis","fy.axis"],["fyTicks","fy.ticks"],["fyTickSize","fy.tickSize"],["fyTickSpacing","fy.tickSpacing"],["fyTickPadding","fy.tickPadding"],["fyTickFormat","fy.tickFormat"],["fyTickRotate","fy.tickRotate"],["fyGrid","fy.grid"],["fyLine","fy.line"],["fyLabel","fy.label"],["fyLabelAnchor","fy.labelAnchor"],["fyLabelOffset","fy.labelOffset"],["fyFontVariant","fy.fontVariant"],["fyAriaLabel","fy.ariaLabel"],["fyAriaDescription","fy.ariaDescription"],["fyReverse","fy.reverse"],["colorScale","color.type"],["colorDomain","color.domain"],["colorRange","color.range"],["colorClamp","color.clamp"],["colorN","color.n"],["colorNice","color.nice"],["colorScheme","color.scheme"],["colorInterpolate","color.interpolate"],["colorPivot","color.pivot"],["colorSymmetric","color.symmetric"],["colorLabel","color.label"],["colorReverse","color.reverse"],["colorZero","color.zero"],["colorTickFormat","color.tickFormat"],["opacityScale","opacity.type"],["opacityDomain","opacity.domain"],["opacityRange","opacity.range"],["opacityClamp","opacity.clamp"],["opacityNice","opacity.nice"],["opacityLabel","opacity.label"],["opacityReverse","opacity.reverse"],["opacityZero","opacity.zero"],["opacityTickFormat","opacity.tickFormat"],["rScale","r.type"],["rDomain","r.domain"],["rRange","r.range"],["rClamp","r.clamp"],["rNice","r.nice"],["rZero","r.zero"],["lengthScale","length.type"],["lengthDomain","length.domain"],["lengthRange","length.range"],["lengthClamp","length.clamp"],["lengthNice","length.nice"],["lengthZero","length.zero"],["projectionType","projection.type"],["projectionParallels","projection.parallels"],["projectionPrecision","projection.precision"],["projectionRotate","projection.rotate"],["projectionDomain","projection.domain"],["projectionInset","projection.inset"],["projectionInsetLeft","projection.insetLeft"],["projectionInsetRight","projection.insetRight"],["projectionInsetTop","projection.insetTop"],["projectionInsetBottom","projection.insetBottom"],["projectionClip","projection.clip"]]);function YW(e,t,n){for(let r=0;r<t.length;++r){let i=t[r];r===t.length-1?e[i]=n:e=e[i]||(e[i]={})}}function mF(e,t,n){for(let r in e){let i=jW.get(r);if(i==null)throw new Error(`Unrecognized plot attribute: ${r}`);let o=e[r];typeof o=="symbol"?n.push(r):o!==void 0&&YW(t,i.split("."),o)}}var WW=new Set(["frame","hexgrid","sphere","graticule"]);async function gF(e){let t={marks:[]},n=[],{attributes:r,marks:i}=e;mF(r,t,n);let o=[];for(let a of i)for(let{type:c,data:l,options:u}of a.plotSpecs())WW.has(c)?t.marks.push(yw[c](u)):t.marks.push(yw[c](l,u)),o.push(a.index);XW(t,e);let s=cm(t);HW(s,o),GW(e,s,r,n);for(let a of e.interactors)await a.init(s);return s}function GW(e,t,n,r){r.forEach(i=>{let o=n[i];if(o===Vf){if(!i.endsWith("Domain"))throw new Error(`Unsupported fixed attribute: ${i}`);let s=i.slice(0,-6),a=t.scale(s);a?.domain&&e.setAttribute(i,n[`${s}Reverse`]?a.domain.slice().reverse():a.domain)}else throw new Error(`Unrecognized symbol: ${o}`)})}function XW(e,t){let{marks:n}=t;gw("x",e,n,["x","x1","x2"]),gw("y",e,n,["y","y1","y2"]),gw("fx",e,n),gw("fy",e,n)}function gw(e,t,n,r=[e]){let i=t[e]||{};if(i.axis===null||i.label!==void 0)return;let o=n.map(u=>u.channelField(r)?.field);if(o.every(u=>u==null))return;let s,a,c;for(let u=0;u<o.length;++u){let{column:f,label:h}=o[u]||{};f===void 0&&h===void 0||(s===void 0&&a===void 0?(s=f,a=h,c=ZW(n[u].data,r)||"number"):a!==h?a=void 0:s!==f&&(s=void 0))}let l=a||s;if(l!==void 0){if((c==="number"||c==="date")&&(e==="x"||e==="y")){i.percent&&(l=`${l} (%)`);let u=(e==="x"?1:-1)*(i.reverse?-1:1);e==="x"||i.labelAnchor==="center"?l=e==="x"==u<0?`\u2190 ${l}`:`${l} \u2192`:l=`${u<0?"\u2191 ":"\u2193 "}${l}`}t[e]={...i,label:l}}}function HW(e,t){let n=e.querySelectorAll('g[aria-label="facet"]');if(n.length)for(let r of n)yF(r,t);else yF(e,t)}function yF(e,t){let n=-1;for(let r of e.children){let i=r.getAttribute("aria-label")||"";r.nodeName==="style"||i.includes("-axis")||i.includes("-grid")||r.setAttribute("data-index",t[++n])}}function ZW(e,t){for(let n of e)for(let r=0;r<t.length;++r){let i=n[t[r]];if(i!=null)return i instanceof Date?"date":typeof i}}var KW={width:640,marginLeft:40,marginRight:20,marginTop:20,marginBottom:30},jM=class{constructor(t){this.attributes={...KW},this.listeners=null,this.interactors=[],this.legends=[],this.marks=[],this.markset=null,this.element=t||document.createElement("div"),this.element.setAttribute("class","plot"),this.element.style.display="flex",this.element.value=this,this.params=new Map,this.synch=Y_()}margins(){return{left:this.getAttribute("marginLeft"),top:this.getAttribute("marginTop"),bottom:this.getAttribute("marginBottom"),right:this.getAttribute("marginRight")}}innerWidth(){let{left:t,right:n}=this.margins();return this.getAttribute("width")-t-n}innerHeight(){let{top:t,bottom:n}=this.margins();return this.getAttribute("height")-t-n}pending(t){this.synch.pending(t)}update(t){return this.synch.ready(t)&&!this.pendingRender&&(this.pendingRender=!0,requestAnimationFrame(()=>this.render())),this.synch.promise}async render(){this.pendingRender=!1;let t=await gF(this),n=this.legends.flatMap(({legend:r,include:i})=>{let o=r.init(t);return i?o:[]});this.element.replaceChildren(t,...n),this.synch.resolve()}getAttribute(t){return this.attributes[t]}setAttribute(t,n,r){return ed(this.attributes[t],n)?(n===void 0?delete this.attributes[t]:this.attributes[t]=n,r?.silent||this.listeners?.get(t)?.forEach(i=>i(t,n)),!0):!1}addAttributeListener(t,n){let r=this.listeners||(this.listeners=new Map);return r.has(t)||r.set(t,new Set),r.get(t).add(n),this}removeAttributeListener(t,n){return this.listeners?.get(t)?.delete(n)}addParams(t,n){let{params:r}=this;for(let i of n)r.has(i)?r.get(i).push(t):(r.set(i,[t]),i.addEventListener("value",()=>Promise.allSettled(r.get(i).map(o=>o.requestQuery()))))}addMark(t){return t.setPlot(this,this.marks.length),this.marks.push(t),this.markset=null,this}get markSet(){return this.markset||(this.markset=new Set(this.marks))}addInteractor(t){return this.interactors.push(t),this}addLegend(t,n=!0){t.setPlot(this),this.legends.push({legend:t,include:n})}};function Rf(e){return typeof e!="string"?!1:(e=e.toLowerCase().trim(),e==="none"||e==="currentcolor"||e.startsWith("url(")&&e.endsWith(")")||e.startsWith("var(")&&e.endsWith(")")||Mr(e)!==null)}var QW=new Set(["order","sort","label","anchor","curve","tension","marker","markerStart","markerMid","markerEnd","textAnchor","lineAnchor","lineHeight","textOverflow","monospace","fontFamily","fontSize","fontStyle","fontVariant","fontWeight","frameAnchor","strokeLinejoin","strokeLinecap","strokeMiterlimit","strokeDasharray","strokeDashoffset","mixBlendMode","shapeRendering","imageRendering","preserveAspectRatio","interpolate","crossOrigin","paintOrder","pointerEvents","target"]);function bF(e){return QW.has(e)}var JW=new Set(["asterisk","circle","cross","diamond","diamond2","hexagon","plus","square","square2","star","times","triangle","triangle2","wye"]);function xF(e){return JW.has(`${e}`.toLowerCase())}function Lm(e){return typeof e?.getChild=="function"}var tG=2,eG=10;function bw(e){return Lm(e)?nG(e):e}function nG(e){let{batches:t,numRows:n}=e;if(!n)return[];let r=Array.from({length:n},()=>({}));for(let i=0,o=0;o<t.length;++o){let s=t[o],{schema:a,numRows:c,numCols:l}=s;for(let u=0;u<l;++u){let f=s.getChildAt(u),{name:h,type:d}=a.fields[u],p=rG(d);for(let y=i,b=0;b<c;++b,++y)r[y][h]=p(f.get(b))}i+=c}return r}function rG(e){let{typeId:t}=e;return t===eG?n=>n==null?n:new Date(n):t===tG&&e.bitWidth>=64?n=>n==null?n:Number(n):n=>n}var wF=e=>e==="stroke"||e==="fill",iG=e=>e==="symbol",oG=(e,t)=>e!=="sort"&&e!=="tip"&&t!=null&&!Array.isArray(t),YM=(e,t)=>({channel:e,field:t,as:t instanceof lr?t.column:e}),WM=(e,t)=>({channel:e,value:t}),xw=e=>Array.isArray(e),tr=class extends Yf{constructor(t,n,r,i={}){super(n?.options?.filterBy),this.type=t,this.reqs=i,this.source=n,xw(this.source)&&(this.data=this.source);let o=this.channels=[],s=this.detail=new Set,a=this.params=new Set,c=(l,u)=>{let f=typeof u;if(l==="channels")for(let h in u)s.add(h),c(h,u[h]);else if(f==="function"&&u[qf]){let h=u(this,l);for(let d in h)c(d,h[d])}else if(f==="string")bF(l)||wF(l)&&Rf(u)||iG(l)&&xF(u)?o.push(WM(l,u)):o.push(YM(l,g0(u)));else if(rs(u))if(Array.isArray(u.columns))o.push(YM(l,u)),a.add(u);else{let h=WM(l,u.value);o.push(h),u.addEventListener("value",d=>(h.value=d,this.update()))}else f==="object"&&oG(l,u)?o.push(YM(l,u)):u!==void 0&&o.push(WM(l,u))};for(let l in r)c(l,r[l])}setPlot(t,n){this.plot=t,this.index=n,t.addParams(this,this.params),this.source?.table&&this.queryPending()}hasOwnData(){return this.source==null||xw(this.source)}channel(t){return this.channels.find(n=>n.channel===t)}channelField(...t){let n=t.flat();for(let r of n){let i=this.channel(r);if(i?.field)return i}return null}fields(){if(this.hasOwnData())return null;let{source:{table:t},channels:n,reqs:r}=this,i=new Map;for(let{channel:o,field:s}of n){let a=s?.column;if(a){if(s.stats?.length||r[o]){i.has(a)||i.set(a,new Set);let c=i.get(a);r[o]?.forEach(l=>c.add(l)),s.stats?.forEach(l=>c.add(l))}}else continue}return Array.from(i,([o,s])=>({table:t,column:o,stats:Array.from(s)}))}fieldInfo(t){return this.stats=t.reduce((n,r)=>(n[r.column]=r,n),Object.create(null)),this}query(t=[]){if(this.hasOwnData())return null;let{channels:n,source:{table:r}}=this;return GM(n,r).where(t)}queryPending(){return this.plot.pending(this),this}queryResult(t){return this.data=bw(t),this}update(){return this.plot.update(this)}plotSpecs(){let{type:t,data:n,detail:r,channels:i}=this,o={},s={};for(let a of i){let c=r.has(a.channel)?s:o;c[a.channel]=ri(a)}return r.size&&(o.channels=s),[{type:t,data:n,options:o}]}};function ri(e){return Object.hasOwn(e,"value")?e.value:wF(e.channel)?{value:e.as,scale:"color"}:e.as}function GM(e,t,n=[]){let r=Ct.from({source:t}),i=new Set,o=!1;for(let s of e){let{channel:a,field:c,as:l}=s;if(!n.includes(a)){if(a==="orderby")r.orderby(s.value);else if(c){if(c.aggregate)o=!0;else{if(i.has(l))continue;i.add(l)}r.select({[l]:c})}}}return o&&r.groupby(Array.from(i)),r}function Cr(e,t,n){if(!e.stats)return r;let{field:r}=e.channelField(t),{type:i}=e.stats[r.column];return n=n??r,i==="date"?td(n):n}function Cm(e,t,n,r,i=!1,o=1){let s=(r-o)/(n-t),a=s!==1?` * ${s}::DOUBLE`:"";return i?q`(${+n} - ${e}::DOUBLE)${a}`:q`(${e}::DOUBLE - ${+t})${a}`}var XM={x:["min","max"]},HM={y:["min","max"]},ww={...XM,...HM};function _F(e,t,n,r,i){let{plot:o,stats:s}=e,a=o.getAttribute(r),c=o.getAttribute(i);if(Array.isArray(a)&&!a[kr])return a;{let{field:l}=e.channelField(n),{column:u}=l,{min:f,max:h}=s[u],d=ZM(t,u)||(c?gs().domain([f,h]).nice().domain():[f,h]);return a!==Vf&&(d[kr]=!0),o.setAttribute(r,d,{silent:!0}),d}}function Do(e,t){return _F(e,t,"x","xDomain","xNice")}function No(e,t){return _F(e,t,"y","yDomain","yNice")}function ZM(e,t){if(!e)return;let n,r,i=(o,s)=>{if(o==="BETWEEN"&&s.field.column===t){let{range:a}=s;a&&(n==null||a[0]<n)&&(n=a[0]),a&&(r==null||a[1]>r)&&(r=a[1])}};return Array.isArray(e)?e.forEach(o=>o.visit?.(i)):e.visit&&e.visit(i),n!=null&&r!=null&&n!==r?[n,r]:void 0}var KM=class extends tr{constructor(t,n,r){let i=t.endsWith("X")?"y":t.endsWith("Y")?"x":null,o={[i]:["count","min","max"]};super(t,n,r,o),this.dim=i}query(t=[]){let{plot:n,dim:r,source:i,stats:o}=this,{optimize:s=!0}=i.options||{},a=super.query(t);if(s&&r){let{field:c,as:l}=this.channelField(r),{column:u}=c,{count:f,max:h,min:d}=o[u],p=r==="x"?n.innerWidth():n.innerHeight(),[y,b]=ZM(t,u)||[d,h],m=(b-y)/(h-d);if(f*m>p*4){let g=Cr(this,r,l),x=this.channelField(r==="x"?"y":"x").as,w=a.select().map(v=>v.as).filter(v=>v!==l&&v!==x);return sG(a,g,l,x,y,b,p,w)}a.orderby(l)}return a}};function sG(e,t,n,r,i,o,s,a=[]){let c=q`FLOOR(${s/(o-i)}::DOUBLE * (${t} - ${+i}::DOUBLE))::INTEGER`,l=u=>Ct.from(e).select(u).groupby(c,a);return Ct.union(l([{[n]:aa(n),[r]:x0(r,n)},...a]),l([{[n]:sa(n),[r]:w0(r,n)},...a]),l([{[n]:x0(n,r),[r]:aa(r)},...a]),l([{[n]:w0(n,r),[r]:sa(r)},...a])).orderby(a,n)}function dn(e,t,n,r){Yl(n)?(r=r||(()=>e.requestUpdate()),n.addEventListener("value",i=>(e[t]=i,r())),e[t]=n.value):e[t]=n}function km(e,t=!1){let n=new Float64Array(5),r=new Float64Array(4);aG(n,r,e);let i=Float64Array.of(0,r[1]-n[1]*r[0],r[2]-n[2]*r[0],r[3]-n[3]*r[0],-n[4]*r[0]),o=1+n[1]+n[2]+n[3]+n[4],s=(r[0]+r[1]+r[2]+r[3])/o,a=(i[1]+i[2]+i[3]+i[4])/o;return{sigma:e,negative:t,a:n,b_causal:r,b_anticausal:i,sum_causal:s,sum_anticausal:a}}function aG(e,t,n){let i=Float64Array.of(.84,1.8675,.84,-1.8675,-.34015,-.1299,-.34015,.1299),o=Math.exp(-1.783/n),s=Math.exp(-1.723/n),a=.6318/n,c=1.997/n,l=Float64Array.of(-o*Math.cos(a),o*Math.sin(a),-o*Math.cos(-a),o*Math.sin(-a),-s*Math.cos(c),s*Math.sin(c),-s*Math.cos(-c),s*Math.sin(-c)),u=n*2.5066282746310007,f=Float64Array.of(i[0],i[1],0,0,0,0,0,0),h=Float64Array.of(1,0,l[0],l[1],0,0,0,0,0,0),d,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],d=p-2;d>0;d-=2)f[d]+=l[p]*f[d-2]-l[p+1]*f[d-1],f[d+1]+=l[p]*f[d-1]+l[p+1]*f[d-2];for(d=0;d<=p;d+=2)f[d]+=i[p]*h[d]-i[p+1]*h[d+1],f[d+1]+=i[p]*h[d+1]+i[p+1]*h[d];for(h[p+2]=l[p]*h[p]-l[p+1]*h[p+1],h[p+3]=l[p]*h[p+1]+l[p+1]*h[p],d=p;d>0;d-=2)h[d]+=l[p]*h[d-2]-l[p+1]*h[d-1],h[d+1]+=l[p]*h[d-1]+l[p+1]*h[d-2]}for(p=0;p<4;++p)d=p<<1,t[p]=f[d]/u,e[p+1]=h[d+2]}function vF(e,t,n,[r,i]){let o=new Float64Array(Math.max(r,i)),s=new Float64Array(Math.max(r,i)),a=new Float64Array(5),c=new Float64Array(n.length);for(let l=0,u=0;l<i;++l,u+=r){let f=c.subarray(u);_w(e,n.subarray(u),r,1,o,s,a,f)}for(let l=0;l<r;++l){let u=c.subarray(l);_w(t,u,i,r,o,s,a,u)}return c}function _w(e,t,n,r=1,i=new Float64Array(n),o=new Float64Array(n),s=new Float64Array(5),a=i,c=cG){let l=r*2,u=r*3,f=r*4,h=r*n,d,p;for(c(i,t,n,r,e.b_causal,3,e.a,4,e.sum_causal,s,e.sigma),p=4,d=f;p<n;++p,d+=r)i[p]=e.b_causal[0]*t[d]+e.b_causal[1]*t[d-r]+e.b_causal[2]*t[d-l]+e.b_causal[3]*t[d-u]-e.a[1]*i[p-1]-e.a[2]*i[p-2]-e.a[3]*i[p-3]-e.a[4]*i[p-4];for(c(o,t,n,-r,e.b_anticausal,4,e.a,4,e.sum_anticausal,s,e.sigma),p=4,d=h-r*5;p<n;++p,d-=r)o[p]=e.b_anticausal[1]*t[d+r]+e.b_anticausal[2]*t[d+l]+e.b_anticausal[3]*t[d+u]+e.b_anticausal[4]*t[d+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,d=0;p<n;++p,d+=r)a[d]=i[p]+o[n-p-1];else for(p=0,d=0;p<n;++p,d+=r)a[d]=Math.max(0,i[p]+o[n-p-1]);return a}function cG(e,t,n,r,i,o,s,a,c,l){let u=Math.abs(r)*n,f=r<0?u+r:0,h,d,p;for(d=0;d<a;++d)for(l[d]=d<=o?i[d]:0,p=1;p<=a&&p<=d;++p)l[d]-=s[p]*l[d-p];for(p=0;p<a;++p)for(e[p]=0,d=1;d<=p;++d)h=f+r*d,h>=0&&h<u&&(e[p]+=l[p-d]*t[h]);let y=t[f];if(y>0)for(p=0;p<a;++p)e[p]+=l[p]*y}function SF(e,t){return MF(new Float64Array(e),t)}function IF(e,t,n,r=[]){return r.length?Object.values(lG(e*t,n,r)):[{grid:MF(new Float64Array(e*t),n)}]}function MF(e,t){if(Lm(t)){let n=t.numRows;if(n===0)return e;let r=t.getChild("index").toArray(),i=t.getChild("value").toArray();for(let o=0;o<n;++o)e[r[o]]=i[o]}else for(let n of t)e[n.index]=n.value;return e}function lG(e,t,n){let r={},i=o=>(r[o]||(r[o]={key:o,grid:new Float64Array(e)})).grid;if(Lm(t)){let o=t.numRows;if(o===0)return r;let s=t.getChild("index").toArray(),a=t.getChild("value").toArray(),c=n.map(l=>t.getChild(l));for(let l=0;l<o;++l){let u=c.map(f=>f.get(l));i(u)[s[l]]=a[l]}}else for(let o of t){let s=n.map(a=>o[a]);i(s)[o.index]=o.value}return r}var Li=class extends tr{constructor(t,n,r){let{bandwidth:i=20,binType:o="linear",binWidth:s=2,binPad:a=1,...c}=r,l=uG(c);super(t,n,c,ww),this.densityMap=l,dn(this,"bandwidth",i,()=>this.grids?this.convolve().update():null),dn(this,"binWidth",s),dn(this,"binType",o),dn(this,"binPad",a)}setPlot(t,n){let r=()=>{this.stats&&this.requestUpdate()};return t.addAttributeListener("domainX",r),t.addAttributeListener("domainY",r),super.setPlot(t,n)}get filterIndexable(){let t=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return t&&n&&!t[kr]&&!n[kr]}query(t=[]){let{plot:n,binType:r,binPad:i,channels:o,densityMap:s,source:a}=this,[c,l]=this.extentX=Do(this,t),[u,f]=this.extentY=No(this,t),[h,d]=this.bins=this.binDimensions(this),p=Cr(this,"x"),y=Cr(this,"y"),b=!!n.getAttribute("xReverse"),m=!!n.getAttribute("yReverse"),g=TF(p,c,l,h,b,this.binPad),x=TF(y,u,f,d,m,this.binPad),w=i?[Oe(p,[c,l]),Oe(y,[u,f])]:[gc(c,p),yc(p,l),gc(u,y),yc(y,f)],v=Ct.from(a.table).where(t.concat(w)),_=this.groupby=[],M=Si();for(let E of o)if(Object.hasOwn(E,"field")){let{as:N,channel:I,field:T}=E;T.aggregate?(M=T,s[I]=!0):I==="weight"?M=Ii(T):I!=="x"&&I!=="y"&&(v.select({[N]:T}),_.push(N))}return r==="linear"?hG(v,g,x,M,h,_):fG(v,g,x,M,h,_)}binDimensions(){let{plot:t,binWidth:n}=this;return[Math.round(t.innerWidth()/n),Math.round(t.innerHeight()/n)]}queryResult(t){let[n,r]=this.bins;return this.grids=IF(n,r,t,this.groupby),this.convolve()}convolve(){let{bandwidth:t,bins:n,grids:r,plot:i}=this;if(t<=0)this.kde=this.grids.map(({key:o,grid:s})=>(s.key=o,s));else{let o=i.innerWidth(),s=i.innerHeight(),[a,c]=n,l=r.some(({grid:h})=>h.some(d=>d<0)),u=km(t*(a-1)/o,l),f=km(t*(c-1)/s,l);this.kde=this.grids.map(({key:h,grid:d})=>{let p=vF(u,f,d,n);return p.key=h,p})}return this}plotSpecs(){throw new Error("Unimplemented. Use a Grid2D mark subclass.")}};function uG(e){let t={};for(let n in e)e[n]==="density"&&(delete e[n],t[n]=!0);return t}function TF(e,t,n,r,i,o){let s=(r-o)/(n-t),a=s!==1?` * ${s}::DOUBLE`:"";return i?q`(${n} - ${e}::DOUBLE)${a}`:q`(${e}::DOUBLE - ${t})${a}`}function fG(e,t,n,r,i,o){return e.select({index:q`FLOOR(${t})::INTEGER + FLOOR(${n})::INTEGER * ${i}`,value:r}).groupby("index",o)}function hG(e,t,n,r,i,o){let s=r.column?`* ${r.column}`:"",a=(h,d)=>e.clone().select({xp:t,yp:n,i:h,w:d}),c=a(q`FLOOR(xp)::INTEGER + FLOOR(yp)::INTEGER * ${i}`,q`(FLOOR(xp)::INTEGER + 1 - xp) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),l=a(q`FLOOR(xp)::INTEGER + (FLOOR(yp)::INTEGER + 1) * ${i}`,q`(FLOOR(xp)::INTEGER + 1 - xp) * (yp - FLOOR(yp)::INTEGER)${s}`),u=a(q`FLOOR(xp)::INTEGER + 1 + FLOOR(yp)::INTEGER * ${i}`,q`(xp - FLOOR(xp)::INTEGER) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),f=a(q`FLOOR(xp)::INTEGER + 1 + (FLOOR(yp)::INTEGER + 1) * ${i}`,q`(xp - FLOOR(xp)::INTEGER) * (yp - FLOOR(yp)::INTEGER)${s}`);return Ct.from(Ct.unionAll(c,l,u,f)).select({index:"i",value:Ii("w")},o).groupby("index",o).having(Qh("value",0))}var QM=class extends Li{constructor(t,n){let{thresholds:r=10,...i}=n;super("geo",t,i),dn(this,"thresholds",r,()=>this.grids?this.contours().update():null)}convolve(){return super.convolve().contours()}contours(){let{bins:t,densityMap:n,kde:r,thresholds:i,groupby:o,plot:s}=this,a=i;if(!Array.isArray(a)){let v=$t(r.map(_=>$t(_)));a=Array.from({length:a-1},(_,M)=>v*(M+1)/a)}(n.fill||n.stroke)&&this.plot.getAttribute("colorScale")!=="log"&&this.plot.setAttribute("colorZero",!0);let[c,l]=t,[u,f]=s.getAttribute("xDomain"),[h,d]=s.getAttribute("yDomain"),p=(f-u)/c,y=(d-h)/l,b=+u,m=+h,g=v=>b+v*p,x=v=>m+v*y,w=ya().size(t);return this.data=r.flatMap(v=>a.map(_=>{let M=dG(w.contour(v,_),g,x);return o.forEach((E,N)=>M[E]=v.key[N]),M.density=_,M})),this}plotSpecs(){let{type:t,channels:n,densityMap:r,data:i}=this,o={};for(let s of n){let{channel:a}=s;a!=="x"&&a!=="y"&&(o[a]=ri(s))}return r.fill&&(o.fill="density"),r.stroke&&(o.stroke="density"),[{type:t,data:i,options:o}]}};function dG(e,t,n){function r(s){s.forEach(i)}function i(s){s.forEach(o)}function o(s){s[0]=t(s[0]),s[1]=n(s[1])}return e.coordinates.forEach(r),e}function vw(e,t,n,r,i,o){let s=(o.length>>2)-1;for(let a=0,c=0;a<r;++a)for(let l=0,u=(r-a-1)*n;l<n;++l,c+=4){let f=s*i(e[l+u])<<2;t[c+0]=o[f+0],t[c+1]=o[f+1],t[c+2]=o[f+2],t[c+3]=o[f+3]}}function $f(e,t){let n=new Uint8ClampedArray(4*e),r=e-1;for(let i=0;i<=r;++i){let o=t(i/r),{r:s,g:a,b:c,opacity:l=1}=typeof o=="string"?en(o):o,u=i<<2;n[u+0]=s,n[u+1]=a,n[u+2]=c,n[u+3]=255*l|0}return n}function Sw(e,t){if(typeof document<"u"){let n=document.createElement("canvas");return n.setAttribute("width",e),n.setAttribute("height",t),n}throw new Error("Can not create a canvas instance.")}function Iw(e="black"){let{r:t,g:n,b:r}=en(e);return i=>({r:t,g:n,b:r,opacity:i})}var Rm=class extends Li{constructor(t,n){super("image",t,n)}setPlot(t,n){let r=()=>{this.stats&&this.rasterize()};t.addAttributeListener("schemeColor",r),super.setPlot(t,n)}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:t,kde:n,groupby:r}=this,[i,o]=t,{canvas:s,ctx:a,img:c}=pG(this,i,o),l=mG(this),u=r.indexOf(this.channelField("fill")?.as),f=u<0?[]:n.map(({key:h})=>h[u]);return this.data=n.map(h=>{let d=yG(this,f,h.key?.[u]);return vw(h,c.data,i,o,l,d),a.putImageData(c,0,0),{src:s.toDataURL()}}),this}plotSpecs(){let{type:t,plot:n,data:r}=this,i={src:"src",width:n.innerWidth(),height:n.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:r,options:i}]}};function pG(e,t,n){if(!e.image||e.image.w!==t||e.image.h!==n){let r=Sw(t,n),i=r.getContext("2d",{willReadFrequently:!0}),o=i.getImageData(0,0,t,n);e.image={canvas:r,ctx:i,img:o,w:t,h:n}}return e.image}function mG(e){let{densityMap:t,kde:n,plot:r}=e,i=t.fill&&r.getAttribute("colorDomain");if(!i){let s=0,a=0;n.forEach(c=>{for(let l of c)l<s&&(s=l),l>a&&(a=l)}),i=s===0&&a===0?[0,1]:[s,a]}let o=r.getAttribute("colorScale");return So({x:{type:o,domain:i,range:[0,1]}}).apply}function yG(e,t,n,r=1024){let{densityMap:i,plot:o}=e,s=o.getAttribute("colorScheme"),a=e.channel("fill"),c=Rf(a?.value)?a.value:void 0;if(i.fill||s&&!c){if(s)try{return $f(r,So({color:{scheme:s,domain:[0,1]}}).interpolate)}catch(l){console.warn(l)}}else if(t.length){let l=o.getAttribute("colorRange");c=So({color:{domain:t,range:l,scheme:s||(l?void 0:"tableau10")}}).apply(n)}return $f(r,Iw(c))}var JM=class extends Rm{constructor(t,n){let{normalize:r=!0,...i}=n;super(t,{bandwidth:0,...i}),dn(this,"normalize",r)}query(t=[]){let{plot:n,channels:r,normalize:i,source:o}=this,[s,a]=Do(this,t),[c,l]=No(this,t),[u,f]=this.bins=this.binDimensions(this),h=Cr(this,"x"),d=Cr(this,"y"),p=!!n.getAttribute("xReverse"),y=!!n.getAttribute("yReverse"),b=Cm(h,s,a,u,p,this.binPad),m=Cm(d,c,l,f,y,this.binPad),g=Ct.from(o.table).where(gG(this,t)),x=this.groupby=[],w=[];for(let v of r)if(Object.hasOwn(v,"field")){let{channel:_,field:M}=v;_==="z"?(g.select({[_]:M}),w.push("z")):_!=="x"&&_!=="y"&&(g.select({[_]:M}),x.push(_))}return bG(g,b,m,w,u,f,x,i)}};function gG(e,t){if(Array.isArray(t)&&!t.length)return t;let n=e.channelField("x").field.column,r=e.channelField("y").field.column,i=s=>s.op!=="BETWEEN"||s.field.column!==n&&s.field.column!==r,o=s=>s.op==="AND"?Sr(s.children.filter(a=>i(a))):s;return Array.isArray(t)?t.filter(s=>i(s)).map(s=>o(s)):o(t)}function bG(e,t,n,r,i,o,s=[],a=!0){e.select({x:q`FLOOR(${t})::INTEGER`,y:q`FLOOR(${n})::INTEGER`});let c=s.concat(r),l=c.length?`PARTITION BY ${c.join(", ")} `:"",u=Ct.from(e).select(c,{x0:"x",y0:"y",dx:q`(lead(x) OVER sw - x)`,dy:q`(lead(y) OVER sw - y)`}).window({sw:q`${l}ORDER BY x ASC`}).qualify(Sr(q`(x0 < ${i} OR x0 + dx < ${i})`,q`(y0 < ${o} OR y0 + dy < ${o})`,q`(x0 > 0 OR x0 + dx > 0)`,q`(y0 > 0 OR y0 + dy > 0)`)),f=Ct.select({x:q`GREATEST(MAX(ABS(dx)), MAX(ABS(dy)))`}).from("pairs"),h=Ct.select({i:q`UNNEST(range((${f})))::INTEGER`}),d=Ct.unionAll(Ct.select(c,{x:q`x0 + i`,y:q`y0 + ROUND(i * dy / dx::FLOAT)::INTEGER`}).from("pairs","indices").where(q`ABS(dy) <= ABS(dx) AND i < ABS(dx)`),Ct.select(c,{x:q`x0 + ROUND(SIGN(dy) * i * dx / dy::FLOAT)::INTEGER`,y:q`y0 + SIGN(dy) * i`}).from("pairs","indices").where(q`ABS(dy) > ABS(dx) AND i < ABS(dy)`),Ct.select(c,{x:"x0",y:"y0"}).from("pairs").where(Kh("dx"))),p=["x"].concat(c).join(", "),y=Ct.from("raster").select(c,"x","y",a?{w:q`1.0 / COUNT(*) OVER (PARTITION BY ${p})`}:null).where(Sr(Oe("x",[0,i]),Oe("y",[0,o])));return Ct.with({pairs:u,indices:h,raster:d,points:y}).from("points").select(s,{index:q`x + y * ${i}::INTEGER`,value:a?Ii("w"):Si()}).groupby("index",s)}var t3=class extends tr{constructor(t,n,r){let{bins:i=1024,bandwidth:o=20,...s}=r,a=t.endsWith("X")?"y":"x";super(t,n,s,a==="x"?XM:HM),this.dim=a,dn(this,"bins",i),dn(this,"bandwidth",o,()=>this.grid?this.convolve().update():null)}get filterIndexable(){let t=this.dim==="x"?"xDomain":"yDomain",n=this.plot.getAttribute(t);return n&&!n[kr]}query(t=[]){if(this.hasOwnData())throw new Error("Density1DMark requires a data source");let{bins:n,channels:r,dim:i,source:{table:o}}=this,[s,a]=this.extent=(i==="x"?Do:No)(this,t),c=Cr(this,i);return xG(GM(r,o,[i]).where(t.concat(Oe(c,[s,a]))),Cm(c,s,a,n),this.channelField("weight")?"weight":null)}queryResult(t){return this.grid=SF(this.bins,t),this.convolve()}convolve(){let{bins:t,bandwidth:n,dim:r,grid:i,plot:o,extent:[s,a]}=this,c=i.some(g=>g<0),l=r==="x"?o.innerWidth():o.innerHeight(),u=km(n*(t-1)/l,c),f=_w(u,i,t),h=this.data=[],d=r==="x"?"y":"x",p=this.channelField(r).as,y=+s,b=(a-y)/(t-1),m=1/b;for(let g=0;g<t;++g)h.push({[p]:y+g*b,[d]:f[g]*m});return this}plotSpecs(){let{type:t,data:n,channels:r,dim:i}=this,o=i==="x"?{y:"y"}:{x:"x"};for(let s of r)o[s.channel]=ri(s);return[{type:t,data:n,options:o}]}};function xG(e,t,n){let r=n?`* ${n}`:"",i=e.clone().select({p:t,i:q`FLOOR(p)::INTEGER`,w:q`(FLOOR(p) + 1 - p)${r}`}),o=e.clone().select({p:t,i:q`FLOOR(p)::INTEGER + 1`,w:q`(p - FLOOR(p))${r}`});return Ct.from(Ct.unionAll(i,o)).select({index:"i",value:Ii("w")}).groupby("index").having(Qh("value",0))}var e3=class extends Li{constructor(t,n){let{type:r="dot",binsX:i,binsY:o,...s}=n;s.binPad=s.binPad??0,super(r,t,s),dn(this,"binsX",i),dn(this,"binsY",o)}convolve(){super.convolve();let{bins:t,binPad:n,extentX:r,extentY:i}=this,[o,s]=t,[a,c]=r,[l,u]=i,f=(c-a)/(o-n),h=(u-l)/(s-n),d=n?0:.5;return this.data=wG(this.kde,t,a,l,f,h,d),this}binDimensions(){let{plot:t,binWidth:n,binsX:r,binsY:i}=this;return[r??Math.round(t.innerWidth()/n),i??Math.round(t.innerHeight()/n)]}plotSpecs(){let{type:t,channels:n,densityMap:r,data:i}=this,o={};for(let s of n){let{channel:a}=s;o[a]=a==="x"||a==="y"?a:ri(s)}for(let s in r)r[s]&&(o[s]="density");return[{type:t,data:i,options:o}]}};function wG(e,t,n,r,i,o,s){let a=1/(i*o),[c,l]=t,u=[];for(let f of e)for(let h=0,d=0;d<l;++d)for(let p=0;p<c;++p,++h)u.push({x:n+(p+s)*i,y:r+(d+s)*o,density:f[h]*a});return u}var _G="geom",n3=class extends tr{constructor(t,n={},r){!xw(t)&&!n?.geometry&&(n.geometry=P_(_G)),super("geo",t,n,r)}queryResult(t){super.queryResult(t);let n=this.channelField("geometry")?.as;return n&&this.data&&this.data.forEach(r=>{typeof r[n]=="string"&&(r[n]=JSON.parse(r[n]))}),this}};var r3=class extends tr{constructor(t,n){let{type:r="hexagon",binWidth:i=20,...o}=n;super(r,t,{r:i/2,clip:!0,...o},ww),this.binWidth=i}get filterIndexable(){let t=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return t&&n&&!t[kr]&&!n[kr]}query(t=[]){if(this.hasOwnData())return null;let{plot:n,binWidth:r,channels:i,source:o}=this,[s,a]=Do(this,t),[c,l]=No(this,t),u=.5-n.getAttribute("marginLeft"),f=0-n.getAttribute("marginTop"),h=`${r}::DOUBLE`,d=`${r*(1.5/Math.sqrt(3))}::DOUBLE`,p=`${n.innerWidth()/(a-s)}::DOUBLE`,y=`${n.innerHeight()/(l-c)}::DOUBLE`,b,m,g=new Set,x={};for(let E of i)E.channel==="orderby"?w.orderby(E.value):E.channel==="x"?b=E:E.channel==="y"?m=E:Object.hasOwn(E,"field")&&(x[E.as]=E.field,E.field.aggregate&&E.field.columns.forEach(N=>g.add(N)));let w=Ct.select({[b.as]:q`${s}::DOUBLE + ((x + 0.5 * (y & 1)) * ${h} + ${u})::DOUBLE / ${p}`,[m.as]:q`${l}::DOUBLE - (y * ${d} + ${f})::DOUBLE / ${y}`,...x}).groupby("x","y"),v=`${p} * (${b.field} - ${s}::DOUBLE)`,_=`${y} * (${l}::DOUBLE - ${m.field})`,M=Ct.select({py:q`(${_} - ${f}) / ${d}`,pj:q`ROUND(py)::INTEGER`,px:q`(${v} - ${u}) / ${h} - 0.5 * (pj & 1)`,pi:q`ROUND(px)::INTEGER`,tt:q`ABS(py-pj) * 3 > 1 AND (px-pi)**2 + (py-pj)**2 > (px - pi - 0.5 * CASE WHEN px < pi THEN -1 ELSE 1 END)**2 + (py - pj - CASE WHEN py < pj THEN -1 ELSE 1 END)**2`,x:q`CASE WHEN tt THEN (pi + (CASE WHEN px < pi THEN -0.5 ELSE 0.5 END) + (CASE WHEN pj & 1 <> 0 THEN 0.5 ELSE -0.5 END))::INTEGER ELSE pi END`,y:q`CASE WHEN tt THEN (pj + CASE WHEN py < pj THEN -1 ELSE 1 END)::INTEGER ELSE pj END`}).select(Array.from(g)).from(o.table).where(mc(b.field),mc(m.field),t);return w.from(M)}};var i3=class extends Li{constructor(t,n){let{origin:r=[0,0],dim:i="xy",...o}=n;super("image",t,o),this.origin=r,this.tileX=i.toLowerCase().includes("x"),this.tileY=i.toLowerCase().includes("y")}setPlot(t,n){let r=()=>{this.stats&&this.rasterize()};t.addAttributeListener("schemeColor",r),super.setPlot(t,n)}requestQuery(){return this.requestTiles()}query(t=[]){return this._filter=t,null}tileQuery(t){let{plot:n,binType:r,binPad:i,channels:o,densityMap:s,source:a}=this,[[c,l],[u,f]]=t,[h,d]=this.bins,p=Cr(this,"x"),y=Cr(this,"y"),b=!!n.getAttribute("xReverse"),m=!!n.getAttribute("yReverse"),g=AF(p,c,l,h,b,i),x=AF(y,u,f,d,m,i),w=i?[Oe(p,[c,l]),Oe(y,[u,f])]:[gc(c,p),yc(p,l),gc(u,y),yc(y,f)],v=Ct.from(a.table).where(w),_=this.groupby=[],M=Si();for(let E of o)if(Object.hasOwn(E,"field")){let{channel:N,field:I}=E;I.aggregate?(M=I,s[N]=!0):N==="weight"?M=Ii(I):N!=="x"&&N!=="y"&&(v.select({[N]:I}),_.push(N))}return r==="linear"?EG(v,g,x,M,h,_):AG(v,g,x,M,h,_)}async requestTiles(){let t=V_();this.prefetch&&t.cancel(this.prefetch);let{binPad:n,tileX:r,tileY:i,origin:[o,s]}=this,[a,c]=this.bins=this.binDimensions(this),[l,u]=Do(this,this._filter),[f,h]=No(this,this._filter),d=u-l,p=h-f,y=Math.floor((l-o)*(a-n)/d),b=Math.floor((f-s)*(c-n)/p),m=(I,T)=>[[o+I*d,o+(I+1)*d],[s+T*p,s+(T+1)*p]],g=Math.floor((l-o)/d),x=r?EF((u-o)/d):g,w=Math.floor((f-s)/p),v=i?EF((h-s)/p):w,_=[];for(let I=g;I<=x;++I)for(let T=w;T<=v;++T)_.push([I,T]);let M=_.map(([I,T])=>t.query(this.tileQuery(m(I,T)))),E=[];if(r)for(let I=w;I<=v;++I)E.push([x+1,I]),E.push([g-1,I]);if(i){let I=r?g-1:g,T=r?x+1:x;for(let O=I;O<=T;++O)E.push([O,v+1]),E.push([O,w-1])}this.prefetch=E.map(([I,T])=>t.prefetch(this.tileQuery(m(I,T))));let N=await Promise.all(M);this.grids=[{grid:vG(a,c,y,b,_,N)}],this.convolve().update()}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:t,kde:n,groupby:r}=this,[i,o]=t,{canvas:s,ctx:a,img:c}=IG(this,i,o),l=MG(this),u=r.indexOf(this.channelField("fill")?.as),f=u<0?[]:n.map(({key:h})=>h[u]);return this.data=n.map(h=>{let d=TG(this,f,h.key?.[u]);return vw(h,c.data,i,o,l,d),a.putImageData(c,0,0),{src:s.toDataURL()}}),this}plotSpecs(){let{type:t,data:n,plot:r}=this,i={src:"src",width:r.innerWidth(),height:r.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:n,options:i}]}};function vG(e,t,n,r,i,o){let s=new Float64Array(e*t);return o.forEach((a,c)=>{let[l,u]=i[c],f=l*e-n,h=u*t-r;SG(e,t,s,a,f,h)}),s}function SG(e,t,n,r,i,o){let s=r.numRows;if(s===0)return;let a=r.getChild("index").toArray(),c=r.getChild("value").toArray();for(let l=0;l<s;++l){let u=a[l],f=i+u%e,h=o+Math.floor(u/e);0<=f&&f<e&&0<=h&&h<t&&(n[f+h*e]=c[l])}}function IG(e,t,n){if(!e.image||e.image.w!==t||e.image.h!==n){let r=Sw(t,n),i=r.getContext("2d",{willReadFrequently:!0}),o=i.getImageData(0,0,t,n);e.image={canvas:r,ctx:i,img:o,w:t,h:n}}return e.image}function MG(e){let{densityMap:t,kde:n,plot:r}=e,i=t.fill&&r.getAttribute("colorDomain");if(!i){let s=0,a=0;n.forEach(c=>{for(let l of c)l<s&&(s=l),l>a&&(a=l)}),i=s===0&&a===0?[0,1]:[s,a]}let o=r.getAttribute("colorScale");return So({x:{type:o,domain:i,range:[0,1]}}).apply}function TG(e,t,n,r=1024){let{densityMap:i,plot:o}=e,s=o.getAttribute("colorScheme"),a=e.channel("fill"),c=Rf(a?.value)?a.value:void 0;if(i.fill||s&&!c){if(s)try{return $f(r,So({color:{scheme:s,domain:[0,1]}}).interpolate)}catch(l){console.warn(l)}}else if(t.length){let l=o.getAttribute("colorRange");c=So({color:{domain:t,range:l,scheme:s||(l?void 0:"tableau10")}}).apply(n)}return $f(r,Iw(c))}function AF(e,t,n,r,i,o){let s=(r-o)/(n-t),a=s!==1?` * ${s}::DOUBLE`:"";return i?q`(${n} - ${e}::DOUBLE)${a}`:q`(${e}::DOUBLE - ${t})${a}`}function AG(e,t,n,r,i,o){return e.select({index:q`FLOOR(${t})::INTEGER + FLOOR(${n})::INTEGER * ${i}`,value:r}).groupby("index",o)}function EG(e,t,n,r,i,o){let s=r.column?`* ${r.column}`:"",a=(h,d)=>e.clone().select({xp:t,yp:n,i:h,w:d}),c=a(q`FLOOR(xp)::INTEGER + FLOOR(yp)::INTEGER * ${i}`,q`(FLOOR(xp)::INTEGER + 1 - xp) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),l=a(q`FLOOR(xp)::INTEGER + (FLOOR(yp)::INTEGER + 1) * ${i}`,q`(FLOOR(xp)::INTEGER + 1 - xp) * (yp - FLOOR(yp)::INTEGER)${s}`),u=a(q`FLOOR(xp)::INTEGER + 1 + FLOOR(yp)::INTEGER * ${i}`,q`(xp - FLOOR(xp)::INTEGER) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),f=a(q`FLOOR(xp)::INTEGER + 1 + (FLOOR(yp)::INTEGER + 1) * ${i}`,q`(xp - FLOOR(xp)::INTEGER) * (yp - FLOOR(yp)::INTEGER)${s}`);return Ct.from(Ct.unionAll(c,l,u,f)).select({index:"i",value:Ii("w")},o).groupby("index",o).having(O_("value",0))}function EF(e){let t=Math.floor(e);return t===e?t-1:t}function DG(e,t,n){var r=1e-8,i=t-1,o=n-1,s=0,a,c,l,u,f,h,d,p,y,b,m;if(e<=0)return 0;if(e>=1)return 1;for(t>=1&&n>=1?(l=e<.5?e:1-e,u=Math.sqrt(-2*Math.log(l)),d=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,e<.5&&(d=-d),p=(d*d-3)/6,y=2/(1/(2*t-1)+1/(2*n-1)),b=d*Math.sqrt(p+y)/y-(1/(2*n-1)-1/(2*t-1))*(p+5/6-2/(3*y)),d=t/(t+n*Math.exp(2*b))):(a=Math.log(t/(t+n)),c=Math.log(n/(t+n)),u=Math.exp(t*a)/t,f=Math.exp(n*c)/n,b=u+f,e<u/b?d=Math.pow(t*b*e,1/t):d=1-Math.pow(n*b*(1-e),1/n)),m=-Uf(t)-Uf(n)+Uf(t+n);s<10;s++){if(d===0||d===1)return d;if(h=NG(d,t,n)-e,u=Math.exp(i*Math.log(d)+o*Math.log(1-d)+m),f=h/u,d-=u=f/(1-.5*Math.min(1,f*(i/d-o/(1-d)))),d<=0&&(d=.5*(d+u)),d>=1&&(d=.5*(d+u+1)),Math.abs(u)<r*d&&s>0)break}return d}function NG(e,t,n){var r=e===0||e===1?0:Math.exp(Uf(t+n)-Uf(t)-Uf(n)+t*Math.log(e)+n*Math.log(1-e));return e<0||e>1?!1:e<(t+1)/(t+n+2)?r*DF(e,t,n)/t:1-r*DF(1-e,n,t)/n}function DF(e,t,n){var r=1e-30,i=1,o=t+n,s=t+1,a=t-1,c=1,l=1-o*e/s,u,f,h,d;for(Math.abs(l)<r&&(l=r),l=1/l,d=l;i<=100&&(u=2*i,f=i*(n-i)*e/((a+u)*(t+u)),l=1+f*l,Math.abs(l)<r&&(l=r),c=1+f/c,Math.abs(c)<r&&(c=r),l=1/l,d*=l*c,f=-(t+i)*(o+i)*e/((t+u)*(s+u)),l=1+f*l,Math.abs(l)<r&&(l=r),c=1+f/c,Math.abs(c)<r&&(c=r),l=1/l,h=l*c,d*=h,!(Math.abs(h-1)<3e-7));i++);return d}function Uf(e){var t=0,n=[76.18009172947146,-86.5053203294167,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],r=1.000000000190015,i,o,s;for(s=(o=i=e)+5.5,s-=(i+.5)*Math.log(s);t<6;t++)r+=n[t]/++o;return Math.log(2.506628274631*r/i)-s}function NF(e,t){var n=DG(2*Math.min(e,1-e),.5*t,.5);return n=Math.sqrt(t*(1-n)/n),e>.5?n:-n}var o3=class extends tr{constructor(t,n){let{ci:r=.95,precision:i=4,...o}=n;super("line",t,o);let s=()=>this.modelFit?this.confidenceBand().update():null;dn(this,"ci",r,s),dn(this,"precision",i,s)}query(t=[]){let n=this.channelField("x").as,r=this.channelField("y").as,i=Array.from(new Set(["stroke","z","fx","fy"].flatMap(o=>this.channelField(o)?.as||[])));return Ct.from(super.query(t)).select({intercept:L_(r,n),slope:C_(r,n),n:k_(r,n),ssy:R_(r,n),ssx:$_(r,n),xm:U_(r,n),x0:_0(aa(n).where(mc(r))),x1:_0(sa(n).where(mc(r)))}).select(i).groupby(i)}queryResult(t){return this.modelFit=bw(t),this.lineData=this.modelFit.flatMap(n=>OG(n)),this.confidenceBand()}confidenceBand(){let{ci:t,modelFit:n,precision:r,plot:i}=this,o=i.innerWidth();return this.areaData=t?n.flatMap(s=>BG(t,r,s,o)):null,this}plotSpecs(){let{lineData:t,areaData:n,channels:r,ci:i}=this,o={x:"x",y:"y"},s={x:"x",y1:"y1",y2:"y2",fillOpacity:.1};for(let a of r)switch(a.channel){case"x":case"y":case"fill":break;case"stroke":o.stroke=s.fill=ri(a);break;case"strokeOpacity":o.strokeOpacity=ri(a);break;case"fillOpacity":s.fillOpacity=ri(a);break;default:o[a.channel]=s[a.channel]=ri(a);break}return[...i?[{type:"areaY",data:n,options:s}]:[],{type:"line",data:t,options:o}]}};function OG(e){let{x0:t,x1:n,xm:r,intercept:i,slope:o,n:s,ssx:a,ssy:c,...l}=e;return[{x:t,y:i+t*o,...l},{x:n,y:i+n*o,...l}]}function BG(e,t,n,r){let{x0:i,x1:o,xm:s,intercept:a,slope:c,n:l,ssx:u,ssy:f,...h}=n,d=t*(o-i)/r,p=NF((1-e)/2,l-2)*Math.sqrt(f/(l-2));return ke(i,o-d/2,d).concat(o).map(y=>{let b=a+y*c,m=p*Math.sqrt(1/l+(y-s)**2/u);return{x:y,y1:b-m,y2:b+m,...h}})}function OF(e){let t=e.toLowerCase(),n=e.length,r="";for(let i=0;i<n;++i)r+=(e[i]!==t[i]?"-":"")+t[i];return r}function Pf(e){let t={};for(let n in e)t[OF(n)]=e[n];return t}function FG(e){let{channels:t}=e,n=new Set,r=!1,i=!1;for(let o of t){let{channel:s,field:a,as:c}=o;if(s==="orderby")r=!0;else if(a)if(a.aggregate)i=!0;else{if(n.has(c))continue;n.add(c)}}return!r&&i&&n.size&&e.channels.push({channel:"orderby",value:Array.from(n)}),e}var s3=class{constructor(t,{selection:n,channels:r={}}){this.mark=FG(t),this.selection=n;let i=Object.entries(Pf(r));this.channels=i.length?i:[["opacity",.2]],this.selection.addEventListener("value",jf(()=>this.update()))}init(t){this.svg=t;let n=this.values=[],r=this.mark.index,i=this.nodes=t.querySelectorAll(`[data-index="${r}"] > *`),{channels:o}=this;for(let s=0;s<i.length;++s){let a=i[s];n.push(o.map(c=>a.getAttribute(c[0])))}return this.update()}async update(){let{svg:t,nodes:n,channels:r,values:i,mark:o,selection:s}=this;if(!t)return;let a=await LG(o,s);for(let c=0;c<n.length;++c){let l=n[c],u=i[c],f=a(l.__data__);for(let h=0;h<r.length;++h){let[d,p]=r[h];l.setAttribute(d,f?u[h]:p)}}}};async function LG(e,t){let n=t?.predicate(e);if(!n||n.length===0)return()=>!0;let r=e.filterBy?.predicate(e,!0),i={__:Sr(n)},o=e.query(r),s=o.groupby().length?o.select(i):o.$select(i),a=await e.coordinator.query(s),c=a.getChild?.("__");return a.numRows||a.length?c?l=>c.get(l):l=>a[l].__:()=>!1}function a3(e){let t=e.on,n=!0;function r(i){n=!1,i(),n=!0}return e.reset=(...i)=>{r(()=>e.clear(...i))},e.moveSilent=(...i)=>{r(()=>e.move(...i))},e.on=(...i)=>{if(i.length>1&&i[1]){let o=i[1];i[1]=(...s)=>n&&o(...s)}return t(...i)},e}function BF(){return a3(Dv())}function FF(){return a3(Av())}function LF(){return a3(Ev())}function $m(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 Oo(e,t){let n=e.channelField(t)?.field;return n?.basis||n}function Um(e,t,n=1){return t.invert(n*Math.floor(e/n))}function Mw(){let e=this,t=e.getScreenCTM,n;e.getScreenCTM=()=>e.isConnected?n=t.call(e):n}var c3=class{constructor(t,{channel:n,selection:r,field:i,pixelSize:o=1,peers:s=!0,brush:a}){this.mark=t,this.channel=n,this.pixelSize=o||1,this.selection=r,this.peers=s,this.field=i||Oo(t,[n,n+"1",n+"2"]),this.style=a&&Pf(a),this.brush=n==="y"?LF():FF(),this.brush.on("brush end",({selection:c})=>this.publish(c))}reset(){this.value=void 0,this.g&&this.brush.reset(this.g)}activate(){this.selection.activate(this.clause(this.value||[0,1]))}publish(t){let n;t&&(n=t.map(r=>Um(r,this.scale,this.pixelSize)).sort((r,i)=>r-i)),$m(n,this.value)||(this.value=n,this.g.call(this.brush.moveSilent,t),this.selection.update(this.clause(n)))}clause(t){let{mark:n,pixelSize:r,field:i,scale:o}=this;return{source:this,schema:{type:"interval",pixelSize:r,scales:[o]},clients:this.peers?n.plot.markSet:new Set().add(n),value:t,predicate:t?Oe(i,t):null}}init(t){let{brush:n,channel:r,style:i}=this;this.scale=t.scale(r);let o=t.scale("x").range,s=t.scale("y").range;n.extent([[oe(o),oe(s)],[$t(o),$t(s)]]);let a=Ut(t).selectAll('g[aria-label="facet"]'),c=a.size()?a:Ut(t);if(this.g=c.append("g").attr("class",`interval-${r}`).each(Mw).call(n).call(n.moveSilent,this.value?.map(this.scale.apply)),i){let l=this.g.selectAll("rect.selection");for(let u in i)l.attr(u,i[u])}t.addEventListener("pointerenter",()=>this.activate())}};var Tw=(e,t)=>e-t,l3=class{constructor(t,{selection:n,xfield:r,yfield:i,pixelSize:o=1,peers:s=!0,brush:a}){this.mark=t,this.pixelSize=o||1,this.selection=n,this.peers=s,this.xfield=r||Oo(t,["x","x1","x2"]),this.yfield=i||Oo(t,["y","y1","y2"]),this.style=a&&Pf(a),this.brush=BF(),this.brush.on("brush end",({selection:c})=>this.publish(c))}reset(){this.value=void 0,this.g&&this.brush.reset(this.g)}activate(){this.selection.activate(this.clause(this.value||[[0,1],[0,1]]))}publish(t){let{value:n,pixelSize:r,xscale:i,yscale:o}=this,s,a;if(t){let[c,l]=t;s=[c[0],l[0]].map(u=>Um(u,i,r)).sort(Tw),a=[c[1],l[1]].map(u=>Um(u,o,r)).sort(Tw)}(!$m(s,n?.[0])||!$m(a,n?.[1]))&&(this.value=t?[s,a]:void 0,this.g.call(this.brush.moveSilent,t),this.selection.update(this.clause(this.value)))}clause(t){let{mark:n,pixelSize:r,xfield:i,yfield:o,xscale:s,yscale:a}=this;return{source:this,schema:{type:"interval",pixelSize:r,scales:[s,a]},clients:this.peers?n.plot.markSet:new Set().add(n),value:t,predicate:t?Sr(Oe(i,t[0]),Oe(o,t[1])):null}}init(t){let{brush:n,style:r}=this,i=this.xscale=t.scale("x"),o=this.yscale=t.scale("y"),s=i.range,a=o.range;n.extent([[oe(s),oe(a)],[$t(s),$t(a)]]);let c=Ut(t).selectAll('g[aria-label="facet"]'),l=c.size()?c:Ut(t);if(this.g=l.append("g").attr("class","interval-xy").each(Mw).call(n),r){let u=this.g.selectAll("rect.selection");for(let f in r)u.attr(f,r[f])}if(this.value){let[u,f]=this.value[0].map(i.apply).sort(Tw),[h,d]=this.value[1].map(o.apply).sort(Tw);this.g.call(n.moveSilent,[[u,h],[f,d]])}t.addEventListener("pointerenter",()=>this.activate())}};var u3=class{constructor(t,{selection:n,channel:r,field:i}){this.mark=t,this.selection=n,this.clients=new Set().add(t),this.channel=r,this.field=i||Oo(t,[r])}clause(t){let{clients:n,field:r}=this,i=t?N_(r,Xh(t)):null;return{source:this,schema:{type:"point"},clients:n,value:t,predicate:i}}init(t){let n=this,{mark:r,channel:i,selection:o}=this,{data:s}=r,a=r.channelField(i).as,c=Ut(t).selectAll('g[aria-label="facet"]'),l=c.size()?c:Ut(t),u=t.scale(i),f=!j_(o);l.on("pointerdown pointermove",function(h){let[d,p]=En(h,this),y=CG(s,a,u.invert(i==="x"?d:p));o.update(f?y:n.clause(y))}),!f&&t.addEventListener("pointerenter",()=>{this.selection.activate(this.clause(0))})}};function CG(e,t,n){let r=1/0,i;return e.forEach(o=>{let s=Math.abs(o[t]-n);s<r&&(r=s,i=o[t])}),i}var CF=(e,t)=>e-t,h3=class{constructor(t,{x:n=new _c,y:r=new _c,xfield:i,yfield:o,zoom:s=!0,panx:a=!0,pany:c=!0}){this.mark=t,this.xsel=n,this.ysel=r,this.xfield=i||Oo(t,["x","x1","x2"]),this.yfield=o||Oo(t,["y","y1","y2"]),this.zoom=f3(s,[0,1/0],[1,1]),this.panx=this.xsel&&a,this.pany=this.ysel&&c;let{plot:l}=t;a&&this.xsel.addEventListener("value",u=>{l.setAttribute("xDomain",u)&&l.update()}),c&&this.ysel.addEventListener("value",u=>{l.setAttribute("yDomain",u)&&l.update()})}publish(t){if(this.panx){let n=kG(t,this.xscale);this.xsel.update(this.clause(n,this.xfield,this.xscale))}if(this.pany){let n=RG(t,this.yscale);this.ysel.update(this.clause(n,this.yfield,this.yscale))}}clause(t,n,r){return{source:this,schema:{type:"interval",scales:[r]},clients:this.mark.plot.markSet,value:t,predicate:t?Oe(n,t):null}}init(t){if(this.svg=t,this.initialized)return;this.initialized=!0;let{panx:n,pany:r,mark:{plot:{element:i}},xsel:o,ysel:s}=this;this.xscale=t.scale("x"),this.yscale=t.scale("y");let a=this.xscale.range.slice().sort(CF),c=this.yscale.range.slice().sort(CF),l=f3(n,[-1/0,1/0],a),u=f3(r,[-1/0,1/0],c),f=YS().extent([[a[0],c[0]],[a[1],c[1]]]).scaleExtent(this.zoom).translateExtent([[l[0],u[0]],[l[1],u[1]]]).on("start",()=>{this.xscale=this.svg.scale("x"),this.yscale=this.svg.scale("y")}).on("end",()=>i.__zoom=new Nr(1,0,0)).on("zoom",({transform:h})=>this.publish(h));if(Ut(i).call(f),n||r){let h=!1;i.addEventListener("mouseenter",()=>{if(!h){if(h=!0,n){let{xscale:d,xfield:p}=this;o.activate(this.clause(d.domain,p,d))}if(r){let{yscale:d,yfield:p}=this;s.activate(this.clause(d.domain,p,d))}}}),i.addEventListener("mouseleave",()=>h=!1)}}};function f3(e,t,n){return e?Array.isArray(e)?e:t:n}function kG(e,t){return t.range.map(e.invertX,e).map(t.invert,t)}function RG(e,t){return t.range.map(e.invertY,e).map(t.invert,t)}var Pm=class{constructor(t,{selection:n,channels:r,peers:i=!0}){this.value=null,this.mark=t,this.selection=n,this.peers=i,this.channels=r.map(o=>{let s=o==="color"?["fill","stroke"]:o==="x"?["x","x1","x2"]:o==="y"?["y","y1","y2"]:[o];for(let a=0;a<s.length;++a){let c=t.channelField(s[a]);if(c)return{field:c.field?.basis||c.field,as:c.as}}throw new Error(`Missing channel: ${o}`)})}clause(t){let{channels:n,mark:r}=this,i=null;if(t){let o=t.map(s=>{let a=s.map((c,l)=>B_(n[l].field,Xh(c)));return a.length>1?Sr(a):a[0]});i=o.length>1?Zh(o):o[0]}return{source:this,schema:{type:"point"},clients:this.peers?r.plot.markSet:new Set().add(r),value:t,predicate:i}}init(t,n,r){let{mark:i,channels:o,selection:s}=this,{data:a}=i;r=r||(l=>{let u=a[l.__data__];return o.map(f=>u[f.as])}),n=n||`[data-index="${i.index}"]`;let c=new Set(t.querySelectorAll(n));t.addEventListener("pointerdown",l=>{let u=s.single?s.value:this.value,f=l.target,h=null;if($G(c,f)){let d=r(f);l.shiftKey&&u?.length?(h=u.filter(p=>d3(p,d)),h.length===u.length&&h.push(d)):u?.length===1&&!d3(u[0],d)?h=null:h=[d]}this.value=h,UG(u,h)&&s.update(this.clause(h))}),t.addEventListener("pointerenter",()=>{this.selection.activate(this.clause([this.channels.map(()=>0)]))})}};function $G(e,t){return e.has(t)||e.has(t.parentNode)||e.has(t.parentNode?.parentNode)}function UG(e,t){return e==null||t==null?e!=null||t!=null:e.length!==t.length||e.some((n,r)=>d3(n,t[r]))}function d3(e,t){let n=e.length;if(t.length!==n)return!0;for(let r=0;r<n;++r)if(e[r]!==t[r])return!0;return!1}var p3=class{constructor(t,n){let{as:r,...i}=n;this.channel=t,this.options={label:null,...i},this.selection=r,this.element=document.createElement("div"),this.element.setAttribute("class","legend"),this.element.value=this}setPlot(t){let{channel:n,selection:r}=this,i=PG(t,n);this.selection&&i&&(this.handler=new Pm(i,{selection:r,channels:[n]}),this.selection.addEventListener("value",()=>this.update()))}init(t){let{channel:n,options:r,handler:i}=this,s=t.scale(n).type==="ordinal"?r:{marginTop:1,tickSize:2,height:28,...r};return this.legend=t.legend(n,s),i&&(i.init(this.legend,":scope > div",a=>[a.__data__]),this.update()),this.element.replaceChildren(this.legend),this.element}update(){if(!this.legend)return;let{value:t}=this.selection,n=t&&t.length?new Set(t.map(i=>i[0])):null,r=this.legend.querySelectorAll(":scope > div");for(let i of r){let o=n?n.has(i.__data__):!0;i.style.opacity=o?1:.2}}};function PG({marks:e},t){let n=t==="color"?["fill","stroke"]:t==="opacity"?["opacity","fillOpacity","strokeOpacity"]:null;if(n==null)return null;for(let r=e.length-1;r>-1;--r)if(e[r].channelField(n))return e[r];return null}var zG=["rectY-x","rectX-y","rect-x","rect-y"];function VG(e,t){return zG.includes(`${t}-${e}`)}function kF(e,t={steps:25}){let n=(r,i)=>VG(i,r.type)?{[`${i}1`]:m3(r,e,t),[`${i}2`]:m3(r,e,{...t,offset:1})}:{[i]:m3(r,e,t)};return n[qf]=!0,n}function m3(e,t,n){return{column:t,label:t,get stats(){return["min","max"]},get columns(){return[t]},get basis(){return t},toString(){let{min:r,max:i}=e.stats[t],o=qG(r,i,n),s=Ht(t),a=o.min===0?s:`(${s} - ${o.min})`,c=`${(o.max-o.min)/o.steps}::DOUBLE`,l=n.offset?`${n.offset} + `:"";return`${o.min} + ${c} * (${l}FLOOR(${a} / ${c})::INTEGER)`}}}function qG(e,t,n){let{steps:r=25,minstep:i=0,nice:o=!0}=n;if(o!==!1){let s=t-e,a=r,c=Math.LN10,l=Math.ceil(Math.log(a)/c),u=Math.max(i,Math.pow(10,Math.round(Math.log(s)/c)-l));for(;Math.ceil(s/u)>a;)u*=10;let f=[5,2],h;for(let y=0,b=f.length;y<b;++y)h=u/f[y],h>=i&&s/h<=a&&(u=h);h=Math.log(u);let d=h>=0?0:~~(-h/c)+1,p=Math.pow(10,-d-1);h=Math.floor(e/u+p)*u,e=e<h?h-u:h,t=Math.ceil(t/u)*u,r=Math.round((t-e)/u)}return{min:e,max:t,steps:r}}export{KM as ConnectedMark,QM as ContourMark,JM as DenseLineMark,t3 as Density1DMark,e3 as Density2DMark,Vf as Fixed,n3 as GeoMark,Li as Grid2DMark,r3 as HexbinMark,s3 as Highlight,c3 as Interval1D,l3 as Interval2D,p3 as Legend,tr as Mark,u3 as Nearest,h3 as PanZoom,jM as Plot,Rm as RasterMark,i3 as RasterTileMark,o3 as RegressionMark,Pm as Toggle,qf as Transform,kr as Transient,kF as bin};
|