@uwdata/vgplot 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/README.md +4 -2
  2. package/dist/vgplot.js +6677 -6503
  3. package/dist/vgplot.min.js +12 -33
  4. package/package.json +8 -10
  5. package/src/api.js +347 -0
  6. package/src/connect.js +14 -0
  7. package/src/context.js +20 -0
  8. package/src/index.js +14 -303
  9. package/src/inputs.js +24 -0
  10. package/src/{directives → plot}/attributes.js +32 -5
  11. package/src/{directives → plot}/interactors.js +8 -6
  12. package/src/{directives → plot}/legends.js +14 -6
  13. package/src/{directives → plot}/marks.js +18 -13
  14. package/src/plot/named-plots.js +49 -0
  15. package/src/plot/plot.js +9 -0
  16. package/src/directives/plot.js +0 -39
  17. package/src/interactors/Highlight.js +0 -101
  18. package/src/interactors/Interval1D.js +0 -90
  19. package/src/interactors/Interval2D.js +0 -102
  20. package/src/interactors/Nearest.js +0 -66
  21. package/src/interactors/PanZoom.js +0 -121
  22. package/src/interactors/Toggle.js +0 -111
  23. package/src/interactors/util/brush.js +0 -45
  24. package/src/interactors/util/close-to.js +0 -9
  25. package/src/interactors/util/get-field.js +0 -4
  26. package/src/interactors/util/invert.js +0 -3
  27. package/src/interactors/util/patchScreenCTM.js +0 -13
  28. package/src/interactors/util/sanitize-styles.js +0 -9
  29. package/src/interactors/util/to-kebab-case.js +0 -9
  30. package/src/layout/index.js +0 -2
  31. package/src/legend.js +0 -64
  32. package/src/marks/ConnectedMark.js +0 -63
  33. package/src/marks/ContourMark.js +0 -89
  34. package/src/marks/DenseLineMark.js +0 -146
  35. package/src/marks/Density1DMark.js +0 -104
  36. package/src/marks/Density2DMark.js +0 -69
  37. package/src/marks/Grid2DMark.js +0 -191
  38. package/src/marks/HexbinMark.js +0 -88
  39. package/src/marks/Mark.js +0 -195
  40. package/src/marks/RasterMark.js +0 -122
  41. package/src/marks/RasterTileMark.js +0 -332
  42. package/src/marks/RegressionMark.js +0 -117
  43. package/src/marks/util/bin-field.js +0 -17
  44. package/src/marks/util/density.js +0 -226
  45. package/src/marks/util/extent.js +0 -56
  46. package/src/marks/util/grid.js +0 -57
  47. package/src/marks/util/handle-param.js +0 -14
  48. package/src/marks/util/is-arrow-table.js +0 -3
  49. package/src/marks/util/is-color.js +0 -18
  50. package/src/marks/util/is-constant-option.js +0 -40
  51. package/src/marks/util/is-symbol.js +0 -20
  52. package/src/marks/util/raster.js +0 -44
  53. package/src/marks/util/stats.js +0 -133
  54. package/src/marks/util/to-data-array.js +0 -58
  55. package/src/plot-attributes.js +0 -211
  56. package/src/plot-renderer.js +0 -161
  57. package/src/plot.js +0 -136
  58. package/src/spec/parse-data.js +0 -69
  59. package/src/spec/parse-spec.js +0 -422
  60. package/src/spec/to-module.js +0 -465
  61. package/src/spec/util.js +0 -43
  62. package/src/symbols.js +0 -3
  63. package/src/transforms/bin.js +0 -81
  64. package/src/transforms/index.js +0 -3
  65. /package/src/{directives → plot}/data.js +0 -0
@@ -1,18 +1,19 @@
1
- var r9=Object.create;var qw=Object.defineProperty;var i9=Object.getOwnPropertyDescriptor;var o9=Object.getOwnPropertyNames;var s9=Object.getPrototypeOf,a9=Object.prototype.hasOwnProperty;var GA=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),_i=(e,t)=>{for(var n in t)qw(e,n,{get:t[n],enumerable:!0})},c9=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of o9(t))!a9.call(e,i)&&i!==n&&qw(e,i,{get:()=>t[i],enumerable:!(r=i9(t,i))||r.enumerable});return e};var l9=(e,t,n)=>(n=e!=null?r9(s9(e)):{},c9(t||!e||!e.__esModule?qw(n,"default",{value:e,enumerable:!0}):n,e));var VL=GA((JPt,qL)=>{"use strict";function FJ(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 DJ(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 LJ(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 CJ(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 BJ(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 ty(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)}qL.exports={ge:function(e,t,n,r,i){return ty(e,t,n,r,i,FJ)},gt:function(e,t,n,r,i){return ty(e,t,n,r,i,DJ)},lt:function(e,t,n,r,i){return ty(e,t,n,r,i,LJ)},le:function(e,t,n,r,i){return ty(e,t,n,r,i,CJ)},eq:function(e,t,n,r,i){return ty(e,t,n,r,i,BJ)}}});var KL=GA((t$t,ZL)=>{"use strict";var uw=VL(),rd=0,Pl=1,lw=2;ZL.exports=$J;function lA(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 ey=lA.prototype;function aA(e,t){e.mid=t.mid,e.left=t.left,e.right=t.right,e.leftPoints=t.leftPoints,e.rightPoints=t.rightPoints,e.count=t.count}function WL(e,t){var n=id(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 YL(e,t){var n=e.intervals([]);n.push(t),WL(e,n)}function GL(e,t){var n=e.intervals([]),r=n.indexOf(t);return r<0?rd:(n.splice(r,1),WL(e,n),Pl)}ey.intervals=function(e){return e.push.apply(e,this.leftPoints),this.left&&this.left.intervals(e),this.right&&this.right.intervals(e),e};ey.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)?YL(this,e):this.left.insert(e):this.left=id([e]);else if(e[0]>this.mid)this.right?4*(this.right.count+1)>3*(t+1)?YL(this,e):this.right.insert(e):this.right=id([e]);else{var n=uw.ge(this.leftPoints,e,uA),r=uw.ge(this.rightPoints,e,fA);this.leftPoints.splice(n,0,e),this.rightPoints.splice(r,0,e)}};ey.remove=function(e){var t=this.count-this.leftPoints;if(e[1]<this.mid){if(!this.left)return rd;var n=this.right?this.right.count:0;if(4*n>3*(t-1))return GL(this,e);var r=this.left.remove(e);return r===lw?(this.left=null,this.count-=1,Pl):(r===Pl&&(this.count-=1),r)}else if(e[0]>this.mid){if(!this.right)return rd;var i=this.left?this.left.count:0;if(4*i>3*(t-1))return GL(this,e);var r=this.right.remove(e);return r===lw?(this.right=null,this.count-=1,Pl):(r===Pl&&(this.count-=1),r)}else{if(this.count===1)return this.leftPoints[0]===e?lw:rd;if(this.leftPoints.length===1&&this.leftPoints[0]===e){if(this.left&&this.right){for(var o=this,s=this.left;s.right;)o=s,s=s.right;if(o===this)s.right=this.right;else{var a=this.left,r=this.right;o.count-=s.count,o.right=s.left,s.left=a,s.right=r}aA(this,s),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?aA(this,this.left):aA(this,this.right);return Pl}for(var a=uw.ge(this.leftPoints,e,uA);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=uw.ge(this.rightPoints,e,fA);r<this.rightPoints.length&&this.rightPoints[r][1]===e[1];++r)if(this.rightPoints[r]===e)return this.rightPoints.splice(r,1),Pl}return rd}};function XL(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 HL(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 QL(e,t){for(var n=0;n<e.length;++n){var r=t(e[n]);if(r)return r}}ey.queryPoint=function(e,t){if(e<this.mid){if(this.left){var n=this.left.queryPoint(e,t);if(n)return n}return XL(this.leftPoints,e,t)}else if(e>this.mid){if(this.right){var n=this.right.queryPoint(e,t);if(n)return n}return HL(this.rightPoints,e,t)}else return QL(this.leftPoints,t)};ey.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?XL(this.leftPoints,t,n):e>this.mid?HL(this.rightPoints,e,n):QL(this.leftPoints,n)};function PJ(e,t){return e-t}function uA(e,t){var n=e[0]-t[0];return n||e[1]-t[1]}function fA(e,t){var n=e[1]-t[1];return n||e[0]-t[0]}function id(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(PJ);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(uA),l.sort(fA),new lA(r,id(i),id(o),c,l)}function cA(e){this.root=e}var od=cA.prototype;od.insert=function(e){this.root?this.root.insert(e):this.root=new lA(e[0],null,null,[e],[e])};od.remove=function(e){if(this.root){var t=this.root.remove(e);return t===lw&&(this.root=null),t!==rd}return!1};od.queryPoint=function(e,t){if(this.root)return this.root.queryPoint(e,t)};od.queryInterval=function(e,t,n){if(e<=t&&this.root)return this.root.queryInterval(e,t,n)};Object.defineProperty(od,"count",{get:function(){return this.root?this.root.count:0}});Object.defineProperty(od,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}});function $J(e){return!e||e.length===0?new cA(null):new cA(id(e))}});function XA(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 Q(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 WA(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 Rt(e){return this instanceof Rt?(this.v=e,this):new Rt(e)}function Tr(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),i,o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(d){r[d]&&(i[d]=function(h){return new Promise(function(p,y){o.push([d,h,p,y])>1||a(d,h)})})}function a(d,h){try{c(r[d](h))}catch(p){f(o[0][3],p)}}function c(d){d.value instanceof Rt?Promise.resolve(d.value.v).then(l,u):f(o[0][2],d)}function l(d){a("next",d)}function u(d){a("throw",d)}function f(d,h){d(h),o.shift(),o.length&&a(o[0][0],o[0][1])}}function zl(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:Rt(e[i](s)),done:!1}:o?o(s):s}:o}}function wi(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 WA=="function"?WA(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 Hw={};_i(Hw,{compareArrayLike:()=>Xw,joinUint8Arrays:()=>Ar,memcpy:()=>jl,rebaseValueOffsets:()=>wd,toArrayBufferView:()=>Ct,toArrayBufferViewAsyncIterator:()=>Si,toArrayBufferViewIterator:()=>Zi,toBigInt64Array:()=>y9,toBigUint64Array:()=>x9,toFloat32Array:()=>_9,toFloat32ArrayAsyncIterator:()=>C9,toFloat32ArrayIterator:()=>M9,toFloat64Array:()=>w9,toFloat64ArrayAsyncIterator:()=>B9,toFloat64ArrayIterator:()=>N9,toInt16Array:()=>m9,toInt16ArrayAsyncIterator:()=>k9,toInt16ArrayIterator:()=>I9,toInt32Array:()=>bc,toInt32ArrayAsyncIterator:()=>F9,toInt32ArrayIterator:()=>T9,toInt8Array:()=>p9,toInt8ArrayAsyncIterator:()=>O9,toInt8ArrayIterator:()=>S9,toUint16Array:()=>g9,toUint16ArrayAsyncIterator:()=>D9,toUint16ArrayIterator:()=>E9,toUint32Array:()=>b9,toUint32ArrayAsyncIterator:()=>L9,toUint32ArrayIterator:()=>A9,toUint8Array:()=>Et,toUint8ArrayAsyncIterator:()=>Ww,toUint8ArrayIterator:()=>Gw,toUint8ClampedArray:()=>v9,toUint8ClampedArrayAsyncIterator:()=>P9,toUint8ClampedArrayIterator:()=>R9});var u9=new TextDecoder("utf-8"),xd=e=>u9.decode(e),f9=new TextEncoder,ea=e=>f9.encode(e);var d9=e=>typeof e=="number",HA=e=>typeof e=="boolean",Je=e=>typeof e=="function",Vn=e=>e!=null&&Object(e)===e,Er=e=>Vn(e)&&Je(e.then);var vi=e=>Vn(e)&&Je(e[Symbol.iterator]),Hr=e=>Vn(e)&&Je(e[Symbol.asyncIterator]),py=e=>Vn(e)&&Vn(e.schema);var my=e=>Vn(e)&&"done"in e&&"value"in e;var yy=e=>Vn(e)&&Je(e.stat)&&d9(e.fd);var gy=e=>Vn(e)&&_d(e.body),by=e=>"_getDOMStream"in e&&"_getNodeStream"in e,QA=e=>Vn(e)&&Je(e.abort)&&Je(e.getWriter)&&!by(e),_d=e=>Vn(e)&&Je(e.cancel)&&Je(e.getReader)&&!by(e),ZA=e=>Vn(e)&&Je(e.end)&&Je(e.write)&&HA(e.writable)&&!by(e),xy=e=>Vn(e)&&Je(e.read)&&Je(e.pipe)&&HA(e.readable)&&!by(e),KA=e=>Vn(e)&&Je(e.clear)&&Je(e.bytes)&&Je(e.position)&&Je(e.setPosition)&&Je(e.capacity)&&Je(e.getBufferIdentifier)&&Je(e.createLong);var Yw=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function h9(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 jl(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 Ar(e,t){let n=h9(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?jl(s,o,a):s=o;break}jl(s||(s=new Uint8Array(l)),o,a),a+=o.length}return[s||new Uint8Array(0),n.slice(c),r-(s?s.byteLength:0)]}function Ct(e,t){let n=my(t)?t.value:t;return n instanceof e?e===Uint8Array?new e(n.buffer,n.byteOffset,n.byteLength):n:n?(typeof n=="string"&&(n=ea(n)),n instanceof ArrayBuffer?new e(n):n instanceof Yw?new e(n):KA(n)?Ct(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 p9=e=>Ct(Int8Array,e),m9=e=>Ct(Int16Array,e),bc=e=>Ct(Int32Array,e),y9=e=>Ct(BigInt64Array,e),Et=e=>Ct(Uint8Array,e),g9=e=>Ct(Uint16Array,e),b9=e=>Ct(Uint32Array,e),x9=e=>Ct(BigUint64Array,e),_9=e=>Ct(Float32Array,e),w9=e=>Ct(Float64Array,e),v9=e=>Ct(Uint8ClampedArray,e),Vw=e=>(e.next(),e);function*Zi(e,t){let n=function*(i){yield i},r=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Yw?n(t):vi(t)?t:n(t);return yield*Vw(function*(i){let o=null;do o=i.next(yield Ct(e,o));while(!o.done)}(r[Symbol.iterator]())),new e}var S9=e=>Zi(Int8Array,e),I9=e=>Zi(Int16Array,e),T9=e=>Zi(Int32Array,e),Gw=e=>Zi(Uint8Array,e),E9=e=>Zi(Uint16Array,e),A9=e=>Zi(Uint32Array,e),M9=e=>Zi(Float32Array,e),N9=e=>Zi(Float64Array,e),R9=e=>Zi(Uint8ClampedArray,e);function Si(e,t){return Tr(this,arguments,function*(){if(Er(t))return yield Rt(yield Rt(yield*zl(wi(Si(e,yield Rt(t))))));let r=function(s){return Tr(this,arguments,function*(){yield yield Rt(yield Rt(s))})},i=function(s){return Tr(this,arguments,function*(){yield Rt(yield*zl(wi(Vw(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 Yw?r(t):vi(t)?i(t):Hr(t)?t:r(t);return yield Rt(yield*zl(wi(Vw(function(s){return Tr(this,arguments,function*(){let a=null;do a=yield Rt(s.next(yield yield Rt(Ct(e,a))));while(!a.done)})}(o[Symbol.asyncIterator]()))))),yield Rt(new e)})}var O9=e=>Si(Int8Array,e),k9=e=>Si(Int16Array,e),F9=e=>Si(Int32Array,e),Ww=e=>Si(Uint8Array,e),D9=e=>Si(Uint16Array,e),L9=e=>Si(Uint32Array,e),C9=e=>Si(Float32Array,e),B9=e=>Si(Float64Array,e),P9=e=>Si(Uint8ClampedArray,e);function wd(e,t,n){if(e!==0){n=n.slice(0,t+1);for(let r=-1;++r<=t;)n[r]+=e}return n}function Xw(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 wn={fromIterable(e){return _y($9(e))},fromAsyncIterable(e){return _y(U9(e))},fromDOMStream(e){return _y(z9(e))},fromNodeStream(e){return _y(j9(e))},toDOMStream(e,t){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(e,t){throw new Error('"toNodeStream" not available in this environment')}},_y=e=>(e.next(),e);function*$9(e){let t,n=!1,r=[],i,o,s,a=0;function c(){return o==="peek"?Ar(r,s)[0]:([i,r,a]=Ar(r,s),i)}({cmd:o,size:s}=yield null);let l=Gw(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 U9(e){return Tr(this,arguments,function*(){let n,r=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?Ar(i,a)[0]:([o,i,c]=Ar(i,a),o)}({cmd:s,size:a}=yield yield Rt(null));let u=Ww(e)[Symbol.asyncIterator]();try{do if({done:n,value:o}=Number.isNaN(a-c)?yield Rt(u.next()):yield Rt(u.next(a-c)),!n&&o.byteLength>0&&(i.push(o),c+=o.byteLength),n||a<=c)do({cmd:s,size:a}=yield yield Rt(l()));while(a<c);while(!n)}catch(f){(r=!0)&&typeof u.throw=="function"&&(yield Rt(u.throw(f)))}finally{r===!1&&typeof u.return=="function"&&(yield Rt(u.return(new Uint8Array(0))))}return yield Rt(null)})}function z9(e){return Tr(this,arguments,function*(){let n=!1,r=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?Ar(i,a)[0]:([o,i,c]=Ar(i,a),o)}({cmd:s,size:a}=yield yield Rt(null));let u=new Zw(e);try{do if({done:n,value:o}=Number.isNaN(a-c)?yield Rt(u.read()):yield Rt(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 Rt(l()));while(a<c);while(!n)}catch(f){(r=!0)&&(yield Rt(u.cancel(f)))}finally{r===!1?yield Rt(u.cancel()):e.locked&&u.releaseLock()}return yield Rt(null)})}var Zw=class{constructor(t){this.source=t,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch(()=>{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return Q(this,void 0,void 0,function*(){let{reader:n,source:r}=this;n&&(yield n.cancel(t).catch(()=>{})),r&&r.locked&&this.releaseLock()})}read(t){return Q(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};let n=yield this.reader.read();return!n.done&&(n.value=Et(n)),n})}},Qw=(e,t)=>{let n=i=>r([t,i]),r;return[t,n,new Promise(i=>(r=i)&&e.once(t,n))]};function j9(e){return Tr(this,arguments,function*(){let n=[],r="error",i=!1,o=null,s,a,c=0,l=[],u;function f(){return s==="peek"?Ar(l,a)[0]:([u,l,c]=Ar(l,a),u)}if({cmd:s,size:a}=yield yield Rt(null),e.isTTY)return yield yield Rt(new Uint8Array(0)),yield Rt(null);try{n[0]=Qw(e,"end"),n[1]=Qw(e,"error");do{if(n[2]=Qw(e,"readable"),[r,o]=yield Rt(Promise.race(n.map(h=>h[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 Rt(f()));while(a<c)}while(!i)}finally{yield Rt(d(n,r==="error"?o:null))}return yield Rt(null);function d(h,p){return u=l=null,new Promise((y,g)=>{for(let[m,b]of h)e.off(m,b);try{let m=e.destroy;m&&m.call(e,p),p=void 0}catch(m){p=m||p}finally{p!=null?g(p):y()}})}})}var on;(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"})(on||(on={}));var Ee;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(Ee||(Ee={}));var ge;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(ge||(ge={}));var vn;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(vn||(vn={}));var $t;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})($t||($t={}));var Yn;(function(e){e[e.YEAR_MONTH=0]="YEAR_MONTH",e[e.DAY_TIME=1]="DAY_TIME",e[e.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(Yn||(Yn={}));var Zt;(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"})(Zt||(Zt={}));var k;(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.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"})(k||(k={}));var Qr;(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(Qr||(Qr={}));var pv={};_i(pv,{clampIndex:()=>kU,clampRange:()=>Td,createElementComparator:()=>ia});function Ki(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=>Ki(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,n)=>typeof n=="bigint"?`${n}`:n)}var Jw={};_i(Jw,{BN:()=>Sd,bigNumToBigInt:()=>eM,bigNumToString:()=>Yl,isArrowBigNumSymbol:()=>JA});var JA=Symbol.for("isArrowBigNum");function Ii(e,...t){return t.length===0?Object.setPrototypeOf(Ct(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}Ii.prototype[JA]=!0;Ii.prototype.toJSON=function(){return`"${Yl(this)}"`};Ii.prototype.valueOf=function(){return tM(this)};Ii.prototype.toString=function(){return Yl(this)};Ii.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return tM(this);case"string":return Yl(this);case"default":return eM(this)}return Yl(this)};function ql(...e){return Ii.apply(this,e)}function Vl(...e){return Ii.apply(this,e)}function vd(...e){return Ii.apply(this,e)}Object.setPrototypeOf(ql.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(Vl.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(vd.prototype,Object.create(Uint32Array.prototype));Object.assign(ql.prototype,Ii.prototype,{constructor:ql,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(Vl.prototype,Ii.prototype,{constructor:Vl,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(vd.prototype,Ii.prototype,{constructor:vd,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});function tM(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 Yl=e=>{if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return Kw(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return Kw(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`-${Kw(t)}`},eM=e=>e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:Yl(e);function Kw(e){let t="",n=new Uint32Array(2),r=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),i=new Uint32Array((r=new Uint16Array(r).reverse()).buffer),o=-1,s=r.length-1;do{for(n[0]=r[o=0];o<s;)r[o++]=n[1]=n[0]/10,n[0]=(n[0]-n[1]*10<<16)+r[o];r[o]=n[1]=n[0]/10,n[0]=n[0]-n[1]*10,t=`${n[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t??"0"}var Sd=class e{static new(t,n){switch(n){case!0:return new ql(t);case!1:return new Vl(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new ql(t)}return t.byteLength===16?new vd(t):new Vl(t)}static signed(t){return new ql(t)}static unsigned(t){return new Vl(t)}static decimal(t){return new vd(t)}constructor(t,n){return e.new(t,n)}};function cr(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 nM,rM,iM,oM,sM,aM,cM,lM,uM,fM,dM,hM,pM,mM,yM,gM,bM,xM,_M,ht=class e{static isNull(t){return t?.typeId===k.Null}static isInt(t){return t?.typeId===k.Int}static isFloat(t){return t?.typeId===k.Float}static isBinary(t){return t?.typeId===k.Binary}static isUtf8(t){return t?.typeId===k.Utf8}static isBool(t){return t?.typeId===k.Bool}static isDecimal(t){return t?.typeId===k.Decimal}static isDate(t){return t?.typeId===k.Date}static isTime(t){return t?.typeId===k.Time}static isTimestamp(t){return t?.typeId===k.Timestamp}static isInterval(t){return t?.typeId===k.Interval}static isList(t){return t?.typeId===k.List}static isStruct(t){return t?.typeId===k.Struct}static isUnion(t){return t?.typeId===k.Union}static isFixedSizeBinary(t){return t?.typeId===k.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===k.FixedSizeList}static isMap(t){return t?.typeId===k.Map}static isDictionary(t){return t?.typeId===k.Dictionary}static isDenseUnion(t){return e.isUnion(t)&&t.mode===Ee.Dense}static isSparseUnion(t){return e.isUnion(t)&&t.mode===Ee.Sparse}get typeId(){return k.NONE}};nM=Symbol.toStringTag;ht[nM]=(e=>(e.children=null,e.ArrayType=Array,e[Symbol.toStringTag]="DataType"))(ht.prototype);var Gn=class extends ht{toString(){return"Null"}get typeId(){return k.Null}};rM=Symbol.toStringTag;Gn[rM]=(e=>e[Symbol.toStringTag]="Null")(Gn.prototype);var Be=class extends ht{constructor(t,n){super(),this.isSigned=t,this.bitWidth=n}get typeId(){return k.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}`}};iM=Symbol.toStringTag;Be[iM]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(Be.prototype);var wy=class extends Be{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},vy=class extends Be{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},Ji=class extends Be{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},Sy=class extends Be{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},Iy=class extends Be{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},Ty=class extends Be{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},Ey=class extends Be{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},Ay=class extends Be{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(wy.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(vy.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(Ji.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(Sy.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(Iy.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(Ty.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Ey.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(Ay.prototype,"ArrayType",{value:BigUint64Array});var lr=class extends ht{constructor(t){super(),this.precision=t}get typeId(){return k.Float}get ArrayType(){switch(this.precision){case ge.HALF:return Uint16Array;case ge.SINGLE:return Float32Array;case ge.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};oM=Symbol.toStringTag;lr[oM]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(lr.prototype);var My=class extends lr{constructor(){super(ge.HALF)}},Ny=class extends lr{constructor(){super(ge.SINGLE)}},Ry=class extends lr{constructor(){super(ge.DOUBLE)}};Object.defineProperty(My.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Ny.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(Ry.prototype,"ArrayType",{value:Float64Array});var Zo=class extends ht{constructor(){super()}get typeId(){return k.Binary}toString(){return"Binary"}};sM=Symbol.toStringTag;Zo[sM]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(Zo.prototype);var Ko=class extends ht{constructor(){super()}get typeId(){return k.Utf8}toString(){return"Utf8"}};aM=Symbol.toStringTag;Ko[aM]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(Ko.prototype);var Jo=class extends ht{constructor(){super()}get typeId(){return k.Bool}toString(){return"Bool"}};cM=Symbol.toStringTag;Jo[cM]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(Jo.prototype);var ts=class extends ht{constructor(t,n,r=128){super(),this.scale=t,this.precision=n,this.bitWidth=r}get typeId(){return k.Decimal}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};lM=Symbol.toStringTag;ts[lM]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(ts.prototype);var es=class extends ht{constructor(t){super(),this.unit=t}get typeId(){return k.Date}toString(){return`Date${(this.unit+1)*32}<${vn[this.unit]}>`}};uM=Symbol.toStringTag;es[uM]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Date"))(es.prototype);var Ti=class extends ht{constructor(t,n){super(),this.unit=t,this.bitWidth=n}get typeId(){return k.Time}toString(){return`Time${this.bitWidth}<${$t[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};fM=Symbol.toStringTag;Ti[fM]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))(Ti.prototype);var ns=class extends ht{constructor(t,n){super(),this.unit=t,this.timezone=n}get typeId(){return k.Timestamp}toString(){return`Timestamp<${$t[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};dM=Symbol.toStringTag;ns[dM]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Timestamp"))(ns.prototype);var rs=class extends ht{constructor(t){super(),this.unit=t}get typeId(){return k.Interval}toString(){return`Interval<${Yn[this.unit]}>`}};hM=Symbol.toStringTag;rs[hM]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))(rs.prototype);var Ei=class extends ht{constructor(t){super(),this.children=[t]}get typeId(){return k.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}};pM=Symbol.toStringTag;Ei[pM]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(Ei.prototype);var me=class extends ht{constructor(t){super(),this.children=t}get typeId(){return k.Struct}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};mM=Symbol.toStringTag;me[mM]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(me.prototype);var Ai=class extends ht{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 k.Union}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};yM=Symbol.toStringTag;Ai[yM]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(Ai.prototype);var is=class extends ht{constructor(t){super(),this.byteWidth=t}get typeId(){return k.FixedSizeBinary}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};gM=Symbol.toStringTag;is[gM]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(is.prototype);var Mi=class extends ht{constructor(t,n){super(),this.listSize=t,this.children=[n]}get typeId(){return k.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}>`}};bM=Symbol.toStringTag;Mi[bM]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(Mi.prototype);var Ni=class extends ht{constructor(t,n=!1){super(),this.children=[t],this.keysSorted=n}get typeId(){return k.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(", ")}}>`}};xM=Symbol.toStringTag;Ni[xM]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(Ni.prototype);var q9=(e=>()=>++e)(-1),Mr=class extends ht{constructor(t,n,r,i){super(),this.indices=n,this.dictionary=t,this.isOrdered=i||!1,this.id=r==null?q9():cr(r)}get typeId(){return k.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}>`}};_M=Symbol.toStringTag;Mr[_M]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(Mr.prototype);function Nr(e){let t=e;switch(e.typeId){case k.Decimal:return e.bitWidth/32;case k.Timestamp:return 2;case k.Date:return 1+t.unit;case k.Interval:return 1+t.unit;case k.FixedSizeList:return t.listSize;case k.FixedSizeBinary:return t.byteWidth;default:return 1}}var gt=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 V9(this,t,n)}getVisitFnByTypeId(t,n=!0){return Gl(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}visitFixedSizeList(t,...n){return null}visitMap(t,...n){return null}};function V9(e,t,n=!0){return typeof t=="number"?Gl(e,t,n):typeof t=="string"&&t in k?Gl(e,k[t],n):t&&t instanceof ht?Gl(e,wM(t),n):t?.type&&t.type instanceof ht?Gl(e,wM(t.type),n):Gl(e,k.NONE,n)}function Gl(e,t,n=!0){let r=null;switch(t){case k.Null:r=e.visitNull;break;case k.Bool:r=e.visitBool;break;case k.Int:r=e.visitInt;break;case k.Int8:r=e.visitInt8||e.visitInt;break;case k.Int16:r=e.visitInt16||e.visitInt;break;case k.Int32:r=e.visitInt32||e.visitInt;break;case k.Int64:r=e.visitInt64||e.visitInt;break;case k.Uint8:r=e.visitUint8||e.visitInt;break;case k.Uint16:r=e.visitUint16||e.visitInt;break;case k.Uint32:r=e.visitUint32||e.visitInt;break;case k.Uint64:r=e.visitUint64||e.visitInt;break;case k.Float:r=e.visitFloat;break;case k.Float16:r=e.visitFloat16||e.visitFloat;break;case k.Float32:r=e.visitFloat32||e.visitFloat;break;case k.Float64:r=e.visitFloat64||e.visitFloat;break;case k.Utf8:r=e.visitUtf8;break;case k.Binary:r=e.visitBinary;break;case k.FixedSizeBinary:r=e.visitFixedSizeBinary;break;case k.Date:r=e.visitDate;break;case k.DateDay:r=e.visitDateDay||e.visitDate;break;case k.DateMillisecond:r=e.visitDateMillisecond||e.visitDate;break;case k.Timestamp:r=e.visitTimestamp;break;case k.TimestampSecond:r=e.visitTimestampSecond||e.visitTimestamp;break;case k.TimestampMillisecond:r=e.visitTimestampMillisecond||e.visitTimestamp;break;case k.TimestampMicrosecond:r=e.visitTimestampMicrosecond||e.visitTimestamp;break;case k.TimestampNanosecond:r=e.visitTimestampNanosecond||e.visitTimestamp;break;case k.Time:r=e.visitTime;break;case k.TimeSecond:r=e.visitTimeSecond||e.visitTime;break;case k.TimeMillisecond:r=e.visitTimeMillisecond||e.visitTime;break;case k.TimeMicrosecond:r=e.visitTimeMicrosecond||e.visitTime;break;case k.TimeNanosecond:r=e.visitTimeNanosecond||e.visitTime;break;case k.Decimal:r=e.visitDecimal;break;case k.List:r=e.visitList;break;case k.Struct:r=e.visitStruct;break;case k.Union:r=e.visitUnion;break;case k.DenseUnion:r=e.visitDenseUnion||e.visitUnion;break;case k.SparseUnion:r=e.visitSparseUnion||e.visitUnion;break;case k.Dictionary:r=e.visitDictionary;break;case k.Interval:r=e.visitInterval;break;case k.IntervalDayTime:r=e.visitIntervalDayTime||e.visitInterval;break;case k.IntervalYearMonth:r=e.visitIntervalYearMonth||e.visitInterval;break;case k.FixedSizeList:r=e.visitFixedSizeList;break;case k.Map:r=e.visitMap;break}if(typeof r=="function")return r;if(!n)return()=>null;throw new Error(`Unrecognized type '${k[t]}'`)}function wM(e){switch(e.typeId){case k.Null:return k.Null;case k.Int:{let{bitWidth:t,isSigned:n}=e;switch(t){case 8:return n?k.Int8:k.Uint8;case 16:return n?k.Int16:k.Uint16;case 32:return n?k.Int32:k.Uint32;case 64:return n?k.Int64:k.Uint64}return k.Int}case k.Float:switch(e.precision){case ge.HALF:return k.Float16;case ge.SINGLE:return k.Float32;case ge.DOUBLE:return k.Float64}return k.Float;case k.Binary:return k.Binary;case k.Utf8:return k.Utf8;case k.Bool:return k.Bool;case k.Decimal:return k.Decimal;case k.Time:switch(e.unit){case $t.SECOND:return k.TimeSecond;case $t.MILLISECOND:return k.TimeMillisecond;case $t.MICROSECOND:return k.TimeMicrosecond;case $t.NANOSECOND:return k.TimeNanosecond}return k.Time;case k.Timestamp:switch(e.unit){case $t.SECOND:return k.TimestampSecond;case $t.MILLISECOND:return k.TimestampMillisecond;case $t.MICROSECOND:return k.TimestampMicrosecond;case $t.NANOSECOND:return k.TimestampNanosecond}return k.Timestamp;case k.Date:switch(e.unit){case vn.DAY:return k.DateDay;case vn.MILLISECOND:return k.DateMillisecond}return k.Date;case k.Interval:switch(e.unit){case Yn.DAY_TIME:return k.IntervalDayTime;case Yn.YEAR_MONTH:return k.IntervalYearMonth}return k.Interval;case k.Map:return k.Map;case k.List:return k.List;case k.Struct:return k.Struct;case k.Union:switch(e.mode){case Ee.Dense:return k.DenseUnion;case Ee.Sparse:return k.SparseUnion}return k.Union;case k.FixedSizeBinary:return k.FixedSizeBinary;case k.FixedSizeList:return k.FixedSizeList;case k.Dictionary:return k.Dictionary}throw new Error(`Unrecognized type '${k[e.typeId]}'`)}gt.prototype.visitInt8=null;gt.prototype.visitInt16=null;gt.prototype.visitInt32=null;gt.prototype.visitInt64=null;gt.prototype.visitUint8=null;gt.prototype.visitUint16=null;gt.prototype.visitUint32=null;gt.prototype.visitUint64=null;gt.prototype.visitFloat16=null;gt.prototype.visitFloat32=null;gt.prototype.visitFloat64=null;gt.prototype.visitDateDay=null;gt.prototype.visitDateMillisecond=null;gt.prototype.visitTimestampSecond=null;gt.prototype.visitTimestampMillisecond=null;gt.prototype.visitTimestampMicrosecond=null;gt.prototype.visitTimestampNanosecond=null;gt.prototype.visitTimeSecond=null;gt.prototype.visitTimeMillisecond=null;gt.prototype.visitTimeMicrosecond=null;gt.prototype.visitTimeNanosecond=null;gt.prototype.visitDenseUnion=null;gt.prototype.visitSparseUnion=null;gt.prototype.visitIntervalDayTime=null;gt.prototype.visitIntervalYearMonth=null;var tv={};_i(tv,{float64ToUint16:()=>Id,uint16ToFloat64:()=>Oy});var vM=new Float64Array(1),Wl=new Uint32Array(vM.buffer);function Oy(e){let t=(e&31744)>>10,n=(e&1023)/1024,r=Math.pow(-1,(e&32768)>>15);switch(t){case 31:return r*(n?Number.NaN:1/0);case 0:return r*(n?6103515625e-14*n:0)}return r*Math.pow(2,t-15)*(1+n)}function Id(e){if(e!==e)return 32256;vM[0]=e;let t=(Wl[1]&2147483648)>>16&65535,n=Wl[1]&2146435072,r=0;return n>=1089470464?Wl[0]>0?n=31744:(n=(n&2080374784)>>16,r=(Wl[1]&1048575)>>10):n<=1056964608?(r=1048576+(Wl[1]&1048575),r=1048576+(r<<(n>>20)-998)>>21,n=0):(n=n-1056964608>>10,r=(Wl[1]&1048575)+512>>10),t|n|r&65535}var At=class extends gt{};function Lt(e){return(t,n,r)=>{if(t.setValid(n,r!=null))return e(t,n,r)}}var Y9=(e,t,n)=>{e[t]=Math.trunc(n/864e5)},ev=(e,t,n)=>{e[t]=Math.trunc(n%4294967296),e[t+1]=Math.trunc(n/4294967296)},G9=(e,t,n)=>{e[t]=Math.trunc(n*1e3%4294967296),e[t+1]=Math.trunc(n*1e3/4294967296)},W9=(e,t,n)=>{e[t]=Math.trunc(n*1e6%4294967296),e[t+1]=Math.trunc(n*1e6/4294967296)},SM=(e,t,n,r)=>{if(n+1<t.length){let{[n]:i,[n+1]:o}=t;e.set(r.subarray(0,o-i),i)}},X9=({offset:e,values:t},n,r)=>{let i=e+n;r?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},os=({values:e},t,n)=>{e[t]=n},nv=({values:e},t,n)=>{e[t]=n},IM=({values:e},t,n)=>{e[t]=Id(n)},H9=(e,t,n)=>{switch(e.type.precision){case ge.HALF:return IM(e,t,n);case ge.SINGLE:case ge.DOUBLE:return nv(e,t,n)}},ky=({values:e},t,n)=>{Y9(e,t,n.valueOf())},Fy=({values:e},t,n)=>{ev(e,t*2,n.valueOf())},rv=({stride:e,values:t},n,r)=>{t.set(r.subarray(0,e),e*n)},Q9=({values:e,valueOffsets:t},n,r)=>SM(e,t,n,r),Z9=({values:e,valueOffsets:t},n,r)=>{SM(e,t,n,ea(r))},iv=(e,t,n)=>{e.type.unit===vn.DAY?ky(e,t,n):Fy(e,t,n)},Dy=({values:e},t,n)=>ev(e,t*2,n/1e3),Ly=({values:e},t,n)=>ev(e,t*2,n),Cy=({values:e},t,n)=>G9(e,t*2,n),By=({values:e},t,n)=>W9(e,t*2,n),ov=(e,t,n)=>{switch(e.type.unit){case $t.SECOND:return Dy(e,t,n);case $t.MILLISECOND:return Ly(e,t,n);case $t.MICROSECOND:return Cy(e,t,n);case $t.NANOSECOND:return By(e,t,n)}},Py=({values:e},t,n)=>{e[t]=n},$y=({values:e},t,n)=>{e[t]=n},Uy=({values:e},t,n)=>{e[t]=n},zy=({values:e},t,n)=>{e[t]=n},sv=(e,t,n)=>{switch(e.type.unit){case $t.SECOND:return Py(e,t,n);case $t.MILLISECOND:return $y(e,t,n);case $t.MICROSECOND:return Uy(e,t,n);case $t.NANOSECOND:return zy(e,t,n)}},av=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},K9=(e,t,n)=>{let r=e.children[0],i=e.valueOffsets,o=Sn.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))},J9=(e,t,n)=>{let r=e.children[0],{valueOffsets:i}=e,o=Sn.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},tU=(e,t)=>(n,r,i,o)=>r&&n(r,e,t[o]),eU=(e,t)=>(n,r,i,o)=>r&&n(r,e,t.get(o)),nU=(e,t)=>(n,r,i,o)=>r&&n(r,e,t.get(i.name)),rU=(e,t)=>(n,r,i,o)=>r&&n(r,e,t[i.name]),iU=(e,t,n)=>{let r=e.type.children.map(o=>Sn.getVisitFn(o.type)),i=n instanceof Map?nU(t,n):n instanceof qt?eU(t,n):Array.isArray(n)?tU(t,n):rU(t,n);e.type.children.forEach((o,s)=>i(r[s],e.children[s],o,s))},oU=(e,t,n)=>{e.type.mode===Ee.Dense?TM(e,t,n):EM(e,t,n)},TM=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];Sn.visit(i,e.valueOffsets[t],n)},EM=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];Sn.visit(i,t,n)},sU=(e,t,n)=>{var r;(r=e.dictionary)===null||r===void 0||r.set(e.values[t],n)},cv=(e,t,n)=>{e.type.unit===Yn.DAY_TIME?jy(e,t,n):qy(e,t,n)},jy=({values:e},t,n)=>{e.set(n.subarray(0,2),2*t)},qy=({values:e},t,n)=>{e[t]=n[0]*12+n[1]%12},aU=(e,t,n)=>{let{stride:r}=e,i=e.children[0],o=Sn.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))};At.prototype.visitBool=Lt(X9);At.prototype.visitInt=Lt(os);At.prototype.visitInt8=Lt(os);At.prototype.visitInt16=Lt(os);At.prototype.visitInt32=Lt(os);At.prototype.visitInt64=Lt(os);At.prototype.visitUint8=Lt(os);At.prototype.visitUint16=Lt(os);At.prototype.visitUint32=Lt(os);At.prototype.visitUint64=Lt(os);At.prototype.visitFloat=Lt(H9);At.prototype.visitFloat16=Lt(IM);At.prototype.visitFloat32=Lt(nv);At.prototype.visitFloat64=Lt(nv);At.prototype.visitUtf8=Lt(Z9);At.prototype.visitBinary=Lt(Q9);At.prototype.visitFixedSizeBinary=Lt(rv);At.prototype.visitDate=Lt(iv);At.prototype.visitDateDay=Lt(ky);At.prototype.visitDateMillisecond=Lt(Fy);At.prototype.visitTimestamp=Lt(ov);At.prototype.visitTimestampSecond=Lt(Dy);At.prototype.visitTimestampMillisecond=Lt(Ly);At.prototype.visitTimestampMicrosecond=Lt(Cy);At.prototype.visitTimestampNanosecond=Lt(By);At.prototype.visitTime=Lt(sv);At.prototype.visitTimeSecond=Lt(Py);At.prototype.visitTimeMillisecond=Lt($y);At.prototype.visitTimeMicrosecond=Lt(Uy);At.prototype.visitTimeNanosecond=Lt(zy);At.prototype.visitDecimal=Lt(av);At.prototype.visitList=Lt(K9);At.prototype.visitStruct=Lt(iU);At.prototype.visitUnion=Lt(oU);At.prototype.visitDenseUnion=Lt(TM);At.prototype.visitSparseUnion=Lt(EM);At.prototype.visitDictionary=Lt(sU);At.prototype.visitInterval=Lt(cv);At.prototype.visitIntervalDayTime=Lt(jy);At.prototype.visitIntervalYearMonth=Lt(qy);At.prototype.visitFixedSizeList=Lt(aU);At.prototype.visitMap=Lt(J9);var Sn=new At;var Ri=Symbol.for("parent"),Xl=Symbol.for("rowIndex"),na=class{constructor(t,n){return this[Ri]=t,this[Xl]=n,new Proxy(this,new uv)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Xl],n=this[Ri],r=n.type.children,i={};for(let o=-1,s=r.length;++o<s;)i[r[o].name]=qe.visit(n.children[o],t);return i}toString(){return`{${[...this].map(([t,n])=>`${Ki(t)}: ${Ki(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new lv(this[Ri],this[Xl])}},lv=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,qe.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(na.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Ri]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Xl]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var uv=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Ri].type.children.map(n=>n.name)}has(t,n){return t[Ri].type.children.findIndex(r=>r.name===n)!==-1}getOwnPropertyDescriptor(t,n){if(t[Ri].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[Ri].type.children.findIndex(i=>i.name===n);if(r!==-1){let i=qe.visit(t[Ri].children[r],t[Xl]);return Reflect.set(t,n,i),i}}set(t,n,r){let i=t[Ri].type.children.findIndex(o=>o.name===n);return i!==-1?(Sn.visit(t[Ri].children[i],t[Xl],r),Reflect.set(t,n,r)):Reflect.has(t,n)||typeof n=="symbol"?Reflect.set(t,n,r):!1}};var _t=class extends gt{};function Ft(e){return(t,n)=>t.getValid(n)?e(t,n):null}var cU=(e,t)=>864e5*e[t],fv=(e,t)=>4294967296*e[t+1]+(e[t]>>>0),lU=(e,t)=>4294967296*(e[t+1]/1e3)+(e[t]>>>0)/1e3,uU=(e,t)=>4294967296*(e[t+1]/1e6)+(e[t]>>>0)/1e6,AM=e=>new Date(e),fU=(e,t)=>AM(cU(e,t)),dU=(e,t)=>AM(fv(e,t)),hU=(e,t)=>null,MM=(e,t,n)=>{if(n+1>=t.length)return null;let r=t[n],i=t[n+1];return e.subarray(r,i)},pU=({offset:e,values:t},n)=>{let r=e+n;return(t[r>>3]&1<<r%8)!==0},NM=({values:e},t)=>fU(e,t),RM=({values:e},t)=>dU(e,t*2),ra=({stride:e,values:t},n)=>t[e*n],mU=({stride:e,values:t},n)=>Oy(t[e*n]),OM=({values:e},t)=>e[t],yU=({stride:e,values:t},n)=>t.subarray(e*n,e*(n+1)),gU=({values:e,valueOffsets:t},n)=>MM(e,t,n),bU=({values:e,valueOffsets:t},n)=>{let r=MM(e,t,n);return r!==null?xd(r):null},xU=({values:e},t)=>e[t],_U=({type:e,values:t},n)=>e.precision!==ge.HALF?t[n]:Oy(t[n]),wU=(e,t)=>e.type.unit===vn.DAY?NM(e,t):RM(e,t),kM=({values:e},t)=>1e3*fv(e,t*2),FM=({values:e},t)=>fv(e,t*2),DM=({values:e},t)=>lU(e,t*2),LM=({values:e},t)=>uU(e,t*2),vU=(e,t)=>{switch(e.type.unit){case $t.SECOND:return kM(e,t);case $t.MILLISECOND:return FM(e,t);case $t.MICROSECOND:return DM(e,t);case $t.NANOSECOND:return LM(e,t)}},CM=({values:e},t)=>e[t],BM=({values:e},t)=>e[t],PM=({values:e},t)=>e[t],$M=({values:e},t)=>e[t],SU=(e,t)=>{switch(e.type.unit){case $t.SECOND:return CM(e,t);case $t.MILLISECOND:return BM(e,t);case $t.MICROSECOND:return PM(e,t);case $t.NANOSECOND:return $M(e,t)}},IU=({values:e,stride:t},n)=>Sd.decimal(e.subarray(t*n,t*(n+1))),TU=(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 qt([c])},EU=(e,t)=>{let{valueOffsets:n,children:r}=e,{[t]:i,[t+1]:o}=n,s=r[0];return new to(s.slice(i,o-i))},AU=(e,t)=>new na(e,t),MU=(e,t)=>e.type.mode===Ee.Dense?UM(e,t):zM(e,t),UM=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return qe.visit(r,e.valueOffsets[t])},zM=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return qe.visit(r,t)},NU=(e,t)=>{var n;return(n=e.dictionary)===null||n===void 0?void 0:n.get(e.values[t])},RU=(e,t)=>e.type.unit===Yn.DAY_TIME?jM(e,t):qM(e,t),jM=({values:e},t)=>e.subarray(2*t,2*(t+1)),qM=({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},OU=(e,t)=>{let{stride:n,children:r}=e,o=r[0].slice(t*n,n);return new qt([o])};_t.prototype.visitNull=Ft(hU);_t.prototype.visitBool=Ft(pU);_t.prototype.visitInt=Ft(xU);_t.prototype.visitInt8=Ft(ra);_t.prototype.visitInt16=Ft(ra);_t.prototype.visitInt32=Ft(ra);_t.prototype.visitInt64=Ft(OM);_t.prototype.visitUint8=Ft(ra);_t.prototype.visitUint16=Ft(ra);_t.prototype.visitUint32=Ft(ra);_t.prototype.visitUint64=Ft(OM);_t.prototype.visitFloat=Ft(_U);_t.prototype.visitFloat16=Ft(mU);_t.prototype.visitFloat32=Ft(ra);_t.prototype.visitFloat64=Ft(ra);_t.prototype.visitUtf8=Ft(bU);_t.prototype.visitBinary=Ft(gU);_t.prototype.visitFixedSizeBinary=Ft(yU);_t.prototype.visitDate=Ft(wU);_t.prototype.visitDateDay=Ft(NM);_t.prototype.visitDateMillisecond=Ft(RM);_t.prototype.visitTimestamp=Ft(vU);_t.prototype.visitTimestampSecond=Ft(kM);_t.prototype.visitTimestampMillisecond=Ft(FM);_t.prototype.visitTimestampMicrosecond=Ft(DM);_t.prototype.visitTimestampNanosecond=Ft(LM);_t.prototype.visitTime=Ft(SU);_t.prototype.visitTimeSecond=Ft(CM);_t.prototype.visitTimeMillisecond=Ft(BM);_t.prototype.visitTimeMicrosecond=Ft(PM);_t.prototype.visitTimeNanosecond=Ft($M);_t.prototype.visitDecimal=Ft(IU);_t.prototype.visitList=Ft(TU);_t.prototype.visitStruct=Ft(AU);_t.prototype.visitUnion=Ft(MU);_t.prototype.visitDenseUnion=Ft(UM);_t.prototype.visitSparseUnion=Ft(zM);_t.prototype.visitDictionary=Ft(NU);_t.prototype.visitInterval=Ft(RU);_t.prototype.visitIntervalDayTime=Ft(jM);_t.prototype.visitIntervalYearMonth=Ft(qM);_t.prototype.visitFixedSizeList=Ft(OU);_t.prototype.visitMap=Ft(EU);var qe=new _t;var Zr=Symbol.for("keys"),Hl=Symbol.for("vals"),to=class{constructor(t){return this[Zr]=new qt([t.children[0]]).memoize(),this[Hl]=t.children[1],new Proxy(this,new hv)}[Symbol.iterator](){return new dv(this[Zr],this[Hl])}get size(){return this[Zr].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Zr],n=this[Hl],r={};for(let i=-1,o=t.length;++i<o;)r[t.get(i)]=qe.visit(n,i);return r}toString(){return`{${[...this].map(([t,n])=>`${Ki(t)}: ${Ki(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},dv=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),qe.visit(this.vals,t)]})}},hv=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Zr].toArray().map(String)}has(t,n){return t[Zr].includes(n)}getOwnPropertyDescriptor(t,n){if(t[Zr].indexOf(n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,n){if(Reflect.has(t,n))return t[n];let r=t[Zr].indexOf(n);if(r!==-1){let i=qe.visit(Reflect.get(t,Hl),r);return Reflect.set(t,n,i),i}}set(t,n,r){let i=t[Zr].indexOf(n);return i!==-1?(Sn.visit(Reflect.get(t,Hl),i,r),Reflect.set(t,n,r)):Reflect.has(t,n)?Reflect.set(t,n,r):!1}};Object.defineProperties(to.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Zr]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Hl]:{writable:!0,enumerable:!1,configurable:!1,value:null}});function kU(e,t,n){let r=e.length,i=t>-1?t:r+t%r;return n?n(e,i):i}var VM;function Td(e,t,n,r){let{length:i=0}=e,o=typeof t!="number"?0:t,s=typeof n!="number"?i:n;return o<0&&(o=(o%i+i)%i),s<0&&(s=(s%i+i)%i),s<o&&(VM=o,o=s,s=VM),s>i&&(s=i),r?r(e,o,s):[o,s]}var YM=e=>e!==e;function ia(e){if(typeof e!=="object"||e===null)return YM(e)?YM: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?Xw(e,n):!1:e instanceof Map?DU(e):Array.isArray(e)?FU(e):e instanceof qt?LU(e):CU(e,!0)}function FU(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=ia(e[n]);return Vy(t)}function DU(e){let t=-1,n=[];for(let r of e.values())n[++t]=ia(r);return Vy(n)}function LU(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=ia(e.get(n));return Vy(t)}function CU(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]=ia(e[n[i]]);return Vy(r,n)}function Vy(e,t){return n=>{if(!n||typeof n!="object")return!1;switch(n.constructor){case Array:return BU(e,n);case Map:return GM(e,n,n.keys());case to:case na:case Object:case void 0:return GM(e,n,t||Object.keys(n))}return n instanceof qt?PU(e,n):!1}}function BU(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 PU(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 GM(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 mv={};_i(mv,{BitIterator:()=>xc,getBit:()=>WM,getBool:()=>Gy,packBools:()=>_c,popcnt_array:()=>XM,popcnt_bit_range:()=>Ed,popcnt_uint32:()=>Yy,setBool:()=>$U,truncateBitmap:()=>Ql});function Gy(e,t,n,r){return(n&1<<r)!==0}function WM(e,t,n,r){return(n&1<<r)>>r}function $U(e,t,n){return n?!!(e[t>>3]|=1<<t%8)||!0:!(e[t>>3]&=~(1<<t%8))&&!1}function Ql(e,t,n){let r=n.byteLength+7&-8;if(e>0||n.byteLength<r){let i=new Uint8Array(r);return i.set(e%8===0?n.subarray(e>>3):_c(new xc(n,e,t,null,Gy)).subarray(0,r)),i}return n}function _c(e){let t=[],n=0,r=0,i=0;for(let s of e)s&&(i|=1<<r),++r===8&&(t[n++]=i,i=r=0);(n===0||r>0)&&(t[n++]=i);let o=new Uint8Array(t.length+7&-8);return o.set(t),o}var xc=class{constructor(t,n,r,i,o){this.bytes=t,this.length=r,this.context=i,this.get=o,this.bit=n%8,this.byteIndex=n>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}};function Ed(e,t,n){if(n-t<=0)return 0;if(n-t<8){let o=0;for(let s of new xc(e,t,n-t,e,WM))o+=s;return o}let r=n>>3<<3,i=t+(t%8===0?0:8-t%8);return Ed(e,t,i)+Ed(e,r,n)+XM(e,i>>3,r-i>>3)}function XM(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+=Yy(o.getUint32(i)),i+=4;for(;s-i>=2;)r+=Yy(o.getUint16(i)),i+=2;for(;s-i>=1;)r+=Yy(o.getUint8(i)),i+=1;return r}function Yy(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 UU=-1,le=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 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(){let t=this._nullCount,n;return t<=UU&&(n=this.nullBitmap)&&(this._nullCount=t=this.length-Ed(n,this.offset,this.offset+this.length)),t}constructor(t,n,r,i,o,s=[],a){this.type=t,this.children=s,this.dictionary=a,this.offset=Math.floor(Math.max(n||0,0)),this.length=Math.floor(Math.max(r||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let c;o instanceof e?(this.stride=o.stride,this.values=o.values,this.typeIds=o.typeIds,this.nullBitmap=o.nullBitmap,this.valueOffsets=o.valueOffsets):(this.stride=Nr(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))),this.nullable=this._nullCount!==0&&this.nullBitmap&&this.nullBitmap.byteLength>0}getValid(t){if(this.nullable&&this.nullCount>0){let n=this.offset+t;return(this.nullBitmap[n>>3]&1<<n%8)!==0}return!0}setValid(t,n){if(!this.nullable)return n;if(!this.nullBitmap||this.nullBitmap.byteLength<=t>>3){let{nullBitmap:c}=this._changeLengthAndBackfillNullBitmap(this.length);Object.assign(this,{nullBitmap:c,_nullCount:0})}let{nullBitmap:r,offset:i}=this,o=i+t>>3,s=(i+t)%8,a=r[o]>>s&1;return n?a===0&&(r[o]|=1<<s,this._nullCount=this.nullCount+1):a===1&&(r[o]&=~(1<<s),this._nullCount=this.nullCount-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===k.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(Ql(this.offset,n,this.nullBitmap),0);let o=this.buffers;return o[Qr.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[Qr.TYPE])&&(s[Qr.TYPE]=o.subarray(t,t+n)),(o=s[Qr.OFFSET])&&(s[Qr.OFFSET]=o.subarray(t,t+n+1))||(o=s[Qr.DATA])&&(s[Qr.DATA]=i===6?o:o.subarray(r*t,r*(t+n))),s}_sliceChildren(t,n,r){return t.map(i=>i.slice(n,r))}};le.prototype.children=Object.freeze([]);var yv=class e extends gt{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:n,["offset"]:r=0,["length"]:i=0}=t;return new le(n,r,i,0)}visitBool(t){let{["type"]:n,["offset"]:r=0}=t,i=Et(t.nullBitmap),o=Ct(n.ArrayType,t.data),{["length"]:s=o.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new le(n,r,s,a,[void 0,o,i])}visitInt(t){let{["type"]:n,["offset"]:r=0}=t,i=Et(t.nullBitmap),o=Ct(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new le(n,r,s,a,[void 0,o,i])}visitFloat(t){let{["type"]:n,["offset"]:r=0}=t,i=Et(t.nullBitmap),o=Ct(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new le(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=bc(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new le(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=bc(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new le(n,r,a,c,[s,i,o])}visitFixedSizeBinary(t){let{["type"]:n,["offset"]:r=0}=t,i=Et(t.nullBitmap),o=Ct(n.ArrayType,t.data),{["length"]:s=o.length/Nr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new le(n,r,s,a,[void 0,o,i])}visitDate(t){let{["type"]:n,["offset"]:r=0}=t,i=Et(t.nullBitmap),o=Ct(n.ArrayType,t.data),{["length"]:s=o.length/Nr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new le(n,r,s,a,[void 0,o,i])}visitTimestamp(t){let{["type"]:n,["offset"]:r=0}=t,i=Et(t.nullBitmap),o=Ct(n.ArrayType,t.data),{["length"]:s=o.length/Nr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new le(n,r,s,a,[void 0,o,i])}visitTime(t){let{["type"]:n,["offset"]:r=0}=t,i=Et(t.nullBitmap),o=Ct(n.ArrayType,t.data),{["length"]:s=o.length/Nr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new le(n,r,s,a,[void 0,o,i])}visitDecimal(t){let{["type"]:n,["offset"]:r=0}=t,i=Et(t.nullBitmap),o=Ct(n.ArrayType,t.data),{["length"]:s=o.length/Nr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new le(n,r,s,a,[void 0,o,i])}visitList(t){let{["type"]:n,["offset"]:r=0,["child"]:i}=t,o=Et(t.nullBitmap),s=bc(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new le(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 le(n,r,s,a,[void 0,void 0,o],i)}visitUnion(t){let{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,o=Et(t.nullBitmap),s=Ct(n.ArrayType,t.typeIds),{["length"]:a=s.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;if(ht.isSparseUnion(n))return new le(n,r,a,c,[void 0,void 0,o,s],i);let l=bc(t.valueOffsets);return new le(n,r,a,c,[l,void 0,o,s],i)}visitDictionary(t){let{["type"]:n,["offset"]:r=0}=t,i=Et(t.nullBitmap),o=Ct(n.indices.ArrayType,t.data),{["dictionary"]:s=new qt([new e().visit({type:n.dictionary})])}=t,{["length"]:a=o.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new le(n,r,a,c,[void 0,o,i],[],s)}visitInterval(t){let{["type"]:n,["offset"]:r=0}=t,i=Et(t.nullBitmap),o=Ct(n.ArrayType,t.data),{["length"]:s=o.length/Nr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new le(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/Nr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new le(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=bc(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new le(n,r,a,c,[s,void 0,o],[i])}};function Ot(e){return new yv().visit(e)}var Ad=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 Wy(e){return e.reduce((t,n)=>t+n.nullCount,0)}function Xy(e){return e.reduce((t,n,r)=>(t[r+1]=t[r]+n.length,t),new Uint32Array(e.length+1))}function Hy(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 gv(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 Md(e,t){return e.getValid(t)}function oa(e){function t(n,r,i){return e(n[r],i)}return function(n){let r=this.data;return gv(r,this._offsets,n,t)}}function Qy(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=gv(o,this._offsets,r,n);return t=void 0,s}}function Zy(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):gv(o,this._offsets,i,n);return t=void 0,s}}var wt=class extends gt{};function zU(e,t){return t===null&&e.length>0?0:-1}function jU(e,t){let{nullBitmap:n}=e;if(!n||e.nullCount<=0)return-1;let r=0;for(let i of new xc(n,e.offset+(t||0),e.length,n,Gy)){if(!i)return r;++r}return-1}function Bt(e,t,n){if(t===void 0)return-1;if(t===null)return jU(e,n);let r=qe.getVisitFn(e),i=ia(t);for(let o=(n||0)-1,s=e.length;++o<s;)if(i(r(e,o)))return o;return-1}function HM(e,t,n){let r=qe.getVisitFn(e),i=ia(t);for(let o=(n||0)-1,s=e.length;++o<s;)if(i(r(e,o)))return o;return-1}wt.prototype.visitNull=zU;wt.prototype.visitBool=Bt;wt.prototype.visitInt=Bt;wt.prototype.visitInt8=Bt;wt.prototype.visitInt16=Bt;wt.prototype.visitInt32=Bt;wt.prototype.visitInt64=Bt;wt.prototype.visitUint8=Bt;wt.prototype.visitUint16=Bt;wt.prototype.visitUint32=Bt;wt.prototype.visitUint64=Bt;wt.prototype.visitFloat=Bt;wt.prototype.visitFloat16=Bt;wt.prototype.visitFloat32=Bt;wt.prototype.visitFloat64=Bt;wt.prototype.visitUtf8=Bt;wt.prototype.visitBinary=Bt;wt.prototype.visitFixedSizeBinary=Bt;wt.prototype.visitDate=Bt;wt.prototype.visitDateDay=Bt;wt.prototype.visitDateMillisecond=Bt;wt.prototype.visitTimestamp=Bt;wt.prototype.visitTimestampSecond=Bt;wt.prototype.visitTimestampMillisecond=Bt;wt.prototype.visitTimestampMicrosecond=Bt;wt.prototype.visitTimestampNanosecond=Bt;wt.prototype.visitTime=Bt;wt.prototype.visitTimeSecond=Bt;wt.prototype.visitTimeMillisecond=Bt;wt.prototype.visitTimeMicrosecond=Bt;wt.prototype.visitTimeNanosecond=Bt;wt.prototype.visitDecimal=Bt;wt.prototype.visitList=Bt;wt.prototype.visitStruct=Bt;wt.prototype.visitUnion=Bt;wt.prototype.visitDenseUnion=HM;wt.prototype.visitSparseUnion=HM;wt.prototype.visitDictionary=Bt;wt.prototype.visitInterval=Bt;wt.prototype.visitIntervalDayTime=Bt;wt.prototype.visitIntervalYearMonth=Bt;wt.prototype.visitFixedSizeList=Bt;wt.prototype.visitMap=Bt;var wc=new wt;var vt=class extends gt{};function Dt(e){let{type:t}=e;if(e.nullCount===0&&e.stride===1&&(t.typeId===k.Timestamp||t instanceof Be&&t.bitWidth!==64||t instanceof Ti&&t.bitWidth!==64||t instanceof lr&&t.precision!==ge.HALF))return new Ad(e.data.length,r=>{let i=e.data[r];return i.values.subarray(0,i.length)[Symbol.iterator]()});let n=0;return new Ad(e.data.length,r=>{let o=e.data[r].length,s=e.slice(n,n+o);return n+=o,new bv(s)})}var bv=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}};vt.prototype.visitNull=Dt;vt.prototype.visitBool=Dt;vt.prototype.visitInt=Dt;vt.prototype.visitInt8=Dt;vt.prototype.visitInt16=Dt;vt.prototype.visitInt32=Dt;vt.prototype.visitInt64=Dt;vt.prototype.visitUint8=Dt;vt.prototype.visitUint16=Dt;vt.prototype.visitUint32=Dt;vt.prototype.visitUint64=Dt;vt.prototype.visitFloat=Dt;vt.prototype.visitFloat16=Dt;vt.prototype.visitFloat32=Dt;vt.prototype.visitFloat64=Dt;vt.prototype.visitUtf8=Dt;vt.prototype.visitBinary=Dt;vt.prototype.visitFixedSizeBinary=Dt;vt.prototype.visitDate=Dt;vt.prototype.visitDateDay=Dt;vt.prototype.visitDateMillisecond=Dt;vt.prototype.visitTimestamp=Dt;vt.prototype.visitTimestampSecond=Dt;vt.prototype.visitTimestampMillisecond=Dt;vt.prototype.visitTimestampMicrosecond=Dt;vt.prototype.visitTimestampNanosecond=Dt;vt.prototype.visitTime=Dt;vt.prototype.visitTimeSecond=Dt;vt.prototype.visitTimeMillisecond=Dt;vt.prototype.visitTimeMicrosecond=Dt;vt.prototype.visitTimeNanosecond=Dt;vt.prototype.visitDecimal=Dt;vt.prototype.visitList=Dt;vt.prototype.visitStruct=Dt;vt.prototype.visitUnion=Dt;vt.prototype.visitDenseUnion=Dt;vt.prototype.visitSparseUnion=Dt;vt.prototype.visitDictionary=Dt;vt.prototype.visitInterval=Dt;vt.prototype.visitIntervalDayTime=Dt;vt.prototype.visitIntervalYearMonth=Dt;vt.prototype.visitFixedSizeList=Dt;vt.prototype.visitMap=Dt;var Zl=new vt;var qU=(e,t)=>e+t,eo=class extends gt{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===$t.SECOND?4:8}visitInterval(t,n){return(t.type.unit+1)*4}visitStruct(t,n){return t.children.reduce((r,i)=>r+Rr.visit(i,n),0)}visitFixedSizeBinary(t,n){return t.type.byteWidth}visitMap(t,n){return 8+t.children.reduce((r,i)=>r+Rr.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)}},VU=({valueOffsets:e},t)=>8+(e[t+1]-e[t]),YU=({valueOffsets:e},t)=>8+(e[t+1]-e[t]),GU=({valueOffsets:e,stride:t,children:n},r)=>{let i=n[0],{[r*t]:o}=e,{[r*t+1]:s}=e,a=Rr.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},WU=({stride:e,children:t},n)=>{let r=t[0],i=r.slice(n*e,e),o=Rr.getVisitFn(r.type),s=0;for(let a=-1,c=i.length;++a<c;)s+=o(i,a);return s},XU=(e,t)=>e.type.mode===Ee.Dense?QM(e,t):ZM(e,t),QM=({type:e,children:t,typeIds:n,valueOffsets:r},i)=>{let o=e.typeIdToChildIndex[n[i]];return 8+Rr.visit(t[o],r[i])},ZM=({children:e},t)=>4+Rr.visitMany(e,e.map(()=>t)).reduce(qU,0);eo.prototype.visitUtf8=VU;eo.prototype.visitBinary=YU;eo.prototype.visitList=GU;eo.prototype.visitFixedSizeList=WU;eo.prototype.visitUnion=XU;eo.prototype.visitDenseUnion=QM;eo.prototype.visitSparseUnion=ZM;var Rr=new eo;var KM,JM={},t3={},qt=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 le)))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}=JM[s.typeId],f=o[0];this.isValid=d=>Md(f,d),this.get=d=>a(f,d),this.set=(d,h)=>c(f,d,h),this.indexOf=d=>l(f,d),this.getByteLength=d=>u(f,d),this._offsets=[0,f.length];break}default:Object.setPrototypeOf(this,t3[s.typeId]),this._offsets=Xy(o);break}this.data=o,this.type=s,this.stride=Nr(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._byteLength===-1&&(this._byteLength=this.data.reduce((t,n)=>t+n.byteLength,0)),this._byteLength}get nullCount(){return this._nullCount===-1&&(this._nullCount=Wy(this.data)),this._nullCount}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${k[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)>0}getByteLength(t){return 0}[Symbol.iterator](){return Zl.visit(this)}concat(...t){return new e(this.data.concat(t.flatMap(n=>n.data).flat(Number.POSITIVE_INFINITY)))}slice(t,n){return new e(Td(this,t,n,({data:r,_offsets:i},o,s)=>Hy(r,i,o,s)))}toJSON(){return[...this]}toArray(){let{type:t,data:n,length:r,stride:i,ArrayType:o}=this;switch(t.typeId){case k.Int:case k.Float:case k.Decimal:case k.Time:case k.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 ht.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(ht.isDictionary(this.type)){let t=new Ky(this.data[0].dictionary),n=this.data.map(r=>{let i=r.clone();return i.dictionary=t,i});return new e(n)}return new Ky(this)}unmemoize(){if(ht.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}};KM=Symbol.toStringTag;qt[KM]=(e=>{e.type=ht.prototype,e.data=[],e.length=0,e.stride=1,e.numChildren=0,e._nullCount=-1,e._byteLength=-1,e._offsets=new Uint32Array([0]),e[Symbol.isConcatSpreadable]=!0;let t=Object.keys(k).map(n=>k[n]).filter(n=>typeof n=="number"&&n!==k.NONE);for(let n of t){let r=qe.getVisitFnByTypeId(n),i=Sn.getVisitFnByTypeId(n),o=wc.getVisitFnByTypeId(n),s=Rr.getVisitFnByTypeId(n);JM[n]={get:r,set:i,indexOf:o,byteLength:s},t3[n]=Object.create(e,{isValid:{value:oa(Md)},get:{value:oa(qe.getVisitFnByTypeId(n))},set:{value:Qy(Sn.getVisitFnByTypeId(n))},indexOf:{value:Zy(wc.getVisitFnByTypeId(n))},getByteLength:{value:oa(Rr.getVisitFnByTypeId(n))}})}return"Vector"})(qt.prototype);var Ky=class e extends qt{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 qt(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function e3(e){if(!e||e.length<=0)return function(i){return!0};let t="",n=e.filter(r=>r===r);return n.length>0&&(t=`
1
+ var A$=Object.create;var bw=Object.defineProperty;var M$=Object.getOwnPropertyDescriptor;var N$=Object.getOwnPropertyNames;var R$=Object.getPrototypeOf,O$=Object.prototype.hasOwnProperty;var _R=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),vr=(e,t)=>{for(var n in t)bw(e,n,{get:t[n],enumerable:!0})},D$=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of N$(t))!O$.call(e,i)&&i!==n&&bw(e,i,{get:()=>t[i],enumerable:!(r=M$(t,i))||r.enumerable});return e};var k$=(e,t,n)=>(n=e!=null?A$(R$(e)):{},D$(t||!e||!e.__esModule?bw(n,"default",{value:e,enumerable:!0}):n,e));var o9=_R((yPt,i9)=>{"use strict";function KJ(e,t,n,r,i){for(var o=i+1;r<=i;){var s=r+i>>>1,a=e[s],c=n!==void 0?n(a,t):a-t;c>=0?(o=s,i=s-1):r=s+1}return o}function JJ(e,t,n,r,i){for(var o=i+1;r<=i;){var s=r+i>>>1,a=e[s],c=n!==void 0?n(a,t):a-t;c>0?(o=s,i=s-1):r=s+1}return o}function ttt(e,t,n,r,i){for(var o=r-1;r<=i;){var s=r+i>>>1,a=e[s],c=n!==void 0?n(a,t):a-t;c<0?(o=s,r=s+1):i=s-1}return o}function ett(e,t,n,r,i){for(var o=r-1;r<=i;){var s=r+i>>>1,a=e[s],c=n!==void 0?n(a,t):a-t;c<=0?(o=s,r=s+1):i=s-1}return o}function ntt(e,t,n,r,i){for(;r<=i;){var o=r+i>>>1,s=e[o],a=n!==void 0?n(s,t):s-t;if(a===0)return o;a<=0?r=o+1:i=o-1}return-1}function cy(e,t,n,r,i,o){return typeof n=="function"?o(e,t,n,r===void 0?0:r|0,i===void 0?e.length-1:i|0):o(e,t,void 0,n===void 0?0:n|0,r===void 0?e.length-1:r|0)}i9.exports={ge:function(e,t,n,r,i){return cy(e,t,n,r,i,KJ)},gt:function(e,t,n,r,i){return cy(e,t,n,r,i,JJ)},lt:function(e,t,n,r,i){return cy(e,t,n,r,i,ttt)},le:function(e,t,n,r,i){return cy(e,t,n,r,i,ett)},eq:function(e,t,n,r,i){return cy(e,t,n,r,i,ntt)}}});var h9=_R((gPt,d9)=>{"use strict";var nw=o9(),sd=0,Ul=1,ew=2;d9.exports=itt;function NA(e,t,n,r,i){this.mid=e,this.left=t,this.right=n,this.leftPoints=r,this.rightPoints=i,this.count=(t?t.count:0)+(n?n.count:0)+r.length}var ly=NA.prototype;function AA(e,t){e.mid=t.mid,e.left=t.left,e.right=t.right,e.leftPoints=t.leftPoints,e.rightPoints=t.rightPoints,e.count=t.count}function c9(e,t){var n=ad(t);e.mid=n.mid,e.left=n.left,e.right=n.right,e.leftPoints=n.leftPoints,e.rightPoints=n.rightPoints,e.count=n.count}function s9(e,t){var n=e.intervals([]);n.push(t),c9(e,n)}function a9(e,t){var n=e.intervals([]),r=n.indexOf(t);return r<0?sd:(n.splice(r,1),c9(e,n),Ul)}ly.intervals=function(e){return e.push.apply(e,this.leftPoints),this.left&&this.left.intervals(e),this.right&&this.right.intervals(e),e};ly.insert=function(e){var t=this.count-this.leftPoints.length;if(this.count+=1,e[1]<this.mid)this.left?4*(this.left.count+1)>3*(t+1)?s9(this,e):this.left.insert(e):this.left=ad([e]);else if(e[0]>this.mid)this.right?4*(this.right.count+1)>3*(t+1)?s9(this,e):this.right.insert(e):this.right=ad([e]);else{var n=nw.ge(this.leftPoints,e,RA),r=nw.ge(this.rightPoints,e,OA);this.leftPoints.splice(n,0,e),this.rightPoints.splice(r,0,e)}};ly.remove=function(e){var t=this.count-this.leftPoints;if(e[1]<this.mid){if(!this.left)return sd;var n=this.right?this.right.count:0;if(4*n>3*(t-1))return a9(this,e);var r=this.left.remove(e);return r===ew?(this.left=null,this.count-=1,Ul):(r===Ul&&(this.count-=1),r)}else if(e[0]>this.mid){if(!this.right)return sd;var i=this.left?this.left.count:0;if(4*i>3*(t-1))return a9(this,e);var r=this.right.remove(e);return r===ew?(this.right=null,this.count-=1,Ul):(r===Ul&&(this.count-=1),r)}else{if(this.count===1)return this.leftPoints[0]===e?ew:sd;if(this.leftPoints.length===1&&this.leftPoints[0]===e){if(this.left&&this.right){for(var o=this,s=this.left;s.right;)o=s,s=s.right;if(o===this)s.right=this.right;else{var a=this.left,r=this.right;o.count-=s.count,o.right=s.left,s.left=a,s.right=r}AA(this,s),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?AA(this,this.left):AA(this,this.right);return Ul}for(var a=nw.ge(this.leftPoints,e,RA);a<this.leftPoints.length&&this.leftPoints[a][0]===e[0];++a)if(this.leftPoints[a]===e){this.count-=1,this.leftPoints.splice(a,1);for(var r=nw.ge(this.rightPoints,e,OA);r<this.rightPoints.length&&this.rightPoints[r][1]===e[1];++r)if(this.rightPoints[r]===e)return this.rightPoints.splice(r,1),Ul}return sd}};function l9(e,t,n){for(var r=0;r<e.length&&e[r][0]<=t;++r){var i=n(e[r]);if(i)return i}}function u9(e,t,n){for(var r=e.length-1;r>=0&&e[r][1]>=t;--r){var i=n(e[r]);if(i)return i}}function f9(e,t){for(var n=0;n<e.length;++n){var r=t(e[n]);if(r)return r}}ly.queryPoint=function(e,t){if(e<this.mid){if(this.left){var n=this.left.queryPoint(e,t);if(n)return n}return l9(this.leftPoints,e,t)}else if(e>this.mid){if(this.right){var n=this.right.queryPoint(e,t);if(n)return n}return u9(this.rightPoints,e,t)}else return f9(this.leftPoints,t)};ly.queryInterval=function(e,t,n){if(e<this.mid&&this.left){var r=this.left.queryInterval(e,t,n);if(r)return r}if(t>this.mid&&this.right){var r=this.right.queryInterval(e,t,n);if(r)return r}return t<this.mid?l9(this.leftPoints,t,n):e>this.mid?u9(this.rightPoints,e,n):f9(this.leftPoints,n)};function rtt(e,t){return e-t}function RA(e,t){var n=e[0]-t[0];return n||e[1]-t[1]}function OA(e,t){var n=e[1]-t[1];return n||e[0]-t[0]}function ad(e){if(e.length===0)return null;for(var t=[],n=0;n<e.length;++n)t.push(e[n][0],e[n][1]);t.sort(rtt);for(var r=t[t.length>>1],i=[],o=[],s=[],n=0;n<e.length;++n){var a=e[n];a[1]<r?i.push(a):r<a[0]?o.push(a):s.push(a)}var c=s,l=s.slice();return c.sort(RA),l.sort(OA),new NA(r,ad(i),ad(o),c,l)}function MA(e){this.root=e}var cd=MA.prototype;cd.insert=function(e){this.root?this.root.insert(e):this.root=new NA(e[0],null,null,[e],[e])};cd.remove=function(e){if(this.root){var t=this.root.remove(e);return t===ew&&(this.root=null),t!==sd}return!1};cd.queryPoint=function(e,t){if(this.root)return this.root.queryPoint(e,t)};cd.queryInterval=function(e,t,n){if(e<=t&&this.root)return this.root.queryInterval(e,t,n)};Object.defineProperty(cd,"count",{get:function(){return this.root?this.root.count:0}});Object.defineProperty(cd,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}});function itt(e){return!e||e.length===0?new MA(null):new MA(ad(e))}});var wR={};function _d(e,t=!1){let n,r,i=wR;function o(l){n=e(l).then(()=>{if(r){let{value:u}=r;r=null,o(u)}else n=null})}function s(l){r={event:l}}function a(l){n?s(l):o(l)}function c(l){i!==l&&requestAnimationFrame(()=>{let u=i;i=wR,a(u)}),i=l}return t?c:a}var ur=class{constructor(t){this._filterBy=t,this._requestUpdate=_d(()=>this.requestQuery(),!0),this._coordinator=null}get coordinator(){return this._coordinator}set coordinator(t){this._coordinator=t}get filterBy(){return this._filterBy}get filterIndexable(){return!0}fields(){return null}fieldInfo(){return this}query(){return null}queryPending(){return this}queryResult(){return this}queryError(t){return console.error(t),this}requestQuery(t){let n=t||this.query(this.filterBy?.predicate(this));return this._coordinator.requestQuery(this,n)}requestUpdate(){this._requestUpdate()}update(){return this}};function SR(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Z(e,t,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(f){s(f)}}function c(u){try{l(r.throw(u))}catch(f){s(f)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(e,t||[])).next())})}function vR(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ct(e){return this instanceof Ct?(this.v=e,this):new Ct(e)}function Sr(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),i,o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(d){r[d]&&(i[d]=function(h){return new Promise(function(p,m){o.push([d,h,p,m])>1||a(d,h)})})}function a(d,h){try{c(r[d](h))}catch(p){f(o[0][3],p)}}function c(d){d.value instanceof Ct?Promise.resolve(d.value.v).then(l,u):f(o[0][2],d)}function l(d){a("next",d)}function u(d){a("throw",d)}function f(d,h){d(h),o.shift(),o.length&&a(o[0][0],o[0][1])}}function Vl(e){var t,n;return t={},r("next"),r("throw",function(i){throw i}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(i,o){t[i]=e[i]?function(s){return(n=!n)?{value:Ct(e[i](s)),done:!1}:o?o(s):s}:o}}function bi(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof vR=="function"?vR(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(o){n[o]=e[o]&&function(s){return new Promise(function(a,c){s=e[o](s),i(a,c,s.done,s.value)})}}function i(o,s,a,c){Promise.resolve(c).then(function(l){o({value:l,done:a})},s)}}var Iw={};vr(Iw,{compareArrayLike:()=>Sw,joinUint8Arrays:()=>Tr,memcpy:()=>Yl,rebaseValueOffsets:()=>Uy,toArrayBufferView:()=>Pt,toArrayBufferViewAsyncIterator:()=>_i,toArrayBufferViewIterator:()=>Xi,toBigInt64Array:()=>U$,toBigUint64Array:()=>j$,toFloat32Array:()=>V$,toFloat32ArrayAsyncIterator:()=>sU,toFloat32ArrayIterator:()=>K$,toFloat64Array:()=>Y$,toFloat64ArrayAsyncIterator:()=>aU,toFloat64ArrayIterator:()=>J$,toInt16Array:()=>$$,toInt16ArrayAsyncIterator:()=>nU,toInt16ArrayIterator:()=>X$,toInt32Array:()=>xc,toInt32ArrayAsyncIterator:()=>rU,toInt32ArrayIterator:()=>H$,toInt8Array:()=>P$,toInt8ArrayAsyncIterator:()=>eU,toInt8ArrayIterator:()=>W$,toUint16Array:()=>z$,toUint16ArrayAsyncIterator:()=>iU,toUint16ArrayIterator:()=>Z$,toUint32Array:()=>q$,toUint32ArrayAsyncIterator:()=>oU,toUint32ArrayIterator:()=>Q$,toUint8Array:()=>Ot,toUint8ArrayAsyncIterator:()=>vw,toUint8ArrayIterator:()=>ww,toUint8ClampedArray:()=>G$,toUint8ClampedArrayAsyncIterator:()=>cU,toUint8ClampedArrayIterator:()=>tU});var F$=new TextDecoder("utf-8"),wd=e=>F$.decode(e),L$=new TextEncoder,oa=e=>L$.encode(e);var C$=e=>typeof e=="number",IR=e=>typeof e=="boolean",tn=e=>typeof e=="function",Vn=e=>e!=null&&Object(e)===e,Ir=e=>Vn(e)&&tn(e.then);var xi=e=>Vn(e)&&tn(e[Symbol.iterator]),Gr=e=>Vn(e)&&tn(e[Symbol.asyncIterator]),Fy=e=>Vn(e)&&Vn(e.schema);var Ly=e=>Vn(e)&&"done"in e&&"value"in e;var Cy=e=>Vn(e)&&tn(e.stat)&&C$(e.fd);var By=e=>Vn(e)&&vd(e.body),Py=e=>"_getDOMStream"in e&&"_getNodeStream"in e,TR=e=>Vn(e)&&tn(e.abort)&&tn(e.getWriter)&&!Py(e),vd=e=>Vn(e)&&tn(e.cancel)&&tn(e.getReader)&&!Py(e),ER=e=>Vn(e)&&tn(e.end)&&tn(e.write)&&IR(e.writable)&&!Py(e),$y=e=>Vn(e)&&tn(e.read)&&tn(e.pipe)&&IR(e.readable)&&!Py(e),AR=e=>Vn(e)&&tn(e.clear)&&tn(e.bytes)&&tn(e.position)&&tn(e.setPosition)&&tn(e.capacity)&&tn(e.getBufferIdentifier)&&tn(e.createLong);var _w=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function B$(e){let t=e[0]?[e[0]]:[],n,r,i,o;for(let s,a,c=0,l=0,u=e.length;++c<u;){if(s=t[l],a=e[c],!s||!a||s.buffer!==a.buffer||a.byteOffset<s.byteOffset){a&&(t[++l]=a);continue}if({byteOffset:n,byteLength:i}=s,{byteOffset:r,byteLength:o}=a,n+i<r||r+o<n){a&&(t[++l]=a);continue}t[l]=new Uint8Array(s.buffer,n,r-n+o)}return t}function Yl(e,t,n=0,r=t.byteLength){let i=e.byteLength,o=new Uint8Array(e.buffer,e.byteOffset,i),s=new Uint8Array(t.buffer,t.byteOffset,Math.min(r,i));return o.set(s,n),e}function Tr(e,t){let n=B$(e),r=n.reduce((u,f)=>u+f.byteLength,0),i,o,s,a=0,c=-1,l=Math.min(t||Number.POSITIVE_INFINITY,r);for(let u=n.length;++c<u;){if(i=n[c],o=i.subarray(0,Math.min(i.length,l-a)),l<=a+o.length){o.length<i.length?n[c]=i.subarray(o.length):o.length===i.length&&c++,s?Yl(s,o,a):s=o;break}Yl(s||(s=new Uint8Array(l)),o,a),a+=o.length}return[s||new Uint8Array(0),n.slice(c),r-(s?s.byteLength:0)]}function Pt(e,t){let n=Ly(t)?t.value:t;return n instanceof e?e===Uint8Array?new e(n.buffer,n.byteOffset,n.byteLength):n:n?(typeof n=="string"&&(n=oa(n)),n instanceof ArrayBuffer?new e(n):n instanceof _w?new e(n):AR(n)?Pt(e,n.bytes()):ArrayBuffer.isView(n)?n.byteLength<=0?new e(0):new e(n.buffer,n.byteOffset,n.byteLength/e.BYTES_PER_ELEMENT):e.from(n)):new e(0)}var P$=e=>Pt(Int8Array,e),$$=e=>Pt(Int16Array,e),xc=e=>Pt(Int32Array,e),U$=e=>Pt(BigInt64Array,e),Ot=e=>Pt(Uint8Array,e),z$=e=>Pt(Uint16Array,e),q$=e=>Pt(Uint32Array,e),j$=e=>Pt(BigUint64Array,e),V$=e=>Pt(Float32Array,e),Y$=e=>Pt(Float64Array,e),G$=e=>Pt(Uint8ClampedArray,e),xw=e=>(e.next(),e);function*Xi(e,t){let n=function*(i){yield i},r=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof _w?n(t):xi(t)?t:n(t);return yield*xw(function*(i){let o=null;do o=i.next(yield Pt(e,o));while(!o.done)}(r[Symbol.iterator]())),new e}var W$=e=>Xi(Int8Array,e),X$=e=>Xi(Int16Array,e),H$=e=>Xi(Int32Array,e),ww=e=>Xi(Uint8Array,e),Z$=e=>Xi(Uint16Array,e),Q$=e=>Xi(Uint32Array,e),K$=e=>Xi(Float32Array,e),J$=e=>Xi(Float64Array,e),tU=e=>Xi(Uint8ClampedArray,e);function _i(e,t){return Sr(this,arguments,function*(){if(Ir(t))return yield Ct(yield Ct(yield*Vl(bi(_i(e,yield Ct(t))))));let r=function(s){return Sr(this,arguments,function*(){yield yield Ct(yield Ct(s))})},i=function(s){return Sr(this,arguments,function*(){yield Ct(yield*Vl(bi(xw(function*(a){let c=null;do c=a.next(yield c?.value);while(!c.done)}(s[Symbol.iterator]())))))})},o=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof _w?r(t):xi(t)?i(t):Gr(t)?t:r(t);return yield Ct(yield*Vl(bi(xw(function(s){return Sr(this,arguments,function*(){let a=null;do a=yield Ct(s.next(yield yield Ct(Pt(e,a))));while(!a.done)})}(o[Symbol.asyncIterator]()))))),yield Ct(new e)})}var eU=e=>_i(Int8Array,e),nU=e=>_i(Int16Array,e),rU=e=>_i(Int32Array,e),vw=e=>_i(Uint8Array,e),iU=e=>_i(Uint16Array,e),oU=e=>_i(Uint32Array,e),sU=e=>_i(Float32Array,e),aU=e=>_i(Float64Array,e),cU=e=>_i(Uint8ClampedArray,e);function Uy(e,t,n){if(e!==0){n=n.slice(0,t);for(let r=-1,i=n.length;++r<i;)n[r]+=e}return n.subarray(0,t)}function Sw(e,t){let n=0,r=e.length;if(r!==t.length)return!1;if(r>0)do if(e[n]!==t[n])return!1;while(++n<r);return!0}var bn={fromIterable(e){return zy(lU(e))},fromAsyncIterable(e){return zy(uU(e))},fromDOMStream(e){return zy(fU(e))},fromNodeStream(e){return zy(dU(e))},toDOMStream(e,t){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(e,t){throw new Error('"toNodeStream" not available in this environment')}},zy=e=>(e.next(),e);function*lU(e){let t,n=!1,r=[],i,o,s,a=0;function c(){return o==="peek"?Tr(r,s)[0]:([i,r,a]=Tr(r,s),i)}({cmd:o,size:s}=yield null);let l=ww(e)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(s-a)?l.next():l.next(s-a),!t&&i.byteLength>0&&(r.push(i),a+=i.byteLength),t||s<=a)do({cmd:o,size:s}=yield c());while(s<a);while(!t)}catch(u){(n=!0)&&typeof l.throw=="function"&&l.throw(u)}finally{n===!1&&typeof l.return=="function"&&l.return(null)}return null}function uU(e){return Sr(this,arguments,function*(){let n,r=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?Tr(i,a)[0]:([o,i,c]=Tr(i,a),o)}({cmd:s,size:a}=yield yield Ct(null));let u=vw(e)[Symbol.asyncIterator]();try{do if({done:n,value:o}=Number.isNaN(a-c)?yield Ct(u.next()):yield Ct(u.next(a-c)),!n&&o.byteLength>0&&(i.push(o),c+=o.byteLength),n||a<=c)do({cmd:s,size:a}=yield yield Ct(l()));while(a<c);while(!n)}catch(f){(r=!0)&&typeof u.throw=="function"&&(yield Ct(u.throw(f)))}finally{r===!1&&typeof u.return=="function"&&(yield Ct(u.return(new Uint8Array(0))))}return yield Ct(null)})}function fU(e){return Sr(this,arguments,function*(){let n=!1,r=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?Tr(i,a)[0]:([o,i,c]=Tr(i,a),o)}({cmd:s,size:a}=yield yield Ct(null));let u=new Ew(e);try{do if({done:n,value:o}=Number.isNaN(a-c)?yield Ct(u.read()):yield Ct(u.read(a-c)),!n&&o.byteLength>0&&(i.push(Ot(o)),c+=o.byteLength),n||a<=c)do({cmd:s,size:a}=yield yield Ct(l()));while(a<c);while(!n)}catch(f){(r=!0)&&(yield Ct(u.cancel(f)))}finally{r===!1?yield Ct(u.cancel()):e.locked&&u.releaseLock()}return yield Ct(null)})}var Ew=class{constructor(t){this.source=t,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch(()=>{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return Z(this,void 0,void 0,function*(){let{reader:n,source:r}=this;n&&(yield n.cancel(t).catch(()=>{})),r&&r.locked&&this.releaseLock()})}read(t){return Z(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};let n=yield this.reader.read();return!n.done&&(n.value=Ot(n)),n})}},Tw=(e,t)=>{let n=i=>r([t,i]),r;return[t,n,new Promise(i=>(r=i)&&e.once(t,n))]};function dU(e){return Sr(this,arguments,function*(){let n=[],r="error",i=!1,o=null,s,a,c=0,l=[],u;function f(){return s==="peek"?Tr(l,a)[0]:([u,l,c]=Tr(l,a),u)}if({cmd:s,size:a}=yield yield Ct(null),e.isTTY)return yield yield Ct(new Uint8Array(0)),yield Ct(null);try{n[0]=Tw(e,"end"),n[1]=Tw(e,"error");do{if(n[2]=Tw(e,"readable"),[r,o]=yield Ct(Promise.race(n.map(h=>h[2]))),r==="error")break;if((i=r==="end")||(Number.isFinite(a-c)?(u=Ot(e.read(a-c)),u.byteLength<a-c&&(u=Ot(e.read()))):u=Ot(e.read()),u.byteLength>0&&(l.push(u),c+=u.byteLength)),i||a<=c)do({cmd:s,size:a}=yield yield Ct(f()));while(a<c)}while(!i)}finally{yield Ct(d(n,r==="error"?o:null))}return yield Ct(null);function d(h,p){return u=l=null,new Promise((m,g)=>{for(let[y,b]of h)e.off(y,b);try{let y=e.destroy;y&&y.call(e,p),p=void 0}catch(y){p=y||p}finally{p!=null?g(p):m()}})}})}var Ie;(function(e){e[e.V1=0]="V1",e[e.V2=1]="V2",e[e.V3=2]="V3",e[e.V4=3]="V4",e[e.V5=4]="V5"})(Ie||(Ie={}));var me;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(me||(me={}));var xe;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(xe||(xe={}));var xn;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(xn||(xn={}));var pt;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(pt||(pt={}));var Yn;(function(e){e[e.YEAR_MONTH=0]="YEAR_MONTH",e[e.DAY_TIME=1]="DAY_TIME",e[e.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(Yn||(Yn={}));var Qt;(function(e){e[e.NONE=0]="NONE",e[e.Schema=1]="Schema",e[e.DictionaryBatch=2]="DictionaryBatch",e[e.RecordBatch=3]="RecordBatch",e[e.Tensor=4]="Tensor",e[e.SparseTensor=5]="SparseTensor"})(Qt||(Qt={}));var D;(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth",e[e.DurationSecond=-27]="DurationSecond",e[e.DurationMillisecond=-28]="DurationMillisecond",e[e.DurationMicrosecond=-29]="DurationMicrosecond",e[e.DurationNanosecond=-30]="DurationNanosecond"})(D||(D={}));var Wr;(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(Wr||(Wr={}));var Yw={};vr(Yw,{clampIndex:()=>rz,clampRange:()=>Ed,createElementComparator:()=>ca});var Aw={};vr(Aw,{valueToString:()=>wi});function wi(e){if(e===null)return"null";if(e===void 0)return"undefined";switch(typeof e){case"number":return`${e}`;case"bigint":return`${e}`;case"string":return`"${e}"`}return typeof e[Symbol.toPrimitive]=="function"?e[Symbol.toPrimitive]("string"):ArrayBuffer.isView(e)?e instanceof BigInt64Array||e instanceof BigUint64Array?`[${[...e].map(t=>wi(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,n)=>typeof n=="bigint"?`${n}`:n)}var Nw={};vr(Nw,{BN:()=>Id,bigNumToBigInt:()=>RR,bigNumToString:()=>Xl,isArrowBigNumSymbol:()=>MR});var MR=Symbol.for("isArrowBigNum");function vi(e,...t){return t.length===0?Object.setPrototypeOf(Pt(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}vi.prototype[MR]=!0;vi.prototype.toJSON=function(){return`"${Xl(this)}"`};vi.prototype.valueOf=function(){return NR(this)};vi.prototype.toString=function(){return Xl(this)};vi.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return NR(this);case"string":return Xl(this);case"default":return RR(this)}return Xl(this)};function Gl(...e){return vi.apply(this,e)}function Wl(...e){return vi.apply(this,e)}function Sd(...e){return vi.apply(this,e)}Object.setPrototypeOf(Gl.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(Wl.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Sd.prototype,Object.create(Uint32Array.prototype));Object.assign(Gl.prototype,vi.prototype,{constructor:Gl,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(Wl.prototype,vi.prototype,{constructor:Wl,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Sd.prototype,vi.prototype,{constructor:Sd,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});function NR(e){let{buffer:t,byteOffset:n,length:r,signed:i}=e,o=new BigUint64Array(t,n,r),s=i&&o.at(-1)&BigInt(1)<<BigInt(63),a=BigInt(s?1:0),c=BigInt(0);if(s){for(let l of o)a+=~l*(BigInt(1)<<BigInt(32)*c++);a*=BigInt(-1)}else for(let l of o)a+=l*(BigInt(1)<<BigInt(32)*c++);return a}var Xl=e=>{if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return Mw(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return Mw(e);t=t.slice();let r=1;for(let o=0;o<t.length;o++){let s=t[o],a=~s+r;t[o]=a,r&=s===0?1:0}return`-${Mw(t)}`},RR=e=>e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:Xl(e);function Mw(e){let t="",n=new Uint32Array(2),r=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),i=new Uint32Array((r=new Uint16Array(r).reverse()).buffer),o=-1,s=r.length-1;do{for(n[0]=r[o=0];o<s;)r[o++]=n[1]=n[0]/10,n[0]=(n[0]-n[1]*10<<16)+r[o];r[o]=n[1]=n[0]/10,n[0]=n[0]-n[1]*10,t=`${n[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t??"0"}var Id=class e{static new(t,n){switch(n){case!0:return new Gl(t);case!1:return new Wl(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new Gl(t)}return t.byteLength===16?new Sd(t):new Wl(t)}static signed(t){return new Gl(t)}static unsigned(t){return new Wl(t)}static decimal(t){return new Sd(t)}constructor(t,n){return e.new(t,n)}};function fr(e){if(typeof e=="bigint"&&(e<Number.MIN_SAFE_INTEGER||e>Number.MAX_SAFE_INTEGER))throw new TypeError(`${e} is not safe to convert to a number.`);return Number(e)}var OR,DR,kR,FR,LR,CR,BR,PR,$R,UR,zR,qR,jR,VR,YR,GR,WR,XR,HR,ZR,at=class e{static isNull(t){return t?.typeId===D.Null}static isInt(t){return t?.typeId===D.Int}static isFloat(t){return t?.typeId===D.Float}static isBinary(t){return t?.typeId===D.Binary}static isUtf8(t){return t?.typeId===D.Utf8}static isBool(t){return t?.typeId===D.Bool}static isDecimal(t){return t?.typeId===D.Decimal}static isDate(t){return t?.typeId===D.Date}static isTime(t){return t?.typeId===D.Time}static isTimestamp(t){return t?.typeId===D.Timestamp}static isInterval(t){return t?.typeId===D.Interval}static isDuration(t){return t?.typeId===D.Duration}static isList(t){return t?.typeId===D.List}static isStruct(t){return t?.typeId===D.Struct}static isUnion(t){return t?.typeId===D.Union}static isFixedSizeBinary(t){return t?.typeId===D.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===D.FixedSizeList}static isMap(t){return t?.typeId===D.Map}static isDictionary(t){return t?.typeId===D.Dictionary}static isDenseUnion(t){return e.isUnion(t)&&t.mode===me.Dense}static isSparseUnion(t){return e.isUnion(t)&&t.mode===me.Sparse}get typeId(){return D.NONE}};OR=Symbol.toStringTag;at[OR]=(e=>(e.children=null,e.ArrayType=Array,e[Symbol.toStringTag]="DataType"))(at.prototype);var Gn=class extends at{toString(){return"Null"}get typeId(){return D.Null}};DR=Symbol.toStringTag;Gn[DR]=(e=>e[Symbol.toStringTag]="Null")(Gn.prototype);var Pe=class extends at{constructor(t,n){super(),this.isSigned=t,this.bitWidth=n}get typeId(){return D.Int}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}};kR=Symbol.toStringTag;Pe[kR]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(Pe.prototype);var qy=class extends Pe{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},jy=class extends Pe{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},Hi=class extends Pe{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},Vy=class extends Pe{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},Yy=class extends Pe{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},Gy=class extends Pe{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},Wy=class extends Pe{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},Xy=class extends Pe{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(qy.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(jy.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(Hi.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(Vy.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(Yy.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(Gy.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Wy.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(Xy.prototype,"ArrayType",{value:BigUint64Array});var dr=class extends at{constructor(t){super(),this.precision=t}get typeId(){return D.Float}get ArrayType(){switch(this.precision){case xe.HALF:return Uint16Array;case xe.SINGLE:return Float32Array;case xe.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};FR=Symbol.toStringTag;dr[FR]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(dr.prototype);var Hy=class extends dr{constructor(){super(xe.HALF)}},Zy=class extends dr{constructor(){super(xe.SINGLE)}},Qy=class extends dr{constructor(){super(xe.DOUBLE)}};Object.defineProperty(Hy.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Zy.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(Qy.prototype,"ArrayType",{value:Float64Array});var Yo=class extends at{constructor(){super()}get typeId(){return D.Binary}toString(){return"Binary"}};LR=Symbol.toStringTag;Yo[LR]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(Yo.prototype);var Go=class extends at{constructor(){super()}get typeId(){return D.Utf8}toString(){return"Utf8"}};CR=Symbol.toStringTag;Go[CR]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(Go.prototype);var Wo=class extends at{constructor(){super()}get typeId(){return D.Bool}toString(){return"Bool"}};BR=Symbol.toStringTag;Wo[BR]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(Wo.prototype);var Xo=class extends at{constructor(t,n,r=128){super(),this.scale=t,this.precision=n,this.bitWidth=r}get typeId(){return D.Decimal}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};PR=Symbol.toStringTag;Xo[PR]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(Xo.prototype);var Ho=class extends at{constructor(t){super(),this.unit=t}get typeId(){return D.Date}toString(){return`Date${(this.unit+1)*32}<${xn[this.unit]}>`}};$R=Symbol.toStringTag;Ho[$R]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Date"))(Ho.prototype);var Si=class extends at{constructor(t,n){super(),this.unit=t,this.bitWidth=n}get typeId(){return D.Time}toString(){return`Time${this.bitWidth}<${pt[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};UR=Symbol.toStringTag;Si[UR]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))(Si.prototype);var Zo=class extends at{constructor(t,n){super(),this.unit=t,this.timezone=n}get typeId(){return D.Timestamp}toString(){return`Timestamp<${pt[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};zR=Symbol.toStringTag;Zo[zR]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Timestamp"))(Zo.prototype);var Qo=class extends at{constructor(t){super(),this.unit=t}get typeId(){return D.Interval}toString(){return`Interval<${Yn[this.unit]}>`}};qR=Symbol.toStringTag;Qo[qR]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))(Qo.prototype);var Ko=class extends at{constructor(t){super(),this.unit=t}get typeId(){return D.Duration}toString(){return`Duration<${pt[this.unit]}>`}};jR=Symbol.toStringTag;Ko[jR]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Duration"))(Ko.prototype);var Ii=class extends at{constructor(t){super(),this.children=[t]}get typeId(){return D.List}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};VR=Symbol.toStringTag;Ii[VR]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(Ii.prototype);var ye=class extends at{constructor(t){super(),this.children=t}get typeId(){return D.Struct}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};YR=Symbol.toStringTag;ye[YR]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(ye.prototype);var Ti=class extends at{constructor(t,n,r){super(),this.mode=t,this.children=r,this.typeIds=n=Int32Array.from(n),this.typeIdToChildIndex=n.reduce((i,o,s)=>(i[o]=s)&&i||i,Object.create(null))}get typeId(){return D.Union}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};GR=Symbol.toStringTag;Ti[GR]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(Ti.prototype);var Jo=class extends at{constructor(t){super(),this.byteWidth=t}get typeId(){return D.FixedSizeBinary}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};WR=Symbol.toStringTag;Jo[WR]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(Jo.prototype);var Ei=class extends at{constructor(t,n){super(),this.listSize=t,this.children=[n]}get typeId(){return D.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}};XR=Symbol.toStringTag;Ei[XR]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(Ei.prototype);var Ai=class extends at{constructor(t,n=!1){var r,i,o;if(super(),this.children=[t],this.keysSorted=n,t&&(t.name="entries",!((r=t?.type)===null||r===void 0)&&r.children)){let s=(i=t?.type)===null||i===void 0?void 0:i.children[0];s&&(s.name="key");let a=(o=t?.type)===null||o===void 0?void 0:o.children[1];a&&(a.name="value")}}get typeId(){return D.Map}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};HR=Symbol.toStringTag;Ai[HR]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(Ai.prototype);var hU=(e=>()=>++e)(-1),Er=class extends at{constructor(t,n,r,i){super(),this.indices=n,this.dictionary=t,this.isOrdered=i||!1,this.id=r==null?hU():fr(r)}get typeId(){return D.Dictionary}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};ZR=Symbol.toStringTag;Er[ZR]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(Er.prototype);function Ar(e){let t=e;switch(e.typeId){case D.Decimal:return e.bitWidth/32;case D.Timestamp:return 2;case D.Date:return 1+t.unit;case D.Interval:return 1+t.unit;case D.FixedSizeList:return t.listSize;case D.FixedSizeBinary:return t.byteWidth;default:return 1}}var ut=class{visitMany(t,...n){return t.map((r,i)=>this.visit(r,...n.map(o=>o[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,n=!0){return pU(this,t,n)}getVisitFnByTypeId(t,n=!0){return Hl(this,t,n)}visitNull(t,...n){return null}visitBool(t,...n){return null}visitInt(t,...n){return null}visitFloat(t,...n){return null}visitUtf8(t,...n){return null}visitBinary(t,...n){return null}visitFixedSizeBinary(t,...n){return null}visitDate(t,...n){return null}visitTimestamp(t,...n){return null}visitTime(t,...n){return null}visitDecimal(t,...n){return null}visitList(t,...n){return null}visitStruct(t,...n){return null}visitUnion(t,...n){return null}visitDictionary(t,...n){return null}visitInterval(t,...n){return null}visitDuration(t,...n){return null}visitFixedSizeList(t,...n){return null}visitMap(t,...n){return null}};function pU(e,t,n=!0){return typeof t=="number"?Hl(e,t,n):typeof t=="string"&&t in D?Hl(e,D[t],n):t&&t instanceof at?Hl(e,QR(t),n):t?.type&&t.type instanceof at?Hl(e,QR(t.type),n):Hl(e,D.NONE,n)}function Hl(e,t,n=!0){let r=null;switch(t){case D.Null:r=e.visitNull;break;case D.Bool:r=e.visitBool;break;case D.Int:r=e.visitInt;break;case D.Int8:r=e.visitInt8||e.visitInt;break;case D.Int16:r=e.visitInt16||e.visitInt;break;case D.Int32:r=e.visitInt32||e.visitInt;break;case D.Int64:r=e.visitInt64||e.visitInt;break;case D.Uint8:r=e.visitUint8||e.visitInt;break;case D.Uint16:r=e.visitUint16||e.visitInt;break;case D.Uint32:r=e.visitUint32||e.visitInt;break;case D.Uint64:r=e.visitUint64||e.visitInt;break;case D.Float:r=e.visitFloat;break;case D.Float16:r=e.visitFloat16||e.visitFloat;break;case D.Float32:r=e.visitFloat32||e.visitFloat;break;case D.Float64:r=e.visitFloat64||e.visitFloat;break;case D.Utf8:r=e.visitUtf8;break;case D.Binary:r=e.visitBinary;break;case D.FixedSizeBinary:r=e.visitFixedSizeBinary;break;case D.Date:r=e.visitDate;break;case D.DateDay:r=e.visitDateDay||e.visitDate;break;case D.DateMillisecond:r=e.visitDateMillisecond||e.visitDate;break;case D.Timestamp:r=e.visitTimestamp;break;case D.TimestampSecond:r=e.visitTimestampSecond||e.visitTimestamp;break;case D.TimestampMillisecond:r=e.visitTimestampMillisecond||e.visitTimestamp;break;case D.TimestampMicrosecond:r=e.visitTimestampMicrosecond||e.visitTimestamp;break;case D.TimestampNanosecond:r=e.visitTimestampNanosecond||e.visitTimestamp;break;case D.Time:r=e.visitTime;break;case D.TimeSecond:r=e.visitTimeSecond||e.visitTime;break;case D.TimeMillisecond:r=e.visitTimeMillisecond||e.visitTime;break;case D.TimeMicrosecond:r=e.visitTimeMicrosecond||e.visitTime;break;case D.TimeNanosecond:r=e.visitTimeNanosecond||e.visitTime;break;case D.Decimal:r=e.visitDecimal;break;case D.List:r=e.visitList;break;case D.Struct:r=e.visitStruct;break;case D.Union:r=e.visitUnion;break;case D.DenseUnion:r=e.visitDenseUnion||e.visitUnion;break;case D.SparseUnion:r=e.visitSparseUnion||e.visitUnion;break;case D.Dictionary:r=e.visitDictionary;break;case D.Interval:r=e.visitInterval;break;case D.IntervalDayTime:r=e.visitIntervalDayTime||e.visitInterval;break;case D.IntervalYearMonth:r=e.visitIntervalYearMonth||e.visitInterval;break;case D.Duration:r=e.visitDuration;break;case D.DurationSecond:r=e.visitDurationSecond||e.visitDuration;break;case D.DurationMillisecond:r=e.visitDurationMillisecond||e.visitDuration;break;case D.DurationMicrosecond:r=e.visitDurationMicrosecond||e.visitDuration;break;case D.DurationNanosecond:r=e.visitDurationNanosecond||e.visitDuration;break;case D.FixedSizeList:r=e.visitFixedSizeList;break;case D.Map:r=e.visitMap;break}if(typeof r=="function")return r;if(!n)return()=>null;throw new Error(`Unrecognized type '${D[t]}'`)}function QR(e){switch(e.typeId){case D.Null:return D.Null;case D.Int:{let{bitWidth:t,isSigned:n}=e;switch(t){case 8:return n?D.Int8:D.Uint8;case 16:return n?D.Int16:D.Uint16;case 32:return n?D.Int32:D.Uint32;case 64:return n?D.Int64:D.Uint64}return D.Int}case D.Float:switch(e.precision){case xe.HALF:return D.Float16;case xe.SINGLE:return D.Float32;case xe.DOUBLE:return D.Float64}return D.Float;case D.Binary:return D.Binary;case D.Utf8:return D.Utf8;case D.Bool:return D.Bool;case D.Decimal:return D.Decimal;case D.Time:switch(e.unit){case pt.SECOND:return D.TimeSecond;case pt.MILLISECOND:return D.TimeMillisecond;case pt.MICROSECOND:return D.TimeMicrosecond;case pt.NANOSECOND:return D.TimeNanosecond}return D.Time;case D.Timestamp:switch(e.unit){case pt.SECOND:return D.TimestampSecond;case pt.MILLISECOND:return D.TimestampMillisecond;case pt.MICROSECOND:return D.TimestampMicrosecond;case pt.NANOSECOND:return D.TimestampNanosecond}return D.Timestamp;case D.Date:switch(e.unit){case xn.DAY:return D.DateDay;case xn.MILLISECOND:return D.DateMillisecond}return D.Date;case D.Interval:switch(e.unit){case Yn.DAY_TIME:return D.IntervalDayTime;case Yn.YEAR_MONTH:return D.IntervalYearMonth}return D.Interval;case D.Duration:switch(e.unit){case pt.SECOND:return D.DurationSecond;case pt.MILLISECOND:return D.DurationMillisecond;case pt.MICROSECOND:return D.DurationMicrosecond;case pt.NANOSECOND:return D.DurationNanosecond}return D.Duration;case D.Map:return D.Map;case D.List:return D.List;case D.Struct:return D.Struct;case D.Union:switch(e.mode){case me.Dense:return D.DenseUnion;case me.Sparse:return D.SparseUnion}return D.Union;case D.FixedSizeBinary:return D.FixedSizeBinary;case D.FixedSizeList:return D.FixedSizeList;case D.Dictionary:return D.Dictionary}throw new Error(`Unrecognized type '${D[e.typeId]}'`)}ut.prototype.visitInt8=null;ut.prototype.visitInt16=null;ut.prototype.visitInt32=null;ut.prototype.visitInt64=null;ut.prototype.visitUint8=null;ut.prototype.visitUint16=null;ut.prototype.visitUint32=null;ut.prototype.visitUint64=null;ut.prototype.visitFloat16=null;ut.prototype.visitFloat32=null;ut.prototype.visitFloat64=null;ut.prototype.visitDateDay=null;ut.prototype.visitDateMillisecond=null;ut.prototype.visitTimestampSecond=null;ut.prototype.visitTimestampMillisecond=null;ut.prototype.visitTimestampMicrosecond=null;ut.prototype.visitTimestampNanosecond=null;ut.prototype.visitTimeSecond=null;ut.prototype.visitTimeMillisecond=null;ut.prototype.visitTimeMicrosecond=null;ut.prototype.visitTimeNanosecond=null;ut.prototype.visitDenseUnion=null;ut.prototype.visitSparseUnion=null;ut.prototype.visitIntervalDayTime=null;ut.prototype.visitIntervalYearMonth=null;ut.prototype.visitDuration=null;ut.prototype.visitDurationSecond=null;ut.prototype.visitDurationMillisecond=null;ut.prototype.visitDurationMicrosecond=null;ut.prototype.visitDurationNanosecond=null;var Rw={};vr(Rw,{float64ToUint16:()=>Td,uint16ToFloat64:()=>Ky});var KR=new Float64Array(1),Zl=new Uint32Array(KR.buffer);function Ky(e){let t=(e&31744)>>10,n=(e&1023)/1024,r=Math.pow(-1,(e&32768)>>15);switch(t){case 31:return r*(n?Number.NaN:1/0);case 0:return r*(n?6103515625e-14*n:0)}return r*Math.pow(2,t-15)*(1+n)}function Td(e){if(e!==e)return 32256;KR[0]=e;let t=(Zl[1]&2147483648)>>16&65535,n=Zl[1]&2146435072,r=0;return n>=1089470464?Zl[0]>0?n=31744:(n=(n&2080374784)>>16,r=(Zl[1]&1048575)>>10):n<=1056964608?(r=1048576+(Zl[1]&1048575),r=1048576+(r<<(n>>20)-998)>>21,n=0):(n=n-1056964608>>10,r=(Zl[1]&1048575)+512>>10),t|n|r&65535}var vt=class extends ut{};function At(e){return(t,n,r)=>{if(t.setValid(n,r!=null))return e(t,n,r)}}var mU=(e,t,n)=>{e[t]=Math.trunc(n/864e5)},Ow=(e,t,n)=>{e[t]=Math.trunc(n%4294967296),e[t+1]=Math.trunc(n/4294967296)},yU=(e,t,n)=>{e[t]=Math.trunc(n*1e3%4294967296),e[t+1]=Math.trunc(n*1e3/4294967296)},gU=(e,t,n)=>{e[t]=Math.trunc(n*1e6%4294967296),e[t+1]=Math.trunc(n*1e6/4294967296)},JR=(e,t,n,r)=>{if(n+1<t.length){let{[n]:i,[n+1]:o}=t;e.set(r.subarray(0,o-i),i)}},bU=({offset:e,values:t},n,r)=>{let i=e+n;r?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},ts=({values:e},t,n)=>{e[t]=n},Dw=({values:e},t,n)=>{e[t]=n},tO=({values:e},t,n)=>{e[t]=Td(n)},xU=(e,t,n)=>{switch(e.type.precision){case xe.HALF:return tO(e,t,n);case xe.SINGLE:case xe.DOUBLE:return Dw(e,t,n)}},Jy=({values:e},t,n)=>{mU(e,t,n.valueOf())},tg=({values:e},t,n)=>{Ow(e,t*2,n.valueOf())},kw=({stride:e,values:t},n,r)=>{t.set(r.subarray(0,e),e*n)},_U=({values:e,valueOffsets:t},n,r)=>JR(e,t,n,r),wU=({values:e,valueOffsets:t},n,r)=>{JR(e,t,n,oa(r))},Fw=(e,t,n)=>{e.type.unit===xn.DAY?Jy(e,t,n):tg(e,t,n)},eg=({values:e},t,n)=>Ow(e,t*2,n/1e3),ng=({values:e},t,n)=>Ow(e,t*2,n),rg=({values:e},t,n)=>yU(e,t*2,n),ig=({values:e},t,n)=>gU(e,t*2,n),Lw=(e,t,n)=>{switch(e.type.unit){case pt.SECOND:return eg(e,t,n);case pt.MILLISECOND:return ng(e,t,n);case pt.MICROSECOND:return rg(e,t,n);case pt.NANOSECOND:return ig(e,t,n)}},og=({values:e},t,n)=>{e[t]=n},sg=({values:e},t,n)=>{e[t]=n},ag=({values:e},t,n)=>{e[t]=n},cg=({values:e},t,n)=>{e[t]=n},Cw=(e,t,n)=>{switch(e.type.unit){case pt.SECOND:return og(e,t,n);case pt.MILLISECOND:return sg(e,t,n);case pt.MICROSECOND:return ag(e,t,n);case pt.NANOSECOND:return cg(e,t,n)}},Bw=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},vU=(e,t,n)=>{let r=e.children[0],i=e.valueOffsets,o=_n.getVisitFn(r);if(Array.isArray(n))for(let s=-1,a=i[t],c=i[t+1];a<c;)o(r,a++,n[++s]);else for(let s=-1,a=i[t],c=i[t+1];a<c;)o(r,a++,n.get(++s))},SU=(e,t,n)=>{let r=e.children[0],{valueOffsets:i}=e,o=_n.getVisitFn(r),{[t]:s,[t+1]:a}=i,c=n instanceof Map?n.entries():Object.entries(n);for(let l of c)if(o(r,s,l),++s>=a)break},IU=(e,t)=>(n,r,i,o)=>r&&n(r,e,t[o]),TU=(e,t)=>(n,r,i,o)=>r&&n(r,e,t.get(o)),EU=(e,t)=>(n,r,i,o)=>r&&n(r,e,t.get(i.name)),AU=(e,t)=>(n,r,i,o)=>r&&n(r,e,t[i.name]),MU=(e,t,n)=>{let r=e.type.children.map(o=>_n.getVisitFn(o.type)),i=n instanceof Map?EU(t,n):n instanceof Vt?TU(t,n):Array.isArray(n)?IU(t,n):AU(t,n);e.type.children.forEach((o,s)=>i(r[s],e.children[s],o,s))},NU=(e,t,n)=>{e.type.mode===me.Dense?eO(e,t,n):nO(e,t,n)},eO=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];_n.visit(i,e.valueOffsets[t],n)},nO=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];_n.visit(i,t,n)},RU=(e,t,n)=>{var r;(r=e.dictionary)===null||r===void 0||r.set(e.values[t],n)},Pw=(e,t,n)=>{e.type.unit===Yn.DAY_TIME?lg(e,t,n):ug(e,t,n)},lg=({values:e},t,n)=>{e.set(n.subarray(0,2),2*t)},ug=({values:e},t,n)=>{e[t]=n[0]*12+n[1]%12},fg=({values:e},t,n)=>{e[t]=n},dg=({values:e},t,n)=>{e[t]=n},hg=({values:e},t,n)=>{e[t]=n},pg=({values:e},t,n)=>{e[t]=n},$w=(e,t,n)=>{switch(e.type.unit){case pt.SECOND:return fg(e,t,n);case pt.MILLISECOND:return dg(e,t,n);case pt.MICROSECOND:return hg(e,t,n);case pt.NANOSECOND:return pg(e,t,n)}},OU=(e,t,n)=>{let{stride:r}=e,i=e.children[0],o=_n.getVisitFn(i);if(Array.isArray(n))for(let s=-1,a=t*r;++s<r;)o(i,a+s,n[s]);else for(let s=-1,a=t*r;++s<r;)o(i,a+s,n.get(s))};vt.prototype.visitBool=At(bU);vt.prototype.visitInt=At(ts);vt.prototype.visitInt8=At(ts);vt.prototype.visitInt16=At(ts);vt.prototype.visitInt32=At(ts);vt.prototype.visitInt64=At(ts);vt.prototype.visitUint8=At(ts);vt.prototype.visitUint16=At(ts);vt.prototype.visitUint32=At(ts);vt.prototype.visitUint64=At(ts);vt.prototype.visitFloat=At(xU);vt.prototype.visitFloat16=At(tO);vt.prototype.visitFloat32=At(Dw);vt.prototype.visitFloat64=At(Dw);vt.prototype.visitUtf8=At(wU);vt.prototype.visitBinary=At(_U);vt.prototype.visitFixedSizeBinary=At(kw);vt.prototype.visitDate=At(Fw);vt.prototype.visitDateDay=At(Jy);vt.prototype.visitDateMillisecond=At(tg);vt.prototype.visitTimestamp=At(Lw);vt.prototype.visitTimestampSecond=At(eg);vt.prototype.visitTimestampMillisecond=At(ng);vt.prototype.visitTimestampMicrosecond=At(rg);vt.prototype.visitTimestampNanosecond=At(ig);vt.prototype.visitTime=At(Cw);vt.prototype.visitTimeSecond=At(og);vt.prototype.visitTimeMillisecond=At(sg);vt.prototype.visitTimeMicrosecond=At(ag);vt.prototype.visitTimeNanosecond=At(cg);vt.prototype.visitDecimal=At(Bw);vt.prototype.visitList=At(vU);vt.prototype.visitStruct=At(MU);vt.prototype.visitUnion=At(NU);vt.prototype.visitDenseUnion=At(eO);vt.prototype.visitSparseUnion=At(nO);vt.prototype.visitDictionary=At(RU);vt.prototype.visitInterval=At(Pw);vt.prototype.visitIntervalDayTime=At(lg);vt.prototype.visitIntervalYearMonth=At(ug);vt.prototype.visitDuration=At($w);vt.prototype.visitDurationSecond=At(fg);vt.prototype.visitDurationMillisecond=At(dg);vt.prototype.visitDurationMicrosecond=At(hg);vt.prototype.visitDurationNanosecond=At(pg);vt.prototype.visitFixedSizeList=At(OU);vt.prototype.visitMap=At(SU);var _n=new vt;var Mi=Symbol.for("parent"),Ql=Symbol.for("rowIndex"),sa=class{constructor(t,n){return this[Mi]=t,this[Ql]=n,new Proxy(this,new zw)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Ql],n=this[Mi],r=n.type.children,i={};for(let o=-1,s=r.length;++o<s;)i[r[o].name]=je.visit(n.children[o],t);return i}toString(){return`{${[...this].map(([t,n])=>`${wi(t)}: ${wi(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new Uw(this[Mi],this[Ql])}},Uw=class{constructor(t,n){this.childIndex=0,this.children=t.children,this.rowIndex=n,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,je.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(sa.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Mi]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Ql]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var zw=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Mi].type.children.map(n=>n.name)}has(t,n){return t[Mi].type.children.findIndex(r=>r.name===n)!==-1}getOwnPropertyDescriptor(t,n){if(t[Mi].type.children.findIndex(r=>r.name===n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,n){if(Reflect.has(t,n))return t[n];let r=t[Mi].type.children.findIndex(i=>i.name===n);if(r!==-1){let i=je.visit(t[Mi].children[r],t[Ql]);return Reflect.set(t,n,i),i}}set(t,n,r){let i=t[Mi].type.children.findIndex(o=>o.name===n);return i!==-1?(_n.visit(t[Mi].children[i],t[Ql],r),Reflect.set(t,n,r)):Reflect.has(t,n)||typeof n=="symbol"?Reflect.set(t,n,r):!1}};var gt=class extends ut{};function Tt(e){return(t,n)=>t.getValid(n)?e(t,n):null}var DU=(e,t)=>864e5*e[t],qw=(e,t)=>4294967296*e[t+1]+(e[t]>>>0),kU=(e,t)=>4294967296*(e[t+1]/1e3)+(e[t]>>>0)/1e3,FU=(e,t)=>4294967296*(e[t+1]/1e6)+(e[t]>>>0)/1e6,rO=e=>new Date(e),LU=(e,t)=>rO(DU(e,t)),CU=(e,t)=>rO(qw(e,t)),BU=(e,t)=>null,iO=(e,t,n)=>{if(n+1>=t.length)return null;let r=t[n],i=t[n+1];return e.subarray(r,i)},PU=({offset:e,values:t},n)=>{let r=e+n;return(t[r>>3]&1<<r%8)!==0},oO=({values:e},t)=>LU(e,t),sO=({values:e},t)=>CU(e,t*2),aa=({stride:e,values:t},n)=>t[e*n],$U=({stride:e,values:t},n)=>Ky(t[e*n]),aO=({values:e},t)=>e[t],UU=({stride:e,values:t},n)=>t.subarray(e*n,e*(n+1)),zU=({values:e,valueOffsets:t},n)=>iO(e,t,n),qU=({values:e,valueOffsets:t},n)=>{let r=iO(e,t,n);return r!==null?wd(r):null},jU=({values:e},t)=>e[t],VU=({type:e,values:t},n)=>e.precision!==xe.HALF?t[n]:Ky(t[n]),YU=(e,t)=>e.type.unit===xn.DAY?oO(e,t):sO(e,t),cO=({values:e},t)=>1e3*qw(e,t*2),lO=({values:e},t)=>qw(e,t*2),uO=({values:e},t)=>kU(e,t*2),fO=({values:e},t)=>FU(e,t*2),GU=(e,t)=>{switch(e.type.unit){case pt.SECOND:return cO(e,t);case pt.MILLISECOND:return lO(e,t);case pt.MICROSECOND:return uO(e,t);case pt.NANOSECOND:return fO(e,t)}},dO=({values:e},t)=>e[t],hO=({values:e},t)=>e[t],pO=({values:e},t)=>e[t],mO=({values:e},t)=>e[t],WU=(e,t)=>{switch(e.type.unit){case pt.SECOND:return dO(e,t);case pt.MILLISECOND:return hO(e,t);case pt.MICROSECOND:return pO(e,t);case pt.NANOSECOND:return mO(e,t)}},XU=({values:e,stride:t},n)=>Id.decimal(e.subarray(t*n,t*(n+1))),HU=(e,t)=>{let{valueOffsets:n,stride:r,children:i}=e,{[t*r]:o,[t*r+1]:s}=n,c=i[0].slice(o,s-o);return new Vt([c])},ZU=(e,t)=>{let{valueOffsets:n,children:r}=e,{[t]:i,[t+1]:o}=n,s=r[0];return new Zi(s.slice(i,o-i))},QU=(e,t)=>new sa(e,t),KU=(e,t)=>e.type.mode===me.Dense?yO(e,t):gO(e,t),yO=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return je.visit(r,e.valueOffsets[t])},gO=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return je.visit(r,t)},JU=(e,t)=>{var n;return(n=e.dictionary)===null||n===void 0?void 0:n.get(e.values[t])},tz=(e,t)=>e.type.unit===Yn.DAY_TIME?bO(e,t):xO(e,t),bO=({values:e},t)=>e.subarray(2*t,2*(t+1)),xO=({values:e},t)=>{let n=e[t],r=new Int32Array(2);return r[0]=Math.trunc(n/12),r[1]=Math.trunc(n%12),r},_O=({values:e},t)=>e[t],wO=({values:e},t)=>e[t],vO=({values:e},t)=>e[t],SO=({values:e},t)=>e[t],ez=(e,t)=>{switch(e.type.unit){case pt.SECOND:return _O(e,t);case pt.MILLISECOND:return wO(e,t);case pt.MICROSECOND:return vO(e,t);case pt.NANOSECOND:return SO(e,t)}},nz=(e,t)=>{let{stride:n,children:r}=e,o=r[0].slice(t*n,n);return new Vt([o])};gt.prototype.visitNull=Tt(BU);gt.prototype.visitBool=Tt(PU);gt.prototype.visitInt=Tt(jU);gt.prototype.visitInt8=Tt(aa);gt.prototype.visitInt16=Tt(aa);gt.prototype.visitInt32=Tt(aa);gt.prototype.visitInt64=Tt(aO);gt.prototype.visitUint8=Tt(aa);gt.prototype.visitUint16=Tt(aa);gt.prototype.visitUint32=Tt(aa);gt.prototype.visitUint64=Tt(aO);gt.prototype.visitFloat=Tt(VU);gt.prototype.visitFloat16=Tt($U);gt.prototype.visitFloat32=Tt(aa);gt.prototype.visitFloat64=Tt(aa);gt.prototype.visitUtf8=Tt(qU);gt.prototype.visitBinary=Tt(zU);gt.prototype.visitFixedSizeBinary=Tt(UU);gt.prototype.visitDate=Tt(YU);gt.prototype.visitDateDay=Tt(oO);gt.prototype.visitDateMillisecond=Tt(sO);gt.prototype.visitTimestamp=Tt(GU);gt.prototype.visitTimestampSecond=Tt(cO);gt.prototype.visitTimestampMillisecond=Tt(lO);gt.prototype.visitTimestampMicrosecond=Tt(uO);gt.prototype.visitTimestampNanosecond=Tt(fO);gt.prototype.visitTime=Tt(WU);gt.prototype.visitTimeSecond=Tt(dO);gt.prototype.visitTimeMillisecond=Tt(hO);gt.prototype.visitTimeMicrosecond=Tt(pO);gt.prototype.visitTimeNanosecond=Tt(mO);gt.prototype.visitDecimal=Tt(XU);gt.prototype.visitList=Tt(HU);gt.prototype.visitStruct=Tt(QU);gt.prototype.visitUnion=Tt(KU);gt.prototype.visitDenseUnion=Tt(yO);gt.prototype.visitSparseUnion=Tt(gO);gt.prototype.visitDictionary=Tt(JU);gt.prototype.visitInterval=Tt(tz);gt.prototype.visitIntervalDayTime=Tt(bO);gt.prototype.visitIntervalYearMonth=Tt(xO);gt.prototype.visitDuration=Tt(ez);gt.prototype.visitDurationSecond=Tt(_O);gt.prototype.visitDurationMillisecond=Tt(wO);gt.prototype.visitDurationMicrosecond=Tt(vO);gt.prototype.visitDurationNanosecond=Tt(SO);gt.prototype.visitFixedSizeList=Tt(nz);gt.prototype.visitMap=Tt(ZU);var je=new gt;var Xr=Symbol.for("keys"),Kl=Symbol.for("vals"),Zi=class{constructor(t){return this[Xr]=new Vt([t.children[0]]).memoize(),this[Kl]=t.children[1],new Proxy(this,new Vw)}[Symbol.iterator](){return new jw(this[Xr],this[Kl])}get size(){return this[Xr].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Xr],n=this[Kl],r={};for(let i=-1,o=t.length;++i<o;)r[t.get(i)]=je.visit(n,i);return r}toString(){return`{${[...this].map(([t,n])=>`${wi(t)}: ${wi(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},jw=class{constructor(t,n){this.keys=t,this.vals=n,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){let t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),je.visit(this.vals,t)]})}},Vw=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Xr].toArray().map(String)}has(t,n){return t[Xr].includes(n)}getOwnPropertyDescriptor(t,n){if(t[Xr].indexOf(n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,n){if(Reflect.has(t,n))return t[n];let r=t[Xr].indexOf(n);if(r!==-1){let i=je.visit(Reflect.get(t,Kl),r);return Reflect.set(t,n,i),i}}set(t,n,r){let i=t[Xr].indexOf(n);return i!==-1?(_n.visit(Reflect.get(t,Kl),i,r),Reflect.set(t,n,r)):Reflect.has(t,n)?Reflect.set(t,n,r):!1}};Object.defineProperties(Zi.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Xr]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Kl]:{writable:!0,enumerable:!1,configurable:!1,value:null}});function rz(e,t,n){let r=e.length,i=t>-1?t:r+t%r;return n?n(e,i):i}var IO;function Ed(e,t,n,r){let{length:i=0}=e,o=typeof t!="number"?0:t,s=typeof n!="number"?i:n;return o<0&&(o=(o%i+i)%i),s<0&&(s=(s%i+i)%i),s<o&&(IO=o,o=s,s=IO),s>i&&(s=i),r?r(e,o,s):[o,s]}var TO=e=>e!==e;function ca(e){if(typeof e!=="object"||e===null)return TO(e)?TO:n=>n===e;if(e instanceof Date){let n=e.valueOf();return r=>r instanceof Date?r.valueOf()===n:!1}return ArrayBuffer.isView(e)?n=>n?Sw(e,n):!1:e instanceof Map?oz(e):Array.isArray(e)?iz(e):e instanceof Vt?sz(e):az(e,!0)}function iz(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=ca(e[n]);return mg(t)}function oz(e){let t=-1,n=[];for(let r of e.values())n[++t]=ca(r);return mg(n)}function sz(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=ca(e.get(n));return mg(t)}function az(e,t=!1){let n=Object.keys(e);if(!t&&n.length===0)return()=>!1;let r=[];for(let i=-1,o=n.length;++i<o;)r[i]=ca(e[n[i]]);return mg(r,n)}function mg(e,t){return n=>{if(!n||typeof n!="object")return!1;switch(n.constructor){case Array:return cz(e,n);case Map:return EO(e,n,n.keys());case Zi:case sa:case Object:case void 0:return EO(e,n,t||Object.keys(n))}return n instanceof Vt?lz(e,n):!1}}function cz(e,t){let n=e.length;if(t.length!==n)return!1;for(let r=-1;++r<n;)if(!e[r](t[r]))return!1;return!0}function lz(e,t){let n=e.length;if(t.length!==n)return!1;for(let r=-1;++r<n;)if(!e[r](t.get(r)))return!1;return!0}function EO(e,t,n){let r=n[Symbol.iterator](),i=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),o=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),s=0,a=e.length,c=o.next(),l=r.next(),u=i.next();for(;s<a&&!l.done&&!u.done&&!c.done&&!(l.value!==u.value||!e[s](c.value));++s,l=r.next(),u=i.next(),c=o.next());return s===a&&l.done&&u.done&&c.done?!0:(r.return&&r.return(),i.return&&i.return(),o.return&&o.return(),!1)}var Gw={};vr(Gw,{BitIterator:()=>_c,getBit:()=>AO,getBool:()=>gg,packBools:()=>vc,popcnt_array:()=>MO,popcnt_bit_range:()=>Ad,popcnt_uint32:()=>yg,setBool:()=>uz,truncateBitmap:()=>wc});function gg(e,t,n,r){return(n&1<<r)!==0}function AO(e,t,n,r){return(n&1<<r)>>r}function uz(e,t,n){return n?!!(e[t>>3]|=1<<t%8)||!0:!(e[t>>3]&=~(1<<t%8))&&!1}function wc(e,t,n){let r=n.byteLength+7&-8;if(e>0||n.byteLength<r){let i=new Uint8Array(r);return i.set(e%8===0?n.subarray(e>>3):vc(new _c(n,e,t,null,gg)).subarray(0,r)),i}return n}function vc(e){let t=[],n=0,r=0,i=0;for(let s of e)s&&(i|=1<<r),++r===8&&(t[n++]=i,i=r=0);(n===0||r>0)&&(t[n++]=i);let o=new Uint8Array(t.length+7&-8);return o.set(t),o}var _c=class{constructor(t,n,r,i,o){this.bytes=t,this.length=r,this.context=i,this.get=o,this.bit=n%8,this.byteIndex=n>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}};function Ad(e,t,n){if(n-t<=0)return 0;if(n-t<8){let o=0;for(let s of new _c(e,t,n-t,e,AO))o+=s;return o}let r=n>>3<<3,i=t+(t%8===0?0:8-t%8);return Ad(e,t,i)+Ad(e,r,n)+MO(e,i>>3,r-i>>3)}function MO(e,t,n){let r=0,i=Math.trunc(t),o=new DataView(e.buffer,e.byteOffset,e.byteLength),s=n===void 0?e.byteLength:i+n;for(;s-i>=4;)r+=yg(o.getUint32(i)),i+=4;for(;s-i>=2;)r+=yg(o.getUint16(i)),i+=2;for(;s-i>=1;)r+=yg(o.getUint8(i)),i+=1;return r}function yg(e){let t=Math.trunc(e);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}var fz=-1,se=class e{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){let{type:t}=this;return at.isSparseUnion(t)?this.children.some(n=>n.nullable):at.isDenseUnion(t)?this.children.some(n=>n.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0,{valueOffsets:n,values:r,nullBitmap:i,typeIds:o}=this;return n&&(t+=n.byteLength),r&&(t+=r.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),this.children.reduce((s,a)=>s+a.byteLength,t)}get nullCount(){if(at.isUnion(this.type))return this.children.reduce((r,i)=>r+i.nullCount,0);let t=this._nullCount,n;return t<=fz&&(n=this.nullBitmap)&&(this._nullCount=t=this.length-Ad(n,this.offset,this.offset+this.length)),t}constructor(t,n,r,i,o,s=[],a){this.type=t,this.children=s,this.dictionary=a,this.offset=Math.floor(Math.max(n||0,0)),this.length=Math.floor(Math.max(r||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let c;o instanceof e?(this.stride=o.stride,this.values=o.values,this.typeIds=o.typeIds,this.nullBitmap=o.nullBitmap,this.valueOffsets=o.valueOffsets):(this.stride=Ar(t),o&&((c=o[0])&&(this.valueOffsets=c),(c=o[1])&&(this.values=c),(c=o[2])&&(this.nullBitmap=c),(c=o[3])&&(this.typeIds=c)))}getValid(t){let{type:n}=this;if(at.isUnion(n)){let r=n,i=this.children[r.typeIdToChildIndex[this.typeIds[t]]],o=r.mode===me.Dense?this.valueOffsets[t]:t;return i.getValid(o)}if(this.nullable&&this.nullCount>0){let r=this.offset+t;return(this.nullBitmap[r>>3]&1<<r%8)!==0}return!0}setValid(t,n){let r,{type:i}=this;if(at.isUnion(i)){let o=i,s=this.children[o.typeIdToChildIndex[this.typeIds[t]]],a=o.mode===me.Dense?this.valueOffsets[t]:t;r=s.getValid(a),s.setValid(a,n)}else{let{nullBitmap:o}=this,{offset:s,length:a}=this,c=s+t,l=1<<c%8,u=c>>3;(!o||o.byteLength<=u)&&(o=new Uint8Array((s+a+63&-64)>>3).fill(255),this.nullCount>0&&o.set(wc(s,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:o,_nullCount:-1}));let f=o[u];r=(f&l)!==0,n?o[u]=f|l:o[u]=f&~l}return r!==!!n&&(this._nullCount=this.nullCount+(n?-1:1)),n}clone(t=this.type,n=this.offset,r=this.length,i=this._nullCount,o=this,s=this.children){return new e(t,n,r,i,o,s,this.dictionary)}slice(t,n){let{stride:r,typeId:i,children:o}=this,s=+(this._nullCount===0)-1,a=i===16?r:1,c=this._sliceBuffers(t,n,r,i);return this.clone(this.type,this.offset+t,n,s,c,o.length===0||this.valueOffsets?o:this._sliceChildren(o,a*t,a*n))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===D.Null)return this.clone(this.type,0,t,0);let{length:n,nullCount:r}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,n>>3);i[n>>3]=(1<<n-(n&-8))-1,r>0&&i.set(wc(this.offset,n,this.nullBitmap),0);let o=this.buffers;return o[Wr.VALIDITY]=i,this.clone(this.type,0,t,r+(t-n),o)}_sliceBuffers(t,n,r,i){let o,{buffers:s}=this;return(o=s[Wr.TYPE])&&(s[Wr.TYPE]=o.subarray(t,t+n)),(o=s[Wr.OFFSET])&&(s[Wr.OFFSET]=o.subarray(t,t+n+1))||(o=s[Wr.DATA])&&(s[Wr.DATA]=i===6?o:o.subarray(r*t,r*(t+n))),s}_sliceChildren(t,n,r){return t.map(i=>i.slice(n,r))}};se.prototype.children=Object.freeze([]);var Ww=class e extends ut{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:n,["offset"]:r=0,["length"]:i=0}=t;return new se(n,r,i,i)}visitBool(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitInt(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitFloat(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitUtf8(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.data),o=Ot(t.nullBitmap),s=xc(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new se(n,r,a,c,[s,i,o])}visitBinary(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.data),o=Ot(t.nullBitmap),s=xc(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new se(n,r,a,c,[s,i,o])}visitFixedSizeBinary(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Ar(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitDate(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Ar(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitTimestamp(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Ar(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitTime(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Ar(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitDecimal(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Ar(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitList(t){let{["type"]:n,["offset"]:r=0,["child"]:i}=t,o=Ot(t.nullBitmap),s=xc(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new se(n,r,a,c,[s,void 0,o],[i])}visitStruct(t){let{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,o=Ot(t.nullBitmap),{length:s=i.reduce((c,{length:l})=>Math.max(c,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,void 0,o],i)}visitUnion(t){let{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,o=Pt(n.ArrayType,t.typeIds),{["length"]:s=o.length,["nullCount"]:a=-1}=t;if(at.isSparseUnion(n))return new se(n,r,s,a,[void 0,void 0,void 0,o],i);let c=xc(t.valueOffsets);return new se(n,r,s,a,[c,void 0,void 0,o],i)}visitDictionary(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.indices.ArrayType,t.data),{["dictionary"]:s=new Vt([new e().visit({type:n.dictionary})])}=t,{["length"]:a=o.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new se(n,r,a,c,[void 0,o,i],[],s)}visitInterval(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Ar(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitDuration(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitFixedSizeList(t){let{["type"]:n,["offset"]:r=0,["child"]:i=new e().visit({type:n.valueType})}=t,o=Ot(t.nullBitmap),{["length"]:s=i.length/Ar(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,void 0,o],[i])}visitMap(t){let{["type"]:n,["offset"]:r=0,["child"]:i=new e().visit({type:n.childType})}=t,o=Ot(t.nullBitmap),s=xc(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new se(n,r,a,c,[s,void 0,o],[i])}},dz=new Ww;function Dt(e){return dz.visit(e)}var Md=class{constructor(t=0,n){this.numChunks=t,this.getChunkIterator=n,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let t=this.chunkIterator.next();if(!t.done)return t;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}};function bg(e){return e.reduce((t,n)=>t+n.nullCount,0)}function xg(e){return e.reduce((t,n,r)=>(t[r+1]=t[r]+n.length,t),new Uint32Array(e.length+1))}function _g(e,t,n,r){let i=[];for(let o=-1,s=e.length;++o<s;){let a=e[o],c=t[o],{length:l}=a;if(c>=r)break;if(n>=c+l)continue;if(c>=n&&c+l<=r){i.push(a);continue}let u=Math.max(0,n-c),f=Math.min(r-c,l);i.push(a.slice(u,f-u))}return i.length===0&&i.push(e[0].slice(0,0)),i}function Xw(e,t,n,r){let i=0,o=0,s=t.length-1;do{if(i>=s-1)return n<t[s]?r(e,i,n-t[i]):null;o=i+Math.trunc((s-i)*.5),n<t[o]?s=o:i=o}while(i<s)}function Nd(e,t){return e.getValid(t)}function la(e){function t(n,r,i){return e(n[r],i)}return function(n){let r=this.data;return Xw(r,this._offsets,n,t)}}function wg(e){let t;function n(r,i,o){return e(r[i],o,t)}return function(r,i){let o=this.data;t=i;let s=Xw(o,this._offsets,r,n);return t=void 0,s}}function vg(e){let t;function n(r,i,o){let s=o,a=0,c=0;for(let l=i-1,u=r.length;++l<u;){let f=r[l];if(~(a=e(f,t,s)))return c+a;s=0,c+=f.length}return-1}return function(r,i){t=r;let o=this.data,s=typeof i!="number"?n(o,0,0):Xw(o,this._offsets,i,n);return t=void 0,s}}var bt=class extends ut{};function hz(e,t){return t===null&&e.length>0?0:-1}function pz(e,t){let{nullBitmap:n}=e;if(!n||e.nullCount<=0)return-1;let r=0;for(let i of new _c(n,e.offset+(t||0),e.length,n,gg)){if(!i)return r;++r}return-1}function kt(e,t,n){if(t===void 0)return-1;if(t===null)switch(e.typeId){case D.Union:break;case D.Dictionary:break;default:return pz(e,n)}let r=je.getVisitFn(e),i=ca(t);for(let o=(n||0)-1,s=e.length;++o<s;)if(i(r(e,o)))return o;return-1}function NO(e,t,n){let r=je.getVisitFn(e),i=ca(t);for(let o=(n||0)-1,s=e.length;++o<s;)if(i(r(e,o)))return o;return-1}bt.prototype.visitNull=hz;bt.prototype.visitBool=kt;bt.prototype.visitInt=kt;bt.prototype.visitInt8=kt;bt.prototype.visitInt16=kt;bt.prototype.visitInt32=kt;bt.prototype.visitInt64=kt;bt.prototype.visitUint8=kt;bt.prototype.visitUint16=kt;bt.prototype.visitUint32=kt;bt.prototype.visitUint64=kt;bt.prototype.visitFloat=kt;bt.prototype.visitFloat16=kt;bt.prototype.visitFloat32=kt;bt.prototype.visitFloat64=kt;bt.prototype.visitUtf8=kt;bt.prototype.visitBinary=kt;bt.prototype.visitFixedSizeBinary=kt;bt.prototype.visitDate=kt;bt.prototype.visitDateDay=kt;bt.prototype.visitDateMillisecond=kt;bt.prototype.visitTimestamp=kt;bt.prototype.visitTimestampSecond=kt;bt.prototype.visitTimestampMillisecond=kt;bt.prototype.visitTimestampMicrosecond=kt;bt.prototype.visitTimestampNanosecond=kt;bt.prototype.visitTime=kt;bt.prototype.visitTimeSecond=kt;bt.prototype.visitTimeMillisecond=kt;bt.prototype.visitTimeMicrosecond=kt;bt.prototype.visitTimeNanosecond=kt;bt.prototype.visitDecimal=kt;bt.prototype.visitList=kt;bt.prototype.visitStruct=kt;bt.prototype.visitUnion=kt;bt.prototype.visitDenseUnion=NO;bt.prototype.visitSparseUnion=NO;bt.prototype.visitDictionary=kt;bt.prototype.visitInterval=kt;bt.prototype.visitIntervalDayTime=kt;bt.prototype.visitIntervalYearMonth=kt;bt.prototype.visitDuration=kt;bt.prototype.visitDurationSecond=kt;bt.prototype.visitDurationMillisecond=kt;bt.prototype.visitDurationMicrosecond=kt;bt.prototype.visitDurationNanosecond=kt;bt.prototype.visitFixedSizeList=kt;bt.prototype.visitMap=kt;var Sc=new bt;var xt=class extends ut{};function Et(e){let{type:t}=e;if(e.nullCount===0&&e.stride===1&&(t.typeId===D.Timestamp||t instanceof Pe&&t.bitWidth!==64||t instanceof Si&&t.bitWidth!==64||t instanceof dr&&t.precision!==xe.HALF))return new Md(e.data.length,r=>{let i=e.data[r];return i.values.subarray(0,i.length)[Symbol.iterator]()});let n=0;return new Md(e.data.length,r=>{let o=e.data[r].length,s=e.slice(n,n+o);return n+=o,new Hw(s)})}var Hw=class{constructor(t){this.vector=t,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}};xt.prototype.visitNull=Et;xt.prototype.visitBool=Et;xt.prototype.visitInt=Et;xt.prototype.visitInt8=Et;xt.prototype.visitInt16=Et;xt.prototype.visitInt32=Et;xt.prototype.visitInt64=Et;xt.prototype.visitUint8=Et;xt.prototype.visitUint16=Et;xt.prototype.visitUint32=Et;xt.prototype.visitUint64=Et;xt.prototype.visitFloat=Et;xt.prototype.visitFloat16=Et;xt.prototype.visitFloat32=Et;xt.prototype.visitFloat64=Et;xt.prototype.visitUtf8=Et;xt.prototype.visitBinary=Et;xt.prototype.visitFixedSizeBinary=Et;xt.prototype.visitDate=Et;xt.prototype.visitDateDay=Et;xt.prototype.visitDateMillisecond=Et;xt.prototype.visitTimestamp=Et;xt.prototype.visitTimestampSecond=Et;xt.prototype.visitTimestampMillisecond=Et;xt.prototype.visitTimestampMicrosecond=Et;xt.prototype.visitTimestampNanosecond=Et;xt.prototype.visitTime=Et;xt.prototype.visitTimeSecond=Et;xt.prototype.visitTimeMillisecond=Et;xt.prototype.visitTimeMicrosecond=Et;xt.prototype.visitTimeNanosecond=Et;xt.prototype.visitDecimal=Et;xt.prototype.visitList=Et;xt.prototype.visitStruct=Et;xt.prototype.visitUnion=Et;xt.prototype.visitDenseUnion=Et;xt.prototype.visitSparseUnion=Et;xt.prototype.visitDictionary=Et;xt.prototype.visitInterval=Et;xt.prototype.visitIntervalDayTime=Et;xt.prototype.visitIntervalYearMonth=Et;xt.prototype.visitDuration=Et;xt.prototype.visitDurationSecond=Et;xt.prototype.visitDurationMillisecond=Et;xt.prototype.visitDurationMicrosecond=Et;xt.prototype.visitDurationNanosecond=Et;xt.prototype.visitFixedSizeList=Et;xt.prototype.visitMap=Et;var Jl=new xt;var mz=(e,t)=>e+t,Qi=class extends ut{visitNull(t,n){return 0}visitInt(t,n){return t.type.bitWidth/8}visitFloat(t,n){return t.type.ArrayType.BYTES_PER_ELEMENT}visitBool(t,n){return 1/8}visitDecimal(t,n){return t.type.bitWidth/8}visitDate(t,n){return(t.type.unit+1)*4}visitTime(t,n){return t.type.bitWidth/8}visitTimestamp(t,n){return t.type.unit===pt.SECOND?4:8}visitInterval(t,n){return(t.type.unit+1)*4}visitDuration(t,n){return 8}visitStruct(t,n){return t.children.reduce((r,i)=>r+Mr.visit(i,n),0)}visitFixedSizeBinary(t,n){return t.type.byteWidth}visitMap(t,n){return 8+t.children.reduce((r,i)=>r+Mr.visit(i,n),0)}visitDictionary(t,n){var r;return t.type.indices.bitWidth/8+(((r=t.dictionary)===null||r===void 0?void 0:r.getByteLength(t.values[n]))||0)}},yz=({valueOffsets:e},t)=>8+(e[t+1]-e[t]),gz=({valueOffsets:e},t)=>8+(e[t+1]-e[t]),bz=({valueOffsets:e,stride:t,children:n},r)=>{let i=n[0],{[r*t]:o}=e,{[r*t+1]:s}=e,a=Mr.getVisitFn(i.type),c=i.slice(o,s-o),l=8;for(let u=-1,f=s-o;++u<f;)l+=a(c,u);return l},xz=({stride:e,children:t},n)=>{let r=t[0],i=r.slice(n*e,e),o=Mr.getVisitFn(r.type),s=0;for(let a=-1,c=i.length;++a<c;)s+=o(i,a);return s},_z=(e,t)=>e.type.mode===me.Dense?RO(e,t):OO(e,t),RO=({type:e,children:t,typeIds:n,valueOffsets:r},i)=>{let o=e.typeIdToChildIndex[n[i]];return 8+Mr.visit(t[o],r[i])},OO=({children:e},t)=>4+Mr.visitMany(e,e.map(()=>t)).reduce(mz,0);Qi.prototype.visitUtf8=yz;Qi.prototype.visitBinary=gz;Qi.prototype.visitList=bz;Qi.prototype.visitFixedSizeList=xz;Qi.prototype.visitUnion=_z;Qi.prototype.visitDenseUnion=RO;Qi.prototype.visitSparseUnion=OO;var Mr=new Qi;var DO,kO={},FO={},Vt=class e{constructor(t){var n,r,i;let o=t[0]instanceof e?t.flatMap(a=>a.data):t;if(o.length===0||o.some(a=>!(a instanceof se)))throw new TypeError("Vector constructor expects an Array of Data instances.");let s=(n=o[0])===null||n===void 0?void 0:n.type;switch(o.length){case 0:this._offsets=[0];break;case 1:{let{get:a,set:c,indexOf:l,byteLength:u}=kO[s.typeId],f=o[0];this.isValid=d=>Nd(f,d),this.get=d=>a(f,d),this.set=(d,h)=>c(f,d,h),this.indexOf=d=>l(f,d),this.getByteLength=d=>u(f,d),this._offsets=[0,f.length];break}default:Object.setPrototypeOf(this,FO[s.typeId]),this._offsets=xg(o);break}this.data=o,this.type=s,this.stride=Ar(s),this.numChildren=(i=(r=s.children)===null||r===void 0?void 0:r.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,n)=>t+n.byteLength,0)}get nullCount(){return bg(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${D[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}set(t,n){}indexOf(t,n){return-1}includes(t,n){return this.indexOf(t,n)>-1}getByteLength(t){return 0}[Symbol.iterator](){return Jl.visit(this)}concat(...t){return new e(this.data.concat(t.flatMap(n=>n.data).flat(Number.POSITIVE_INFINITY)))}slice(t,n){return new e(Ed(this,t,n,({data:r,_offsets:i},o,s)=>_g(r,i,o,s)))}toJSON(){return[...this]}toArray(){let{type:t,data:n,length:r,stride:i,ArrayType:o}=this;switch(t.typeId){case D.Int:case D.Float:case D.Decimal:case D.Time:case D.Timestamp:switch(n.length){case 0:return new o;case 1:return n[0].values.subarray(0,r*i);default:return n.reduce((s,{values:a,length:c})=>(s.array.set(a.subarray(0,c*i),s.offset),s.offset+=c*i,s),{array:new o(r*i),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var n;return this.getChildAt((n=this.type.children)===null||n===void 0?void 0:n.findIndex(r=>r.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new e(this.data.map(({children:n})=>n[t])):null}get isMemoized(){return at.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(at.isDictionary(this.type)){let t=new Sg(this.data[0].dictionary),n=this.data.map(r=>{let i=r.clone();return i.dictionary=t,i});return new e(n)}return new Sg(this)}unmemoize(){if(at.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),n=this.data.map(r=>{let i=r.clone();return i.dictionary=t,i});return new e(n)}return this}};DO=Symbol.toStringTag;Vt[DO]=(e=>{e.type=at.prototype,e.data=[],e.length=0,e.stride=1,e.numChildren=0,e._offsets=new Uint32Array([0]),e[Symbol.isConcatSpreadable]=!0;let t=Object.keys(D).map(n=>D[n]).filter(n=>typeof n=="number"&&n!==D.NONE);for(let n of t){let r=je.getVisitFnByTypeId(n),i=_n.getVisitFnByTypeId(n),o=Sc.getVisitFnByTypeId(n),s=Mr.getVisitFnByTypeId(n);kO[n]={get:r,set:i,indexOf:o,byteLength:s},FO[n]=Object.create(e,{isValid:{value:la(Nd)},get:{value:la(je.getVisitFnByTypeId(n))},set:{value:wg(_n.getVisitFnByTypeId(n))},indexOf:{value:vg(Sc.getVisitFnByTypeId(n))},getByteLength:{value:la(Mr.getVisitFnByTypeId(n))}})}return"Vector"})(Vt.prototype);var Sg=class e extends Vt{constructor(t){super(t.data);let n=this.get,r=this.set,i=this.slice,o=new Array(this.length);Object.defineProperty(this,"get",{value(s){let a=o[s];if(a!==void 0)return a;let c=n.call(this,s);return o[s]=c,c}}),Object.defineProperty(this,"set",{value(s,a){r.call(this,s,a),o[s]=a}}),Object.defineProperty(this,"slice",{value:(s,a)=>new e(i.call(this,s,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new Vt(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function LO(e){if(!e||e.length<=0)return function(i){return!0};let t="",n=e.filter(r=>r===r);return n.length>0&&(t=`
2
2
  switch (x) {${n.map(r=>`
3
- case ${HU(r)}:`).join("")}
3
+ case ${wz(r)}:`).join("")}
4
4
  return false;
5
5
  }`),e.length!==n.length&&(t=`if (x !== x) return false;
6
6
  ${t}`),new Function("x",`${t}
7
- return true;`)}function HU(e){return typeof e!="bigint"?Ki(e):`${Ki(e)}n`}var xv=(e,t)=>(Math.ceil(e)*t+63&-64||64)/t,QU=(e,t=0)=>e.length>=t?e.subarray(0,t):jl(new e.constructor(t),e,0),sa=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?xv(r*1,this.BYTES_PER_ELEMENT):xv(r*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=xv(t*this.stride,this.BYTES_PER_ELEMENT);let n=QU(this.buffer,t);return this.clear(),n}clear(){return this.length=0,this._resize(0),this}_resize(t){return this.buffer=jl(new this.ArrayType(t),this.buffer)}};sa.prototype.offset=0;var ss=class extends sa{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}},Kl=class extends ss{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()}},Jl=class extends ss{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 be=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=Nr(t),this._nulls=new Kl,n&&n.length>0&&(this._isValid=e3(n))}toVector(){return new qt([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:n,_values:r,_nulls:i,_typeIds:o,children:s}=this;return n&&(t+=n.byteLength),r&&(t+=r.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),s.reduce((a,c)=>a+c.byteLength,t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((n,r)=>n+r.reservedByteLength,t)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(t){return this.set(this.length,t)}isValid(t){return this._isValid(t)}set(t,n){return this.setValid(t,this.isValid(n))&&this.setValue(t,n),this}setValue(t,n){this._setValue(this,t,n)}setValid(t,n){return this.length=this._nulls.set(t,+n).length,n}addChild(t,n=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(t){return this.children[t]||null}flush(){let t,n,r,i,{type:o,length:s,nullCount:a,_typeIds:c,_offsets:l,_values:u,_nulls:f}=this;(n=c?.flush(s))?i=l?.flush(s):(i=l?.flush(s))?t=u?.flush(l.last()):t=u?.flush(s),a>0&&(r=f?.flush(s));let d=this.children.map(h=>h.flush());return this.clear(),Ot({type:o,length:s,nullCount:a,children:d,child:d[0],data:t,typeIds:n,nullBitmap:r,valueOffsets:i})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,n,r,i;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(n=this._values)===null||n===void 0||n.clear(),(r=this._offsets)===null||r===void 0||r.clear(),(i=this._typeIds)===null||i===void 0||i.clear();for(let o of this.children)o.clear();return this}};be.prototype.length=1;be.prototype.stride=1;be.prototype.children=null;be.prototype.finished=!1;be.prototype.nullValues=null;be.prototype._isValid=()=>!0;var sn=class extends be{constructor(t){super(t),this._values=new ss(new this.ArrayType(0),this.stride)}setValue(t,n){let r=this._values;return r.reserve(t-r.length+1),super.setValue(t,n)}},no=class extends be{constructor(t){super(t),this._pendingLength=0,this._offsets=new Jl}setValue(t,n){let r=this._pending||(this._pending=new Map),i=r.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=n instanceof to?n[Zr].length:n.length,r.set(t,n)}setValid(t,n){return super.setValid(t,n)?!0:((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){let t=this._pending,n=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,n),this}};var vc=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,n,r,i){return t.prep(8,24),t.writeInt64(BigInt(i??0)),t.pad(4),t.writeInt32(r),t.writeInt64(BigInt(n??0)),t.offset()}};var ro=new Int32Array(2),Jy=new Float32Array(ro.buffer),tg=new Float64Array(ro.buffer),tu=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Nd;(function(e){e[e.UTF8_BYTES=1]="UTF8_BYTES",e[e.UTF16_STRING=2]="UTF16_STRING"})(Nd||(Nd={}));var Or=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 ro[0]=this.readInt32(t),Jy[0]}readFloat64(t){return ro[tu?0:1]=this.readInt32(t),ro[tu?1:0]=this.readInt32(t+4),tg[0]}writeInt8(t,n){this.bytes_[t]=n}writeUint8(t,n){this.bytes_[t]=n}writeInt16(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8}writeUint16(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8}writeInt32(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8,this.bytes_[t+2]=n>>16,this.bytes_[t+3]=n>>24}writeUint32(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8,this.bytes_[t+2]=n>>16,this.bytes_[t+3]=n>>24}writeInt64(t,n){this.writeInt32(t,Number(BigInt.asIntN(32,n))),this.writeInt32(t+4,Number(BigInt.asIntN(32,n>>BigInt(32))))}writeUint64(t,n){this.writeUint32(t,Number(BigInt.asUintN(32,n))),this.writeUint32(t+4,Number(BigInt.asUintN(32,n>>BigInt(32))))}writeFloat32(t,n){Jy[0]=n,this.writeInt32(t,ro[0])}writeFloat64(t,n){tg[0]=n,this.writeInt32(t,ro[tu?0:1]),this.writeInt32(t+4,ro[tu?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let n=0;n<4;n++)t+=String.fromCharCode(this.readInt8(this.position_+4+n));return t}__offset(t,n){let r=t-this.readInt32(t);return n<this.readInt16(r)?this.readInt16(r+n):0}__union(t,n){return t.bb_pos=n+this.readInt32(n),t.bb=this,t}__string(t,n){t+=this.readInt32(t);let r=this.readInt32(t);t+=4;let i=this.bytes_.subarray(t,t+r);return n===Nd.UTF8_BYTES?i:this.text_decoder_.decode(i)}__union_with_string(t,n){return typeof t=="string"?this.__string(n):this.__union(t,n)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let n=0;n<4;n++)if(t.charCodeAt(n)!=this.readInt8(this.position()+4+n))return!1;return!0}createScalarList(t,n){let r=[];for(let i=0;i<n;++i){let o=t(i);o!==null&&r.push(o)}return r}createObjList(t,n){let r=[];for(let i=0;i<n;++i){let o=t(i);o!==null&&r.push(o.unpack())}return r}};var Sc=class e{constructor(t){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let n;t?n=t:n=1024,this.bb=Or.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=Or.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 tn=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 aa;(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"})(aa||(aa={}));var ca;(function(e){e[e.Little=0]="Little",e[e.Big=1]="Big"})(ca||(ca={}));var Rd;(function(e){e[e.DenseArray=0]="DenseArray"})(Rd||(Rd={}));var ki=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static 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 io=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 ki).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}isOrdered(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}dictionaryKind(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):Rd.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,n){t.addFieldInt64(0,n,BigInt("0"))}static addIndexType(t,n){t.addFieldOffset(1,n,0)}static addIsOrdered(t,n){t.addFieldInt8(2,+n,0)}static addDictionaryKind(t,n){t.addFieldInt16(3,n,Rd.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var Od=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsBinary(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return e.startBinary(t),e.endBinary(t)}};var kd=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsBool(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return e.startBool(t),e.endBool(t)}};var Fd;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(Fd||(Fd={}));var la=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDate(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Fd.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,Fd.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,n){return e.startDate(t),e.addUnit(t,n),e.endDate(t)}};var oo=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 ua;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(ua||(ua={}));var fa=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static 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 da=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 Dd;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(Dd||(Dd={}));var ha=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static 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):Dd.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,n){t.addFieldInt16(0,n,Dd.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,n){return e.startFloatingPoint(t),e.addPrecision(t,n),e.endFloatingPoint(t)}};var Ld;(function(e){e[e.YEAR_MONTH=0]="YEAR_MONTH",e[e.DAY_TIME=1]="DAY_TIME",e[e.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(Ld||(Ld={}));var pa=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsInterval(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Ld.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,Ld.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,n){return e.startInterval(t),e.addUnit(t,n),e.endInterval(t)}};var Cd=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsList(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return e.startList(t),e.endList(t)}};var ma=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsMap(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let t=this.bb.__offset(this.bb_pos,4);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startMap(t){t.startObject(1)}static addKeysSorted(t,n){t.addFieldInt8(0,+n,0)}static endMap(t){return t.endObject()}static createMap(t,n){return e.startMap(t),e.addKeysSorted(t,n),e.endMap(t)}};var Bd=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsNull(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return e.startNull(t),e.endNull(t)}};var Pd=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsStruct_(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return e.startStruct_(t),e.endStruct_(t)}};var as=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):ua.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,ua.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 cs=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):ua.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,ua.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 $d;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})($d||($d={}));var Fi=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):$d.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,$d.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 Ud=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 xe;(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"})(xe||(xe={}));var Dn=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):xe.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 io).__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 tn).__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,xe.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 ur=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):ca.Little}fields(t,n){let r=this.bb.__offset(this.bb_pos,6);return r?(n||new Dn).__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 tn).__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,ca.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 kr=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):aa.V1}schema(t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new ur).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}dictionaries(t,n){let r=this.bb.__offset(this.bb_pos,8);return r?(n||new vc).__init(this.bb.__vector(this.bb_pos+r)+t*24,this.bb):null}dictionariesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,n){let r=this.bb.__offset(this.bb_pos,10);return r?(n||new vc).__init(this.bb.__vector(this.bb_pos+r)+t*24,this.bb):null}recordBatchesLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,n){let r=this.bb.__offset(this.bb_pos,12);return r?(n||new tn).__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,aa.V1)}static addSchema(t,n){t.addFieldOffset(1,n,0)}static addDictionaries(t,n){t.addFieldOffset(2,n,0)}static startDictionariesVector(t,n){t.startVector(24,n,8)}static addRecordBatches(t,n){t.addFieldOffset(3,n,0)}static startRecordBatchesVector(t,n){t.startVector(24,n,8)}static addCustomMetadata(t,n){t.addFieldOffset(4,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,n){t.finish(n)}static finishSizePrefixedFooterBuffer(t,n){t.finish(n,void 0,!0)}};var re=class e{constructor(t=[],n,r){this.fields=t||[],this.metadata=n||new Map,r||(r=_v(t)),this.dictionaries=r}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=ng(ng(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:ng(ng(new Map,r[c].metadata),a.metadata)}))&&!1:!0}),s=_v(o,new Map);return new e([...r,...o],i,new Map([...this.dictionaries,...s]))}};re.prototype.fields=null;re.prototype.metadata=null;re.prototype.dictionaries=null;var Pt=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)}};Pt.prototype.type=null;Pt.prototype.name=null;Pt.prototype.nullable=null;Pt.prototype.metadata=null;function ng(e,t){return new Map([...e||new Map,...t||new Map])}function _v(e,t=new Map){for(let n=-1,r=e.length;++n<r;){let o=e[n].type;if(ht.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&&_v(o.children,t)}return t}var ZU=Sc,KU=Or,ls=class{static decode(t){t=new KU(Et(t));let n=kr.getRootAsFooter(t),r=re.decode(n.schema());return new wv(r,n)}static encode(t){let n=new ZU,r=re.encode(n,t.schema);kr.startRecordBatchesVector(n,t.numRecordBatches);for(let s of[...t.recordBatches()].slice().reverse())us.encode(n,s);let i=n.endVector();kr.startDictionariesVector(n,t.numDictionaries);for(let s of[...t.dictionaryBatches()].slice().reverse())us.encode(n,s);let o=n.endVector();return kr.startFooter(n),kr.addSchema(n,r),kr.addVersion(n,on.V4),kr.addRecordBatches(n,i),kr.addDictionaries(n,o),kr.finishFooterBuffer(n,kr.endFooter(n)),n.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,n=on.V4,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 wv=class extends ls{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 us.decode(n)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let n=this._footer.dictionaries(t);if(n)return us.decode(n)}return null}},us=class e{static decode(t){return new e(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,n){let{metaDataLength:r}=n,i=BigInt(n.offset),o=BigInt(n.bodyLength);return vc.createBlock(t,i,r,o)}constructor(t,n,r){this.metaDataLength=t,this.offset=cr(r),this.bodyLength=cr(n)}};var ye=Object.freeze({done:!0,value:void 0}),zd=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},Ic=class{tee(){return this._getDOMStream().tee()}pipe(t,n){return this._getNodeStream().pipe(t,n)}pipeTo(t,n){return this._getDOMStream().pipeTo(t,n)}pipeThrough(t,n){return this._getDOMStream().pipeThrough(t,n)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}},rg=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 Q(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){let{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(ye);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return wn.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return wn.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return Q(this,void 0,void 0,function*(){return yield this.abort(t),ye})}return(t){return Q(this,void 0,void 0,function*(){return yield this.close(),ye})}read(t){return Q(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return Q(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((n,r)=>{this.resolvers.push({resolve:n,reject:r})}):Promise.resolve(ye)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var so=class extends rg{write(t){if((t=Et(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?xd(this.toUint8Array(!0)):this.toUint8Array(!1).then(xd)}toUint8Array(t=!1){return t?Ar(this._values)[0]:Q(this,void 0,void 0,function*(){var n,r,i,o;let s=[],a=0;try{for(var c=!0,l=wi(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 Ar(s,a)[0]})}},ao=class{constructor(t){t&&(this.source=new vv(wn.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)}},Jr=class e{constructor(t){t instanceof e?this.source=t.source:t instanceof so?this.source=new fs(wn.fromAsyncIterable(t)):xy(t)?this.source=new fs(wn.fromNodeStream(t)):_d(t)?this.source=new fs(wn.fromDOMStream(t)):gy(t)?this.source=new fs(wn.fromDOMStream(t.body)):vi(t)?this.source=new fs(wn.fromIterable(t)):Er(t)?this.source=new fs(wn.fromAsyncIterable(t)):Hr(t)&&(this.source=new fs(wn.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)}},vv=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)||ye)}return(t){return Object.create(this.source.return&&this.source.return(t)||ye)}},fs=class{constructor(t){this.source=t,this._closedPromise=new Promise(n=>this._closedPromiseResolve=n)}cancel(t){return Q(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return Q(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return Q(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t,n="read"){return Q(this,void 0,void 0,function*(){return yield this.source.next({cmd:n,size:t})})}throw(t){return Q(this,void 0,void 0,function*(){let n=this.source.throw&&(yield this.source.throw(t))||ye;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(n)})}return(t){return Q(this,void 0,void 0,function*(){let n=this.source.return&&(yield this.source.return(t))||ye;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(n)})}};var jd=class extends ao{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}}},ya=class extends Jr{constructor(t,n){super(),this.position=0,this._handle=t,typeof n=="number"?this.size=n:this._pending=Q(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return Q(this,void 0,void 0,function*(){let{buffer:n,byteOffset:r}=yield this.readAt(t,4);return new DataView(n,r).getInt32(0,!0)})}seek(t){return Q(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(t,this.size),t<this.size})}read(t){return Q(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle: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 Q(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 Q(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return Q(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return Q(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var Iv={};_i(Iv,{BaseInt64:()=>qd,Int128:()=>Vd,Int64:()=>ds,Uint64:()=>Ae});function eu(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}var nu=8,Sv=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],qd=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`${eu(this.buffer[1])} ${eu(this.buffer[0])}`}},Ae=class e extends qd{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=nu<r-o?nu:r-o,a=new e(new Uint32Array([Number.parseInt(t.slice(o,o+s),10),0])),c=new e(new Uint32Array([Sv[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)}},ds=class e extends qd{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=nu<i-s?nu:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0])),l=new e(new Uint32Array([Sv[a],0]));o.times(l),o.plus(c),s+=a}return r?o.negate():o}static convertArray(t){let n=new Uint32Array(t.length*2);for(let r=-1,i=t.length;++r<i;)e.from(t[r],new Uint32Array(n.buffer,n.byteOffset+2*r*4,2));return n}static multiply(t,n){return new e(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new e(new Uint32Array(t.buffer)).plus(n)}},Vd=class e{constructor(t){this.buffer=t}high(){return new ds(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new ds(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 Ae(new Uint32Array([this.buffer[3],0])),r=new Ae(new Uint32Array([this.buffer[2],0])),i=new Ae(new Uint32Array([this.buffer[1],0])),o=new Ae(new Uint32Array([this.buffer[0],0])),s=new Ae(new Uint32Array([t.buffer[3],0])),a=new Ae(new Uint32Array([t.buffer[2],0])),c=new Ae(new Uint32Array([t.buffer[1],0])),l=new Ae(new Uint32Array([t.buffer[0],0])),u=Ae.multiply(o,l);this.buffer[0]=u.low();let f=new Ae(new Uint32Array([u.high(),0]));return u=Ae.multiply(i,l),f.plus(u),u=Ae.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 Ae(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(Ae.multiply(r,l)).plus(Ae.multiply(i,c)).plus(Ae.multiply(o,a)),this.buffer[3]+=Ae.multiply(n,l).plus(Ae.multiply(r,c)).plus(Ae.multiply(i,a)).plus(Ae.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`${eu(this.buffer[3])} ${eu(this.buffer[2])} ${eu(this.buffer[1])} ${eu(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=nu<i-s?nu:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0,0,0])),l=new e(new Uint32Array([Sv[a],0,0,0]));o.times(l),o.plus(c),s+=a}return r?o.negate():o}static convertArray(t){let n=new Uint32Array(t.length*4);for(let r=-1,i=t.length;++r<i;)e.from(t[r],new Uint32Array(n.buffer,n.byteOffset+4*4*r,4));return n}};var Yd=class extends gt{constructor(t,n,r,i){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=n,this.buffers=r,this.dictionaries=i}visit(t){return super.visit(t instanceof Pt?t.type:t)}visitNull(t,{length:n}=this.nextFieldNode()){return Ot({type:t,length:n})}visitBool(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ot({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitInt(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ot({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitFloat(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ot({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitUtf8(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ot({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 Ot({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 Ot({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDate(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ot({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitTimestamp(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ot({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitTime(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ot({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDecimal(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ot({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitList(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ot({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 Ot({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),children:this.visitMany(t.children)})}visitUnion(t){return t.mode===Ee.Sparse?this.visitSparseUnion(t):this.visitDenseUnion(t)}visitDenseUnion(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ot({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ot({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ot({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 Ot({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitFixedSizeList(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ot({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 Ot({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)}},ig=class extends Yd{constructor(t,n,r,i){super(new Uint8Array(0),n,r,i),this.sources=t}readNullBitmap(t,n,{offset:r}=this.nextBufferRange()){return n<=0?new Uint8Array(0):_c(this.sources[r])}readOffsets(t,{offset:n}=this.nextBufferRange()){return Ct(Uint8Array,Ct(Int32Array,this.sources[n]))}readTypeIds(t,{offset:n}=this.nextBufferRange()){return Ct(Uint8Array,Ct(t.ArrayType,this.sources[n]))}readData(t,{offset:n}=this.nextBufferRange()){let{sources:r}=this;return ht.isTimestamp(t)?Ct(Uint8Array,ds.convertArray(r[n])):(ht.isInt(t)||ht.isTime(t))&&t.bitWidth===64?Ct(Uint8Array,ds.convertArray(r[n])):ht.isDate(t)&&t.unit===vn.MILLISECOND?Ct(Uint8Array,ds.convertArray(r[n])):ht.isDecimal(t)?Ct(Uint8Array,Vd.convertArray(r[n])):ht.isBinary(t)||ht.isFixedSizeBinary(t)?JU(r[n]):ht.isBool(t)?_c(r[n]):ht.isUtf8(t)?ea(r[n].join("")):Ct(Uint8Array,Ct(t.ArrayType,r[n].map(i=>+i)))}};function JU(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 ru=class extends no{constructor(t){super(t),this._values=new sa(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 og=class extends be{constructor(t){super(t),this._values=new Kl}setValue(t,n){this._values.set(t,+n)}};var Tc=class extends sn{};Tc.prototype._setValue=iv;var Gd=class extends Tc{};Gd.prototype._setValue=ky;var Wd=class extends Tc{};Wd.prototype._setValue=Fy;var Xd=class extends sn{};Xd.prototype._setValue=av;var sg=class extends be{constructor({type:t,nullValues:n,dictionaryHashFunction:r}){super({type:new Mr(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=Ec({type:this.type.indices,nullValues:n}),this.dictionary=Ec({type:this.type.dictionary,nullValues:null}),typeof r=="function"&&(this.valueToKey=r)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,n){let r=this.indices;return n=r.setValid(t,n),this.length=r.length,n}setValue(t,n){let r=this._keysToIndices,i=this.valueToKey(n),o=r[i];return o===void 0&&(r[i]=o=this._dictionaryOffset+this.dictionary.append(n).length-1),this.indices.setValue(t,o)}flush(){let t=this.type,n=this._dictionary,r=this.dictionary.toVector(),i=this.indices.flush().clone(t);return i.dictionary=n?n.concat(r):r,this.finished||(this._dictionaryOffset+=r.length),this._dictionary=i.dictionary,this.clear(),i}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(t){return typeof t=="string"?t:`${t}`}};var Hd=class extends sn{};Hd.prototype._setValue=rv;var ag=class extends be{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 Mi(this.type.listSize,new Pt(n,t.type,!0)),r}};var Ac=class extends sn{setValue(t,n){this._values.set(t,n)}},cg=class extends Ac{setValue(t,n){super.setValue(t,Id(n))}},lg=class extends Ac{},ug=class extends Ac{};var Mc=class extends sn{};Mc.prototype._setValue=cv;var Qd=class extends Mc{};Qd.prototype._setValue=jy;var Zd=class extends Mc{};Zd.prototype._setValue=qy;var ti=class extends sn{setValue(t,n){this._values.set(t,n)}},fg=class extends ti{},dg=class extends ti{},hg=class extends ti{},pg=class extends ti{},mg=class extends ti{},yg=class extends ti{},gg=class extends ti{},bg=class extends ti{};var xg=class extends no{constructor(t){super(t),this._offsets=new Jl}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 Ei(new Pt(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 _g=class extends no{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 Ni(new Pt(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 wg=class extends be{setValue(t,n){}setValid(t,n){return this.length=Math.max(t+1,this.length),n}};var vg=class extends be{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 me([...this.type.children,new Pt(n,t.type,!0)]),r}};var hs=class extends sn{};hs.prototype._setValue=ov;var Kd=class extends hs{};Kd.prototype._setValue=Dy;var Jd=class extends hs{};Jd.prototype._setValue=Ly;var th=class extends hs{};th.prototype._setValue=Cy;var eh=class extends hs{};eh.prototype._setValue=By;var ps=class extends sn{};ps.prototype._setValue=sv;var nh=class extends ps{};nh.prototype._setValue=Py;var rh=class extends ps{};rh.prototype._setValue=$y;var ih=class extends ps{};ih.prototype._setValue=Uy;var oh=class extends ps{};oh.prototype._setValue=zy;var iu=class extends be{constructor(t){super(t),this._typeIds=new ss(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.setValid(t,this.isValid(n))&&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 Pt(n,t.type)];return this.type=new Ai(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.")}},Sg=class extends iu{},Ig=class extends iu{constructor(t){super(t),this._offsets=new ss(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 sh=class extends no{constructor(t){super(t),this._values=new sa(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,ea(n))}_flushPending(t,n){}};sh.prototype._flushPending=ru.prototype._flushPending;var Tv=class extends gt{visitNull(){return wg}visitBool(){return og}visitInt(){return ti}visitInt8(){return fg}visitInt16(){return dg}visitInt32(){return hg}visitInt64(){return pg}visitUint8(){return mg}visitUint16(){return yg}visitUint32(){return gg}visitUint64(){return bg}visitFloat(){return Ac}visitFloat16(){return cg}visitFloat32(){return lg}visitFloat64(){return ug}visitUtf8(){return sh}visitBinary(){return ru}visitFixedSizeBinary(){return Hd}visitDate(){return Tc}visitDateDay(){return Gd}visitDateMillisecond(){return Wd}visitTimestamp(){return hs}visitTimestampSecond(){return Kd}visitTimestampMillisecond(){return Jd}visitTimestampMicrosecond(){return th}visitTimestampNanosecond(){return eh}visitTime(){return ps}visitTimeSecond(){return nh}visitTimeMillisecond(){return rh}visitTimeMicrosecond(){return ih}visitTimeNanosecond(){return oh}visitDecimal(){return Xd}visitList(){return xg}visitStruct(){return vg}visitUnion(){return iu}visitDenseUnion(){return Ig}visitSparseUnion(){return Sg}visitDictionary(){return sg}visitInterval(){return Mc}visitIntervalDayTime(){return Qd}visitIntervalYearMonth(){return Zd}visitFixedSizeList(){return ag}visitMap(){return _g}},n3=new Tv;var St=class extends gt{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 fr(e,t){return t instanceof e.constructor}function ah(e,t){return e===t||fr(e,t)}function ms(e,t){return e===t||fr(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function Tg(e,t){return e===t||fr(e,t)&&e.precision===t.precision}function tz(e,t){return e===t||fr(e,t)&&e.byteWidth===t.byteWidth}function Ev(e,t){return e===t||fr(e,t)&&e.unit===t.unit}function ch(e,t){return e===t||fr(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function lh(e,t){return e===t||fr(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function ez(e,t){return e===t||fr(e,t)&&e.children.length===t.children.length&&co.compareManyFields(e.children,t.children)}function nz(e,t){return e===t||fr(e,t)&&e.children.length===t.children.length&&co.compareManyFields(e.children,t.children)}function Av(e,t){return e===t||fr(e,t)&&e.mode===t.mode&&e.typeIds.every((n,r)=>n===t.typeIds[r])&&co.compareManyFields(e.children,t.children)}function rz(e,t){return e===t||fr(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&co.visit(e.indices,t.indices)&&co.visit(e.dictionary,t.dictionary)}function Mv(e,t){return e===t||fr(e,t)&&e.unit===t.unit}function iz(e,t){return e===t||fr(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&co.compareManyFields(e.children,t.children)}function oz(e,t){return e===t||fr(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&co.compareManyFields(e.children,t.children)}St.prototype.visitNull=ah;St.prototype.visitBool=ah;St.prototype.visitInt=ms;St.prototype.visitInt8=ms;St.prototype.visitInt16=ms;St.prototype.visitInt32=ms;St.prototype.visitInt64=ms;St.prototype.visitUint8=ms;St.prototype.visitUint16=ms;St.prototype.visitUint32=ms;St.prototype.visitUint64=ms;St.prototype.visitFloat=Tg;St.prototype.visitFloat16=Tg;St.prototype.visitFloat32=Tg;St.prototype.visitFloat64=Tg;St.prototype.visitUtf8=ah;St.prototype.visitBinary=ah;St.prototype.visitFixedSizeBinary=tz;St.prototype.visitDate=Ev;St.prototype.visitDateDay=Ev;St.prototype.visitDateMillisecond=Ev;St.prototype.visitTimestamp=ch;St.prototype.visitTimestampSecond=ch;St.prototype.visitTimestampMillisecond=ch;St.prototype.visitTimestampMicrosecond=ch;St.prototype.visitTimestampNanosecond=ch;St.prototype.visitTime=lh;St.prototype.visitTimeSecond=lh;St.prototype.visitTimeMillisecond=lh;St.prototype.visitTimeMicrosecond=lh;St.prototype.visitTimeNanosecond=lh;St.prototype.visitDecimal=ah;St.prototype.visitList=ez;St.prototype.visitStruct=nz;St.prototype.visitUnion=Av;St.prototype.visitDenseUnion=Av;St.prototype.visitSparseUnion=Av;St.prototype.visitDictionary=rz;St.prototype.visitInterval=Mv;St.prototype.visitIntervalDayTime=Mv;St.prototype.visitIntervalYearMonth=Mv;St.prototype.visitFixedSizeList=iz;St.prototype.visitMap=oz;var co=new St;function Nc(e,t){return co.compareSchemas(e,t)}function r3(e,t){return co.compareFields(e,t)}function i3(e,t){return co.visit(e,t)}function Ec(e){let t=e.type,n=new(n3.getVisitFn(t)())(e);if(t.children&&t.children.length>0){let r=e.children||[],i={nullValues:e.nullValues},o=Array.isArray(r)?(s,a)=>r[a]||i:({name:s})=>r[s]||i;for(let[s,a]of t.children.entries()){let{type:c}=a,l=o(a,s);n.children.push(Ec(Object.assign(Object.assign({},l),{type:c})))}}return n}function Eg(e,t){return sz(e,t.map(n=>n.data.concat()))}function sz(e,t){let n=[...e.fields],r=[],i={numBatches:t.reduce((f,d)=>Math.max(f,d.length),0)},o=0,s=0,a=-1,c=t.length,l,u=[];for(;i.numBatches-- >0;){for(s=Number.POSITIVE_INFINITY,a=-1;++a<c;)u[a]=l=t[a].shift(),s=Math.min(s,l?l.length:s);Number.isFinite(s)&&(u=az(n,s,u,t,i),s>0&&(r[o++]=Ot({type:new me(n),length:s,nullCount:0,children:u.slice()})))}return[e=e.assign(n),r.map(f=>new ke(e,f))]}function az(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:Ot({type:f.type,length:t,nullCount:t,nullBitmap:new Uint8Array(s)})}}return n}var o3,an=class e{constructor(...t){var n,r;if(t.length===0)return this.batches=[],this.schema=new re([]),this._offsets=[0],this;let i,o;t[0]instanceof re&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(o=t.pop());let s=c=>{if(c){if(c instanceof ke)return[c];if(c instanceof e)return c.batches;if(c instanceof le){if(c.type instanceof me)return[new ke(new re(c.type.children),c)]}else{if(Array.isArray(c))return c.flatMap(l=>s(l));if(typeof c[Symbol.iterator]=="function")return[...c].flatMap(l=>s(l));if(typeof c=="object"){let l=Object.keys(c),u=l.map(h=>new qt([c[h]])),f=new re(l.map((h,p)=>new Pt(String(h),u[p].type))),[,d]=Eg(f,u);return d.length===0?[new ke(c)]:d}}}return[]},a=t.flatMap(c=>s(c));if(i=(r=i??((n=a[0])===null||n===void 0?void 0:n.schema))!==null&&r!==void 0?r:new re([]),!(i instanceof re))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let c of a){if(!(c instanceof ke))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Nc(i,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=o??Xy(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=Wy(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?Zl.visit(new qt(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
7
+ return true;`)}function wz(e){return typeof e!="bigint"?wi(e):`${wi(e)}n`}var Zw=(e,t)=>(Math.ceil(e)*t+63&-64||64)/t,vz=(e,t=0)=>e.length>=t?e.subarray(0,t):Yl(new e.constructor(t),e,0),ua=class{constructor(t,n=1){this.buffer=t,this.stride=n,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t.constructor,this._resize(this.length=Math.ceil(t.length/n))}get byteLength(){return Math.ceil(this.length*this.stride)*this.BYTES_PER_ELEMENT}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(t,n){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;let n=this.stride,r=this.length*n,i=this.buffer.length;r>=i&&this._resize(i===0?Zw(r*1,this.BYTES_PER_ELEMENT):Zw(r*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=Zw(t*this.stride,this.BYTES_PER_ELEMENT);let n=vz(this.buffer,t);return this.clear(),n}clear(){return this.length=0,this._resize(0),this}_resize(t){return this.buffer=Yl(new this.ArrayType(t),this.buffer)}};ua.prototype.offset=0;var es=class extends ua{last(){return this.get(this.length-1)}get(t){return this.buffer[t]}set(t,n){return this.reserve(t-this.length+1),this.buffer[t*this.stride]=n,this}},tu=class extends es{constructor(t=new Uint8Array(0)){super(t,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,n){let{buffer:r}=this.reserve(t-this.length+1),i=t>>3,o=t%8,s=r[i]>>o&1;return n?s===0&&(r[i]|=1<<o,++this.numValid):s===1&&(r[i]&=~(1<<o),--this.numValid),this}clear(){return this.numValid=0,super.clear()}},eu=class extends es{constructor(t=new Int32Array(1)){super(t,1)}append(t){return this.set(this.length-1,t)}set(t,n){let r=this.length-1,i=this.reserve(t-r+1).buffer;return r<t++&&i.fill(i[r],r,t),i[t]=i[t-1]+n,this}flush(t=this.length-1){return t>this.length&&this.set(t-1,0),super.flush(t+1)}};var _e=class{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t){throw new Error('"throughDOM" not available in this environment')}constructor({type:t,nullValues:n}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=n,this.stride=Ar(t),this._nulls=new tu,n&&n.length>0&&(this._isValid=LO(n))}toVector(){return new Vt([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:n,_values:r,_nulls:i,_typeIds:o,children:s}=this;return n&&(t+=n.byteLength),r&&(t+=r.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),s.reduce((a,c)=>a+c.byteLength,t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((n,r)=>n+r.reservedByteLength,t)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(t){return this.set(this.length,t)}isValid(t){return this._isValid(t)}set(t,n){return this.setValid(t,this.isValid(n))&&this.setValue(t,n),this}setValue(t,n){this._setValue(this,t,n)}setValid(t,n){return this.length=this._nulls.set(t,+n).length,n}addChild(t,n=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(t){return this.children[t]||null}flush(){let t,n,r,i,{type:o,length:s,nullCount:a,_typeIds:c,_offsets:l,_values:u,_nulls:f}=this;(n=c?.flush(s))?i=l?.flush(s):(i=l?.flush(s))?t=u?.flush(l.last()):t=u?.flush(s),a>0&&(r=f?.flush(s));let d=this.children.map(h=>h.flush());return this.clear(),Dt({type:o,length:s,nullCount:a,children:d,child:d[0],data:t,typeIds:n,nullBitmap:r,valueOffsets:i})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,n,r,i;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(n=this._values)===null||n===void 0||n.clear(),(r=this._offsets)===null||r===void 0||r.clear(),(i=this._typeIds)===null||i===void 0||i.clear();for(let o of this.children)o.clear();return this}};_e.prototype.length=1;_e.prototype.stride=1;_e.prototype.children=null;_e.prototype.finished=!1;_e.prototype.nullValues=null;_e.prototype._isValid=()=>!0;var Ve=class extends _e{constructor(t){super(t),this._values=new es(new this.ArrayType(0),this.stride)}setValue(t,n){let r=this._values;return r.reserve(t-r.length+1),super.setValue(t,n)}},Ki=class extends _e{constructor(t){super(t),this._pendingLength=0,this._offsets=new eu}setValue(t,n){let r=this._pending||(this._pending=new Map),i=r.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=n instanceof Zi?n[Xr].length:n.length,r.set(t,n)}setValid(t,n){return super.setValid(t,n)?!0:((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){let t=this._pending,n=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,n),this}};var Ic=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,n,r,i){return t.prep(8,24),t.writeInt64(BigInt(i??0)),t.pad(4),t.writeInt32(r),t.writeInt64(BigInt(n??0)),t.offset()}};var Ji=new Int32Array(2),Ig=new Float32Array(Ji.buffer),Tg=new Float64Array(Ji.buffer),nu=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Rd;(function(e){e[e.UTF8_BYTES=1]="UTF8_BYTES",e[e.UTF16_STRING=2]="UTF16_STRING"})(Rd||(Rd={}));var Nr=class e{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new e(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readUint64(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readFloat32(t){return Ji[0]=this.readInt32(t),Ig[0]}readFloat64(t){return Ji[nu?0:1]=this.readInt32(t),Ji[nu?1:0]=this.readInt32(t+4),Tg[0]}writeInt8(t,n){this.bytes_[t]=n}writeUint8(t,n){this.bytes_[t]=n}writeInt16(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8}writeUint16(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8}writeInt32(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8,this.bytes_[t+2]=n>>16,this.bytes_[t+3]=n>>24}writeUint32(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8,this.bytes_[t+2]=n>>16,this.bytes_[t+3]=n>>24}writeInt64(t,n){this.writeInt32(t,Number(BigInt.asIntN(32,n))),this.writeInt32(t+4,Number(BigInt.asIntN(32,n>>BigInt(32))))}writeUint64(t,n){this.writeUint32(t,Number(BigInt.asUintN(32,n))),this.writeUint32(t+4,Number(BigInt.asUintN(32,n>>BigInt(32))))}writeFloat32(t,n){Ig[0]=n,this.writeInt32(t,Ji[0])}writeFloat64(t,n){Tg[0]=n,this.writeInt32(t,Ji[nu?0:1]),this.writeInt32(t+4,Ji[nu?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let n=0;n<4;n++)t+=String.fromCharCode(this.readInt8(this.position_+4+n));return t}__offset(t,n){let r=t-this.readInt32(t);return n<this.readInt16(r)?this.readInt16(r+n):0}__union(t,n){return t.bb_pos=n+this.readInt32(n),t.bb=this,t}__string(t,n){t+=this.readInt32(t);let r=this.readInt32(t);t+=4;let i=this.bytes_.subarray(t,t+r);return n===Rd.UTF8_BYTES?i:this.text_decoder_.decode(i)}__union_with_string(t,n){return typeof t=="string"?this.__string(n):this.__union(t,n)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let n=0;n<4;n++)if(t.charCodeAt(n)!=this.readInt8(this.position()+4+n))return!1;return!0}createScalarList(t,n){let r=[];for(let i=0;i<n;++i){let o=t(i);o!==null&&r.push(o)}return r}createObjList(t,n){let r=[];for(let i=0;i<n;++i){let o=t(i);o!==null&&r.push(o.unpack())}return r}};var Tc=class e{constructor(t){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let n;t?n=t:n=1024,this.bb=Nr.allocate(n),this.space=n}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(t){this.force_defaults=t}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,n){t>this.minalign&&(this.minalign=t);let r=~(this.bb.capacity()-this.space+n)+1&t-1;for(;this.space<r+t+n;){let i=this.bb.capacity();this.bb=e.growByteBuffer(this.bb),this.space+=this.bb.capacity()-i}this.pad(r)}pad(t){for(let n=0;n<t;n++)this.bb.writeInt8(--this.space,0)}writeInt8(t){this.bb.writeInt8(this.space-=1,t)}writeInt16(t){this.bb.writeInt16(this.space-=2,t)}writeInt32(t){this.bb.writeInt32(this.space-=4,t)}writeInt64(t){this.bb.writeInt64(this.space-=8,t)}writeFloat32(t){this.bb.writeFloat32(this.space-=4,t)}writeFloat64(t){this.bb.writeFloat64(this.space-=8,t)}addInt8(t){this.prep(1,0),this.writeInt8(t)}addInt16(t){this.prep(2,0),this.writeInt16(t)}addInt32(t){this.prep(4,0),this.writeInt32(t)}addInt64(t){this.prep(8,0),this.writeInt64(t)}addFloat32(t){this.prep(4,0),this.writeFloat32(t)}addFloat64(t){this.prep(8,0),this.writeFloat64(t)}addFieldInt8(t,n,r){(this.force_defaults||n!=r)&&(this.addInt8(n),this.slot(t))}addFieldInt16(t,n,r){(this.force_defaults||n!=r)&&(this.addInt16(n),this.slot(t))}addFieldInt32(t,n,r){(this.force_defaults||n!=r)&&(this.addInt32(n),this.slot(t))}addFieldInt64(t,n,r){(this.force_defaults||n!==r)&&(this.addInt64(n),this.slot(t))}addFieldFloat32(t,n,r){(this.force_defaults||n!=r)&&(this.addFloat32(n),this.slot(t))}addFieldFloat64(t,n,r){(this.force_defaults||n!=r)&&(this.addFloat64(n),this.slot(t))}addFieldOffset(t,n,r){(this.force_defaults||n!=r)&&(this.addOffset(n),this.slot(t))}addFieldStruct(t,n,r){n!=r&&(this.nested(n),this.slot(t))}nested(t){if(t!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")}slot(t){this.vtable!==null&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){let n=t.capacity();if(n&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");let r=n<<1,i=Nr.allocate(r);return i.setPosition(r-n),i.bytes().set(t.bytes(),r-n),i}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let n=0;n<t;n++)this.vtable[n]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let t=this.offset(),n=this.vtable_in_use-1;for(;n>=0&&this.vtable[n]==0;n--);let r=n+1;for(;n>=0;n--)this.addInt16(this.vtable[n]!=0?t-this.vtable[n]:0);let i=2;this.addInt16(t-this.object_start);let o=(r+i)*2;this.addInt16(o);let s=0,a=this.space;t:for(n=0;n<this.vtables.length;n++){let c=this.bb.capacity()-this.vtables[n];if(o==this.bb.readInt16(c)){for(let l=2;l<o;l+=2)if(this.bb.readInt16(a+l)!=this.bb.readInt16(c+l))continue t;s=this.vtables[n];break}}return s?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,s-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,n,r){let i=r?4:0;if(n){let o=n;if(this.prep(this.minalign,8+i),o.length!=4)throw new TypeError("FlatBuffers: file identifier must be length "+4);for(let s=3;s>=0;s--)this.writeInt8(o.charCodeAt(s))}this.prep(this.minalign,4+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,n){this.finish(t,n,!0)}requiredField(t,n){let r=this.bb.capacity()-t,i=r-this.bb.readInt32(r);if(!(n<this.bb.readInt16(i)&&this.bb.readInt16(i+n)!=0))throw new TypeError("FlatBuffers: field "+n+" must be set")}startVector(t,n,r){this.notNested(),this.vector_num_elems=n,this.prep(4,t*n),this.prep(r,t*n)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);let n=this.createString(t);return this.string_maps.set(t,n),n}createString(t){if(t==null)return 0;let n;t instanceof Uint8Array?n=t:n=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,n.length,1),this.bb.setPosition(this.space-=n.length);for(let r=0,i=this.space,o=this.bb.bytes();r<n.length;r++)o[i++]=n[r];return this.endVector()}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){let n=[];for(let r=0;r<t.length;++r){let i=t[r];if(i!==null)n.push(this.createObjectOffset(i));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return n}createStructOffsetList(t,n){return n(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}};var en=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsKeyValue(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}key(t){let n=this.bb.__offset(this.bb_pos,4);return n?this.bb.__string(this.bb_pos+n,t):null}value(t){let n=this.bb.__offset(this.bb_pos,6);return n?this.bb.__string(this.bb_pos+n,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,n){t.addFieldOffset(0,n,0)}static addValue(t,n){t.addFieldOffset(1,n,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,n,r){return e.startKeyValue(t),e.addKey(t,n),e.addValue(t,r),e.endKeyValue(t)}};var fa;(function(e){e[e.V1=0]="V1",e[e.V2=1]="V2",e[e.V3=2]="V3",e[e.V4=3]="V4",e[e.V5=4]="V5"})(fa||(fa={}));var da;(function(e){e[e.Little=0]="Little",e[e.Big=1]="Big"})(da||(da={}));var Od;(function(e){e[e.DenseArray=0]="DenseArray"})(Od||(Od={}));var Ri=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsInt(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startInt(t){t.startObject(2)}static addBitWidth(t,n){t.addFieldInt32(0,n,0)}static addIsSigned(t,n){t.addFieldInt8(1,+n,0)}static endInt(t){return t.endObject()}static createInt(t,n,r){return e.startInt(t),e.addBitWidth(t,n),e.addIsSigned(t,r),e.endInt(t)}};var to=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDictionaryEncoding(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new Ri).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}isOrdered(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}dictionaryKind(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):Od.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,n){t.addFieldInt64(0,n,BigInt("0"))}static addIndexType(t,n){t.addFieldOffset(1,n,0)}static addIsOrdered(t,n){t.addFieldInt8(2,+n,0)}static addDictionaryKind(t,n){t.addFieldInt16(3,n,Od.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var Dd=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsBinary(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return e.startBinary(t),e.endBinary(t)}};var kd=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsBool(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return e.startBool(t),e.endBool(t)}};var Fd;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(Fd||(Fd={}));var ha=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDate(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Fd.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,Fd.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,n){return e.startDate(t),e.addUnit(t,n),e.endDate(t)}};var eo=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDecimal(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,n){t.addFieldInt32(0,n,0)}static addScale(t,n){t.addFieldInt32(1,n,0)}static addBitWidth(t,n){t.addFieldInt32(2,n,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,n,r,i){return e.startDecimal(t),e.addPrecision(t,n),e.addScale(t,r),e.addBitWidth(t,i),e.endDecimal(t)}};var Oi;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(Oi||(Oi={}));var pa=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDuration(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Oi.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,Oi.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,n){return e.startDuration(t),e.addUnit(t,n),e.endDuration(t)}};var ma=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFixedSizeBinary(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,n){t.addFieldInt32(0,n,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,n){return e.startFixedSizeBinary(t),e.addByteWidth(t,n),e.endFixedSizeBinary(t)}};var ya=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFixedSizeList(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}listSize(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,n){t.addFieldInt32(0,n,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,n){return e.startFixedSizeList(t),e.addListSize(t,n),e.endFixedSizeList(t)}};var Ld;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(Ld||(Ld={}));var ga=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFloatingPoint(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Ld.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,n){t.addFieldInt16(0,n,Ld.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,n){return e.startFloatingPoint(t),e.addPrecision(t,n),e.endFloatingPoint(t)}};var Cd;(function(e){e[e.YEAR_MONTH=0]="YEAR_MONTH",e[e.DAY_TIME=1]="DAY_TIME",e[e.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(Cd||(Cd={}));var ba=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsInterval(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Cd.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,Cd.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,n){return e.startInterval(t),e.addUnit(t,n),e.endInterval(t)}};var Bd=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsList(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return e.startList(t),e.endList(t)}};var xa=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsMap(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let t=this.bb.__offset(this.bb_pos,4);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startMap(t){t.startObject(1)}static addKeysSorted(t,n){t.addFieldInt8(0,+n,0)}static endMap(t){return t.endObject()}static createMap(t,n){return e.startMap(t),e.addKeysSorted(t,n),e.endMap(t)}};var Pd=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsNull(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return e.startNull(t),e.endNull(t)}};var $d=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsStruct_(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return e.startStruct_(t),e.endStruct_(t)}};var ns=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsTime(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Oi.MILLISECOND}bitWidth(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,n){t.addFieldInt16(0,n,Oi.MILLISECOND)}static addBitWidth(t,n){t.addFieldInt32(1,n,32)}static endTime(t){return t.endObject()}static createTime(t,n,r){return e.startTime(t),e.addUnit(t,n),e.addBitWidth(t,r),e.endTime(t)}};var rs=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsTimestamp(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Oi.SECOND}timezone(t){let n=this.bb.__offset(this.bb_pos,6);return n?this.bb.__string(this.bb_pos+n,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,n){t.addFieldInt16(0,n,Oi.SECOND)}static addTimezone(t,n){t.addFieldOffset(1,n,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,n,r){return e.startTimestamp(t),e.addUnit(t,n),e.addTimezone(t,r),e.endTimestamp(t)}};var Ud;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(Ud||(Ud={}));var Di=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsUnion(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}mode(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Ud.Sparse}typeIds(t){let n=this.bb.__offset(this.bb_pos,6);return n?this.bb.readInt32(this.bb.__vector(this.bb_pos+n)+t*4):0}typeIdsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){let t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,n){t.addFieldInt16(0,n,Ud.Sparse)}static addTypeIds(t,n){t.addFieldOffset(1,n,0)}static createTypeIdsVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addInt32(n[r]);return t.endVector()}static startTypeIdsVector(t,n){t.startVector(4,n,4)}static endUnion(t){return t.endObject()}static createUnion(t,n,r){return e.startUnion(t),e.addMode(t,n),e.addTypeIds(t,r),e.endUnion(t)}};var zd=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsUtf8(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return e.startUtf8(t),e.endUtf8(t)}};var ge;(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.FloatingPoint=3]="FloatingPoint",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct_=13]="Struct_",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.LargeBinary=19]="LargeBinary",e[e.LargeUtf8=20]="LargeUtf8",e[e.LargeList=21]="LargeList",e[e.RunEndEncoded=22]="RunEndEncoded"})(ge||(ge={}));var Fn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsField(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}name(t){let n=this.bb.__offset(this.bb_pos,4);return n?this.bb.__string(this.bb_pos+n,t):null}nullable(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):ge.NONE}type(t){let n=this.bb.__offset(this.bb_pos,10);return n?this.bb.__union(t,this.bb_pos+n):null}dictionary(t){let n=this.bb.__offset(this.bb_pos,12);return n?(t||new to).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}children(t,n){let r=this.bb.__offset(this.bb_pos,14);return r?(n||new e).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}childrenLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,n){let r=this.bb.__offset(this.bb_pos,16);return r?(n||new en).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,n){t.addFieldOffset(0,n,0)}static addNullable(t,n){t.addFieldInt8(1,+n,0)}static addTypeType(t,n){t.addFieldInt8(2,n,ge.NONE)}static addType(t,n){t.addFieldOffset(3,n,0)}static addDictionary(t,n){t.addFieldOffset(4,n,0)}static addChildren(t,n){t.addFieldOffset(5,n,0)}static createChildrenVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startChildrenVector(t,n){t.startVector(4,n,4)}static addCustomMetadata(t,n){t.addFieldOffset(6,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static endField(t){return t.endObject()}};var hr=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsSchema(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):da.Little}fields(t,n){let r=this.bb.__offset(this.bb_pos,6);return r?(n||new Fn).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}fieldsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,n){let r=this.bb.__offset(this.bb_pos,8);return r?(n||new en).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){let n=this.bb.__offset(this.bb_pos,10);return n?this.bb.readInt64(this.bb.__vector(this.bb_pos+n)+t*8):BigInt(0)}featuresLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,n){t.addFieldInt16(0,n,da.Little)}static addFields(t,n){t.addFieldOffset(1,n,0)}static createFieldsVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startFieldsVector(t,n){t.startVector(4,n,4)}static addCustomMetadata(t,n){t.addFieldOffset(2,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static addFeatures(t,n){t.addFieldOffset(3,n,0)}static createFeaturesVector(t,n){t.startVector(8,n.length,8);for(let r=n.length-1;r>=0;r--)t.addInt64(n[r]);return t.endVector()}static startFeaturesVector(t,n){t.startVector(8,n,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,n){t.finish(n)}static finishSizePrefixedSchemaBuffer(t,n){t.finish(n,void 0,!0)}static createSchema(t,n,r,i,o){return e.startSchema(t),e.addEndianness(t,n),e.addFields(t,r),e.addCustomMetadata(t,i),e.addFeatures(t,o),e.endSchema(t)}};var Rr=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFooter(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):fa.V1}schema(t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new hr).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}dictionaries(t,n){let r=this.bb.__offset(this.bb_pos,8);return r?(n||new Ic).__init(this.bb.__vector(this.bb_pos+r)+t*24,this.bb):null}dictionariesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,n){let r=this.bb.__offset(this.bb_pos,10);return r?(n||new Ic).__init(this.bb.__vector(this.bb_pos+r)+t*24,this.bb):null}recordBatchesLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,n){let r=this.bb.__offset(this.bb_pos,12);return r?(n||new en).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,n){t.addFieldInt16(0,n,fa.V1)}static addSchema(t,n){t.addFieldOffset(1,n,0)}static addDictionaries(t,n){t.addFieldOffset(2,n,0)}static startDictionariesVector(t,n){t.startVector(24,n,8)}static addRecordBatches(t,n){t.addFieldOffset(3,n,0)}static startRecordBatchesVector(t,n){t.startVector(24,n,8)}static addCustomMetadata(t,n){t.addFieldOffset(4,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,n){t.finish(n)}static finishSizePrefixedFooterBuffer(t,n){t.finish(n,void 0,!0)}};var re=class e{constructor(t=[],n,r,i=Ie.V5){this.fields=t||[],this.metadata=n||new Map,r||(r=Qw(t)),this.dictionaries=r,this.metadataVersion=i}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,n)=>`${n}: ${t}`).join(", ")} }>`}select(t){let n=new Set(t),r=this.fields.filter(i=>n.has(i.name));return new e(r,this.metadata)}selectAt(t){let n=t.map(r=>this.fields[r]).filter(Boolean);return new e(n,this.metadata)}assign(...t){let n=t[0]instanceof e?t[0]:Array.isArray(t[0])?new e(t[0]):new e(t),r=[...this.fields],i=Ag(Ag(new Map,this.metadata),n.metadata),o=n.fields.filter(a=>{let c=r.findIndex(l=>l.name===a.name);return~c?(r[c]=a.clone({metadata:Ag(Ag(new Map,r[c].metadata),a.metadata)}))&&!1:!0}),s=Qw(o,new Map);return new e([...r,...o],i,new Map([...this.dictionaries,...s]))}};re.prototype.fields=null;re.prototype.metadata=null;re.prototype.dictionaries=null;var $t=class e{static new(...t){let[n,r,i,o]=t;return t[0]&&typeof t[0]=="object"&&({name:n}=t[0],r===void 0&&(r=t[0].type),i===void 0&&(i=t[0].nullable),o===void 0&&(o=t[0].metadata)),new e(`${n}`,r,i,o)}constructor(t,n,r=!1,i){this.name=t,this.type=n,this.nullable=r,this.metadata=i||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[n,r,i,o]=t;return!t[0]||typeof t[0]!="object"?[n=this.name,r=this.type,i=this.nullable,o=this.metadata]=t:{name:n=this.name,type:r=this.type,nullable:i=this.nullable,metadata:o=this.metadata}=t[0],e.new(n,r,i,o)}};$t.prototype.type=null;$t.prototype.name=null;$t.prototype.nullable=null;$t.prototype.metadata=null;function Ag(e,t){return new Map([...e||new Map,...t||new Map])}function Qw(e,t=new Map){for(let n=-1,r=e.length;++n<r;){let o=e[n].type;if(at.isDictionary(o)){if(!t.has(o.id))t.set(o.id,o.dictionary);else if(t.get(o.id)!==o.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}o.children&&o.children.length>0&&Qw(o.children,t)}return t}var Sz=Tc,Iz=Nr,is=class{static decode(t){t=new Iz(Ot(t));let n=Rr.getRootAsFooter(t),r=re.decode(n.schema(),new Map,n.version());return new Kw(r,n)}static encode(t){let n=new Sz,r=re.encode(n,t.schema);Rr.startRecordBatchesVector(n,t.numRecordBatches);for(let s of[...t.recordBatches()].slice().reverse())os.encode(n,s);let i=n.endVector();Rr.startDictionariesVector(n,t.numDictionaries);for(let s of[...t.dictionaryBatches()].slice().reverse())os.encode(n,s);let o=n.endVector();return Rr.startFooter(n),Rr.addSchema(n,r),Rr.addVersion(n,Ie.V5),Rr.addRecordBatches(n,i),Rr.addDictionaries(n,o),Rr.finishFooterBuffer(n,Rr.endFooter(n)),n.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,n=Ie.V5,r,i){this.schema=t,this.version=n,r&&(this._recordBatches=r),i&&(this._dictionaryBatches=i)}*recordBatches(){for(let t,n=-1,r=this.numRecordBatches;++n<r;)(t=this.getRecordBatch(n))&&(yield t)}*dictionaryBatches(){for(let t,n=-1,r=this.numDictionaries;++n<r;)(t=this.getDictionaryBatch(n))&&(yield t)}getRecordBatch(t){return t>=0&&t<this.numRecordBatches&&this._recordBatches[t]||null}getDictionaryBatch(t){return t>=0&&t<this.numDictionaries&&this._dictionaryBatches[t]||null}};var Kw=class extends is{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(t,n){super(t,n.version()),this._footer=n}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){let n=this._footer.recordBatches(t);if(n)return os.decode(n)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let n=this._footer.dictionaries(t);if(n)return os.decode(n)}return null}},os=class e{static decode(t){return new e(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,n){let{metaDataLength:r}=n,i=BigInt(n.offset),o=BigInt(n.bodyLength);return Ic.createBlock(t,i,r,o)}constructor(t,n,r){this.metaDataLength=t,this.offset=fr(r),this.bodyLength=fr(n)}};var be=Object.freeze({done:!0,value:void 0}),qd=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},Ec=class{tee(){return this._getDOMStream().tee()}pipe(t,n){return this._getNodeStream().pipe(t,n)}pipeTo(t,n){return this._getDOMStream().pipeTo(t,n)}pipeThrough(t,n){return this._getDOMStream().pipeThrough(t,n)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}},Mg=class extends Ec{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return Z(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){let{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(be);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return bn.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return bn.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return Z(this,void 0,void 0,function*(){return yield this.abort(t),be})}return(t){return Z(this,void 0,void 0,function*(){return yield this.close(),be})}read(t){return Z(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return Z(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((n,r)=>{this.resolvers.push({resolve:n,reject:r})}):Promise.resolve(be)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var no=class extends Mg{write(t){if((t=Ot(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?wd(this.toUint8Array(!0)):this.toUint8Array(!1).then(wd)}toUint8Array(t=!1){return t?Tr(this._values)[0]:Z(this,void 0,void 0,function*(){var n,r,i,o;let s=[],a=0;try{for(var c=!0,l=bi(this),u;u=yield l.next(),n=u.done,!n;c=!0){o=u.value,c=!1;let f=o;s.push(f),a+=f.byteLength}}catch(f){r={error:f}}finally{try{!c&&!n&&(i=l.return)&&(yield i.call(l))}finally{if(r)throw r.error}}return Tr(s,a)[0]})}},ro=class{constructor(t){t&&(this.source=new Jw(bn.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},Zr=class e{constructor(t){t instanceof e?this.source=t.source:t instanceof no?this.source=new ss(bn.fromAsyncIterable(t)):$y(t)?this.source=new ss(bn.fromNodeStream(t)):vd(t)?this.source=new ss(bn.fromDOMStream(t)):By(t)?this.source=new ss(bn.fromDOMStream(t.body)):xi(t)?this.source=new ss(bn.fromIterable(t)):Ir(t)?this.source=new ss(bn.fromAsyncIterable(t)):Gr(t)&&(this.source=new ss(bn.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}get closed(){return this.source.closed}cancel(t){return this.source.cancel(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},Jw=class{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,n="read"){return this.source.next({cmd:n,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||be)}return(t){return Object.create(this.source.return&&this.source.return(t)||be)}},ss=class{constructor(t){this.source=t,this._closedPromise=new Promise(n=>this._closedPromiseResolve=n)}cancel(t){return Z(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return Z(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return Z(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t,n="read"){return Z(this,void 0,void 0,function*(){return yield this.source.next({cmd:n,size:t})})}throw(t){return Z(this,void 0,void 0,function*(){let n=this.source.throw&&(yield this.source.throw(t))||be;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(n)})}return(t){return Z(this,void 0,void 0,function*(){let n=this.source.return&&(yield this.source.return(t))||be;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(n)})}};var jd=class extends ro{constructor(t,n){super(),this.position=0,this.buffer=Ot(t),this.size=n===void 0?this.buffer.byteLength:n}readInt32(t){let{buffer:n,byteOffset:r}=this.readAt(t,4);return new DataView(n,r).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){let{buffer:n,size:r,position:i}=this;return n&&i<r?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(r,i+Math.min(r-i,t)),n.subarray(i,this.position)):null}readAt(t,n){let r=this.buffer,i=Math.min(this.size,t+n);return r?r.subarray(t,i):new Uint8Array(n)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}},_a=class extends Zr{constructor(t,n){super(),this.position=0,this._handle=t,typeof n=="number"?this.size=n:this._pending=Z(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return Z(this,void 0,void 0,function*(){let{buffer:n,byteOffset:r}=yield this.readAt(t,4);return new DataView(n,r).getInt32(0,!0)})}seek(t){return Z(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(t,this.size),t<this.size})}read(t){return Z(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:n,size:r,position:i}=this;if(n&&i<r){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let o=i,s=0,a=0,c=Math.min(r,o+Math.min(r-o,t)),l=new Uint8Array(Math.max(0,(this.position=c)-o));for(;(o+=a)<c&&(s+=a)<l.byteLength;)({bytesRead:a}=yield n.read(l,s,l.byteLength-s,o));return l}return null})}readAt(t,n){return Z(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:r,size:i}=this;if(r&&t+n<i){let o=Math.min(i,t+n),s=new Uint8Array(o-t);return(yield r.read(s,0,n,t)).buffer}return new Uint8Array(n)})}close(){return Z(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return Z(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return Z(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var ev={};vr(ev,{BaseInt64:()=>Vd,Int128:()=>Yd,Int64:()=>as,Uint64:()=>Ne});function ru(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}var iu=8,tv=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],Vd=class{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){let n=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),r=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]),i=n[3]*r[3];this.buffer[0]=i&65535;let o=i>>>16;return i=n[2]*r[3],o+=i,i=n[3]*r[2]>>>0,o+=i,this.buffer[0]+=o<<16,this.buffer[1]=o>>>0<i?65536:0,this.buffer[1]+=o>>>16,this.buffer[1]+=n[1]*r[3]+n[2]*r[2]+n[3]*r[1],this.buffer[1]+=n[0]*r[3]+n[1]*r[2]+n[2]*r[1]+n[3]*r[0]<<16,this}_plus(t){let n=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],n<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=n}lessThan(t){return this.buffer[1]<t.buffer[1]||this.buffer[1]===t.buffer[1]&&this.buffer[0]<t.buffer[0]}equals(t){return this.buffer[1]===t.buffer[1]&&this.buffer[0]==t.buffer[0]}greaterThan(t){return t.lessThan(this)}hex(){return`${ru(this.buffer[1])} ${ru(this.buffer[0])}`}},Ne=class e extends Vd{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,n=new Uint32Array(2)){return e.fromString(typeof t=="string"?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(2)){return e.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(2)){let r=t.length,i=new e(n);for(let o=0;o<r;){let s=iu<r-o?iu:r-o,a=new e(new Uint32Array([Number.parseInt(t.slice(o,o+s),10),0])),c=new e(new Uint32Array([tv[s],0]));i.times(c),i.plus(a),o+=s}return i}static convertArray(t){let n=new Uint32Array(t.length*2);for(let r=-1,i=t.length;++r<i;)e.from(t[r],new Uint32Array(n.buffer,n.byteOffset+2*r*4,2));return n}static multiply(t,n){return new e(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new e(new Uint32Array(t.buffer)).plus(n)}},as=class e extends Vd{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(t){return this._times(t),this}plus(t){return this._plus(t),this}lessThan(t){let n=this.buffer[1]<<0,r=t.buffer[1]<<0;return n<r||n===r&&this.buffer[0]<t.buffer[0]}static from(t,n=new Uint32Array(2)){return e.fromString(typeof t=="string"?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(2)){return e.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(2)){let r=t.startsWith("-"),i=t.length,o=new e(n);for(let s=r?1:0;s<i;){let a=iu<i-s?iu:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0])),l=new e(new Uint32Array([tv[a],0]));o.times(l),o.plus(c),s+=a}return r?o.negate():o}static convertArray(t){let n=new Uint32Array(t.length*2);for(let r=-1,i=t.length;++r<i;)e.from(t[r],new Uint32Array(n.buffer,n.byteOffset+2*r*4,2));return n}static multiply(t,n){return new e(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new e(new Uint32Array(t.buffer)).plus(n)}},Yd=class e{constructor(t){this.buffer=t}high(){return new as(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new as(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(t){let n=new Ne(new Uint32Array([this.buffer[3],0])),r=new Ne(new Uint32Array([this.buffer[2],0])),i=new Ne(new Uint32Array([this.buffer[1],0])),o=new Ne(new Uint32Array([this.buffer[0],0])),s=new Ne(new Uint32Array([t.buffer[3],0])),a=new Ne(new Uint32Array([t.buffer[2],0])),c=new Ne(new Uint32Array([t.buffer[1],0])),l=new Ne(new Uint32Array([t.buffer[0],0])),u=Ne.multiply(o,l);this.buffer[0]=u.low();let f=new Ne(new Uint32Array([u.high(),0]));return u=Ne.multiply(i,l),f.plus(u),u=Ne.multiply(o,c),f.plus(u),this.buffer[1]=f.low(),this.buffer[3]=f.lessThan(u)?1:0,this.buffer[2]=f.high(),new Ne(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(Ne.multiply(r,l)).plus(Ne.multiply(i,c)).plus(Ne.multiply(o,a)),this.buffer[3]+=Ne.multiply(n,l).plus(Ne.multiply(r,c)).plus(Ne.multiply(i,a)).plus(Ne.multiply(o,s)).low(),this}plus(t){let n=new Uint32Array(4);return n[3]=this.buffer[3]+t.buffer[3]>>>0,n[2]=this.buffer[2]+t.buffer[2]>>>0,n[1]=this.buffer[1]+t.buffer[1]>>>0,n[0]=this.buffer[0]+t.buffer[0]>>>0,n[0]<this.buffer[0]>>>0&&++n[1],n[1]<this.buffer[1]>>>0&&++n[2],n[2]<this.buffer[2]>>>0&&++n[3],this.buffer[3]=n[3],this.buffer[2]=n[2],this.buffer[1]=n[1],this.buffer[0]=n[0],this}hex(){return`${ru(this.buffer[3])} ${ru(this.buffer[2])} ${ru(this.buffer[1])} ${ru(this.buffer[0])}`}static multiply(t,n){return new e(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new e(new Uint32Array(t.buffer)).plus(n)}static from(t,n=new Uint32Array(4)){return e.fromString(typeof t=="string"?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(4)){return e.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(4)){let r=t.startsWith("-"),i=t.length,o=new e(n);for(let s=r?1:0;s<i;){let a=iu<i-s?iu:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0,0,0])),l=new e(new Uint32Array([tv[a],0,0,0]));o.times(l),o.plus(c),s+=a}return r?o.negate():o}static convertArray(t){let n=new Uint32Array(t.length*4);for(let r=-1,i=t.length;++r<i;)e.from(t[r],new Uint32Array(n.buffer,n.byteOffset+4*4*r,4));return n}};var Gd=class extends ut{constructor(t,n,r,i,o=Ie.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=n,this.buffers=r,this.dictionaries=i,this.metadataVersion=o}visit(t){return super.visit(t instanceof $t?t.type:t)}visitNull(t,{length:n}=this.nextFieldNode()){return Dt({type:t,length:n})}visitBool(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitInt(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitFloat(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitUtf8(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinary(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitFixedSizeBinary(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDate(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitTimestamp(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitTime(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDecimal(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitList(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),children:this.visitMany(t.children)})}visitUnion(t,{length:n,nullCount:r}=this.nextFieldNode()){return this.metadataVersion<Ie.V5&&this.readNullBitmap(t,r),t.mode===me.Sparse?this.visitSparseUnion(t,{length:n,nullCount:r}):this.visitDenseUnion(t,{length:n,nullCount:r})}visitDenseUnion(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDuration(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitFixedSizeList(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),child:this.visit(t.children[0])})}visitMap(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,n,r=this.nextBufferRange()){return n>0&&this.readData(t,r)||new Uint8Array(0)}readOffsets(t,n){return this.readData(t,n)}readTypeIds(t,n){return this.readData(t,n)}readData(t,{length:n,offset:r}=this.nextBufferRange()){return this.bytes.subarray(r,r+n)}readDictionary(t){return this.dictionaries.get(t.id)}},Ng=class extends Gd{constructor(t,n,r,i,o){super(new Uint8Array(0),n,r,i,o),this.sources=t}readNullBitmap(t,n,{offset:r}=this.nextBufferRange()){return n<=0?new Uint8Array(0):vc(this.sources[r])}readOffsets(t,{offset:n}=this.nextBufferRange()){return Pt(Uint8Array,Pt(Int32Array,this.sources[n]))}readTypeIds(t,{offset:n}=this.nextBufferRange()){return Pt(Uint8Array,Pt(t.ArrayType,this.sources[n]))}readData(t,{offset:n}=this.nextBufferRange()){let{sources:r}=this;return at.isTimestamp(t)?Pt(Uint8Array,as.convertArray(r[n])):(at.isInt(t)||at.isTime(t))&&t.bitWidth===64||at.isDuration(t)?Pt(Uint8Array,as.convertArray(r[n])):at.isDate(t)&&t.unit===xn.MILLISECOND?Pt(Uint8Array,as.convertArray(r[n])):at.isDecimal(t)?Pt(Uint8Array,Yd.convertArray(r[n])):at.isBinary(t)||at.isFixedSizeBinary(t)?Tz(r[n]):at.isBool(t)?vc(r[n]):at.isUtf8(t)?oa(r[n].join("")):Pt(Uint8Array,Pt(t.ArrayType,r[n].map(i=>+i)))}};function Tz(e){let t=e.join(""),n=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)n[r>>1]=Number.parseInt(t.slice(r,r+2),16);return n}var ou=class extends Ki{constructor(t){super(t),this._values=new ua(new Uint8Array(0))}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,n){return super.setValue(t,Ot(n))}_flushPending(t,n){let r=this._offsets,i=this._values.reserve(n).buffer,o=0;for(let[s,a]of t)if(a===void 0)r.set(s,0);else{let c=a.length;i.set(a,o),r.set(s,c),o+=c}}};var Rg=class extends _e{constructor(t){super(t),this._values=new tu}setValue(t,n){this._values.set(t,+n)}};var Ac=class extends Ve{};Ac.prototype._setValue=Fw;var Wd=class extends Ac{};Wd.prototype._setValue=Jy;var Xd=class extends Ac{};Xd.prototype._setValue=tg;var Hd=class extends Ve{};Hd.prototype._setValue=Bw;var Og=class extends _e{constructor({type:t,nullValues:n,dictionaryHashFunction:r}){super({type:new Er(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=Mc({type:this.type.indices,nullValues:n}),this.dictionary=Mc({type:this.type.dictionary,nullValues:null}),typeof r=="function"&&(this.valueToKey=r)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,n){let r=this.indices;return n=r.setValid(t,n),this.length=r.length,n}setValue(t,n){let r=this._keysToIndices,i=this.valueToKey(n),o=r[i];return o===void 0&&(r[i]=o=this._dictionaryOffset+this.dictionary.append(n).length-1),this.indices.setValue(t,o)}flush(){let t=this.type,n=this._dictionary,r=this.dictionary.toVector(),i=this.indices.flush().clone(t);return i.dictionary=n?n.concat(r):r,this.finished||(this._dictionaryOffset+=r.length),this._dictionary=i.dictionary,this.clear(),i}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(t){return typeof t=="string"?t:`${t}`}};var Zd=class extends Ve{};Zd.prototype._setValue=kw;var Dg=class extends _e{setValue(t,n){let[r]=this.children,i=t*this.stride;for(let o=-1,s=n.length;++o<s;)r.set(i+o,n[o])}addChild(t,n="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");let r=this.children.push(t);return this.type=new Ei(this.type.listSize,new $t(n,t.type,!0)),r}};var Nc=class extends Ve{setValue(t,n){this._values.set(t,n)}},kg=class extends Nc{setValue(t,n){super.setValue(t,Td(n))}},Fg=class extends Nc{},Lg=class extends Nc{};var Rc=class extends Ve{};Rc.prototype._setValue=Pw;var Qd=class extends Rc{};Qd.prototype._setValue=lg;var Kd=class extends Rc{};Kd.prototype._setValue=ug;var cs=class extends Ve{};cs.prototype._setValue=$w;var Jd=class extends cs{};Jd.prototype._setValue=fg;var th=class extends cs{};th.prototype._setValue=dg;var eh=class extends cs{};eh.prototype._setValue=hg;var nh=class extends cs{};nh.prototype._setValue=pg;var Qr=class extends Ve{setValue(t,n){this._values.set(t,n)}},Cg=class extends Qr{},Bg=class extends Qr{},Pg=class extends Qr{},$g=class extends Qr{},Ug=class extends Qr{},zg=class extends Qr{},qg=class extends Qr{},jg=class extends Qr{};var Vg=class extends Ki{constructor(t){super(t),this._offsets=new eu}addChild(t,n="0"){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new Ii(new $t(n,t.type,!0)),this.numChildren-1}_flushPending(t){let n=this._offsets,[r]=this.children;for(let[i,o]of t)if(typeof o>"u")n.set(i,0);else{let s=o,a=s.length,c=n.set(i,a).buffer[i];for(let l=-1;++l<a;)r.set(c+l,s[l])}}};var Yg=class extends Ki{set(t,n){return super.set(t,n)}setValue(t,n){let r=n instanceof Map?n:new Map(Object.entries(n)),i=this._pending||(this._pending=new Map),o=i.get(t);o&&(this._pendingLength-=o.size),this._pendingLength+=r.size,i.set(t,r)}addChild(t,n=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new Ai(new $t(n,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let n=this._offsets,[r]=this.children;for(let[i,o]of t)if(o===void 0)n.set(i,0);else{let{[i]:s,[i+1]:a}=n.set(i,o.size).buffer;for(let c of o.entries())if(r.set(s,c),++s>=a)break}}};var Gg=class extends _e{setValue(t,n){}setValid(t,n){return this.length=Math.max(t+1,this.length),n}};var Wg=class extends _e{setValue(t,n){let{children:r,type:i}=this;switch(Array.isArray(n)||n.constructor){case!0:return i.children.forEach((o,s)=>r[s].set(t,n[s]));case Map:return i.children.forEach((o,s)=>r[s].set(t,n.get(o.name)));default:return i.children.forEach((o,s)=>r[s].set(t,n[o.name]))}}setValid(t,n){return super.setValid(t,n)||this.children.forEach(r=>r.setValid(t,n)),n}addChild(t,n=`${this.numChildren}`){let r=this.children.push(t);return this.type=new ye([...this.type.children,new $t(n,t.type,!0)]),r}};var ls=class extends Ve{};ls.prototype._setValue=Lw;var rh=class extends ls{};rh.prototype._setValue=eg;var ih=class extends ls{};ih.prototype._setValue=ng;var oh=class extends ls{};oh.prototype._setValue=rg;var sh=class extends ls{};sh.prototype._setValue=ig;var us=class extends Ve{};us.prototype._setValue=Cw;var ah=class extends us{};ah.prototype._setValue=og;var ch=class extends us{};ch.prototype._setValue=sg;var lh=class extends us{};lh.prototype._setValue=ag;var uh=class extends us{};uh.prototype._setValue=cg;var su=class extends _e{constructor(t){super(t),this._typeIds=new es(new Int8Array(0),1),typeof t.valueToChildTypeId=="function"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,n){return this.set(this.length,t,n)}set(t,n,r){return r===void 0&&(r=this._valueToChildTypeId(this,n,t)),this.setValue(t,n,r),this}setValue(t,n,r){this._typeIds.set(t,r);let i=this.type.typeIdToChildIndex[r],o=this.children[i];o?.set(t,n)}addChild(t,n=`${this.children.length}`){let r=this.children.push(t),{type:{children:i,mode:o,typeIds:s}}=this,a=[...i,new $t(n,t.type)];return this.type=new Ti(o,[...s,r],a),r}_valueToChildTypeId(t,n,r){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}},Xg=class extends su{},Hg=class extends su{constructor(t){super(t),this._offsets=new es(new Int32Array(0))}setValue(t,n,r){let i=this._typeIds.set(t,r).buffer[t],o=this.getChildAt(this.type.typeIdToChildIndex[i]),s=this._offsets.set(t,o.length).buffer[t];o?.set(s,n)}};var fh=class extends Ki{constructor(t){super(t),this._values=new ua(new Uint8Array(0))}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,n){return super.setValue(t,oa(n))}_flushPending(t,n){}};fh.prototype._flushPending=ou.prototype._flushPending;var nv=class extends ut{visitNull(){return Gg}visitBool(){return Rg}visitInt(){return Qr}visitInt8(){return Cg}visitInt16(){return Bg}visitInt32(){return Pg}visitInt64(){return $g}visitUint8(){return Ug}visitUint16(){return zg}visitUint32(){return qg}visitUint64(){return jg}visitFloat(){return Nc}visitFloat16(){return kg}visitFloat32(){return Fg}visitFloat64(){return Lg}visitUtf8(){return fh}visitBinary(){return ou}visitFixedSizeBinary(){return Zd}visitDate(){return Ac}visitDateDay(){return Wd}visitDateMillisecond(){return Xd}visitTimestamp(){return ls}visitTimestampSecond(){return rh}visitTimestampMillisecond(){return ih}visitTimestampMicrosecond(){return oh}visitTimestampNanosecond(){return sh}visitTime(){return us}visitTimeSecond(){return ah}visitTimeMillisecond(){return ch}visitTimeMicrosecond(){return lh}visitTimeNanosecond(){return uh}visitDecimal(){return Hd}visitList(){return Vg}visitStruct(){return Wg}visitUnion(){return su}visitDenseUnion(){return Hg}visitSparseUnion(){return Xg}visitDictionary(){return Og}visitInterval(){return Rc}visitIntervalDayTime(){return Qd}visitIntervalYearMonth(){return Kd}visitDuration(){return cs}visitDurationSecond(){return Jd}visitDurationMillisecond(){return th}visitDurationMicrosecond(){return eh}visistDurationNanosecond(){return nh}visitFixedSizeList(){return Dg}visitMap(){return Yg}},CO=new nv;var _t=class extends ut{compareSchemas(t,n){return t===n||n instanceof t.constructor&&this.compareManyFields(t.fields,n.fields)}compareManyFields(t,n){return t===n||Array.isArray(t)&&Array.isArray(n)&&t.length===n.length&&t.every((r,i)=>this.compareFields(r,n[i]))}compareFields(t,n){return t===n||n instanceof t.constructor&&t.name===n.name&&t.nullable===n.nullable&&this.visit(t.type,n.type)}};function Wn(e,t){return t instanceof e.constructor}function dh(e,t){return e===t||Wn(e,t)}function fs(e,t){return e===t||Wn(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function Zg(e,t){return e===t||Wn(e,t)&&e.precision===t.precision}function Ez(e,t){return e===t||Wn(e,t)&&e.byteWidth===t.byteWidth}function rv(e,t){return e===t||Wn(e,t)&&e.unit===t.unit}function hh(e,t){return e===t||Wn(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function ph(e,t){return e===t||Wn(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function Az(e,t){return e===t||Wn(e,t)&&e.children.length===t.children.length&&io.compareManyFields(e.children,t.children)}function Mz(e,t){return e===t||Wn(e,t)&&e.children.length===t.children.length&&io.compareManyFields(e.children,t.children)}function iv(e,t){return e===t||Wn(e,t)&&e.mode===t.mode&&e.typeIds.every((n,r)=>n===t.typeIds[r])&&io.compareManyFields(e.children,t.children)}function Nz(e,t){return e===t||Wn(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&io.visit(e.indices,t.indices)&&io.visit(e.dictionary,t.dictionary)}function ov(e,t){return e===t||Wn(e,t)&&e.unit===t.unit}function mh(e,t){return e===t||Wn(e,t)&&e.unit===t.unit}function Rz(e,t){return e===t||Wn(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&io.compareManyFields(e.children,t.children)}function Oz(e,t){return e===t||Wn(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&io.compareManyFields(e.children,t.children)}_t.prototype.visitNull=dh;_t.prototype.visitBool=dh;_t.prototype.visitInt=fs;_t.prototype.visitInt8=fs;_t.prototype.visitInt16=fs;_t.prototype.visitInt32=fs;_t.prototype.visitInt64=fs;_t.prototype.visitUint8=fs;_t.prototype.visitUint16=fs;_t.prototype.visitUint32=fs;_t.prototype.visitUint64=fs;_t.prototype.visitFloat=Zg;_t.prototype.visitFloat16=Zg;_t.prototype.visitFloat32=Zg;_t.prototype.visitFloat64=Zg;_t.prototype.visitUtf8=dh;_t.prototype.visitBinary=dh;_t.prototype.visitFixedSizeBinary=Ez;_t.prototype.visitDate=rv;_t.prototype.visitDateDay=rv;_t.prototype.visitDateMillisecond=rv;_t.prototype.visitTimestamp=hh;_t.prototype.visitTimestampSecond=hh;_t.prototype.visitTimestampMillisecond=hh;_t.prototype.visitTimestampMicrosecond=hh;_t.prototype.visitTimestampNanosecond=hh;_t.prototype.visitTime=ph;_t.prototype.visitTimeSecond=ph;_t.prototype.visitTimeMillisecond=ph;_t.prototype.visitTimeMicrosecond=ph;_t.prototype.visitTimeNanosecond=ph;_t.prototype.visitDecimal=dh;_t.prototype.visitList=Az;_t.prototype.visitStruct=Mz;_t.prototype.visitUnion=iv;_t.prototype.visitDenseUnion=iv;_t.prototype.visitSparseUnion=iv;_t.prototype.visitDictionary=Nz;_t.prototype.visitInterval=ov;_t.prototype.visitIntervalDayTime=ov;_t.prototype.visitIntervalYearMonth=ov;_t.prototype.visitDuration=mh;_t.prototype.visitDurationSecond=mh;_t.prototype.visitDurationMillisecond=mh;_t.prototype.visitDurationMicrosecond=mh;_t.prototype.visitDurationNanosecond=mh;_t.prototype.visitFixedSizeList=Rz;_t.prototype.visitMap=Oz;var io=new _t;function Oc(e,t){return io.compareSchemas(e,t)}function BO(e,t){return io.compareFields(e,t)}function PO(e,t){return io.visit(e,t)}function Mc(e){let t=e.type,n=new(CO.getVisitFn(t)())(e);if(t.children&&t.children.length>0){let r=e.children||[],i={nullValues:e.nullValues},o=Array.isArray(r)?(s,a)=>r[a]||i:({name:s})=>r[s]||i;for(let[s,a]of t.children.entries()){let{type:c}=a,l=o(a,s);n.children.push(Mc(Object.assign(Object.assign({},l),{type:c})))}}return n}function Qg(e,t){return Dz(e,t.map(n=>n.data.concat()))}function Dz(e,t){let n=[...e.fields],r=[],i={numBatches:t.reduce((f,d)=>Math.max(f,d.length),0)},o=0,s=0,a=-1,c=t.length,l,u=[];for(;i.numBatches-- >0;){for(s=Number.POSITIVE_INFINITY,a=-1;++a<c;)u[a]=l=t[a].shift(),s=Math.min(s,l?l.length:s);Number.isFinite(s)&&(u=kz(n,s,u,t,i),s>0&&(r[o++]=Dt({type:new ye(n),length:s,nullCount:0,children:u.slice()})))}return[e=e.assign(n),r.map(f=>new ke(e,f))]}function kz(e,t,n,r,i){var o;let s=(t+63&-64)>>3;for(let a=-1,c=r.length;++a<c;){let l=n[a],u=l?.length;if(u>=t)u===t?n[a]=l:(n[a]=l.slice(0,t),i.numBatches=Math.max(i.numBatches,r[a].unshift(l.slice(t,u-t))));else{let f=e[a];e[a]=f.clone({nullable:!0}),n[a]=(o=l?._changeLengthAndBackfillNullBitmap(t))!==null&&o!==void 0?o:Dt({type:f.type,length:t,nullCount:t,nullBitmap:new Uint8Array(s)})}}return n}var $O,sn=class e{constructor(...t){var n,r;if(t.length===0)return this.batches=[],this.schema=new re([]),this._offsets=[0],this;let i,o;t[0]instanceof re&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(o=t.pop());let s=c=>{if(c){if(c instanceof ke)return[c];if(c instanceof e)return c.batches;if(c instanceof se){if(c.type instanceof ye)return[new ke(new re(c.type.children),c)]}else{if(Array.isArray(c))return c.flatMap(l=>s(l));if(typeof c[Symbol.iterator]=="function")return[...c].flatMap(l=>s(l));if(typeof c=="object"){let l=Object.keys(c),u=l.map(h=>new Vt([c[h]])),f=new re(l.map((h,p)=>new $t(String(h),u[p].type))),[,d]=Qg(f,u);return d.length===0?[new ke(c)]:d}}}return[]},a=t.flatMap(c=>s(c));if(i=(r=i??((n=a[0])===null||n===void 0?void 0:n.schema))!==null&&r!==void 0?r:new re([]),!(i instanceof re))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let c of a){if(!(c instanceof ke))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Oc(i,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=o??xg(this.data)}get data(){return this.batches.map(({data:t})=>t)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((t,n)=>t+n.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=bg(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}set(t,n){}indexOf(t,n){return-1}getByteLength(t){return 0}[Symbol.iterator](){return this.batches.length>0?Jl.visit(new Vt(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
8
8
  ${this.toArray().join(`,
9
9
  `)}
10
- ]`}concat(...t){let n=this.schema,r=this.data.concat(t.flatMap(({data:i})=>i));return new e(n,r.map(i=>new ke(n,i)))}slice(t,n){let r=this.schema;[t,n]=Td({length:this.numRows},t,n);let i=Hy(this.data,this._offsets,t,n);return new e(r,i.map(o=>new ke(r,o)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(n=>n.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let n=this.data.map(r=>r.children[t]);if(n.length===0){let{type:r}=this.schema.fields[t],i=Ot({type:r,length:0,nullCount:0});n.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new qt(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 qt([Ot({type:new Gn,length:this.numRows})]));let o=r.fields.slice(),s=o[t].clone({type:n.type}),a=this.schema.fields.map((c,l)=>this.getChildAt(l));[o[t],a[t]]=[s,n],[r,i]=Eg(r,a)}return new e(r,i)}select(t){let n=this.schema.fields.reduce((r,i,o)=>r.set(i.name,o),new Map);return this.selectAt(t.map(r=>n.get(r)).filter(r=>r>-1))}selectAt(t){let n=this.schema.selectAt(t),r=this.batches.map(i=>i.selectAt(t));return new e(n,r)}assign(t){let n=this.schema.fields,[r,i]=t.schema.fields.reduce((a,c,l)=>{let[u,f]=a,d=n.findIndex(h=>h.name===c.name);return~d?f[d]=l:u.push(l),a},[[],[]]),o=this.schema.assign(t.schema),s=[...n.map((a,c)=>[c,i[c]]).map(([a,c])=>c===void 0?this.getChildAt(a):t.getChildAt(c)),...r.map(a=>t.getChildAt(a))].filter(Boolean);return new e(...Eg(o,s))}};o3=Symbol.toStringTag;an[o3]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e.isValid=oa(Md),e.get=oa(qe.getVisitFn(k.Struct)),e.set=Qy(Sn.getVisitFn(k.Struct)),e.indexOf=Zy(wc.getVisitFn(k.Struct)),e.getByteLength=oa(Rr.getVisitFn(k.Struct)),"Table"))(an.prototype);var a3,ke=class e{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof re))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=Ot({nullCount:0,type:new me(this.schema.fields),children:this.schema.fields.map(n=>Ot({type:n.type,nullCount:0}))})]=t,!(this.data instanceof le))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=s3(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]=Pt.new({name:l,type:n[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),s=new re(r),a=Ot({type:new me(r),length:o,children:i,nullCount:0});[this.schema,this.data]=s3(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=c3(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 qe.visit(this.data,t)}set(t,n){return Sn.visit(this.data,t,n)}indexOf(t,n){return wc.visit(this.data,t,n)}getByteLength(t){return Rr.visit(this.data,t)}[Symbol.iterator](){return Zl.visit(new qt([this.data]))}toArray(){return[...this]}concat(...t){return new an(this.schema,[this,...t])}slice(t,n){let[r]=new qt([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 qt([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 qt([Ot({type:new Gn,length:this.numRows})]));let o=r.fields.slice(),s=i.children.slice(),a=o[t].clone({type:n.type});[o[t],s[t]]=[a,n.data[0]],r=new re(o,new Map(this.schema.metadata)),i=Ot({type:new me(o),children:s})}return new e(r,i)}select(t){let n=this.schema.select(t),r=new me(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,Ot({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=Ot({type:new me(n.fields),length:this.numRows,children:r});return new e(n,i)}};a3=Symbol.toStringTag;ke[a3]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(ke.prototype);function s3(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:Ot({type:c.type,length:n,nullCount:n,nullBitmap:new Uint8Array(s)}))}return[e.assign(i),Ot({type:new me(i),length:n,children:o})]}function c3(e,t,n=new Map){for(let r=-1,i=e.length;++r<i;){let s=e[r].type,a=t[r];if(ht.isDictionary(s)){if(!n.has(s.id))a.dictionary&&n.set(s.id,a.dictionary);else if(n.get(s.id)!==a.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}s.children&&s.children.length>0&&c3(s.children,a.children,n)}return n}var Rc=class extends ke{constructor(t){let n=t.fields.map(i=>Ot({type:i.type})),r=Ot({type:new me(t.fields),nullCount:0,children:n});super(t,r)}};var uh;(function(e){e[e.BUFFER=0]="BUFFER"})(uh||(uh={}));var fh;(function(e){e[e.LZ4_FRAME=0]="LZ4_FRAME",e[e.ZSTD=1]="ZSTD"})(fh||(fh={}));var Ag=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):fh.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):uh.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,n){t.addFieldInt8(0,n,fh.LZ4_FRAME)}static addMethod(t,n){t.addFieldInt8(1,n,uh.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 ou=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 su=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 Fr=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 su).__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 ou).__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 Ag).__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 ys=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 Fr).__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 au;(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"})(au||(au={}));var Di=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static 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):aa.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):au.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 tn).__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,aa.V1)}static addHeaderType(t,n){t.addFieldInt8(1,n,au.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 Nv=class extends gt{visit(t,n){return t==null||n==null?void 0:super.visit(t,n)}visitNull(t,n){return Bd.startNull(n),Bd.endNull(n)}visitInt(t,n){return ki.startInt(n),ki.addBitWidth(n,t.bitWidth),ki.addIsSigned(n,t.isSigned),ki.endInt(n)}visitFloat(t,n){return ha.startFloatingPoint(n),ha.addPrecision(n,t.precision),ha.endFloatingPoint(n)}visitBinary(t,n){return Od.startBinary(n),Od.endBinary(n)}visitBool(t,n){return kd.startBool(n),kd.endBool(n)}visitUtf8(t,n){return Ud.startUtf8(n),Ud.endUtf8(n)}visitDecimal(t,n){return oo.startDecimal(n),oo.addScale(n,t.scale),oo.addPrecision(n,t.precision),oo.addBitWidth(n,t.bitWidth),oo.endDecimal(n)}visitDate(t,n){return la.startDate(n),la.addUnit(n,t.unit),la.endDate(n)}visitTime(t,n){return as.startTime(n),as.addUnit(n,t.unit),as.addBitWidth(n,t.bitWidth),as.endTime(n)}visitTimestamp(t,n){let r=t.timezone&&n.createString(t.timezone)||void 0;return cs.startTimestamp(n),cs.addUnit(n,t.unit),r!==void 0&&cs.addTimezone(n,r),cs.endTimestamp(n)}visitInterval(t,n){return pa.startInterval(n),pa.addUnit(n,t.unit),pa.endInterval(n)}visitList(t,n){return Cd.startList(n),Cd.endList(n)}visitStruct(t,n){return Pd.startStruct_(n),Pd.endStruct_(n)}visitUnion(t,n){Fi.startTypeIdsVector(n,t.typeIds.length);let r=Fi.createTypeIdsVector(n,t.typeIds);return Fi.startUnion(n),Fi.addMode(n,t.mode),Fi.addTypeIds(n,r),Fi.endUnion(n)}visitDictionary(t,n){let r=this.visit(t.indices,n);return io.startDictionaryEncoding(n),io.addId(n,BigInt(t.id)),io.addIsOrdered(n,t.isOrdered),r!==void 0&&io.addIndexType(n,r),io.endDictionaryEncoding(n)}visitFixedSizeBinary(t,n){return fa.startFixedSizeBinary(n),fa.addByteWidth(n,t.byteWidth),fa.endFixedSizeBinary(n)}visitFixedSizeList(t,n){return da.startFixedSizeList(n),da.addListSize(n,t.listSize),da.endFixedSizeList(n)}visitMap(t,n){return ma.startMap(n),ma.addKeysSorted(n,t.keysSorted),ma.endMap(n)}},Mg=new Nv;function d3(e,t=new Map){return new re(lz(e,t),Ng(e.customMetadata),t)}function Rv(e){return new In(e.count,p3(e.columns),m3(e.columns))}function h3(e){return new hr(Rv(e.data),e.id,e.isDelta)}function lz(e,t){return(e.fields||[]).filter(Boolean).map(n=>Pt.fromJSON(n,t))}function l3(e,t){return(e.children||[]).filter(Boolean).map(n=>Pt.fromJSON(n,t))}function p3(e){return(e||[]).reduce((t,n)=>[...t,new Li(n.count,uz(n.VALIDITY)),...p3(n.children)],[])}function m3(e,t=[]){for(let n=-1,r=(e||[]).length;++n<r;){let i=e[n];i.VALIDITY&&t.push(new dr(t.length,i.VALIDITY.length)),i.TYPE&&t.push(new dr(t.length,i.TYPE.length)),i.OFFSET&&t.push(new dr(t.length,i.OFFSET.length)),i.DATA&&t.push(new dr(t.length,i.DATA.length)),t=m3(i.children,t)}return t}function uz(e){return(e||[]).reduce((t,n)=>t+ +(n===0),0)}function y3(e,t){let n,r,i,o,s,a;return!t||!(o=e.dictionary)?(s=f3(e,l3(e,t)),i=new Pt(e.name,s,e.nullable,Ng(e.customMetadata))):t.has(n=o.id)?(r=(r=o.indexType)?u3(r):new Ji,a=new Mr(t.get(n),r,n,o.isOrdered),i=new Pt(e.name,a,e.nullable,Ng(e.customMetadata))):(r=(r=o.indexType)?u3(r):new Ji,t.set(n,s=f3(e,l3(e,t))),a=new Mr(s,r,n,o.isOrdered),i=new Pt(e.name,a,e.nullable,Ng(e.customMetadata))),i||null}function Ng(e){return new Map(Object.entries(e||{}))}function u3(e){return new Be(e.isSigned,e.bitWidth)}function f3(e,t){let n=e.type.name;switch(n){case"NONE":return new Gn;case"null":return new Gn;case"binary":return new Zo;case"utf8":return new Ko;case"bool":return new Jo;case"list":return new Ei((t||[])[0]);case"struct":return new me(t||[]);case"struct_":return new me(t||[])}switch(n){case"int":{let r=e.type;return new Be(r.isSigned,r.bitWidth)}case"floatingpoint":{let r=e.type;return new lr(ge[r.precision])}case"decimal":{let r=e.type;return new ts(r.scale,r.precision,r.bitWidth)}case"date":{let r=e.type;return new es(vn[r.unit])}case"time":{let r=e.type;return new Ti($t[r.unit],r.bitWidth)}case"timestamp":{let r=e.type;return new ns($t[r.unit],r.timezone)}case"interval":{let r=e.type;return new rs(Yn[r.unit])}case"union":{let r=e.type;return new Ai(Ee[r.mode],r.typeIds||[],t||[])}case"fixedsizebinary":{let r=e.type;return new is(r.byteWidth)}case"fixedsizelist":{let r=e.type;return new Mi(r.listSize,(t||[])[0])}case"map":{let r=e.type;return new Ni((t||[])[0],r.keysSorted)}}throw new Error(`Unrecognized type: "${n}"`)}var fz=Sc,dz=Or,pr=class e{static fromJSON(t,n){let r=new e(0,on.V4,n);return r._createHeader=hz(t,n),r}static decode(t){t=new dz(Et(t));let n=Di.getRootAsMessage(t),r=n.bodyLength(),i=n.version(),o=n.headerType(),s=new e(r,i,o);return s._createHeader=pz(n,o),s}static encode(t){let n=new fz,r=-1;return t.isSchema()?r=re.encode(n,t.header()):t.isRecordBatch()?r=In.encode(n,t.header()):t.isDictionaryBatch()&&(r=hr.encode(n,t.header())),Di.startMessage(n),Di.addVersion(n,on.V4),Di.addHeader(n,r),Di.addHeaderType(n,t.headerType),Di.addBodyLength(n,BigInt(t.bodyLength)),Di.finishMessageBuffer(n,Di.endMessage(n)),n.asUint8Array()}static from(t,n=0){if(t instanceof re)return new e(0,on.V4,Zt.Schema,t);if(t instanceof In)return new e(n,on.V4,Zt.RecordBatch,t);if(t instanceof hr)return new e(n,on.V4,Zt.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===Zt.Schema}isRecordBatch(){return this.headerType===Zt.RecordBatch}isDictionaryBatch(){return this.headerType===Zt.DictionaryBatch}constructor(t,n,r,i){this._version=n,this._headerType=r,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=cr(t)}},In=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=cr(t)}},hr=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,n,r=!1){this._data=t,this._isDelta=r,this._id=cr(n)}},dr=class{constructor(t,n){this.offset=cr(t),this.length=cr(n)}},Li=class{constructor(t,n){this.length=cr(t),this.nullCount=cr(n)}};function hz(e,t){return()=>{switch(t){case Zt.Schema:return re.fromJSON(e);case Zt.RecordBatch:return In.fromJSON(e);case Zt.DictionaryBatch:return hr.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${Zt[t]}, type: ${t} }`)}}function pz(e,t){return()=>{switch(t){case Zt.Schema:return re.decode(e.header(new ur));case Zt.RecordBatch:return In.decode(e.header(new Fr),e.version());case Zt.DictionaryBatch:return hr.decode(e.header(new ys),e.version())}throw new Error(`Unrecognized Message type: { name: ${Zt[t]}, type: ${t} }`)}}Pt.encode=Tz;Pt.decode=Sz;Pt.fromJSON=y3;re.encode=Iz;re.decode=mz;re.fromJSON=d3;In.encode=Ez;In.decode=yz;In.fromJSON=Rv;hr.encode=Az;hr.decode=gz;hr.fromJSON=h3;Li.encode=Mz;Li.decode=xz;dr.encode=Nz;dr.decode=bz;function mz(e,t=new Map){let n=vz(e,t);return new re(n,Rg(e),t)}function yz(e,t=on.V4){if(e.compression()!==null)throw new Error("Record batch compression not implemented");return new In(e.length(),_z(e),wz(e,t))}function gz(e,t=on.V4){return new hr(In.decode(e.data(),t),e.id(),e.isDelta())}function bz(e){return new dr(e.offset(),e.length())}function xz(e){return new Li(e.length(),e.nullCount())}function _z(e){let t=[];for(let n,r=-1,i=-1,o=e.nodesLength();++r<o;)(n=e.nodes(r))&&(t[++i]=Li.decode(n));return t}function wz(e,t){let n=[];for(let r,i=-1,o=-1,s=e.buffersLength();++i<s;)(r=e.buffers(i))&&(t<on.V4&&(r.bb_pos+=8*(i+1)),n[++o]=dr.decode(r));return n}function vz(e,t){let n=[];for(let r,i=-1,o=-1,s=e.fieldsLength();++i<s;)(r=e.fields(i))&&(n[++o]=Pt.decode(r,t));return n}function g3(e,t){let n=[];for(let r,i=-1,o=-1,s=e.childrenLength();++i<s;)(r=e.children(i))&&(n[++o]=Pt.decode(r,t));return n}function Sz(e,t){let n,r,i,o,s,a;return!t||!(a=e.dictionary())?(i=x3(e,g3(e,t)),r=new Pt(e.name(),i,e.nullable(),Rg(e))):t.has(n=cr(a.id()))?(o=(o=a.indexType())?b3(o):new Ji,s=new Mr(t.get(n),o,n,a.isOrdered()),r=new Pt(e.name(),s,e.nullable(),Rg(e))):(o=(o=a.indexType())?b3(o):new Ji,t.set(n,i=x3(e,g3(e,t))),s=new Mr(i,o,n,a.isOrdered()),r=new Pt(e.name(),s,e.nullable(),Rg(e))),r||null}function Rg(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 b3(e){return new Be(e.isSigned(),e.bitWidth())}function x3(e,t){let n=e.typeType();switch(n){case xe.NONE:return new Gn;case xe.Null:return new Gn;case xe.Binary:return new Zo;case xe.Utf8:return new Ko;case xe.Bool:return new Jo;case xe.List:return new Ei((t||[])[0]);case xe.Struct_:return new me(t||[])}switch(n){case xe.Int:{let r=e.type(new ki);return new Be(r.isSigned(),r.bitWidth())}case xe.FloatingPoint:{let r=e.type(new ha);return new lr(r.precision())}case xe.Decimal:{let r=e.type(new oo);return new ts(r.scale(),r.precision(),r.bitWidth())}case xe.Date:{let r=e.type(new la);return new es(r.unit())}case xe.Time:{let r=e.type(new as);return new Ti(r.unit(),r.bitWidth())}case xe.Timestamp:{let r=e.type(new cs);return new ns(r.unit(),r.timezone())}case xe.Interval:{let r=e.type(new pa);return new rs(r.unit())}case xe.Union:{let r=e.type(new Fi);return new Ai(r.mode(),r.typeIdsArray()||[],t||[])}case xe.FixedSizeBinary:{let r=e.type(new fa);return new is(r.byteWidth())}case xe.FixedSizeList:{let r=e.type(new da);return new Mi(r.listSize(),(t||[])[0])}case xe.Map:{let r=e.type(new ma);return new Ni((t||[])[0],r.keysSorted())}}throw new Error(`Unrecognized type: "${xe[n]}" (${n})`)}function Iz(e,t){let n=t.fields.map(o=>Pt.encode(e,o));ur.startFieldsVector(e,n.length);let r=ur.createFieldsVector(e,n),i=t.metadata&&t.metadata.size>0?ur.createCustomMetadataVector(e,[...t.metadata].map(([o,s])=>{let a=e.createString(`${o}`),c=e.createString(`${s}`);return tn.startKeyValue(e),tn.addKey(e,a),tn.addValue(e,c),tn.endKeyValue(e)})):-1;return ur.startSchema(e),ur.addFields(e,r),ur.addEndianness(e,Rz?ca.Little:ca.Big),i!==-1&&ur.addCustomMetadata(e,i),ur.endSchema(e)}function Tz(e,t){let n=-1,r=-1,i=-1,o=t.type,s=t.typeId;ht.isDictionary(o)?(s=o.dictionary.typeId,i=Mg.visit(o,e),r=Mg.visit(o.dictionary,e)):r=Mg.visit(o,e);let a=(o.children||[]).map(u=>Pt.encode(e,u)),c=Dn.createChildrenVector(e,a),l=t.metadata&&t.metadata.size>0?Dn.createCustomMetadataVector(e,[...t.metadata].map(([u,f])=>{let d=e.createString(`${u}`),h=e.createString(`${f}`);return tn.startKeyValue(e),tn.addKey(e,d),tn.addValue(e,h),tn.endKeyValue(e)})):-1;return t.name&&(n=e.createString(t.name)),Dn.startField(e),Dn.addType(e,r),Dn.addTypeType(e,s),Dn.addChildren(e,c),Dn.addNullable(e,!!t.nullable),n!==-1&&Dn.addName(e,n),i!==-1&&Dn.addDictionary(e,i),l!==-1&&Dn.addCustomMetadata(e,l),Dn.endField(e)}function Ez(e,t){let n=t.nodes||[],r=t.buffers||[];Fr.startNodesVector(e,n.length);for(let s of n.slice().reverse())Li.encode(e,s);let i=e.endVector();Fr.startBuffersVector(e,r.length);for(let s of r.slice().reverse())dr.encode(e,s);let o=e.endVector();return Fr.startRecordBatch(e),Fr.addLength(e,BigInt(t.length)),Fr.addNodes(e,i),Fr.addBuffers(e,o),Fr.endRecordBatch(e)}function Az(e,t){let n=In.encode(e,t.data);return ys.startDictionaryBatch(e),ys.addId(e,BigInt(t.id)),ys.addIsDelta(e,t.isDelta),ys.addData(e,n),ys.endDictionaryBatch(e)}function Mz(e,t){return su.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function Nz(e,t){return ou.createBuffer(e,BigInt(t.offset),BigInt(t.length))}var Rz=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})();var kv=e=>`Expected ${Zt[e]} Message in stream, but was null or length 0.`,Fv=e=>`Header pointer of flatbuffer-encoded ${Zt[e]} Message is null or length 0.`,_3=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,w3=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,cu=class{constructor(t){this.source=t instanceof ao?t:new ao(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?ye:t.value===-1&&(t=this.readMetadataLength()).done?ye:(t=this.readMetadata(t.value)).done?ye: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(kv(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(w3(t,n.byteLength));return n.byteOffset%8===0&&n.byteOffset+n.byteLength<=n.buffer.byteLength?n:n.slice()}readSchema(t=!1){let n=Zt.Schema,r=this.readMessage(n),i=r?.header();if(t&&!i)throw new Error(Fv(n));return i}readMetadataLength(){let t=this.source.read(Og),n=t&&new Or(t),r=n?.readInt32(0)||0;return{done:r===0,value:r}}readMetadata(t){let n=this.source.read(t);if(!n)return ye;if(n.byteLength<t)throw new Error(_3(t,n.byteLength));return{done:!1,value:pr.decode(n)}}},dh=class{constructor(t,n){this.source=t instanceof Jr?t:yy(t)?new ya(t,n):new Jr(t)}[Symbol.asyncIterator](){return this}next(){return Q(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?ye:t.value===-1&&(t=yield this.readMetadataLength()).done?ye:(t=yield this.readMetadata(t.value)).done?ye:t})}throw(t){return Q(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return Q(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return Q(this,void 0,void 0,function*(){let n;if((n=yield this.next()).done)return null;if(t!=null&&n.value.headerType!==t)throw new Error(kv(t));return n.value})}readMessageBody(t){return Q(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(w3(t,n.byteLength));return n.byteOffset%8===0&&n.byteOffset+n.byteLength<=n.buffer.byteLength?n:n.slice()})}readSchema(t=!1){return Q(this,void 0,void 0,function*(){let n=Zt.Schema,r=yield this.readMessage(n),i=r?.header();if(t&&!i)throw new Error(Fv(n));return i})}readMetadataLength(){return Q(this,void 0,void 0,function*(){let t=yield this.source.read(Og),n=t&&new Or(t),r=n?.readInt32(0)||0;return{done:r===0,value:r}})}readMetadata(t){return Q(this,void 0,void 0,function*(){let n=yield this.source.read(t);if(!n)return ye;if(n.byteLength<t)throw new Error(_3(t,n.byteLength));return{done:!1,value:pr.decode(n)}})}},hh=class extends cu{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof zd?t:new zd(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:pr.fromJSON(t.schema,Zt.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let n=t.dictionaries[this._dictionaryIndex++];return this._body=n.data.columns,{done:!1,value:pr.fromJSON(n,Zt.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let n=t.batches[this._batchIndex++];return this._body=n.columns,{done:!1,value:pr.fromJSON(n,Zt.RecordBatch)}}return this._body=[],ye}readMessageBody(t){return n(this._body);function n(r){return(r||[]).reduce((i,o)=>[...i,...o.VALIDITY&&[o.VALIDITY]||[],...o.TYPE&&[o.TYPE]||[],...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(kv(t));return n.value}readSchema(){let t=Zt.Schema,n=this.readMessage(t),r=n?.header();if(!n||!r)throw new Error(Fv(t));return r}},Og=4,Ov="ARROW1",lu=new Uint8Array(Ov.length);for(let e=0;e<Ov.length;e+=1)lu[e]=Ov.codePointAt(e);function kg(e,t=0){for(let n=-1,r=lu.length;++n<r;)if(lu[n]!==e[t+n])return!1;return!0}var uu=lu.length,Dv=uu+Og,v3=uu*2+Og;var en=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 Er(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 wn.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return wn.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:py(t)?kz(t):yy(t)?Lz(t):Er(t)?Q(this,void 0,void 0,function*(){return yield e.from(yield t)}):gy(t)||_d(t)||xy(t)||Hr(t)?Dz(new Jr(t)):Fz(new ao(t))}static readAll(t){return t instanceof e?t.isSync()?S3(t):I3(t):py(t)||ArrayBuffer.isView(t)||vi(t)||my(t)?S3(t):I3(t)}},lo=class extends en{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return Tr(this,arguments,function*(){yield Rt(yield*zl(wi(this[Symbol.iterator]())))})}},ga=class extends en{constructor(t){super(t),this._impl=t}readAll(){var t,n,r,i;return Q(this,void 0,void 0,function*(){let o=new Array;try{for(var s=!0,a=wi(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]()}},ba=class extends lo{constructor(t){super(t),this._impl=t}},ph=class extends ga{constructor(t){super(t),this._impl=t}},Fg=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=Ot({type:new me(this.schema.fields),length:t.length,children:r});return new ke(this.schema,i)}_loadDictionaryBatch(t,n){let{id:r,isDelta:i}=t,{dictionaries:o,schema:s}=this,a=o.get(r);if(i||!a){let c=s.dictionaries.get(r),l=this._loadVectors(t.data,n,[c]);return(a&&i?a.concat(new qt(l)):new qt(l)).memoize()}return a.memoize()}_loadVectors(t,n,r){return new Yd(n,t.nodes,t.buffers,this.dictionaries).visitMany(r)}},fu=class extends Fg{constructor(t,n){super(n),this._reader=py(t)?new hh(this._handle=t):new cu(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=T3(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):ye}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):ye}next(){if(this.closed)return ye;let t,{_reader:n}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let r=t.header(),i=n.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(r,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let r=t.header(),i=n.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(r,i);this.dictionaries.set(r.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Rc(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},du=class extends Fg{constructor(t,n){super(n),this._reader=new dh(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return Q(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(t){return Q(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=T3(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return Q(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):ye})}return(t){return Q(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):ye})}next(){return Q(this,void 0,void 0,function*(){if(this.closed)return ye;let t,{_reader:n}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let r=t.header(),i=yield n.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(r,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let r=t.header(),i=yield n.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(r,i);this.dictionaries.set(r.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Rc(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return Q(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},Dg=class extends fu{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,n){super(t instanceof jd?t:new jd(t),n)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let n of this._footer.dictionaryBatches())n&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var n;if(this.closed)return null;this._footer||this.open();let r=(n=this._footer)===null||n===void 0?void 0:n.getRecordBatch(t);if(r&&this._handle.seek(r.offset)){let i=this._reader.readMessage(Zt.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(Zt.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-Dv,r=t.readInt32(n),i=t.readAt(n-r,r);return ls.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}},Lv=class extends du{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,...n){let r=typeof n[0]!="number"?n.shift():void 0,i=n[0]instanceof Map?n.shift():void 0;super(t instanceof ya?t:new ya(t,r),i)}isFile(){return!0}isAsync(){return!0}open(t){let n=Object.create(null,{open:{get:()=>super.open}});return Q(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let r of this._footer.dictionaryBatches())r&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield n.open.call(this,t)})}readRecordBatch(t){var n;return Q(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(Zt.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 Q(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(Zt.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}})}_readFooter(){return Q(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let n=t.size-Dv,r=yield t.readInt32(n),i=yield t.readAt(n-r,r);return ls.decode(i)})}_readNextMessageAndValidate(t){return Q(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let n=this._footer.getRecordBatch(this._recordBatchIndex);if(n&&(yield this._handle.seek(n.offset)))return yield this._reader.readMessage(t)}return null})}},Cv=class extends fu{constructor(t,n){super(t,n)}_loadVectors(t,n,r){return new ig(n,t.nodes,t.buffers,this.dictionaries).visitMany(r)}};function T3(e,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:e.autoDestroy}function*S3(e){let t=en.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function I3(e){return Tr(this,arguments,function*(){let n=yield Rt(en.from(e));try{if(!(yield Rt(n.open({autoDestroy:!1}))).closed)do yield yield Rt(n);while(!(yield Rt(n.reset().open())).closed)}finally{yield Rt(n.cancel())}})}function kz(e){return new lo(new Cv(e))}function Fz(e){let t=e.peek(uu+7&-8);return t&&t.byteLength>=4?kg(t)?new ba(new Dg(e.read())):new lo(new fu(e)):new lo(new fu(function*(){}()))}function Dz(e){return Q(this,void 0,void 0,function*(){let t=yield e.peek(uu+7&-8);return t&&t.byteLength>=4?kg(t)?new ba(new Dg(yield e.read())):new ga(new du(e)):new ga(new du(function(){return Tr(this,arguments,function*(){})}()))})}function Lz(e){return Q(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),n=new ya(e,t);return t>=v3&&kg(yield n.readAt(0,uu+7&-8))?new ph(new Lv(n)):new ga(new du(n))})}var Pe=class e extends gt{static assemble(...t){let n=i=>i.flatMap(o=>Array.isArray(o)?n(o):o instanceof ke?o.data.children:o.data),r=new e;return r.visitMany(n(t)),r}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof qt)return this.visitMany(t.data),this;let{type:n}=t;if(!ht.isDictionary(n)){let{length:r,nullCount:i}=t;if(r>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");ht.isNull(n)||Ci.call(this,i<=0?new Uint8Array(0):Ql(t.offset,r,t.nullBitmap)),this.nodes.push(new Li(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 Ci(e){let t=e.byteLength+7&-8;return this.buffers.push(e),this.bufferRegions.push(new dr(this._byteLength,t)),this._byteLength+=t,this}function Cz(e){let{type:t,length:n,typeIds:r,valueOffsets:i}=e;if(Ci.call(this,r),t.mode===Ee.Sparse)return Bv.call(this,e);if(t.mode===Ee.Dense){if(e.offset<=0)return Ci.call(this,i),Bv.call(this,e);{let o=r.reduce((u,f)=>Math.max(u,f),r[0]),s=new Int32Array(o+1),a=new Int32Array(o+1).fill(-1),c=new Int32Array(n),l=wd(-i[0],n,i);for(let u,f,d=-1;++d<n;)(f=a[u=r[d]])===-1&&(f=a[u]=l[u]),c[d]=l[d]-f,++s[u];Ci.call(this,c);for(let u,f=-1,d=t.children.length;++f<d;)if(u=e.children[f]){let h=t.typeIds[f],p=Math.min(n,s[h]);this.visit(u.slice(a[h],p))}}}return this}function Bz(e){let t;return e.nullCount>=e.length?Ci.call(this,new Uint8Array(0)):(t=e.values)instanceof Uint8Array?Ci.call(this,Ql(e.offset,e.length,t)):Ci.call(this,_c(e.values))}function xa(e){return Ci.call(this,e.values.subarray(0,e.length*e.stride))}function E3(e){let{length:t,values:n,valueOffsets:r}=e,i=r[0],o=r[t],s=Math.min(o-i,n.byteLength-i);return Ci.call(this,wd(-r[0],t,r)),Ci.call(this,n.subarray(i,i+s)),this}function Pv(e){let{length:t,valueOffsets:n}=e;return n&&Ci.call(this,wd(n[0],t,n)),this.visit(e.children[0])}function Bv(e){return this.visitMany(e.type.children.map((t,n)=>e.children[n]).filter(Boolean))[0]}Pe.prototype.visitBool=Bz;Pe.prototype.visitInt=xa;Pe.prototype.visitFloat=xa;Pe.prototype.visitUtf8=E3;Pe.prototype.visitBinary=E3;Pe.prototype.visitFixedSizeBinary=xa;Pe.prototype.visitDate=xa;Pe.prototype.visitTimestamp=xa;Pe.prototype.visitTime=xa;Pe.prototype.visitDecimal=xa;Pe.prototype.visitList=Pv;Pe.prototype.visitStruct=Bv;Pe.prototype.visitUnion=Cz;Pe.prototype.visitInterval=xa;Pe.prototype.visitFixedSizeList=Pv;Pe.prototype.visitMap=Pv;var Oc=class extends Ic{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,n){throw new Error('"throughDOM" not available in this environment')}constructor(t){super(),this._position=0,this._started=!1,this._sink=new so,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,Vn(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return Er(t)?t.then(n=>this.writeAll(n)):Hr(t)?Uv(this,t):$v(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 so?this._sink=t:(this._sink=new so,t&&QA(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&ZA(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,(!n||!Nc(n,this._schema))&&(n==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=n,this._writeSchema(n))),this}write(t){let n=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof an&&!(n=t.schema))return this.finish()&&void 0;if(t instanceof ke&&!(n=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(n&&!Nc(n,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,n)}t instanceof ke?t instanceof Rc||this._writeRecordBatch(t):t instanceof an?this.writeAll(t.batches):vi(t)&&this.writeAll(t)}_writeMessage(t,n=8){let r=n-1,i=pr.encode(t),o=i.byteLength,s=this._writeLegacyIpcFormat?4:8,a=o+s+r&~r,c=a-o-s;return t.headerType===Zt.RecordBatch?this._recordBatchBlocks.push(new us(a,t.bodyLength,this._position)):t.headerType===Zt.DictionaryBatch&&this._dictionaryBlocks.push(new us(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(pr.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(lu)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:n,nodes:r,bufferRegions:i,buffers:o}=Pe.assemble(t),s=new In(t.numRows,r,i),a=pr.from(s,n);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(o)}_writeDictionaryBatch(t,n,r=!1){this._dictionaryDeltaOffsets.set(n,t.length+(this._dictionaryDeltaOffsets.get(n)||0));let{byteLength:i,nodes:o,bufferRegions:s,buffers:a}=Pe.assemble(new qt([t])),c=new In(t.length,o,s),l=new hr(c,n,r),u=pr.from(l,i);return this._writeMessage(u)._writeBodyBuffers(a)}_writeBodyBuffers(t){let n,r,i;for(let o=-1,s=t.length;++o<s;)(n=t[o])&&(r=n.byteLength)>0&&(this._write(n),(i=(r+7&-8)-r)>0&&this._writePadding(i));return this}_writeDictionaries(t){for(let[n,r]of t.dictionaries){let i=this._dictionaryDeltaOffsets.get(n)||0;if(i===0||(r=r?.slice(i)).length>0)for(let o of r.data)this._writeDictionaryBatch(o,n,i>0),i+=o.length}return this}},kc=class e extends Oc{static writeAll(t,n){let r=new e(n);return Er(t)?t.then(i=>r.writeAll(i)):Hr(t)?Uv(r,t):$v(r,t)}},Fc=class e extends Oc{static writeAll(t){let n=new e;return Er(t)?t.then(r=>n.writeAll(r)):Hr(t)?Uv(n,t):$v(n,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){let n=ls.encode(new ls(t,on.V4,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(n)._write(Int32Array.of(n.byteLength))._writeMagic()}};function $v(e,t){let n=t;t instanceof an&&(n=t.batches,e.reset(void 0,t.schema));for(let r of n)e.write(r);return e.finish()}function Uv(e,t){var n,r,i,o,s,a,c;return Q(this,void 0,void 0,function*(){try{for(n=!0,r=wi(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 A3(e,t){if(Hr(e))return $z(e,t);if(vi(e))return Pz(e,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function Pz(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 $z(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 Q(this,void 0,void 0,function*(){yield o(s,n||(n=e[Symbol.asyncIterator]()))})},pull(s){return Q(this,void 0,void 0,function*(){n?yield o(s,n):s.close()})},cancel(){return Q(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 Q(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 R3(e){return new zv(e)}var zv=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:n,["writableStrategy"]:r,["queueingStrategy"]:i="count"}=t,o=XA(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=Ec(o),this._getSize=i!=="bytes"?M3:N3;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"?M3:N3}),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)}},M3=e=>{var t;return(t=e?.length)!==null&&t!==void 0?t:0},N3=e=>{var t;return(t=e?.byteLength)!==null&&t!==void 0?t:0};function Lg(e,t){let n=new so,r=null,i=new ReadableStream({cancel(){return Q(this,void 0,void 0,function*(){yield n.close()})},start(a){return Q(this,void 0,void 0,function*(){yield s(a,r||(r=yield o()))})},pull(a){return Q(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 Q(this,void 0,void 0,function*(){return yield(yield en.from(n)).open(t)})}function s(a,c){return Q(this,void 0,void 0,function*(){let l=a.desiredSize,u=null;for(;!(u=yield c.next()).done;)if(a.enqueue(u.value),l!=null&&--l<=0)return;a.close()})}}function Cg(e,t){let n=new this(e),r=new Jr(n),i=new ReadableStream({cancel(){return Q(this,void 0,void 0,function*(){yield r.cancel()})},pull(s){return Q(this,void 0,void 0,function*(){yield o(s)})},start(s){return Q(this,void 0,void 0,function*(){yield o(s)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(n,e),readable:i};function o(s){return Q(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 Dc(e){let t=en.from(e);return Er(t)?t.then(n=>Dc(n)):t.isAsync()?t.readAll().then(n=>new an(n)):new an(t.readAll())}function Bg(e,t="stream"){return(t==="stream"?kc:Fc).writeAll(e).toUint8Array(!0)}var jz=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Jw),Iv),mv),tv),Hw),pv),{compareSchemas:Nc,compareFields:r3,compareTypes:i3});wn.toDOMStream=A3;be.throughDOM=R3;en.throughDOM=Lg;ba.throughDOM=Lg;lo.throughDOM=Lg;Oc.throughDOM=Cg;Fc.throughDOM=Cg;kc.throughDOM=Cg;function Pg(e="ws://localhost:3000/"){let t=[],n=!1,r=null,i,o={open(){n=!0,c()},close(){for(n=!1,r=null,i=null;t.length;)t.shift().reject("Socket closed")},error(l){if(r){let{reject:u}=r;r=null,c(),u(l)}else console.error("WebSocket error: ",l)},message({data:l}){if(r){let{query:u,resolve:f,reject:d}=r;if(r=null,c(),typeof l=="string"){let h=JSON.parse(l);h.error?d(h.error):f(h)}else if(u.type==="exec")f();else if(u.type==="arrow")f(Dc(l.arrayBuffer()));else throw new Error(`Unexpected socket data: ${l}`)}else console.log("WebSocket message: ",l)}};function s(){i=new WebSocket(e);for(let l in o)i.addEventListener(l,o[l])}function a(l,u,f){i==null&&s(),t.push({query:l,resolve:u,reject:f}),n&&!r&&c()}function c(){t.length&&(r=t.shift(),i.send(JSON.stringify(r.query)))}return{get connected(){return n},query(l){return new Promise((u,f)=>a(l,u,f))}}}var mr=class{constructor(t,n){t&&(this.table=String(t)),n&&(this.column=n)}get columns(){return this.column?[this.column]:[]}toString(){let{table:t,column:n}=this;if(n){let r=n.startsWith("*")?n:`"${n}"`;return`${t?`${k3(t)}.`:""}${r}`}else return t?k3(t):"NULL"}};function k3(e){return e.split(".").map(n=>`"${n}"`).join(".")}function F3(e,t){return e instanceof mr&&e.column===t}function Vt(e){return typeof e=="string"?Cc(e):e}function Lc(e){return typeof e=="string"?D3(e):e}function D3(e){return new mr(e)}function Cc(e,t){return arguments.length===1&&(t=e,e=null),new mr(e,t)}function uo(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 gs=e=>typeof e?.addEventListener=="function";function $g(e){return e instanceof _a}var _a=class{constructor(t,n,r){this._expr=Array.isArray(t)?t:[t],this._deps=n||[],this.annotate(r);let i=this._expr.filter(o=>gs(o));i.length>0?(this._params=Array.from(new Set(i)),this._params.forEach(o=>{o.addEventListener("value",()=>qz(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=>gs(t)&&!$g(t)?uo(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 qz(e,t){if(t?.size)return Promise.allSettled(Array.from(t,n=>n(e)))}function jv(e,t){let n=[e[0]],r=new Set,i=t.length;for(let o=0,s=0;o<i;){let a=t[o];gs(a)?n[++s]=a:(Array.isArray(a?.columns)&&a.columns.forEach(l=>r.add(l)),n[s]+=typeof a=="string"?a:uo(a));let c=e[++o];gs(n[s])?n[++s]=c:n[s]+=c}return{spans:n,cols:Array.from(r)}}function q(e,...t){let{spans:n,cols:r}=jv(e,t);return new _a(n,r)}function qv(e){let t=Vt(e);return q`${t} DESC NULLS LAST`.annotate({label:t?.label,desc:!0})}var ei=e=>({value:e,toString:()=>uo(e)});function mh(e){e(this.op,this),this.children?.forEach(t=>t.visit(e))}function L3(e,t){let n=t.filter(i=>i!=null).map(Vt),r=n.map((i,o)=>o?` ${e} `:"");return n.length===1?r.push(""):n.length>1&&(r[0]="(",r.push(")")),q(r,...n).annotate({op:e,children:n,visit:mh})}var yr=(...e)=>L3("AND",e.flat()),hu=(...e)=>L3("OR",e.flat()),Vz=e=>t=>q`(${e} ${Vt(t)})`.annotate({op:e,a:t,visit:mh}),C3=Vz("NOT"),B3=e=>t=>q`(${Vt(t)} ${e})`.annotate({op:e,a:t,visit:mh}),pu=B3("IS NULL"),wa=B3("IS NOT NULL"),va=e=>(t,n)=>q`(${Vt(t)} ${e} ${Vt(n)})`.annotate({op:e,a:t,b:n,visit:mh}),Sa=va("="),Ug=va("<>"),Ia=va("<"),mu=va(">"),Ta=va("<="),P3=va(">="),$3=va("IS DISTINCT FROM"),zg=va("IS NOT DISTINCT FROM");function U3(e,t,n,r){t=Vt(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:mh,field:t,range:n})}var Me=(e,t,n)=>U3("BETWEEN",e,t,n),z3=(e,t,n)=>U3("NOT BETWEEN",e,t,n);function Bc(e,t){return Array.from({length:e},()=>t)}function ni(e,t){return(...n)=>{let r=n.map(Vt),i=t?`::${t}`:"";return(r.length?q([`${e}(`,...Bc(r.length-1,", "),`)${i}`],...r):q`${e}()${i}`).annotate({func:e,args:r})}}var Vv=ni("REGEXP_MATCHES"),Yv=ni("CONTAINS"),Gv=ni("PREFIX"),Wv=ni("SUFFIX"),Yz=ni("LOWER"),Gz=ni("UPPER"),Wz=ni("LENGTH"),Xz=ni("ISNAN"),Hz=ni("ISFINITE"),Qz=ni("ISINF");var yh=class e extends _a{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 d=o&&s?" ":"",h=(o||s)&&a?" ":"";c=q`${n} OVER (${i?`"${i}" `:""}${o}${d}${s}${h}${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(Vt),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(Vt),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=j3("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=j3("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 j3(e,t){if(gs(t)){let n=q`${t}`;return n.toString=()=>`${e} ${q3(t.value)}`,n}return`${e} ${q3(t)}`}function q3(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 Bi(e,t){return(...n)=>{let r=ni(e)(...n);return new yh(e,r,t)}}var jg=Bi("ROW_NUMBER","INTEGER"),qg=Bi("RANK","INTEGER"),Vg=Bi("DENSE_RANK","INTEGER"),Yg=Bi("PERCENT_RANK"),Gg=Bi("CUME_DIST"),Wg=Bi("NTILE"),Xg=Bi("LAG"),Hg=Bi("LEAD"),Qg=Bi("FIRST_VALUE"),Zg=Bi("LAST_VALUE"),Kg=Bi("NTH_VALUE");function V3(e,...t){return q(e,...t).annotate({aggregate:!0})}var Xv=class e extends _a{constructor(t,n,r,i,o){n=(n||[]).map(Vt);let{strings:s,exprs:a}=Zz(t,n,r,i,o),{spans:c,cols:l}=jv(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(Kz).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 yh(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 Zz(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 Kz(e){let t=uo(e);return t&&t.startsWith('"')&&t.endsWith('"')?t.slice(1,-1):t}function Ht(e,t){return(...n)=>new Xv(e,n,t)}var gr=Ht("COUNT","INTEGER"),Jg=Ht("AVG"),Jz=Ht("AVG"),Y3=Ht("MAD"),Dr=Ht("MAX"),Lr=Ht("MIN"),br=Ht("SUM","DOUBLE"),G3=Ht("PRODUCT"),t0=Ht("MEDIAN"),e0=Ht("QUANTILE"),n0=Ht("MODE"),W3=Ht("VARIANCE"),X3=Ht("STDDEV"),H3=Ht("SKEWNESS"),Q3=Ht("KURTOSIS"),Z3=Ht("ENTROPY"),K3=Ht("VAR_POP"),J3=Ht("STDDEV_POP"),t6=Ht("CORR"),e6=Ht("COVAR_POP"),Hv=Ht("REGR_INTERCEPT"),Qv=Ht("REGR_SLOPE"),Zv=Ht("REGR_COUNT"),tj=Ht("REGR_R2"),Kv=Ht("REGR_SYY"),Jv=Ht("REGR_SXX"),ej=Ht("REGR_SXY"),t2=Ht("REGR_AVGX"),nj=Ht("REGR_AVGY"),rj=Ht("FIRST"),n6=Ht("LAST"),gh=Ht("ARG_MIN"),bh=Ht("ARG_MAX"),r6=Ht("STRING_AGG"),i6=Ht("ARRAY_AGG");function r0(e,t){let n=Vt(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 xh=e=>r0(e,"DOUBLE"),o6=e=>r0(e,"INTEGER");var _h=e=>{let t=Vt(e);return q`(1000 * (epoch(${t}) - second(${t})) + millisecond(${t}))::DOUBLE`},i0=e=>{let t=Vt(e);return q`MAKE_DATE(2012, MONTH(${t}), 1)`.annotate({label:"month"})},o0=e=>{let t=Vt(e);return q`MAKE_DATE(2012, MONTH(${t}), DAY(${t}))`.annotate({label:"date"})},s0=e=>{let t=Vt(e);return q`MAKE_DATE(2012, 1, DAY(${t}))`.annotate({label:"date"})};var pt=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 Pc("UNION",t.flat())}static unionAll(...t){return new Pc("UNION ALL",t.flat())}static intersect(...t){return new Pc("INTERSECT",t.flat())}static except(...t){return new Pc("EXCEPT",t.flat())}constructor(){this.query={with:[],select:[],from:[],where:[],groupby:[],having:[],window:[],qualify:[],orderby:[]}}clone(){let t=new e;return t.query={...this.query},t}with(...t){let{query:n}=this;if(t.length===0)return n.with;{let r=[],i=(o,s)=>{let a=s.clone();a.cteFor=this,r.push({as:o,query:a})};return t.flat().forEach(o=>{if(o!=null)if(o.as&&o.query)i(o.as,o.query);else for(let s in o)i(s,o[s])}),n.with=n.with.concat(r),this}}select(...t){let{query:n}=this;if(t.length===0)return n.select;{let r=[];for(let i of t.flat())if(i!=null)if(typeof i=="string")r.push({as:i,expr:Vt(i)});else if(i instanceof mr)r.push({as:i.column,expr:i});else if(Array.isArray(i))r.push({as:i[0],expr:i[1]});else for(let o in i)r.push({as:a0(o),expr:Vt(i[o])});return n.select=n.select.concat(r),this}}$select(...t){return this.query.select=[],this.select(...t)}distinct(t=!0){return this.query.distinct=!!t,this}from(...t){let{query:n}=this;if(t.length===0)return n.from;{let r=[];return t.flat().forEach(i=>{if(i!=null)if(typeof i=="string")r.push({as:i,from:Lc(i)});else if(i instanceof mr)r.push({as:i.table,from:i});else if(c0(i)||$g(i))r.push({from:i});else if(Array.isArray(i))r.push({as:a0(i[0]),from:Lc(i[1])});else for(let o in i)r.push({as:a0(o),from:Lc(i[o])})}),n.from=n.from.concat(r),this}}$from(...t){return this.query.from=[],this.from(...t)}sample(t,n){let{query:r}=this;if(arguments.length===0)return r.sample;{let i=t;return typeof t=="number"&&(i=t>0&&t<1?{perc:100*t,method:n}:{rows:Math.round(t),method:n}),r.sample=i,this}}where(...t){let{query:n}=this;return t.length===0?n.where:(n.where=n.where.concat(t.flat().filter(r=>r)),this)}$where(...t){return this.query.where=[],this.where(...t)}groupby(...t){let{query:n}=this;return t.length===0?n.groupby:(n.groupby=n.groupby.concat(t.flat().filter(r=>r).map(Vt)),this)}$groupby(...t){return this.query.groupby=[],this.groupby(...t)}having(...t){let{query:n}=this;return t.length===0?n.having:(n.having=n.having.concat(t.flat().filter(r=>r)),this)}window(...t){let{query:n}=this;if(t.length===0)return n.window;{let r=[];return t.flat().forEach(i=>{if(i!=null)for(let o in i)r.push({as:a0(o),expr:i[o]})}),n.window=n.window.concat(r),this}}qualify(...t){let{query:n}=this;return t.length===0?n.qualify:(n.qualify=n.qualify.concat(t.flat().filter(r=>r)),this)}orderby(...t){let{query:n}=this;return t.length===0?n.orderby:(n.orderby=n.orderby.concat(t.flat().filter(r=>r).map(Vt)),this)}limit(t){let{query:n}=this;return arguments.length===0?n.limit:(n.limit=Number.isFinite(t)?t:void 0,this)}offset(t){let{query:n}=this;return arguments.length===0?n.offset:(n.offset=Number.isFinite(t)?t:void 0,this)}get subqueries(){let{query:t,cteFor:n}=this,i=(n?.query||t).with?.reduce((s,{as:a,query:c})=>(s[a]=c,s),{}),o=[];return t.from.forEach(({from:s})=>{if(c0(s))o.push(s);else if(i[s.table]){let a=i[s.table];o.push(a)}}),o}toString(){let{select:t,distinct:n,from:r,sample:i,where:o,groupby:s,having:a,window:c,qualify:l,orderby:u,limit:f,offset:d,with:h}=this.query,p=[];if(h.length){let g=h.map(({as:m,query:b})=>`"${m}" AS (${b})`);p.push(`WITH ${g.join(", ")}`)}let y=t.map(({as:g,expr:m})=>F3(m,g)&&!m.table?`${m}`:`${m} AS "${g}"`);if(p.push(`SELECT${n?" DISTINCT":""} ${y.join(", ")}`),r.length){let g=r.map(({as:m,from:b})=>{let x=c0(b)?`(${b})`:`${b}`;return!m||m===b.table?x:`${x} AS "${m}"`});p.push(`FROM ${g.join(", ")}`)}if(o.length){let g=o.map(String).filter(m=>m).join(" AND ");g&&p.push(`WHERE ${g}`)}if(i){let{rows:g,perc:m,method:b,seed:x}=i,_=g?`${g} ROWS`:`${m} PERCENT`,v=b?` (${b}${x!=null?`, ${x}`:""})`:"";p.push(`USING SAMPLE ${_}${v}`)}if(s.length&&p.push(`GROUP BY ${s.join(", ")}`),a.length){let g=a.map(String).filter(m=>m).join(" AND ");g&&p.push(`HAVING ${g}`)}if(c.length){let g=c.map(({as:m,expr:b})=>`"${m}" AS (${b})`);p.push(`WINDOW ${g.join(", ")}`)}if(l.length){let g=l.map(String).filter(m=>m).join(" AND ");g&&p.push(`QUALIFY ${g}`)}return u.length&&p.push(`ORDER BY ${u.join(", ")}`),Number.isFinite(f)&&p.push(`LIMIT ${f}`),Number.isFinite(d)&&p.push(`OFFSET ${d}`),p.join(" ")}},Pc=class e{constructor(t,n){this.op=t,this.queries=n.map(r=>r.clone()),this.query={orderby:[]}}clone(){let t=new e(this.op,this.queries);return t.query={...this.query},t}orderby(...t){let{query:n}=this;return t.length===0?n.orderby:(n.orderby=n.orderby.concat(t.flat().filter(r=>r).map(Vt)),this)}limit(t){let{query:n}=this;return arguments.length===0?n.limit:(n.limit=Number.isFinite(t)?t:void 0,this)}offset(t){let{query:n}=this;return arguments.length===0?n.offset:(n.offset=Number.isFinite(t)?t:void 0,this)}get subqueries(){let{queries:t,cteFor:n}=this;return n&&t.forEach(r=>r.cteFor=n),t}toString(){let{op:t,queries:n,query:{orderby:r,limit:i,offset:o}}=this,s=[n.join(` ${t} `)];return r.length&&s.push(`ORDER BY ${r.join(", ")}`),Number.isFinite(i)&&s.push(`LIMIT ${i}`),Number.isFinite(o)&&s.push(`OFFSET ${o}`),s.join(" ")}};function c0(e){return e instanceof pt||e instanceof Pc}function a0(e){return ij(e)?e.slice(1,-1):e}function ij(e){return e[0]==='"'&&e[e.length-1]==='"'}function fo(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 s6(e,{columns:t=Object.keys(e?.[0]||{})}={}){let n=[];if(Array.isArray(t)?(n=t,t=n.reduce((i,o)=>(i[o]=o,i),{})):t&&(n=Object.keys(t)),!n.length)throw new Error("Can not create table from empty column set.");let r=[];for(let i of e){let o=n.map(s=>`${uo(i[s])} AS "${t[s]}"`);r.push(`(SELECT ${o.join(", ")})`)}return r.join(" UNION ALL ")}function n2(e,t,n,r={},i={}){let{select:o=["*"],where:s,view:a,temp:c,replace:l,...u}=r,f=oj({...i,...u}),d=`${e}('${n}'${f?", "+f:""})`,h=s?` WHERE ${s}`:"",p=`SELECT ${o.join(", ")} FROM ${d}${h}`;return fo(t,p,{view:a,temp:c,replace:l})}function l0(e,t,n){return n2("read_csv",e,t,n,{auto_detect:!0,sample_size:-1})}function u0(e,t,n){return n2("read_json",e,t,n,{auto_detect:!0,json_format:"auto"})}function f0(e,t,n){return n2("read_parquet",e,t,n)}function d0(e,t,n={}){let{select:r=["*"],...i}=n,o=s6(t),s=r.length===1&&r[0]==="*"?o:`SELECT ${r} FROM ${o}`;return fo(e,s,i)}function oj(e){return Object.entries(e).map(([t,n])=>`${t}=${e2(n)}`).join(", ")}function e2(e){switch(typeof e){case"boolean":return String(e);case"string":return`'${e}'`;case"undefined":case"object":return e==null?"NULL":Array.isArray(e)?"["+e.map(t=>e2(t)).join(", ")+"]":"{"+Object.entries(e).map(([t,n])=>`'${t}': ${e2(n)}`).join(", ")+"}";default:return e}}function a6(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 sj="count",aj="nulls",cj="max",lj="min",uj="distinct";var fj={[sj]:gr,[uj]:e=>gr(e).distinct(),[cj]:Dr,[lj]:Lr,[aj]:e=>gr().where(pu(e))};function c6({table:e,column:t},n){return pt.from(e).select(n.map(r=>[r,fj[r](t)]))}var l6=()=>Object.create(null),h0=class{constructor(t){this.mc=t,this.clear()}clear(){this.tables=l6()}tableInfo(t){let n=this.tables;if(n[t])return n[t];let r=dj(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(c6(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 hj(this,t);return(await Promise.all(n.map(i=>this.fieldInfo(i)))).filter(i=>i)}};async function dj(e,t){let n=await e.query(`DESCRIBE ${Lc(t)}`,{type:"json",cache:!1}),r=l6();for(let i of n)r[i.column_name]={table:t,column:i.column_name,sqlType:i.column_type,type:a6(i.column_type),nullable:i.null==="YES"};return r}async function hj(e,t){return t.length===1&&t[0].column==="*"?Object.values(await e.tableInfo(t[0].table)):t}function f6(e){let t=2166136261;for(let n=0,r=e.length;n<r;++n){let i=e.charCodeAt(n),o=i&65280;o&&(t=u6(t^o>>8)),t=u6(t^i&255)}return pj(t)}function u6(e){return e+(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24)}function pj(e){return e+=e<<13,e^=e>>>7,e+=e<<3,e^=e>>>17,e+=e<<5,e&4294967295}var p6=e=>e,p0=class{constructor(t,{selection:n,temp:r=!0}){this.mc=t,this.selection=n,this.temp=r,this.reset()}reset(){this.enabled=!1,this.clients=null,this.indices=null,this.activeView=null}clear(){this.indices&&(this.mc.cancel(Array.from(this.indices.values(),t=>t.result)),this.indices=null)}index(t,n){if(this.clients!==t){let l=Array.from(t,h6),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=mj(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=h6(l),f=l.query(o.predicate(l)).select({...i.columns,...u.count}).groupby(Object.keys(i.columns)),[d]=f.subqueries;if(d){let b=Object.values(i.columns).map(x=>x.columns[0]);bj(d,b)}let h=f.orderby();f.query.orderby=[];let p=f.toString(),g=`cube_index_${(f6(p)>>>0).toString(16)}`,m=a.exec(fo(g,p,{temp:c}));s.set(l,{table:g,result:m,order:h,...u})}}async update(){let{clients:t,selection:n,activeView:r}=this,i=r.predicate(n.active.predicate);return Promise.all(Array.from(t).map(o=>this.updateClient(o,i)))}async updateClient(t,n){let r=this.indices.get(t);if(!r)return;n||(n=this.activeView.predicate(this.selection.active.predicate));let{table:i,dims:o,aggr:s,order:a=[]}=r,c=pt.select(o,s).from(i).groupby(o).where(n).orderby(a);return this.mc.updateClient(t,c)}};function mj(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=>yj(l,s));if(c.some(l=>l==null))return null;c.length===1?(a=l=>l?Me("active0",l.range.map(c[0])):[],r={active0:c[0](e.predicate.field)}):(a=l=>l?yr(l.children.map(({range:u},f)=>Me(`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=p6,r=Object.fromEntries(r.map(c=>[c.toString(),c]));else return null;return{source:t,columns:r,predicate:a}}function yj(e,t){let{type:n,domain:r,range:i}=e,o,s;switch(n){case"linear":o=p6,s=Vt;break;case"log":o=Math.log,s=a=>q`LN(${Vt(a)})`;break;case"symlog":o=a=>Math.sign(a)*Math.log1p(Math.abs(a)),s=a=>(a=Vt(a),q`SIGN(${a}) * LN(1 + ABS(${a}))`);break;case"sqrt":o=Math.sqrt,s=a=>q`SQRT(${Vt(a)})`;break;case"utc":case"time":o=a=>+a,s=a=>a instanceof Date?+a:_h(Vt(a));break}return o?gj(r,i,t,o,s):null}function gj(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 d6={from:NaN};function h6(e){if(!e.filterIndexable)return d6;let t=e.query(),n=r2(t);if(!n||!t.groupby)return d6;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 r2(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=r2(t[0]);for(let r=1;r<t.length;++r){let i=r2(t[r]);if(i!==void 0&&i!==n)return NaN}return n}function bj(e,t){let n=new Set,r=i=>{n.has(i)||(n.add(i),i.select&&i.from().length&&i.select(t),i.subqueries.forEach(r))};r(e)}var m0=class{constructor(t,n,r=!0){this.mc=t,this.selection=n,this.clients=new Set,this.indexer=r?new p0(this.mc,{...r,selection:n}):null;let{value:i,activate:o}=this.handlers={value:()=>this.update(),activate:s=>this.indexer?.index(this.clients,s)};n.addEventListener("value",i),n.addEventListener("activate",o)}finalize(){let{value:t,activate:n}=this.handlers;this.selection.removeEventListener("value",t),this.selection.removeEventListener("activate",n)}reset(){this.indexer?.reset()}add(t){return(this.clients=new Set(this.clients)).add(t),this}remove(t){return this.clients.has(t)&&(this.clients=new Set(this.clients)).delete(t),this}update(){let{mc:t,indexer:n,clients:r,selection:i}=this;return n?.index(r)?n.update():xj(t,r,i)}};function xj(e,t,n){return Promise.all(Array.from(t).map(r=>{let i=n.predicate(r);if(i!=null)return e.updateClient(r,r.query(i))}))}function y0(){let e,t,n=new Promise((r,i)=>{e=r,t=i});return n.fulfill=r=>(e(r),n),n.reject=r=>(t(r),n),n}function m6(e,t,n){let r=[],i=0;function o(){let s=_j(r,t);r=[],i=0;for(let a of s)vj(a,e,n),Tj(a,t)}return{add(s,a){s.request.type==="arrow"?(i=i||requestAnimationFrame(()=>o()),r.push({entry:s,priority:a,index:r.length})):e(s,a)}}}function _j(e,t){let n=[],r=new Map;for(let i of e){let{entry:{request:o}}=i,s=wj(o.query,t);if(!r.has(s)){let a=[];n.push(a),r.set(s,a)}r.get(s).push(i)}return n}function wj(e,t){let n=`${e}`;if(e instanceof pt&&!t.get(n)){if(e.orderby().length||e.where().length||e.qualify().length||e.having().length)return n;let r=e.clone().$select("*"),i=e.groupby();if(i.length){let o={};e.select().forEach(({as:s,expr:a})=>o[s]=a),r.$groupby(i.map(s=>s instanceof mr&&o[s.column]||s))}return`${r}`}else return n}function vj(e,t,n){if(Sj(e))t({request:{type:"arrow",cache:!1,record:!1,query:Ij(e,n)},result:e.result=y0()});else for(let{entry:r,priority:i}of e)t(r,i)}function Sj(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 Ij(e,t){let n=e.maps=[],r=new Map;for(let s of e){let{query:a}=s.entry.request,c=[];n.push(c);for(let{as:l,expr:u}of a.select()){let f=`${u}`;r.has(f)||r.set(f,[`col${r.size}`,u]);let[d]=r.get(f);c.push([d,l])}t(`${a}`)}let i=e[0].entry.request.query.clone(),o=i.groupby();if(o.length){let s={};e.maps[0].forEach(([a,c])=>s[c]=a),i.$groupby(o.map(a=>a instanceof mr&&s[a.column]||a))}return i.$select(Array.from(r.values()))}async function Tj(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=Ej(i,n[s]);a.cache&&t.set(String(a.query),l),c.fulfill(l)})}function Ej(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 Aj=typeof requestIdleCallback<"u"?requestIdleCallback:setTimeout,y6=()=>({get:()=>{},set:(e,t)=>t,clear:()=>{}});function g6({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&&Aj(r),o},clear(){n=new Map}}}function b6(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 ho={High:0,Normal:1,Low:2};function x6(){let e=b6(3),t,n,r,i=[],o=null,s;function a(){if(o||e.isEmpty())return;let{request:f,result:d}=e.next();o=u(f,d),o.finally(()=>{o=null,a()})}function c(f,d=ho.Normal){e.insert(f,d),a()}function l(f){i.length&&f&&i.forEach(d=>d.add(f))}async function u(f,d){try{let{query:h,type:p,cache:y=!1,record:g=!0,options:m}=f,b=h?`${h}`:null;if(g&&l(b),y){let v=n.get(b);if(v){r.debug("Cache"),d.fulfill(v);return}}let x=performance.now(),_=await t.query({type:p,sql:b,...m});y&&n.set(b,_),r.debug(`Request: ${(performance.now()-x).toFixed(1)}`),d.fulfill(_)}catch(h){d.reject(h)}}return{cache(f){return f!==void 0?n=f===!0?g6():f||y6():n},logger(f){return f?r=f:r},connector(f){return f?t=f:t},consolidate(f){f&&!s?s=m6(c,n,l):!f&&s&&(s=null)},request(f,d=ho.Normal){let h=y0(),p={request:f,result:h};return s?s.add(p,d):c(p,d),h},cancel(f){let d=new Set(f);e.remove(({result:h})=>d.has(h))},clear(){e.remove(({result:f})=>(f.reject("Cleared"),!0))},record(){let f=[],d={add(h){f.push(h)},reset(){f=[]},snapshot(){return f.slice()},stop(){return i=i.filter(h=>h!==d),f}};return i.push(d),d}}}function _6(){return{debug(){},info(){},log(){},warn(){},error(){}}}var g0;function Tn(e){return e?g0=e:g0==null&&(g0=new wh),g0}var wh=class{constructor(t=Pg(),n={}){this.catalog=new h0(this),this.manager=n.manager||x6(),this.logger(n.logger||console),this.configure(n),this.databaseConnector(t),this.clear()}logger(t){return arguments.length&&(this._logger=t||_6(),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=ho.Normal}={}){return this.manager.request({type:"exec",query:t},n)}query(t,{type:n="arrow",cache:r=!0,priority:i=ho.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:ho.Low})}createBundle(t,n,r=ho.Low){let i={name:t,queries:n};return this.manager.request({type:"create-bundle",options:i},r)}loadBundle(t,n=ho.High){let r={name:t};return this.manager.request({type:"load-bundle",options:r},n)}updateClient(t,n,r=ho.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);let s=t.fields();s?.length&&t.fieldInfo(await n.queryFields(s));let a=t.filterBy;if(a)if(i.has(a))i.get(a).add(t);else{let c=new m0(this,a,o);i.set(a,c.add(t))}t.requestQuery()}disconnect(t){let{clients:n,filterGroups:r}=this;n.has(t)&&(n.delete(t),r.get(t.filterBy)?.remove(t))}};var w6={};function vh(e,t=!1){let n,r,i=w6;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=w6,a(u)}),i=l}return t?c:a}var xr=class{constructor(t){this._filterBy=t,this._requestUpdate=vh(()=>this.requestQuery(),!0)}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 Tn().requestQuery(this,n)}requestUpdate(){this._requestUpdate()}update(){return this}};var b0=class{constructor(){this._callbacks=new Map}addEventListener(t,n){this._callbacks.has(t)||this._callbacks.set(t,{callbacks:new Set,pending:null,queue:new i2}),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}}}},i2=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 Sh(e,t){return e===t?!1:e instanceof Date&&t instanceof Date?+e!=+t:Array.isArray(e)&&Array.isArray(t)?Mj(e,t):!0}function Mj(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 _r(e){return e instanceof Pi}var Pi=class e extends b0{constructor(t){super(),this._value=t}static value(t){return new e(t)}static array(t){if(t.some(n=>_r(n))){let n=new e,r=()=>n.update(t.map(i=>_r(i)?i.value:i));return r(),t.forEach(i=>_r(i)?i.addEventListener("value",r):0),n}return new e(t)}get value(){return this._value}update(t,{force:n}={}){return Sh(this._value,t)||n?this.emit("value",t):this.cancel("value"),this}willEmit(t,n){return t==="value"&&(this._value=n),n}};function ri(e){return e instanceof wr}var wr=class e extends Pi{static intersect({cross:t=!1}={}){return new e(new $c({cross:t}))}static union({cross:t=!1}={}){return new e(new $c({cross:t,union:!0}))}static single({cross:t=!1}={}){return new e(new $c({cross:t,single:!0}))}static crossfilter(){return new e(new $c({cross:!0}))}constructor(t=new $c){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)}},$c=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?hu(o):o}queueFilter(t){if(this.cross){let n=t.active?.source;return r=>r.active?.source!==n}}};function v6(e="http://localhost:3000/"){return{async query(t){let n=fetch(e,{method:"POST",mode:"cors",cache:"no-cache",credentials:"omit",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return t.type==="exec"?n:t.type==="arrow"?Dc(n):(await n).json()}}}var Nj=Object.create,S6=Object.defineProperty,Rj=Object.getOwnPropertyDescriptor,Oj=Object.getOwnPropertyNames,kj=Object.getPrototypeOf,Fj=Object.prototype.hasOwnProperty,Dj=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Lj=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Oj(t))!Fj.call(e,i)&&i!==n&&S6(e,i,{get:()=>t[i],enumerable:!(r=Rj(t,i))||r.enumerable});return e},Cj=(e,t,n)=>(n=e!=null?Nj(kj(e)):{},Lj(t||!e||!e.__esModule?S6(n,"default",{value:e,enumerable:!0}):n,e)),Bj=Dj((e,t)=>{t.exports=Worker}),Pj=(e=>(e[e.UNDEFINED=0]="UNDEFINED",e[e.AUTOMATIC=1]="AUTOMATIC",e[e.READ_ONLY=2]="READ_ONLY",e[e.READ_WRITE=3]="READ_WRITE",e))(Pj||{}),$j=(e=>(e[e.IDENTIFIER=0]="IDENTIFIER",e[e.NUMERIC_CONSTANT=1]="NUMERIC_CONSTANT",e[e.STRING_CONSTANT=2]="STRING_CONSTANT",e[e.OPERATOR=3]="OPERATOR",e[e.KEYWORD=4]="KEYWORD",e[e.COMMENT=5]="COMMENT",e))($j||{}),Uj=(e=>(e[e.NONE=0]="NONE",e[e.DEBUG=1]="DEBUG",e[e.INFO=2]="INFO",e[e.WARNING=3]="WARNING",e[e.ERROR=4]="ERROR",e))(Uj||{}),zj=(e=>(e[e.NONE=0]="NONE",e[e.CONNECT=1]="CONNECT",e[e.DISCONNECT=2]="DISCONNECT",e[e.OPEN=3]="OPEN",e[e.QUERY=4]="QUERY",e[e.INSTANTIATE=5]="INSTANTIATE",e))(zj||{}),jj=(e=>(e[e.NONE=0]="NONE",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR",e[e.START=3]="START",e[e.RUN=4]="RUN",e[e.CAPTURE=5]="CAPTURE",e))(jj||{}),qj=(e=>(e[e.NONE=0]="NONE",e[e.WEB_WORKER=1]="WEB_WORKER",e[e.NODE_WORKER=2]="NODE_WORKER",e[e.BINDINGS=3]="BINDINGS",e[e.ASYNC_DUCKDB=4]="ASYNC_DUCKDB",e))(qj||{}),I6=class{log(e){}},T6=class{constructor(e=2){this.level=e}log(e){e.level>=this.level&&console.log(e)}};var Vj=(e=>(e[e.SUCCESS=0]="SUCCESS",e))(Vj||{}),Yj=class{constructor(e,t){this._bindings=e,this._conn=t}get bindings(){return this._bindings}async close(){return this._bindings.disconnect(this._conn)}useUnsafe(e){return e(this._bindings,this._conn)}async query(e){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:e});let t=await this._bindings.runQuery(this._conn,e),n=en.from(t);return console.assert(n.isSync(),"Reader is not sync"),console.assert(n.isFile(),"Reader is not file"),new an(n)}async send(e){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:e});let t=await this._bindings.startPendingQuery(this._conn,e);for(;t==null;)t=await this._bindings.pollPendingQuery(this._conn);let n=new E6(this._bindings,this._conn,t),r=await en.from(n);return console.assert(r.isAsync()),console.assert(r.isStream()),r}async cancelSent(){return await this._bindings.cancelPendingQuery(this._conn)}async getTableNames(e){return await this._bindings.getTableNames(this._conn,e)}async prepare(e){let t=await this._bindings.createPrepared(this._conn,e);return new Gj(this._bindings,this._conn,t)}async insertArrowTable(e,t){let n=Bg(e,"stream");await this.insertArrowFromIPCStream(n,t)}async insertArrowFromIPCStream(e,t){await this._bindings.insertArrowFromIPCStream(this._conn,e,t)}async insertCSVFromPath(e,t){await this._bindings.insertCSVFromPath(this._conn,e,t)}async insertJSONFromPath(e,t){await this._bindings.insertJSONFromPath(this._conn,e,t)}},E6=class{constructor(e,t,n){this.db=e,this.conn=t,this.header=n,this._first=!0,this._depleted=!1,this._inFlight=null}async next(){if(this._first)return this._first=!1,{done:!1,value:this.header};if(this._depleted)return{done:!0,value:null};let e;return this._inFlight!=null?(e=await this._inFlight,this._inFlight=null):e=await this.db.fetchQueryResults(this.conn),this._depleted=e.length==0,this._depleted||(this._inFlight=this.db.fetchQueryResults(this.conn)),{done:this._depleted,value:e}}[Symbol.asyncIterator](){return this}},Gj=class{constructor(e,t,n){this.bindings=e,this.connectionId=t,this.statementId=n}async close(){await this.bindings.closePrepared(this.connectionId,this.statementId)}async query(...e){let t=await this.bindings.runPrepared(this.connectionId,this.statementId,e),n=en.from(t);return console.assert(n.isSync()),console.assert(n.isFile()),new an(n)}async send(...e){let t=await this.bindings.sendPrepared(this.connectionId,this.statementId,e),n=new E6(this.bindings,this.connectionId,t),r=await en.from(n);return console.assert(r.isAsync()),console.assert(r.isStream()),r}},Wj=(e=>(e.CANCEL_PENDING_QUERY="CANCEL_PENDING_QUERY",e.CLOSE_PREPARED="CLOSE_PREPARED",e.COLLECT_FILE_STATISTICS="COLLECT_FILE_STATISTICS",e.CONNECT="CONNECT",e.COPY_FILE_TO_BUFFER="COPY_FILE_TO_BUFFER",e.COPY_FILE_TO_PATH="COPY_FILE_TO_PATH",e.CREATE_PREPARED="CREATE_PREPARED",e.DISCONNECT="DISCONNECT",e.DROP_FILE="DROP_FILE",e.DROP_FILES="DROP_FILES",e.EXPORT_FILE_STATISTICS="EXPORT_FILE_STATISTICS",e.FETCH_QUERY_RESULTS="FETCH_QUERY_RESULTS",e.FLUSH_FILES="FLUSH_FILES",e.GET_FEATURE_FLAGS="GET_FEATURE_FLAGS",e.GET_TABLE_NAMES="GET_TABLE_NAMES",e.GET_VERSION="GET_VERSION",e.GLOB_FILE_INFOS="GLOB_FILE_INFOS",e.INSERT_ARROW_FROM_IPC_STREAM="INSERT_ARROW_FROM_IPC_STREAM",e.INSERT_CSV_FROM_PATH="IMPORT_CSV_FROM_PATH",e.INSERT_JSON_FROM_PATH="IMPORT_JSON_FROM_PATH",e.INSTANTIATE="INSTANTIATE",e.OPEN="OPEN",e.PING="PING",e.POLL_PENDING_QUERY="POLL_PENDING_QUERY",e.REGISTER_FILE_BUFFER="REGISTER_FILE_BUFFER",e.REGISTER_FILE_HANDLE="REGISTER_FILE_HANDLE",e.REGISTER_FILE_URL="REGISTER_FILE_URL",e.RESET="RESET",e.RUN_PREPARED="RUN_PREPARED",e.RUN_QUERY="RUN_QUERY",e.SEND_PREPARED="SEND_PREPARED",e.START_PENDING_QUERY="START_PENDING_QUERY",e.TOKENIZE="TOKENIZE",e))(Wj||{}),Xj=(e=>(e.CONNECTION_INFO="CONNECTION_INFO",e.ERROR="ERROR",e.FEATURE_FLAGS="FEATURE_FLAGS",e.FILE_BUFFER="FILE_BUFFER",e.FILE_INFOS="FILE_INFOS",e.FILE_SIZE="FILE_SIZE",e.FILE_STATISTICS="FILE_STATISTICS",e.INSTANTIATE_PROGRESS="INSTANTIATE_PROGRESS",e.LOG="LOG",e.OK="OK",e.PREPARED_STATEMENT_ID="PREPARED_STATEMENT_ID",e.QUERY_PLAN="QUERY_PLAN",e.QUERY_RESULT="QUERY_RESULT",e.QUERY_RESULT_CHUNK="QUERY_RESULT_CHUNK",e.QUERY_RESULT_HEADER="QUERY_RESULT_HEADER",e.QUERY_RESULT_HEADER_OR_NULL="QUERY_RESULT_HEADER_OR_NULL",e.REGISTERED_FILE="REGISTERED_FILE",e.SCRIPT_TOKENS="SCRIPT_TOKENS",e.SUCCESS="SUCCESS",e.TABLE_NAMES="TABLE_NAMES",e.VERSION_STRING="VERSION_STRING",e))(Xj||{}),Kt=class{constructor(e,t){this.promiseResolver=()=>{},this.promiseRejecter=()=>{},this.type=e,this.data=t,this.promise=new Promise((n,r)=>{this.promiseResolver=n,this.promiseRejecter=r})}};function x0(e){switch(e.typeId){case k.Binary:return{sqlType:"binary"};case k.Bool:return{sqlType:"bool"};case k.Date:return{sqlType:"date"};case k.DateDay:return{sqlType:"date32[d]"};case k.DateMillisecond:return{sqlType:"date64[ms]"};case k.Decimal:{let t=e;return{sqlType:"decimal",precision:t.precision,scale:t.scale}}case k.Float:return{sqlType:"float"};case k.Float16:return{sqlType:"float16"};case k.Float32:return{sqlType:"float32"};case k.Float64:return{sqlType:"float64"};case k.Int:return{sqlType:"int32"};case k.Int16:return{sqlType:"int16"};case k.Int32:return{sqlType:"int32"};case k.Int64:return{sqlType:"int64"};case k.Uint16:return{sqlType:"uint16"};case k.Uint32:return{sqlType:"uint32"};case k.Uint64:return{sqlType:"uint64"};case k.Uint8:return{sqlType:"uint8"};case k.IntervalDayTime:return{sqlType:"interval[dt]"};case k.IntervalYearMonth:return{sqlType:"interval[m]"};case k.List:return{sqlType:"list",valueType:x0(e.valueType)};case k.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:e.byteWidth};case k.Null:return{sqlType:"null"};case k.Utf8:return{sqlType:"utf8"};case k.Struct:return{sqlType:"struct",fields:e.children.map(t=>u2(t.name,t.type))};case k.Map:{let t=e;return{sqlType:"map",keyType:x0(t.keyType),valueType:x0(t.valueType)}}case k.Time:return{sqlType:"time[s]"};case k.TimeMicrosecond:return{sqlType:"time[us]"};case k.TimeMillisecond:return{sqlType:"time[ms]"};case k.TimeNanosecond:return{sqlType:"time[ns]"};case k.TimeSecond:return{sqlType:"time[s]"};case k.Timestamp:return{sqlType:"timestamp",timezone:e.timezone||void 0};case k.TimestampSecond:return{sqlType:"timestamp[s]",timezone:e.timezone||void 0};case k.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:e.timezone||void 0};case k.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:e.timezone||void 0};case k.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:e.timezone||void 0}}throw new Error("unsupported arrow type: ".concat(e.toString()))}function u2(e,t){let n=x0(t);return n.name=e,n}var Hj=new TextEncoder,A6=class{constructor(e,t=null){this._onInstantiationProgress=[],this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{},this._nextMessageId=0,this._pendingRequests=new Map,this._logger=e,this._onMessageHandler=this.onMessage.bind(this),this._onErrorHandler=this.onError.bind(this),this._onCloseHandler=this.onClose.bind(this),t!=null&&this.attach(t)}get logger(){return this._logger}attach(e){this._worker=e,this._worker.addEventListener("message",this._onMessageHandler),this._worker.addEventListener("error",this._onErrorHandler),this._worker.addEventListener("close",this._onCloseHandler),this._workerShutdownPromise=new Promise((t,n)=>{this._workerShutdownResolver=t})}detach(){this._worker&&(this._worker.removeEventListener("message",this._onMessageHandler),this._worker.removeEventListener("error",this._onErrorHandler),this._worker.removeEventListener("close",this._onCloseHandler),this._worker=null,this._workerShutdownResolver(null),this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async terminate(){this._worker&&(this._worker.terminate(),this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async postTask(e,t=[]){if(!this._worker){console.error("cannot send a message since the worker is not set!");return}let n=this._nextMessageId++;return this._pendingRequests.set(n,e),this._worker.postMessage({messageId:n,type:e.type,data:e.data},t),await e.promise}onMessage(e){var t;let n=e.data;switch(n.type){case"LOG":{this._logger.log(n.data);return}case"INSTANTIATE_PROGRESS":{for(let i of this._onInstantiationProgress)i(n.data);return}}let r=this._pendingRequests.get(n.requestId);if(!r){console.warn("unassociated response: [".concat(n.requestId,", ").concat(n.type.toString(),"]"));return}if(this._pendingRequests.delete(n.requestId),n.type=="ERROR"){let i=new Error(n.data.message);i.name=n.data.name,(t=Object.getOwnPropertyDescriptor(i,"stack"))!=null&&t.writable&&(i.stack=n.data.stack),r.promiseRejecter(i);return}switch(r.type){case"CLOSE_PREPARED":case"COLLECT_FILE_STATISTICS":case"COPY_FILE_TO_PATH":case"DISCONNECT":case"DROP_FILE":case"DROP_FILES":case"FLUSH_FILES":case"INSERT_ARROW_FROM_IPC_STREAM":case"IMPORT_CSV_FROM_PATH":case"IMPORT_JSON_FROM_PATH":case"OPEN":case"PING":case"REGISTER_FILE_BUFFER":case"REGISTER_FILE_HANDLE":case"REGISTER_FILE_URL":case"RESET":if(n.type=="OK"){r.promiseResolver(n.data);return}break;case"INSTANTIATE":if(this._onInstantiationProgress=[],n.type=="OK"){r.promiseResolver(n.data);return}break;case"GLOB_FILE_INFOS":if(n.type=="FILE_INFOS"){r.promiseResolver(n.data);return}break;case"GET_VERSION":if(n.type=="VERSION_STRING"){r.promiseResolver(n.data);return}break;case"GET_FEATURE_FLAGS":if(n.type=="FEATURE_FLAGS"){r.promiseResolver(n.data);return}break;case"GET_TABLE_NAMES":if(n.type=="TABLE_NAMES"){r.promiseResolver(n.data);return}break;case"TOKENIZE":if(n.type=="SCRIPT_TOKENS"){r.promiseResolver(n.data);return}break;case"COPY_FILE_TO_BUFFER":if(n.type=="FILE_BUFFER"){r.promiseResolver(n.data);return}break;case"EXPORT_FILE_STATISTICS":if(n.type=="FILE_STATISTICS"){r.promiseResolver(n.data);return}break;case"CONNECT":if(n.type=="CONNECTION_INFO"){r.promiseResolver(n.data);return}break;case"RUN_PREPARED":case"RUN_QUERY":if(n.type=="QUERY_RESULT"){r.promiseResolver(n.data);return}break;case"SEND_PREPARED":if(n.type=="QUERY_RESULT_HEADER"){r.promiseResolver(n.data);return}break;case"START_PENDING_QUERY":if(n.type=="QUERY_RESULT_HEADER_OR_NULL"){r.promiseResolver(n.data);return}break;case"POLL_PENDING_QUERY":if(n.type=="QUERY_RESULT_HEADER_OR_NULL"){r.promiseResolver(n.data);return}break;case"CANCEL_PENDING_QUERY":if(this._onInstantiationProgress=[],n.type=="SUCCESS"){r.promiseResolver(n.data);return}break;case"FETCH_QUERY_RESULTS":if(n.type=="QUERY_RESULT_CHUNK"){r.promiseResolver(n.data);return}break;case"CREATE_PREPARED":if(n.type=="PREPARED_STATEMENT_ID"){r.promiseResolver(n.data);return}break}r.promiseRejecter(new Error("unexpected response type: ".concat(n.type.toString())))}onError(e){console.error(e),console.error("error in duckdb worker: ".concat(e.message)),this._pendingRequests.clear()}onClose(){if(this._workerShutdownResolver(null),this._pendingRequests.size!=0){console.warn("worker terminated with ".concat(this._pendingRequests.size," pending requests"));return}this._pendingRequests.clear()}async reset(){let e=new Kt("RESET",null);return await this.postTask(e)}async ping(){let e=new Kt("PING",null);await this.postTask(e)}async dropFile(e){let t=new Kt("DROP_FILE",e);return await this.postTask(t)}async dropFiles(){let e=new Kt("DROP_FILES",null);return await this.postTask(e)}async flushFiles(){let e=new Kt("FLUSH_FILES",null);return await this.postTask(e)}async instantiate(e,t=null,n=r=>{}){this._onInstantiationProgress.push(n);let r=new Kt("INSTANTIATE",[e,t]);return await this.postTask(r)}async getVersion(){let e=new Kt("GET_VERSION",null);return await this.postTask(e)}async getFeatureFlags(){let e=new Kt("GET_FEATURE_FLAGS",null);return await this.postTask(e)}async open(e){let t=new Kt("OPEN",e);await this.postTask(t)}async tokenize(e){let t=new Kt("TOKENIZE",e);return await this.postTask(t)}async connectInternal(){let e=new Kt("CONNECT",null);return await this.postTask(e)}async connect(){let e=await this.connectInternal();return new Yj(this,e)}async disconnect(e){let t=new Kt("DISCONNECT",e);await this.postTask(t)}async runQuery(e,t){let n=new Kt("RUN_QUERY",[e,t]);return await this.postTask(n)}async startPendingQuery(e,t){let n=new Kt("START_PENDING_QUERY",[e,t]);return await this.postTask(n)}async pollPendingQuery(e){let t=new Kt("POLL_PENDING_QUERY",e);return await this.postTask(t)}async cancelPendingQuery(e){let t=new Kt("CANCEL_PENDING_QUERY",e);return await this.postTask(t)}async fetchQueryResults(e){let t=new Kt("FETCH_QUERY_RESULTS",e);return await this.postTask(t)}async getTableNames(e,t){let n=new Kt("GET_TABLE_NAMES",[e,t]);return await this.postTask(n)}async createPrepared(e,t){let n=new Kt("CREATE_PREPARED",[e,t]);return await this.postTask(n)}async closePrepared(e,t){let n=new Kt("CLOSE_PREPARED",[e,t]);await this.postTask(n)}async runPrepared(e,t,n){let r=new Kt("RUN_PREPARED",[e,t,n]);return await this.postTask(r)}async sendPrepared(e,t,n){let r=new Kt("SEND_PREPARED",[e,t,n]);return await this.postTask(r)}async globFiles(e){let t=new Kt("GLOB_FILE_INFOS",e);return await this.postTask(t)}async registerFileText(e,t){let n=Hj.encode(t);await this.registerFileBuffer(e,n)}async registerFileURL(e,t,n,r){t===void 0&&(t=e);let i=new Kt("REGISTER_FILE_URL",[e,t,n,r]);await this.postTask(i)}async registerEmptyFileBuffer(e){let t=new Kt("REGISTER_FILE_BUFFER",[e,new Uint8Array]);await this.postTask(t)}async registerFileBuffer(e,t){let n=new Kt("REGISTER_FILE_BUFFER",[e,t]);await this.postTask(n,[t.buffer])}async registerFileHandle(e,t,n,r){let i=new Kt("REGISTER_FILE_HANDLE",[e,t,n,r]);await this.postTask(i,[])}async collectFileStatistics(e,t){let n=new Kt("COLLECT_FILE_STATISTICS",[e,t]);await this.postTask(n,[])}async exportFileStatistics(e){let t=new Kt("EXPORT_FILE_STATISTICS",e);return await this.postTask(t,[])}async copyFileToBuffer(e){let t=new Kt("COPY_FILE_TO_BUFFER",e);return await this.postTask(t)}async copyFileToPath(e,t){let n=new Kt("COPY_FILE_TO_PATH",[e,t]);await this.postTask(n)}async insertArrowFromIPCStream(e,t,n){if(t.length==0)return;let r=new Kt("INSERT_ARROW_FROM_IPC_STREAM",[e,t,n]);await this.postTask(r,[t.buffer])}async insertCSVFromPath(e,t,n){if(n.columns!==void 0){let i=[];for(let o in n.columns){let s=n.columns[o];i.push(u2(o,s))}n.columnsFlat=i,delete n.columns}let r=new Kt("IMPORT_CSV_FROM_PATH",[e,t,n]);await this.postTask(r)}async insertJSONFromPath(e,t,n){if(n.columns!==void 0){let i=[];for(let o in n.columns){let s=n.columns[o];i.push(u2(o,s))}n.columnsFlat=i,delete n.columns}let r=new Kt("IMPORT_JSON_FROM_PATH",[e,t,n]);await this.postTask(r)}};var Qj=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11])),Zj=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,6,64,25,11,11])),Kj=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),Jj=()=>(async e=>{try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(e)}catch{return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11])),f2={name:"@duckdb/duckdb-wasm",version:"1.28.0",description:"DuckDB powered by WebAssembly",license:"MIT",repository:{type:"git",url:"https://github.com/duckdb/duckdb-wasm.git"},keywords:["sql","duckdb","relational","database","data","query","wasm","analytics","olap","arrow","parquet","json","csv"],dependencies:{"apache-arrow":"^13.0.0"},devDependencies:{"@types/emscripten":"^1.39.8","@types/jasmine":"^4.3.1","@typescript-eslint/eslint-plugin":"^6.5.0","@typescript-eslint/parser":"^6.7.3",esbuild:"^0.19.5",eslint:"^8.50.0","eslint-plugin-jasmine":"^4.1.3","eslint-plugin-react":"^7.33.2","fast-glob":"^3.3.1",jasmine:"^5.1.0","jasmine-core":"^5.1.1","jasmine-spec-reporter":"^7.0.0","js-sha256":"^0.9.0",karma:"^6.4.2","karma-chrome-launcher":"^3.2.0","karma-coverage":"^2.2.1","karma-firefox-launcher":"^2.1.2","karma-jasmine":"^5.1.0","karma-jasmine-html-reporter":"^2.1.0","karma-sourcemap-loader":"^0.4.0","karma-spec-reporter":"^0.0.36","make-dir":"^4.0.0",nyc:"^15.1.0",prettier:"^3.0.2",puppeteer:"^21.1.1",rimraf:"^5.0.5",s3rver:"^3.7.1",typedoc:"^0.25.2",typescript:"^5.2.2","wasm-feature-detect":"^1.5.1","web-worker":"^1.2.0"},scripts:{"build:debug":"node bundle.mjs debug && tsc --emitDeclarationOnly","build:release":"node bundle.mjs release && tsc --emitDeclarationOnly",docs:"typedoc",report:"node ./coverage.mjs","test:node":"node --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:node:debug":"node --inspect-brk --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:node:coverage":"nyc -r json --report-dir ./coverage/node node ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:firefox":"karma start ./karma/tests-firefox.cjs","test:chrome":"karma start ./karma/tests-chrome.cjs","test:chrome:eh":"karma start ./karma/tests-chrome-eh.cjs","test:chrome:coverage":"karma start ./karma/tests-chrome-coverage.cjs","test:browser":"karma start ./karma/tests-all.cjs","test:browser:debug":"karma start ./karma/tests-debug.cjs",test:"npm run test:chrome && npm run test:node","test:coverage":"npm run test:chrome:coverage && npm run test:node:coverage && npm run report",lint:"eslint src test"},files:["dist","!dist/types/test"],main:"dist/duckdb-browser.cjs",module:"dist/duckdb-browser.mjs",types:"dist/duckdb-browser.d.ts",jsdelivr:"dist/duckdb-browser.cjs",unpkg:"dist/duckdb-browser.mjs",sideEffects:!1,browser:{fs:!1,path:!1,perf_hooks:!1,os:!1,worker_threads:!1},exports:{"./dist/duckdb-mvp.wasm":"./dist/duckdb-mvp.wasm","./dist/duckdb-eh.wasm":"./dist/duckdb-eh.wasm","./dist/duckdb-coi.wasm":"./dist/duckdb-coi.wasm","./dist/duckdb-browser":"./dist/duckdb-browser.mjs","./dist/duckdb-browser.cjs":"./dist/duckdb-browser.cjs","./dist/duckdb-browser.mjs":"./dist/duckdb-browser.mjs","./dist/duckdb-browser-blocking":"./dist/duckdb-browser-blocking.mjs","./dist/duckdb-browser-blocking.mjs":"./dist/duckdb-browser-blocking.mjs","./dist/duckdb-browser-blocking.cjs":"./dist/duckdb-browser-blocking.cjs","./dist/duckdb-browser-coi.pthread.worker.js":"./dist/duckdb-browser-coi.pthread.worker.js","./dist/duckdb-browser-coi.worker.js":"./dist/duckdb-browser-coi.worker.js","./dist/duckdb-browser-eh.worker.js":"./dist/duckdb-browser-eh.worker.js","./dist/duckdb-browser-mvp.worker.js":"./dist/duckdb-browser-mvp.worker.js","./dist/duckdb-node":"./dist/duckdb-node.cjs","./dist/duckdb-node.cjs":"./dist/duckdb-node.cjs","./dist/duckdb-node-blocking":"./dist/duckdb-node-blocking.cjs","./dist/duckdb-node-blocking.cjs":"./dist/duckdb-node-blocking.cjs","./dist/duckdb-node-eh.worker.cjs":"./dist/duckdb-node-eh.worker.cjs","./dist/duckdb-node-mvp.worker.cjs":"./dist/duckdb-node-mvp.worker.cjs","./blocking":{browser:{types:"./dist/duckdb-browser-blocking.d.ts",import:"./dist/duckdb-browser-blocking.mjs",require:"./dist/duckdb-browser-blocking.cjs"},node:{types:"./dist/duckdb-node-blocking.d.ts",require:"./dist/duckdb-node-blocking.cjs",import:"./dist/duckdb-node-blocking.cjs"},types:"./dist/duckdb-browser-blocking.d.ts",import:"./dist/duckdb-browser-blocking.mjs",require:"./dist/duckdb-browser-blocking.cjs"},".":{browser:{types:"./dist/duckdb-browser.d.ts",import:"./dist/duckdb-browser.mjs",require:"./dist/duckdb-browser.cjs"},node:{types:"./dist/duckdb-node.d.ts",import:"./dist/duckdb-node.cjs",require:"./dist/duckdb-node.cjs"},types:"./dist/duckdb-browser.d.ts",import:"./dist/duckdb-browser.mjs",require:"./dist/duckdb-browser.cjs"}}},tq=f2.name,eq=f2.version,d2=f2.version.split("."),oht=d2[0],sht=d2[1],aht=d2[2],nq=()=>typeof navigator>"u";function M6(){let e="https://cdn.jsdelivr.net/npm/".concat(tq,"@").concat(eq,"/dist/");return{mvp:{mainModule:"".concat(e,"duckdb-mvp.wasm"),mainWorker:"".concat(e,"duckdb-browser-mvp.worker.js")},eh:{mainModule:"".concat(e,"duckdb-eh.wasm"),mainWorker:"".concat(e,"duckdb-browser-eh.worker.js")}}}var o2=null,s2=null,a2=null,c2=null,l2=null;async function rq(){return o2==null&&(o2=typeof BigInt64Array<"u"),s2==null&&(s2=await Zj()),a2==null&&(a2=await Jj()),c2==null&&(c2=await Kj()),l2==null&&(l2=await Qj()),{bigInt64Array:o2,crossOriginIsolated:nq()||globalThis.crossOriginIsolated||!1,wasmExceptions:s2,wasmSIMD:c2,wasmThreads:a2,wasmBulkMemory:l2}}async function N6(e){let t=await rq();if(t.wasmExceptions){if(t.wasmSIMD&&t.wasmThreads&&t.crossOriginIsolated&&e.coi)return{mainModule:e.coi.mainModule,mainWorker:e.coi.mainWorker,pthreadWorker:e.coi.pthreadWorker};if(e.eh)return{mainModule:e.eh.mainModule,mainWorker:e.eh.mainWorker,pthreadWorker:null}}return{mainModule:e.mvp.mainModule,mainWorker:e.mvp.mainWorker,pthreadWorker:null}}var cht=Cj(Bj());function iq(){let e=new TextDecoder;return t=>(typeof SharedArrayBuffer<"u"&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),e.decode(t))}var lht=iq(),oq=(e=>(e[e.BUFFER=0]="BUFFER",e[e.NODE_FS=1]="NODE_FS",e[e.BROWSER_FILEREADER=2]="BROWSER_FILEREADER",e[e.BROWSER_FSACCESS=3]="BROWSER_FSACCESS",e[e.HTTP=4]="HTTP",e[e.S3=5]="S3",e))(oq||{});async function R6(e){let t=await aq(e),n=await t.connect();return{db:t,con:n,query:async r=>{let{type:i,sql:o}=r,s=await n.query(o);return i==="exec"?void 0:i==="arrow"?s:Array.from(s)}}}async function aq({log:e=!1}={}){let t=M6(),n=await N6(t),r=URL.createObjectURL(new Blob([`importScripts("${n.mainWorker}");`],{type:"text/javascript"})),i=new Worker(r),o=e?new T6:new I6,s=new A6(o,i);return await s.instantiate(n.mainModule,n.pthreadWorker),URL.revokeObjectURL(r),s}function h2(){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}}}function Ea(e,t){let n=new e(t);return Tn().connect(n),n.element}var cq=e=>e&&typeof e=="object"&&!Array.isArray(e),w0=e=>Ea(_0,e),_0=class extends xr{constructor({element:t,filterBy:n,from:r,column:i,label:o=i,format:s=u=>u,options:a,value:c,as:l}={}){super(n),this.from=r,this.column=i,this.selection=l,this.format=s,this.element=t??document.createElement("div"),this.element.setAttribute("class","input"),this.element.value=this;let u=document.createElement("label");u.innerText=o||i,this.element.appendChild(u),this.select=document.createElement("select"),a&&(this.data=a.map(f=>cq(f)?f:{value:f}),this.update()),c=c??this.selection?.value??this.data?.[0]?.value,this.selection?.value===void 0&&this.publish(c),this.element.appendChild(this.select),this.selection&&(this.select.addEventListener("input",()=>{this.publish(this.selectedValue()??null)}),ri(this.selection)||this.selection.addEventListener("value",f=>{f!==this.select.value&&this.selectedValue(f)}))}selectedValue(t){if(arguments.length===0){let n=this.select.selectedIndex;return this.data[n].value}else{let n=this.data?.findIndex(r=>r.value===t);n>=0?this.select.selectedIndex=n:this.select.value=String(t)}}reset(){this.select.selectedIndex=this.from?0:-1}publish(t){let{selection:n,column:r}=this;ri(n)?n.update({source:this,schema:{type:"point"},value:t,predicate:t?Sa(r,ei(t)):null}):_r(n)&&n.update(t)}query(t=[]){let{from:n,column:r}=this;return n?pt.from(n).select({value:r}).distinct().where(t).orderby(r):null}queryResult(t){return this.data=[{value:"",label:"All"},...t],this}update(){let{data:t,format:n,select:r}=this;r.replaceChildren();for(let{value:i,label:o}of t){let s=document.createElement("option");s.setAttribute("value",i),s.innerText=o??n(i),this.select.appendChild(s)}return this.selection&&this.selectedValue(this.selection?.value??""),this}};var lq={contains:Yv,prefix:Gv,suffix:Wv,regexp:Vv},uq=0,S0=e=>Ea(v0,e),v0=class extends xr{constructor({element:t,filterBy:n,from:r,column:i,label:o,type:s="contains",as:a}={}){if(super(n),this.id="search_"+ ++uq,this.type=s,this.from=r,this.column=i,this.selection=a,this.element=t??document.createElement("div"),this.element.setAttribute("class","input"),this.element.value=this,o){let c=document.createElement("label");c.setAttribute("for",this.id),c.innerText=o,this.element.appendChild(c)}this.searchbox=document.createElement("input"),this.searchbox.setAttribute("id",this.id),this.searchbox.setAttribute("type","text"),this.searchbox.setAttribute("placeholder","Query"),this.element.appendChild(this.searchbox),this.selection&&(this.searchbox.addEventListener("input",()=>{this.publish(this.searchbox.value||null)}),ri(this.selection)||this.selection.addEventListener("value",c=>{c!==this.searchbox.value&&(this.searchbox.value=c)}))}reset(){this.searchbox.value=""}publish(t){let{selection:n,column:r,type:i}=this;ri(n)?n.update({source:this,schema:{type:i},value:t,predicate:t?lq[i](r,ei(t)):null}):_r(n)&&n.update(t)}query(t=[]){let{from:n,column:r}=this;return n?pt.from(n).select({list:r}).distinct().where(t):null}queryResult(t){return this.data=t,this}update(){let t=document.createElement("datalist"),n=`${this.id}_list`;t.setAttribute("id",n);for(let r of this.data){let i=document.createElement("option");i.setAttribute("value",r.list),t.append(i)}return this.datalist&&this.datalist.remove(),this.element.appendChild(this.datalist=t),this.searchbox.setAttribute("list",n),this}};var fq=0,T0=e=>Ea(I0,e),I0=class extends xr{constructor({element:t,filterBy:n,as:r,min:i,max:o,step:s,from:a,column:c,label:l=c,value:u=r?.value,width:f}={}){if(super(n),this.id="slider_"+ ++fq,this.from=a,this.column=c||"value",this.selection=r,this.min=i,this.max=o,this.step=s,this.element=t||document.createElement("div"),this.element.setAttribute("class","input"),this.element.value=this,l){let d=document.createElement("label");d.setAttribute("for",this.id),d.innerText=l,this.element.appendChild(d)}this.slider=document.createElement("input"),this.slider.setAttribute("id",this.id),this.slider.setAttribute("type","range"),f!=null&&(this.slider.style.width=`${+f}px`),i!=null&&this.slider.setAttribute("min",i),o!=null&&this.slider.setAttribute("max",o),s!=null&&this.slider.setAttribute("step",s),u!=null&&(this.slider.setAttribute("value",u),this.selection?.value===void 0&&this.publish(u)),this.element.appendChild(this.slider),this.selection&&(this.slider.addEventListener("input",()=>{this.publish(+this.slider.value)}),ri(this.selection)||this.selection.addEventListener("value",d=>{d!==+this.slider.value&&(this.slider.value=d)}))}query(t=[]){let{from:n,column:r}=this;return!n||this.min!=null&&this.max!=null?null:pt.select({min:Lr(r),max:Dr(r)}).from(n).where(t)}queryResult(t){let{min:n,max:r}=Array.from(t)[0];return this.min==null&&this.slider.setAttribute("min",n),this.max==null&&this.slider.setAttribute("max",r),this.step==null&&this.slider.setAttribute("step",(r-n)/500),this}publish(t){let{selection:n,column:r}=this;ri(n)?n.update({source:this,schema:{type:"point"},value:t,predicate:Sa(r,ei(t))}):_r(this.selection)&&n.update(t)}};function yu(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`${dq(e.getUTCFullYear(),4)}-${bs(e.getUTCMonth()+1,2)}-${bs(e.getUTCDate(),2)}${n||r||i||o?`T${bs(n,2)}:${bs(r,2)}${i||o?`:${bs(i,2)}${o?`.${bs(o,3)}`:""}`:""}Z`:""}`}function dq(e){return e<0?`-${bs(-e,6)}`:e>9999?`+${bs(e,6)}`:bs(e,4)}function bs(e,t){return`${e}`.padStart(t,"0")}var hq=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function Uc(e,t){return hq.test(e+="")?new Date(e):typeof t=="function"?t(e):t}var p2=y2(e=>{let t=E0(e);return n=>n==null?"":typeof n=="number"?t(n):n instanceof Date?m2(n):`${n}`}),E0=y2(e=>t=>t===0?"0":t.toLocaleString(e)),Zht=p2(),Kht=E0();function m2(e){return yu(e,"Invalid Date")}function y2(e){let t=y2,n;return(r="en")=>r===t?n:n=e(t=r)}var pq=-1,M0=e=>Ea(A0,e),A0=class extends xr{constructor({element:t,filterBy:n,from:r,columns:i=["*"],align:o={},format:s,width:a,maxWidth:c,height:l=500,rowBatch:u=100}={}){super(n),this.id=`table-${++pq}`,this.from=r,this.columns=i,this.format=s,this.align=o,this.widths=typeof a=="object"?a:{},this.offset=0,this.limit=+u,this.pending=!1,this.sortHeader=null,this.sortColumn=null,this.sortDesc=!1,this.element=t||document.createElement("div"),this.element.setAttribute("id",this.id),this.element.value=this,typeof a=="number"&&(this.element.style.width=`${a}px`),c&&(this.element.style.maxWidth=`${c}px`),this.element.style.maxHeight=`${l}px`,this.element.style.overflow="auto";let f=-1;this.element.addEventListener("scroll",d=>{let{pending:h,loaded:p}=this,{scrollHeight:y,scrollTop:g,clientHeight:m}=d.target,b=g<f;f=g,!(b||h||p)&&y-g<2*m&&(this.pending=!0,this.requestData(this.offset+this.limit))}),this.tbl=document.createElement("table"),this.element.appendChild(this.tbl),this.head=document.createElement("thead"),this.tbl.appendChild(this.head),this.body=document.createElement("tbody"),this.tbl.appendChild(this.body),this.style=document.createElement("style"),this.element.appendChild(this.style)}requestData(t=0){this.offset=t;let n=this.query(this.filterBy?.predicate(this));this.requestQuery(n),Tn().prefetch(n.clone().offset(t+this.limit))}fields(){return this.columns.map(t=>Cc(this.from,t))}fieldInfo(t){this.schema=t;let n=this.head;n.innerHTML="";let r=document.createElement("tr");for(let{column:i}of t){let o=document.createElement("th");o.addEventListener("click",s=>this.sort(s,i)),o.appendChild(document.createElement("span")),o.appendChild(document.createTextNode(i)),r.appendChild(o)}return n.appendChild(r),this.formats=mq(this.format,t),this.style.innerText=bq(this.id,yq(this.align,t),gq(this.widths,t)),this}query(t=[]){let{from:n,limit:r,offset:i,schema:o,sortColumn:s,sortDesc:a}=this;return pt.from(n).select(o.map(c=>c.column)).where(t).orderby(s?a?qv(s):s:[]).limit(r).offset(i)}queryResult(t){return this.pending||(this.loaded=!1,this.body.replaceChildren()),this.data=t,this}update(){let{body:t,formats:n,data:r,schema:i,limit:o}=this,s=i.length,a=0;for(let c of r){++a;let l=document.createElement("tr");for(let u=0;u<s;++u){let f=c[i[u].column],d=document.createElement("td");d.innerText=f==null?"":n[u](f),l.appendChild(d)}t.appendChild(l)}return a<o&&(this.loaded=!0),this.pending=!1,this}sort(t,n){n===this.sortColumn?this.sortDesc=!this.sortDesc:(this.sortColumn=n,this.sortDesc=!1);let r=t.currentTarget,i=this.sortHeader;i===r&&t.metaKey?(i.firstChild.textContent="",this.sortHeader=null,this.sortColumn=null):(i&&(i.firstChild.textContent=""),this.sortHeader=r,r.firstChild.textContent=this.sortDesc?"\u25BE":"\u25B4"),this.requestData()}};function mq(e={},t,n){return t.map(({column:r,type:i})=>{if(r in e)return e[r];switch(i){case"number":return E0(n);case"date":return m2;default:return p2(n)}})}function yq(e={},t){return t.map(({column:n,type:r})=>n in e?e[n]:r==="number"?"right":"left")}function gq(e={},t){return t.map(({column:n})=>e[n])}function bq(e,t,n){let r=[];return t.forEach((i,o)=>{let s=+n[o];if(i!=="left"||s){let a=i!=="left"?`text-align:${i};`:"",c=s?`width:${s}px;max-width:${s}px;`:"";r.push(`#${e} tr>:nth-child(${o+1}) {${a}${c}}`)}}),r.join(" ")}var zc=Symbol("Fixed"),$i=Symbol("Transient"),N0=Symbol("Transform");var xq=["rectY-x","rectX-y","rect-x","rect-y"];function _q(e,t){return xq.includes(`${t}-${e}`)}function Ih(e,t={steps:25}){let n=(r,i)=>_q(i,r.type)?{[`${i}1`]:g2(r,e,t),[`${i}2`]:g2(r,e,{...t,offset:1})}:{[i]:g2(r,e,t)};return n[N0]=!0,n}function g2(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=wq(r,i,n),s=Vt(t),a=o.min===0?s:`(${s} - ${o.min})`,c=`${(o.max-o.min)/o.steps}::DOUBLE`,l=n.offset?`${n.offset} + `:"";return`${o.min} + ${c} * (${l}FLOOR(${a} / ${c})::INTEGER)`}}}function wq(e,t,n){let{steps:r=25,minstep:i=0,nice:o=!0}=n;if(o!==!1){let s=t-e,a=r,c=Math.LN10,l=Math.ceil(Math.log(a)/c),u=Math.max(i,Math.pow(10,Math.round(Math.log(s)/c)-l));for(;Math.ceil(s/u)>a;)u*=10;let f=[5,2],d;for(let y=0,g=f.length;y<g;++y)d=u/f[y],d>=i&&s/d<=a&&(u=d);d=Math.log(u);let h=d>=0?0:~~(-d/c)+1,p=Math.pow(10,-h-1);d=Math.floor(e/u+p)*u,e=e<d?d-u:d,t=Math.ceil(t/u)*u,r=Math.round((t-e)/u)}return{min:e,max:t,steps:r}}var xA={};_i(xA,{align:()=>N5,aspectRatio:()=>R5,attribute:()=>bA,attributes:()=>mw,axis:()=>O5,colorClamp:()=>JB,colorDomain:()=>ZB,colorInterpolate:()=>n7,colorLabel:()=>o7,colorNice:()=>t7,colorPivot:()=>r7,colorRange:()=>KB,colorReverse:()=>s7,colorScale:()=>QB,colorScheme:()=>e7,colorSymmetric:()=>i7,colorTickFormat:()=>c7,colorZero:()=>a7,facetGrid:()=>XC,facetLabel:()=>HC,facetMargin:()=>qC,facetMarginBottom:()=>YC,facetMarginLeft:()=>GC,facetMarginRight:()=>WC,facetMarginTop:()=>VC,fxAlign:()=>rB,fxAriaDescription:()=>wB,fxAriaLabel:()=>_B,fxAxis:()=>aB,fxDomain:()=>QC,fxFontVariant:()=>xB,fxGrid:()=>pB,fxInset:()=>JC,fxInsetLeft:()=>tB,fxInsetRight:()=>eB,fxLabel:()=>yB,fxLabelAnchor:()=>gB,fxLabelOffset:()=>bB,fxLine:()=>mB,fxNice:()=>KC,fxPadding:()=>iB,fxPaddingInner:()=>oB,fxPaddingOuter:()=>sB,fxRange:()=>ZC,fxReverse:()=>vB,fxRound:()=>nB,fxTickFormat:()=>dB,fxTickPadding:()=>fB,fxTickRotate:()=>hB,fxTickSize:()=>lB,fxTickSpacing:()=>uB,fxTicks:()=>cB,fyAlign:()=>RB,fyAriaDescription:()=>XB,fyAriaLabel:()=>WB,fyAxis:()=>DB,fyDomain:()=>SB,fyFontVariant:()=>GB,fyGrid:()=>zB,fyInset:()=>EB,fyInsetBottom:()=>MB,fyInsetTop:()=>AB,fyLabel:()=>qB,fyLabelAnchor:()=>VB,fyLabelOffset:()=>YB,fyLine:()=>jB,fyNice:()=>TB,fyPadding:()=>OB,fyPaddingInner:()=>kB,fyPaddingOuter:()=>FB,fyRange:()=>IB,fyReverse:()=>HB,fyRound:()=>NB,fyTickFormat:()=>$B,fyTickPadding:()=>PB,fyTickRotate:()=>UB,fyTickSize:()=>CB,fyTickSpacing:()=>BB,fyTicks:()=>LB,grid:()=>F5,height:()=>S5,inset:()=>k5,label:()=>D5,lengthClamp:()=>A7,lengthDomain:()=>T7,lengthNice:()=>M7,lengthRange:()=>E7,lengthScale:()=>I7,lengthZero:()=>N7,margin:()=>I5,marginBottom:()=>M5,marginLeft:()=>T5,marginRight:()=>E5,marginTop:()=>A5,margins:()=>x5,name:()=>g5,opacityClamp:()=>d7,opacityDomain:()=>u7,opacityLabel:()=>p7,opacityNice:()=>h7,opacityRange:()=>f7,opacityReverse:()=>m7,opacityScale:()=>l7,opacityTickFormat:()=>g7,opacityZero:()=>y7,padding:()=>L5,projectionClip:()=>U7,projectionDomain:()=>D7,projectionInset:()=>L7,projectionInsetBottom:()=>$7,projectionInsetLeft:()=>C7,projectionInsetRight:()=>B7,projectionInsetTop:()=>P7,projectionParallels:()=>O7,projectionPrecision:()=>k7,projectionRotate:()=>F7,projectionType:()=>R7,rClamp:()=>w7,rDomain:()=>x7,rNice:()=>v7,rRange:()=>_7,rScale:()=>b7,rZero:()=>S7,round:()=>C5,style:()=>w5,width:()=>v5,xAlign:()=>G5,xAriaDescription:()=>uC,xAriaLabel:()=>lC,xAxis:()=>Q5,xClamp:()=>V5,xDomain:()=>P5,xFontVariant:()=>cC,xGrid:()=>rC,xInset:()=>z5,xInsetLeft:()=>j5,xInsetRight:()=>q5,xLabel:()=>oC,xLabelAnchor:()=>sC,xLabelOffset:()=>aC,xLine:()=>iC,xNice:()=>U5,xPadding:()=>W5,xPaddingInner:()=>X5,xPaddingOuter:()=>H5,xRange:()=>$5,xReverse:()=>fC,xRound:()=>Y5,xScale:()=>B5,xTickFormat:()=>eC,xTickPadding:()=>tC,xTickRotate:()=>nC,xTickSize:()=>K5,xTickSpacing:()=>J5,xTicks:()=>Z5,xZero:()=>dC,xyDomain:()=>_5,yAlign:()=>vC,yAriaDescription:()=>UC,yAriaLabel:()=>$C,yAxis:()=>EC,yClamp:()=>_C,yDomain:()=>pC,yFontVariant:()=>PC,yGrid:()=>FC,yInset:()=>gC,yInsetBottom:()=>xC,yInsetTop:()=>bC,yLabel:()=>LC,yLabelAnchor:()=>CC,yLabelOffset:()=>BC,yLine:()=>DC,yNice:()=>yC,yPadding:()=>SC,yPaddingInner:()=>IC,yPaddingOuter:()=>TC,yRange:()=>mC,yReverse:()=>zC,yRound:()=>wC,yScale:()=>hC,yTickFormat:()=>OC,yTickPadding:()=>RC,yTickRotate:()=>kC,yTickSize:()=>MC,yTickSpacing:()=>NC,yTicks:()=>AC,yZero:()=>jC});var hw={};_i(hw,{Area:()=>kl,Arrow:()=>Lm,BarX:()=>Cm,BarY:()=>Bm,Cell:()=>Fl,Contour:()=>Gm,Density:()=>Hm,Dot:()=>Dl,Frame:()=>Am,Geo:()=>Qm,Hexgrid:()=>Zm,Image:()=>Km,Line:()=>Ll,Link:()=>Fm,Mark:()=>mt,Raster:()=>Ym,Rect:()=>Bl,RuleX:()=>vm,RuleY:()=>Sm,Text:()=>Nl,TickX:()=>zm,TickY:()=>jm,Tip:()=>Mm,Vector:()=>Ol,area:()=>km,areaX:()=>ac,areaY:()=>Js,arrow:()=>TD,auto:()=>CD,autoSpec:()=>BE,axisFx:()=>k_,axisFy:()=>O_,axisX:()=>Tm,axisY:()=>Im,barX:()=>Yo,barY:()=>Go,bin:()=>Ks,binX:()=>qo,binY:()=>Vo,bollinger:()=>fc,bollingerX:()=>jD,bollingerY:()=>qD,boxX:()=>VD,boxY:()=>YD,cell:()=>cc,cellX:()=>AD,cellY:()=>MD,centroid:()=>zL,circle:()=>OD,cluster:()=>UL,column:()=>yn,contour:()=>tL,crosshair:()=>rL,crosshairX:()=>iL,crosshairY:()=>oL,delaunayLink:()=>cL,delaunayMesh:()=>lL,density:()=>pL,differenceY:()=>gL,dodgeX:()=>e5,dodgeY:()=>n5,dot:()=>gi,dotX:()=>ND,dotY:()=>RD,filter:()=>Pk,find:()=>Wk,formatIsoDate:()=>GT,formatMonth:()=>Kk,formatWeekday:()=>Jk,frame:()=>Bf,geo:()=>nw,geoCentroid:()=>jL,graticule:()=>xL,gridFx:()=>C_,gridFy:()=>D_,gridX:()=>L_,gridY:()=>F_,group:()=>pm,groupX:()=>Ja,groupY:()=>tc,groupZ:()=>hm,hexagon:()=>kD,hexbin:()=>_L,hexgrid:()=>wL,hull:()=>uL,identity:()=>W,image:()=>SL,indexOf:()=>Ie,initializer:()=>ve,interpolateNearest:()=>VE,interpolateNone:()=>ew,interpolatorBarycentric:()=>qE,interpolatorRandomWalk:()=>YE,legend:()=>WF,line:()=>Cl,lineX:()=>lc,lineY:()=>uc,linearRegressionX:()=>EL,linearRegressionY:()=>AL,link:()=>G_,map:()=>Sr,mapX:()=>Qf,mapY:()=>Zf,marks:()=>Ke,normalize:()=>fw,normalizeX:()=>s5,normalizeY:()=>a5,plot:()=>Rm,pointer:()=>kf,pointerX:()=>Ff,pointerY:()=>Tl,raster:()=>QD,rect:()=>$m,rectX:()=>Wf,rectY:()=>Xf,reverse:()=>$k,ruleX:()=>Yr,ruleY:()=>Gr,scale:()=>zo,select:()=>l5,selectFirst:()=>dA,selectLast:()=>hA,selectMaxX:()=>d5,selectMaxY:()=>h5,selectMinX:()=>u5,selectMinY:()=>f5,shiftX:()=>c5,shuffle:()=>Uk,sort:()=>H1,sphere:()=>bL,spike:()=>AF,stackX:()=>DE,stackX1:()=>yD,stackX2:()=>gD,stackY:()=>LE,stackY1:()=>bD,stackY2:()=>xD,text:()=>jo,textX:()=>I_,textY:()=>T_,tickX:()=>K_,tickY:()=>J_,tip:()=>$_,transform:()=>gn,tree:()=>sA,treeLink:()=>aw,treeNode:()=>Jm,valueof:()=>dt,vector:()=>SE,vectorX:()=>M_,vectorY:()=>N_,voronoi:()=>fL,voronoiMesh:()=>dL,window:()=>Kf,windowX:()=>BD,windowY:()=>PD});function Gt(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Wn(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function xs(e){let t,n,r;e.length!==2?(t=Gt,n=(a,c)=>Gt(e(a),c),r=(a,c)=>e(a)-c):(t=e===Gt||e===Wn?e:vq,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 vq(){return 0}function Th(e){return e===null?NaN:+e}function*O6(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 k6=xs(Gt),F6=k6.right,Sq=k6.left,Iq=xs(Th).center,_s=F6;var Eh=D6(L6),b2=D6(Tq);function D6(e){return function(t,n,r=n){if(!((n=+n)>=0))throw new RangeError("invalid rx");if(!((r=+r)>=0))throw new RangeError("invalid ry");let{data:i,width:o,height:s}=t;if(!((o=Math.floor(o))>=0))throw new RangeError("invalid width");if(!((s=Math.floor(s!==void 0?s:i.length/o))>=0))throw new RangeError("invalid height");if(!o||!s||!n&&!r)return t;let a=n&&e(n),c=r&&e(r),l=i.slice();return a&&c?(gu(a,l,i,o,s),gu(a,i,l,o,s),gu(a,l,i,o,s),bu(c,i,l,o,s),bu(c,l,i,o,s),bu(c,i,l,o,s)):a?(gu(a,i,l,o,s),gu(a,l,i,o,s),gu(a,i,l,o,s)):c&&(bu(c,i,l,o,s),bu(c,l,i,o,s),bu(c,i,l,o,s)),t}}function gu(e,t,n,r,i){for(let o=0,s=r*i;o<s;)e(t,n,o,o+=r,1)}function bu(e,t,n,r,i){for(let o=0,s=r*i;o<r;++o)e(t,n,o,o+s,r)}function Tq(e){let t=L6(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 L6(e){let t=Math.floor(e);if(t===e)return Eq(e);let n=e-t,r=2*e+1;return(i,o,s,a,c)=>{if(!((a-=c)>=s))return;let l=t*o[s],u=c*t,f=u+c;for(let d=s,h=s+u;d<h;d+=c)l+=o[Math.min(a,d)];for(let d=s,h=a;d<=h;d+=c)l+=o[Math.min(a,d+u)],i[d]=(l+n*(o[Math.max(s,d-f)]+o[Math.min(a,d+f)]))/r,l-=o[Math.max(s,d-u)]}}function Eq(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 po(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 Aq(e){return e.length|0}function Mq(e){return!(e>0)}function Nq(e){return typeof e!="object"||"length"in e?e:Array.from(e)}function Rq(e){return t=>e(...t)}function R0(...e){let t=typeof e[e.length-1]=="function"&&Rq(e.pop());e=e.map(Nq);let n=e.map(Aq),r=e.length-1,i=new Array(r+1).fill(0),o=[];if(r<0||n.some(Mq))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 O0(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 Aa(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 ii(e,t){let n=Aa(e,t);return n&&Math.sqrt(n)}function se(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 En=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 Xn=class extends Map{constructor(t,n=P6){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(x2(this,t))}has(t){return super.has(x2(this,t))}set(t,n){return super.set(C6(this,t),n)}delete(t){return super.delete(B6(this,t))}},Cr=class extends Set{constructor(t,n=P6){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(x2(this,t))}add(t){return super.add(C6(this,t))}delete(t){return super.delete(B6(this,t))}};function x2({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function C6({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function B6({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function P6(e){return e!==null&&typeof e=="object"?e.valueOf():e}function Ah(e){return e}function cn(e,...t){return w2(e,Ah,Ah,t)}function Ui(e,t,...n){return w2(e,Ah,t,n)}function _2(e,t,...n){return w2(e,Array.from,t,n)}function w2(e,t,n,r){return function i(o,s){if(s>=r.length)return n(o);let a=new Xn,c=r[s++],l=-1;for(let u of o){let f=c(u,++l,o),d=a.get(f);d?d.push(u):a.set(f,[u])}for(let[u,f]of a)a.set(u,i(f,s));return t(a)}(e,0)}function v2(e,t){return Array.from(t,n=>e[n])}function mo(e,...t){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");e=Array.from(e);let[n]=t;if(n&&n.length!==2||t.length>1){let r=Uint32Array.from(e,(i,o)=>o);return t.length>1?(t=t.map(i=>e.map(i)),r.sort((i,o)=>{for(let s of t){let a=jc(s[i],s[o]);if(a)return a}})):(n=e.map(n),r.sort((i,o)=>jc(n[i],n[o]))),v2(e,r)}return e.sort(Mh(n))}function Mh(e=Gt){if(e===Gt)return jc;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{let r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function jc(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}function xu(e,t,n){return(t.length!==2?mo(Ui(e,t,n),([r,i],[o,s])=>Gt(i,s)||Gt(r,o)):mo(cn(e,n),([r,i],[o,s])=>t(i,s)||Gt(r,o))).map(([r])=>r)}var Oq=Math.sqrt(50),kq=Math.sqrt(10),Fq=Math.sqrt(2);function k0(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>=Oq?10:o>=kq?5:o>=Fq?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?k0(e,t,n*2):[a,c,l]}function An(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?k0(t,e,n):k0(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 ws(e,t,n){return t=+t,e=+e,n=+n,k0(e,t,n)[2]}function _u(e,t,n){t=+t,e=+e,n=+n;let r=t<e,i=r?ws(t,e,n):ws(e,t,n);return(r?-1:1)*(i<0?1/-i:i)}function wu(e,t,n){let r;for(;;){let i=ws(e,t,n);if(i===r||i===0||!isFinite(i))return[e,t];i>0?(e=Math.floor(e/i)*i,t=Math.ceil(t/i)*i):i<0&&(e=Math.ceil(e*i)/i,t=Math.floor(t*i)/i),r=i}}function Ma(e){return Math.max(1,Math.ceil(Math.log(po(e))/Math.LN2)+1)}function Ut(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 F0(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 ae(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 D0(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 L0(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?jc:Mh(i);r>n;){if(r-n>600){let c=r-n+1,l=t-n+1,u=Math.log(c),f=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*f*(c-f)/c)*(l-c/2<0?-1:1),h=Math.max(n,Math.floor(t-l*f/c+d)),p=Math.min(r,Math.floor(t+(c-l)*f/c+d));L0(e,t,h,p,i)}let o=e[t],s=n,a=r;for(Nh(e,n,t),i(e[r],o)>0&&Nh(e,n,r);s<a;){for(Nh(e,s,a),++s,--a;i(e[s],o)<0;)++s;for(;i(e[a],o)>0;)--a}i(e[n],o)===0?Nh(e,n,a):(++a,Nh(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}return e}function Nh(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function qc(e,t=Gt){let n,r=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(r?Gt(s,i)>0:Gt(s,s)===0)&&(n=o,i=s,r=!0)}}else for(let i of e)(r?t(i,n)>0:t(i,i)===0)&&(n=i,r=!0);return n}function Hn(e,t,n){if(e=Float64Array.from(O6(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return ae(e);if(t>=1)return Ut(e);var r,i=(r-1)*t,o=Math.floor(i),s=Ut(L0(e,o).subarray(0,o+1)),a=ae(e.subarray(o+1));return s+(a-s)*(i-o)}}function S2(e,t,n=Th){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 C0(e,t,n){let r=po(e),i=Hn(e,.75)-Hn(e,.25);return r&&i?Math.ceil((n-t)/(2*i*Math.pow(r,-1/3))):1}function Rh(e,t,n){let r=po(e),i=ii(e);return r&&i?Math.ceil((n-t)*Math.cbrt(r)/(3.49*i)):1}function vs(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 zi(e,t){return Hn(e,.5,t)}function*Lq(e){for(let t of e)yield*t}function vu(e){return Array.from(Lq(e))}function Su(e,t){let n=new Xn;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 B0(e,t=Cq){let n=[],r,i=!1;for(let o of e)i&&n.push(t(r,o)),r=o,i=!0;return n}function Cq(e,t){return[e,t]}function $e(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,o=new Array(i);++r<i;)o[r]=e+r*n;return o}function Oh(e,t=Gt){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");let n=Array.from(e),r=new Float64Array(n.length);t.length!==2&&(n=n.map(t),t=Gt);let i=(a,c)=>t(n[a],n[c]),o,s;return e=Uint32Array.from(n,(a,c)=>c),e.sort(t===Gt?(a,c)=>jc(n[a],n[c]):Mh(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=Gt){let n,r=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(r?Gt(s,i)<0:Gt(s,s)===0)&&(n=o,i=s,r=!0)}}else for(let i of e)(r?t(i,n)<0:t(i,i)===0)&&(n=i,r=!0);return n}function Mn(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 Na(e){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");return Array.from(e).reverse()}function $6(e){return e}var I2=1,T2=2,E2=3,$0=4,U6=1e-6;function Bq(e){return"translate("+e+",0)"}function Pq(e){return"translate(0,"+e+")"}function $q(e){return t=>+e(t)}function Uq(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),n=>+e(n)+t}function zq(){return!this.__axis}function jq(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===I2||e===$0?-1:1,u=e===$0||e===T2?"x":"y",f=e===I2||e===E2?Bq:Pq;function d(h){var p=r??(t.ticks?t.ticks.apply(t,n):t.domain()),y=i??(t.tickFormat?t.tickFormat.apply(t,n):$6),g=Math.max(o,0)+a,m=t.range(),b=+m[0]+c,x=+m[m.length-1]+c,_=(t.bandwidth?Uq:$q)(t.copy(),c),v=h.selection?h.selection():h,w=v.selectAll(".domain").data([null]),T=v.selectAll(".tick").data(p,t).order(),M=T.exit(),R=T.enter().append("g").attr("class","tick"),I=T.select("line"),E=T.select("text");w=w.merge(w.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),T=T.merge(R),I=I.merge(R.append("line").attr("stroke","currentColor").attr(u+"2",l*o)),E=E.merge(R.append("text").attr("fill","currentColor").attr(u,l*g).attr("dy",e===I2?"0em":e===E2?"0.71em":"0.32em")),h!==v&&(w=w.transition(h),T=T.transition(h),I=I.transition(h),E=E.transition(h),M=M.transition(h).attr("opacity",U6).attr("transform",function(O){return isFinite(O=_(O))?f(O+c):this.getAttribute("transform")}),R.attr("opacity",U6).attr("transform",function(O){var F=this.parentNode.__axis;return f((F&&isFinite(F=F(O))?F:_(O))+c)})),M.remove(),w.attr("d",e===$0||e===T2?s?"M"+l*s+","+b+"H"+c+"V"+x+"H"+l*s:"M"+c+","+b+"V"+x:s?"M"+b+","+l*s+"V"+c+"H"+x+"V"+l*s:"M"+b+","+c+"H"+x),T.attr("opacity",1).attr("transform",function(O){return f(_(O)+c)}),I.attr(u+"2",l*o),E.attr(u,l*g).text(y),v.filter(zq).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===T2?"start":e===$0?"end":"middle"),v.each(function(){this.__axis=_})}return d.scale=function(h){return arguments.length?(t=h,d):t},d.ticks=function(){return n=Array.from(arguments),d},d.tickArguments=function(h){return arguments.length?(n=h==null?[]:Array.from(h),d):n.slice()},d.tickValues=function(h){return arguments.length?(r=h==null?null:Array.from(h),d):r&&r.slice()},d.tickFormat=function(h){return arguments.length?(i=h,d):i},d.tickSize=function(h){return arguments.length?(o=s=+h,d):o},d.tickSizeInner=function(h){return arguments.length?(o=+h,d):o},d.tickSizeOuter=function(h){return arguments.length?(s=+h,d):s},d.tickPadding=function(h){return arguments.length?(a=+h,d):a},d.offset=function(h){return arguments.length?(c=+h,d):c},d}function A2(e){return jq(E2,e)}var qq={value:()=>{}};function j6(){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 U0(n)}function U0(e){this._=e}function Vq(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}})}U0.prototype=j6.prototype={constructor:U0,on:function(e,t){var n=this._,r=Vq(e+"",n),i,o=-1,s=r.length;if(arguments.length<2){for(;++o<s;)if((i=(e=r[o]).type)&&(i=Yq(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]=z6(n[i],e.name,t);else if(t==null)for(i in n)n[i]=z6(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 U0(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 Yq(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function z6(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=qq,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Vc=j6;var z0="http://www.w3.org/1999/xhtml",oi={svg:"http://www.w3.org/2000/svg",xhtml:z0,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ss(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),oi.hasOwnProperty(t)?{space:oi[t],local:e}:e}function Gq(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===z0&&t.documentElement.namespaceURI===z0?t.createElement(e):t.createElementNS(n,e)}}function Wq(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Is(e){var t=Ss(e);return(t.local?Wq:Gq)(t)}function Xq(){}function Yc(e){return e==null?Xq:function(){return this.querySelector(e)}}function q6(e){typeof e!="function"&&(e=Yc(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 Fe(r,this._parents)}function M2(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Hq(){return[]}function kh(e){return e==null?Hq:function(){return this.querySelectorAll(e)}}function Qq(e){return function(){return M2(e.apply(this,arguments))}}function V6(e){typeof e=="function"?e=Qq(e):e=kh(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 Fe(r,i)}function Fh(e){return function(){return this.matches(e)}}function j0(e){return function(t){return t.matches(e)}}var Zq=Array.prototype.find;function Kq(e){return function(){return Zq.call(this.children,e)}}function Jq(){return this.firstElementChild}function Y6(e){return this.select(e==null?Jq:Kq(typeof e=="function"?e:j0(e)))}var tV=Array.prototype.filter;function eV(){return Array.from(this.children)}function nV(e){return function(){return tV.call(this.children,e)}}function G6(e){return this.selectAll(e==null?eV:nV(typeof e=="function"?e:j0(e)))}function W6(e){typeof e!="function"&&(e=Fh(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 Fe(r,this._parents)}function q0(e){return new Array(e.length)}function X6(){return new Fe(this._enter||this._groups.map(q0),this._parents)}function Dh(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Dh.prototype={constructor:Dh,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 H6(e){return function(){return e}}function rV(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 Dh(e,o[s]);for(;s<c;++s)(a=t[s])&&(i[s]=a)}function iV(e,t,n,r,i,o,s){var a,c,l=new Map,u=t.length,f=o.length,d=new Array(u),h;for(a=0;a<u;++a)(c=t[a])&&(d[a]=h=s.call(c,c.__data__,a,t)+"",l.has(h)?i[a]=c:l.set(h,c));for(a=0;a<f;++a)h=s.call(e,o[a],a,o)+"",(c=l.get(h))?(r[a]=c,c.__data__=o[a],l.delete(h)):n[a]=new Dh(e,o[a]);for(a=0;a<u;++a)(c=t[a])&&l.get(d[a])===c&&(i[a]=c)}function oV(e){return e.__data__}function Q6(e,t){if(!arguments.length)return Array.from(this,oV);var n=t?iV:rV,r=this._parents,i=this._groups;typeof e!="function"&&(e=H6(e));for(var o=i.length,s=new Array(o),a=new Array(o),c=new Array(o),l=0;l<o;++l){var u=r[l],f=i[l],d=f.length,h=sV(e.call(u,u&&u.__data__,l,r)),p=h.length,y=a[l]=new Array(p),g=s[l]=new Array(p),m=c[l]=new Array(d);n(u,f,y,g,m,h,t);for(var b=0,x=0,_,v;b<p;++b)if(_=y[b]){for(b>=x&&(x=b+1);!(v=g[x])&&++x<p;);_._next=v||null}}return s=new Fe(s,r),s._enter=a,s._exit=c,s}function sV(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Z6(){return new Fe(this._exit||this._groups.map(q0),this._parents)}function K6(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 J6(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,o=r.length,s=Math.min(i,o),a=new Array(i),c=0;c<s;++c)for(var l=n[c],u=r[c],f=l.length,d=a[c]=new Array(f),h,p=0;p<f;++p)(h=l[p]||u[p])&&(d[p]=h);for(;c<i;++c)a[c]=n[c];return new Fe(a,this._parents)}function tN(){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 eN(e){e||(e=aV);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var s=n[o],a=s.length,c=i[o]=new Array(a),l,u=0;u<a;++u)(l=s[u])&&(c[u]=l);c.sort(t)}return new Fe(i,this._parents).order()}function aV(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function nN(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function rN(){return Array.from(this)}function iN(){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 oN(){let e=0;for(let t of this)++e;return e}function sN(){return!this.node()}function aN(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 cV(e){return function(){this.removeAttribute(e)}}function lV(e){return function(){this.removeAttributeNS(e.space,e.local)}}function uV(e,t){return function(){this.setAttribute(e,t)}}function fV(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function dV(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function hV(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 cN(e,t){var n=Ss(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?lV:cV:typeof t=="function"?n.local?hV:dV:n.local?fV:uV)(n,t))}function V0(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function pV(e){return function(){this.style.removeProperty(e)}}function mV(e,t,n){return function(){this.style.setProperty(e,t,n)}}function yV(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function lN(e,t,n){return arguments.length>1?this.each((t==null?pV:typeof t=="function"?yV:mV)(e,t,n??"")):Ra(this.node(),e)}function Ra(e,t){return e.style.getPropertyValue(t)||V0(e).getComputedStyle(e,null).getPropertyValue(t)}function gV(e){return function(){delete this[e]}}function bV(e,t){return function(){this[e]=t}}function xV(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function uN(e,t){return arguments.length>1?this.each((t==null?gV:typeof t=="function"?xV:bV)(e,t)):this.node()[e]}function fN(e){return e.trim().split(/^|\s+/)}function N2(e){return e.classList||new dN(e)}function dN(e){this._node=e,this._names=fN(e.getAttribute("class")||"")}dN.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 hN(e,t){for(var n=N2(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function pN(e,t){for(var n=N2(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function _V(e){return function(){hN(this,e)}}function wV(e){return function(){pN(this,e)}}function vV(e,t){return function(){(t.apply(this,arguments)?hN:pN)(this,e)}}function mN(e,t){var n=fN(e+"");if(arguments.length<2){for(var r=N2(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?vV:t?_V:wV)(n,t))}function SV(){this.textContent=""}function IV(e){return function(){this.textContent=e}}function TV(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function yN(e){return arguments.length?this.each(e==null?SV:(typeof e=="function"?TV:IV)(e)):this.node().textContent}function EV(){this.innerHTML=""}function AV(e){return function(){this.innerHTML=e}}function MV(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function gN(e){return arguments.length?this.each(e==null?EV:(typeof e=="function"?MV:AV)(e)):this.node().innerHTML}function NV(){this.nextSibling&&this.parentNode.appendChild(this)}function bN(){return this.each(NV)}function RV(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function xN(){return this.each(RV)}function _N(e){var t=typeof e=="function"?e:Is(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function OV(){return null}function wN(e,t){var n=typeof e=="function"?e:Is(e),r=t==null?OV:typeof t=="function"?t:Yc(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function kV(){var e=this.parentNode;e&&e.removeChild(this)}function vN(){return this.each(kV)}function FV(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function DV(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function SN(e){return this.select(e?DV:FV)}function IN(e){return arguments.length?this.property("__data__",e):this.node().__data__}function LV(e){return function(t){e.call(this,t,this.__data__)}}function CV(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 BV(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 PV(e,t,n){return function(){var r=this.__on,i,o=LV(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 TN(e,t,n){var r=CV(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?PV:BV,i=0;i<o;++i)this.each(a(r[i],t,n));return this}function EN(e,t,n){var r=V0(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 $V(e,t){return function(){return EN(this,e,t)}}function UV(e,t){return function(){return EN(this,e,t.apply(this,arguments))}}function AN(e,t){return this.each((typeof t=="function"?UV:$V)(e,t))}function*MN(){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 R2=[null];function Fe(e,t){this._groups=e,this._parents=t}function NN(){return new Fe([[document.documentElement]],R2)}function zV(){return this}Fe.prototype=NN.prototype={constructor:Fe,select:q6,selectAll:V6,selectChild:Y6,selectChildren:G6,filter:W6,data:Q6,enter:X6,exit:Z6,join:K6,merge:J6,selection:zV,order:tN,sort:eN,call:nN,nodes:rN,node:iN,size:oN,empty:sN,each:aN,attr:cN,style:lN,property:uN,classed:mN,text:yN,html:gN,raise:bN,lower:xN,append:_N,insert:wN,remove:vN,clone:SN,datum:IN,on:TN,dispatch:AN,[Symbol.iterator]:MN};var Ts=NN;function zt(e){return typeof e=="string"?new Fe([[document.querySelector(e)]],[document.documentElement]):new Fe([[e]],R2)}function RN(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Ln(e,t){if(e=RN(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 Y0={capture:!0,passive:!1};function G0(e){e.preventDefault(),e.stopImmediatePropagation()}function Lh(e){var t=e.document.documentElement,n=zt(e).on("dragstart.drag",G0,Y0);"onselectstart"in t?n.on("selectstart.drag",G0,Y0):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Ch(e,t){var n=e.document.documentElement,r=zt(e).on("dragstart.drag",null);t&&(r.on("click.drag",G0,Y0),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 Es(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Oa(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function go(){}var ka=.7,Xc=1/ka,Iu="\\s*([+-]?\\d+)\\s*",Bh="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",yo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",jV=/^#([0-9a-f]{3,8})$/,qV=new RegExp(`^rgb\\(${Iu},${Iu},${Iu}\\)$`),VV=new RegExp(`^rgb\\(${yo},${yo},${yo}\\)$`),YV=new RegExp(`^rgba\\(${Iu},${Iu},${Iu},${Bh}\\)$`),GV=new RegExp(`^rgba\\(${yo},${yo},${yo},${Bh}\\)$`),WV=new RegExp(`^hsl\\(${Bh},${yo},${yo}\\)$`),XV=new RegExp(`^hsla\\(${Bh},${yo},${yo},${Bh}\\)$`),ON={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};Es(go,Br,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:kN,formatHex:kN,formatHex8:HV,formatHsl:QV,formatRgb:FN,toString:FN});function kN(){return this.rgb().formatHex()}function HV(){return this.rgb().formatHex8()}function QV(){return $N(this).formatHsl()}function FN(){return this.rgb().formatRgb()}function Br(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=jV.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?DN(t):n===3?new Ve(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?W0(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?W0(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=qV.exec(e))?new Ve(t[1],t[2],t[3],1):(t=VV.exec(e))?new Ve(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=YV.exec(e))?W0(t[1],t[2],t[3],t[4]):(t=GV.exec(e))?W0(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=WV.exec(e))?BN(t[1],t[2]/100,t[3]/100,1):(t=XV.exec(e))?BN(t[1],t[2]/100,t[3]/100,t[4]):ON.hasOwnProperty(e)?DN(ON[e]):e==="transparent"?new Ve(NaN,NaN,NaN,0):null}function DN(e){return new Ve(e>>16&255,e>>8&255,e&255,1)}function W0(e,t,n,r){return r<=0&&(e=t=n=NaN),new Ve(e,t,n,r)}function Ph(e){return e instanceof go||(e=Br(e)),e?(e=e.rgb(),new Ve(e.r,e.g,e.b,e.opacity)):new Ve}function ln(e,t,n,r){return arguments.length===1?Ph(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}Es(Ve,ln,Oa(go,{brighter(e){return e=e==null?Xc:Math.pow(Xc,e),new Ve(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ka:Math.pow(ka,e),new Ve(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ve(Wc(this.r),Wc(this.g),Wc(this.b),H0(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:LN,formatHex:LN,formatHex8:ZV,formatRgb:CN,toString:CN}));function LN(){return`#${Gc(this.r)}${Gc(this.g)}${Gc(this.b)}`}function ZV(){return`#${Gc(this.r)}${Gc(this.g)}${Gc(this.b)}${Gc((isNaN(this.opacity)?1:this.opacity)*255)}`}function CN(){let e=H0(this.opacity);return`${e===1?"rgb(":"rgba("}${Wc(this.r)}, ${Wc(this.g)}, ${Wc(this.b)}${e===1?")":`, ${e})`}`}function H0(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Wc(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Gc(e){return e=Wc(e),(e<16?"0":"")+e.toString(16)}function BN(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ji(e,t,n,r)}function $N(e){if(e instanceof ji)return new ji(e.h,e.s,e.l,e.opacity);if(e instanceof go||(e=Br(e)),!e)return new ji;if(e instanceof ji)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 ji(s,a,c,e.opacity)}function $h(e,t,n,r){return arguments.length===1?$N(e):new ji(e,t,n,r??1)}function ji(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Es(ji,$h,Oa(go,{brighter(e){return e=e==null?Xc:Math.pow(Xc,e),new ji(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ka:Math.pow(ka,e),new ji(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(O2(e>=240?e-240:e+120,i,r),O2(e,i,r),O2(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new ji(PN(this.h),X0(this.s),X0(this.l),H0(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=H0(this.opacity);return`${e===1?"hsl(":"hsla("}${PN(this.h)}, ${X0(this.s)*100}%, ${X0(this.l)*100}%${e===1?")":`, ${e})`}`}}));function PN(e){return e=(e||0)%360,e<0?e+360:e}function X0(e){return Math.max(0,Math.min(1,e||0))}function O2(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,Z0=180/Math.PI;var K0=18,UN=.96422,zN=1,jN=.82521,qN=4/29,Tu=6/29,VN=3*Tu*Tu,KV=Tu*Tu*Tu;function YN(e){if(e instanceof bo)return new bo(e.l,e.a,e.b,e.opacity);if(e instanceof As)return GN(e);e instanceof Ve||(e=Ph(e));var t=L2(e.r),n=L2(e.g),r=L2(e.b),i=k2((.2225045*t+.7168786*n+.0606169*r)/zN),o,s;return t===n&&n===r?o=s=i:(o=k2((.4360747*t+.3850649*n+.1430804*r)/UN),s=k2((.0139322*t+.0971045*n+.7141733*r)/jN)),new bo(116*i-16,500*(o-i),200*(i-s),e.opacity)}function Eu(e,t,n,r){return arguments.length===1?YN(e):new bo(e,t,n,r??1)}function bo(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}Es(bo,Eu,Oa(go,{brighter(e){return new bo(this.l+K0*(e??1),this.a,this.b,this.opacity)},darker(e){return new bo(this.l-K0*(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=UN*F2(t),e=zN*F2(e),n=jN*F2(n),new Ve(D2(3.1338561*t-1.6168667*e-.4906146*n),D2(-.9787684*t+1.9161415*e+.033454*n),D2(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}}));function k2(e){return e>KV?Math.pow(e,1/3):e/VN+qN}function F2(e){return e>Tu?e*e*e:VN*(e-qN)}function D2(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function L2(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function JV(e){if(e instanceof As)return new As(e.h,e.c,e.l,e.opacity);if(e instanceof bo||(e=YN(e)),e.a===0&&e.b===0)return new As(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*Z0;return new As(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function Uh(e,t,n,r){return arguments.length===1?JV(e):new As(e,t,n,r??1)}function As(e,t,n,r){this.h=+e,this.c=+t,this.l=+n,this.opacity=+r}function GN(e){if(isNaN(e.h))return new bo(e.l,0,0,e.opacity);var t=e.h*Q0;return new bo(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}Es(As,Uh,Oa(go,{brighter(e){return new As(this.h,this.c,this.l+K0*(e??1),this.opacity)},darker(e){return new As(this.h,this.c,this.l-K0*(e??1),this.opacity)},rgb(){return GN(this).rgb()}}));var QN=-.14861,C2=1.78277,B2=-.29227,J0=-.90649,zh=1.97294,WN=zh*J0,XN=zh*C2,HN=C2*B2-J0*QN;function tY(e){if(e instanceof Hc)return new Hc(e.h,e.s,e.l,e.opacity);e instanceof Ve||(e=Ph(e));var t=e.r/255,n=e.g/255,r=e.b/255,i=(HN*r+WN*t-XN*n)/(HN+WN-XN),o=r-i,s=(zh*(n-i)-B2*o)/J0,a=Math.sqrt(s*s+o*o)/(zh*i*(1-i)),c=a?Math.atan2(s,o)*Z0-120:NaN;return new Hc(c<0?c+360:c,a,i,e.opacity)}function Qn(e,t,n,r){return arguments.length===1?tY(e):new Hc(e,t,n,r??1)}function Hc(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Es(Hc,Qn,Oa(go,{brighter(e){return e=e==null?Xc:Math.pow(Xc,e),new Hc(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ka:Math.pow(ka,e),new Hc(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*(QN*r+C2*i)),255*(t+n*(B2*r+J0*i)),255*(t+n*(zh*r)),this.opacity)}}));function P2(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 ZN(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 P2((n-r/t)*t,s,i,o,a)}}function KN(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 P2((n-r/t)*t,i,o,s,a)}}var Au=e=>()=>e;function JN(e,t){return function(n){return e+n*t}}function eY(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 Mu(e,t){var n=t-e;return n?JN(e,n>180||n<-180?n-360*Math.round(n/360):n):Au(isNaN(e)?t:e)}function t4(e){return(e=+e)==1?Se:function(t,n){return n-t?eY(t,n,e):Au(isNaN(t)?n:t)}}function Se(e,t){var n=t-e;return n?JN(e,n):Au(isNaN(e)?t:e)}var si=function e(t){var n=t4(t);function r(i,o){var s=n((i=ln(i)).r,(o=ln(o)).r),a=n(i.g,o.g),c=n(i.b,o.b),l=Se(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 e4(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=ln(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 $2=e4(ZN),nY=e4(KN);function n4(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 r4(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function i4(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]=Pr(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 o4(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function _e(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function s4(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]=Pr(e[i],t[i]):r[i]=t[i];return function(o){for(i in n)r[i]=n[i](o);return r}}var z2=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,U2=new RegExp(z2.source,"g");function rY(e){return function(){return e}}function iY(e){return function(t){return e(t)+""}}function jh(e,t){var n=z2.lastIndex=U2.lastIndex=0,r,i,o,s=-1,a=[],c=[];for(e=e+"",t=t+"";(r=z2.exec(e))&&(i=U2.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:_e(r,i)})),n=U2.lastIndex;return n<t.length&&(o=t.slice(n),a[s]?a[s]+=o:a[++s]=o),a.length<2?c[0]?iY(c[0].x):rY(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 Pr(e,t){var n=typeof t,r;return t==null||n==="boolean"?Au(t):(n==="number"?_e:n==="string"?(r=Br(t))?(t=r,si):jh:t instanceof Br?si:t instanceof Date?o4:r4(t)?n4:Array.isArray(t)?i4:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?s4:_e)(e,t)}function Qc(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}var a4=180/Math.PI,tb={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function j2(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)*a4,skewX:Math.atan(c)*a4,scaleX:s,scaleY:a}}var eb;function c4(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?tb:j2(t.a,t.b,t.c,t.d,t.e,t.f)}function l4(e){return e==null?tb:(eb||(eb=document.createElementNS("http://www.w3.org/2000/svg","g")),eb.setAttribute("transform",e),(e=eb.transform.baseVal.consolidate())?(e=e.matrix,j2(e.a,e.b,e.c,e.d,e.e,e.f)):tb)}function u4(e,t,n,r){function i(l){return l.length?l.pop()+" ":""}function o(l,u,f,d,h,p){if(l!==f||u!==d){var y=h.push("translate(",null,t,null,n);p.push({i:y-4,x:_e(l,f)},{i:y-2,x:_e(u,d)})}else(f||d)&&h.push("translate("+f+t+d+n)}function s(l,u,f,d){l!==u?(l-u>180?u+=360:u-l>180&&(l+=360),d.push({i:f.push(i(f)+"rotate(",null,r)-2,x:_e(l,u)})):u&&f.push(i(f)+"rotate("+u+r)}function a(l,u,f,d){l!==u?d.push({i:f.push(i(f)+"skewX(",null,r)-2,x:_e(l,u)}):u&&f.push(i(f)+"skewX("+u+r)}function c(l,u,f,d,h,p){if(l!==f||u!==d){var y=h.push(i(h)+"scale(",null,",",null,")");p.push({i:y-4,x:_e(l,f)},{i:y-2,x:_e(u,d)})}else(f!==1||d!==1)&&h.push(i(h)+"scale("+f+","+d+")")}return function(l,u){var f=[],d=[];return l=e(l),u=e(u),o(l.translateX,l.translateY,u.translateX,u.translateY,f,d),s(l.rotate,u.rotate,f,d),a(l.skewX,u.skewX,f,d),c(l.scaleX,l.scaleY,u.scaleX,u.scaleY,f,d),l=u=null,function(h){for(var p=-1,y=d.length,g;++p<y;)f[(g=d[p]).i]=g.x(h);return f.join("")}}}var q2=u4(c4,"px, ","px)","deg)"),V2=u4(l4,", ",")",")");var oY=1e-12;function f4(e){return((e=Math.exp(e))+1/e)/2}function sY(e){return((e=Math.exp(e))-1/e)/2}function aY(e){return((e=Math.exp(2*e))-1)/(e+1)}var Y2=function e(t,n,r){function i(o,s){var a=o[0],c=o[1],l=o[2],u=s[0],f=s[1],d=s[2],h=u-a,p=f-c,y=h*h+p*p,g,m;if(y<oY)m=Math.log(d/l)/t,g=function(T){return[a+T*h,c+T*p,l*Math.exp(t*T*m)]};else{var b=Math.sqrt(y),x=(d*d-l*l+r*y)/(2*l*n*b),_=(d*d-l*l-r*y)/(2*d*n*b),v=Math.log(Math.sqrt(x*x+1)-x),w=Math.log(Math.sqrt(_*_+1)-_);m=(w-v)/t,g=function(T){var M=T*m,R=f4(v),I=l/(n*b)*(R*aY(t*M+v)-sY(v));return[a+I*h,c+I*p,l*R/f4(t*M+v)]}}return g.duration=m*1e3*t/Math.SQRT2,g}return i.rho=function(o){var s=Math.max(.001,+o),a=s*s,c=a*a;return e(s,a,c)},i}(Math.SQRT2,2,4);function d4(e){return function(t,n){var r=e((t=$h(t)).h,(n=$h(n)).h),i=Se(t.s,n.s),o=Se(t.l,n.l),s=Se(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 G2=d4(Mu),cY=d4(Se);function nb(e,t){var n=Se((e=Eu(e)).l,(t=Eu(t)).l),r=Se(e.a,t.a),i=Se(e.b,t.b),o=Se(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 h4(e){return function(t,n){var r=e((t=Uh(t)).h,(n=Uh(n)).h),i=Se(t.c,n.c),o=Se(t.l,n.l),s=Se(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 W2=h4(Mu),lY=h4(Se);function p4(e){return function t(n){n=+n;function r(i,o){var s=e((i=Qn(i)).h,(o=Qn(o)).h),a=Se(i.s,o.s),c=Se(i.l,o.l),l=Se(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 uY=p4(Mu),Nu=p4(Se);function xo(e,t){t===void 0&&(t=e,e=Pr);for(var n=0,r=t.length-1,i=t[0],o=new Array(r<0?0:r);n<r;)o[n]=e(i,i=t[++n]);return function(s){var a=Math.max(0,Math.min(r-1,Math.floor(s*=r)));return o[a](s-a)}}function Cn(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e(r/(t-1));return n}var Ru=0,Vh=0,qh=0,y4=1e3,rb,Yh,ib=0,Zc=0,ob=0,Gh=typeof performance=="object"&&performance.now?performance:Date,g4=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Xh(){return Zc||(g4(fY),Zc=Gh.now()+ob)}function fY(){Zc=0}function Wh(){this._call=this._time=this._next=null}Wh.prototype=sb.prototype={constructor:Wh,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Xh():+n)+(t==null?0:+t),!this._next&&Yh!==this&&(Yh?Yh._next=this:rb=this,Yh=this),this._call=e,this._time=n,X2()},stop:function(){this._call&&(this._call=null,this._time=1/0,X2())}};function sb(e,t,n){var r=new Wh;return r.restart(e,t,n),r}function b4(){Xh(),++Ru;for(var e=rb,t;e;)(t=Zc-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ru}function m4(){Zc=(ib=Gh.now())+ob,Ru=Vh=0;try{b4()}finally{Ru=0,hY(),Zc=0}}function dY(){var e=Gh.now(),t=e-ib;t>y4&&(ob-=t,ib=e)}function hY(){for(var e,t=rb,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:rb=n);Yh=e,X2(r)}function X2(e){if(!Ru){Vh&&(Vh=clearTimeout(Vh));var t=e-Zc;t>24?(e<1/0&&(Vh=setTimeout(m4,e-Gh.now()-ob)),qh&&(qh=clearInterval(qh))):(qh||(ib=Gh.now(),qh=setInterval(dY,y4)),Ru=1,g4(m4))}}function ab(e,t,n){var r=new Wh;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var pY=Vc("start","end","cancel","interrupt"),mY=[],w4=0,x4=1,lb=2,cb=3,_4=4,ub=5,Hh=6;function Fa(e,t,n,r,i,o){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;yY(e,n,{name:t,index:r,group:i,on:pY,tween:mY,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:w4})}function Qh(e,t){var n=nn(e,t);if(n.state>w4)throw new Error("too late; already scheduled");return n}function Nn(e,t){var n=nn(e,t);if(n.state>cb)throw new Error("too late; already running");return n}function nn(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function yY(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=sb(o,0,n.time);function o(l){n.state=x4,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var u,f,d,h;if(n.state!==x4)return c();for(u in r)if(h=r[u],h.name===n.name){if(h.state===cb)return ab(s);h.state===_4?(h.state=Hh,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[u]):+u<t&&(h.state=Hh,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[u])}if(ab(function(){n.state===cb&&(n.state=_4,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=lb,n.on.call("start",e,e.__data__,n.index,n.group),n.state===lb){for(n.state=cb,i=new Array(d=n.tween.length),u=0,f=-1;u<d;++u)(h=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(i[++f]=h);i.length=f+1}}function a(l){for(var u=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=ub,1),f=-1,d=i.length;++f<d;)i[f].call(e,u);n.state===ub&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Hh,n.timer.stop(),delete r[t];for(var l in r)return;delete e.__transition}}function _o(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>lb&&r.state<ub,r.state=Hh,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[s]}o&&delete e.__transition}}function v4(e){return this.each(function(){_o(this,e)})}function gY(e,t){var n,r;return function(){var i=Nn(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 bY(e,t,n){var r,i;if(typeof n!="function")throw new Error;return function(){var o=Nn(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 S4(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=nn(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?gY:bY)(n,e,t))}function Ou(e,t,n){var r=e._id;return e.each(function(){var i=Nn(this,r);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return nn(i,r).value[t]}}function fb(e,t){var n;return(typeof t=="number"?_e:t instanceof Br?si:(n=Br(t))?(t=n,si):jh)(e,t)}function xY(e){return function(){this.removeAttribute(e)}}function _Y(e){return function(){this.removeAttributeNS(e.space,e.local)}}function wY(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 vY(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 SY(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 IY(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 I4(e,t){var n=Ss(e),r=n==="transform"?V2:fb;return this.attrTween(e,typeof t=="function"?(n.local?IY:SY)(n,r,Ou(this,"attr."+e,t)):t==null?(n.local?_Y:xY)(n):(n.local?vY:wY)(n,r,t))}function TY(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function EY(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function AY(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&EY(e,o)),n}return i._value=t,i}function MY(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&TY(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=Ss(e);return this.tween(n,(r.local?AY:MY)(r,t))}function NY(e,t){return function(){Qh(this,e).delay=+t.apply(this,arguments)}}function RY(e,t){return t=+t,function(){Qh(this,e).delay=t}}function E4(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?NY:RY)(t,e)):nn(this.node(),t).delay}function OY(e,t){return function(){Nn(this,e).duration=+t.apply(this,arguments)}}function kY(e,t){return t=+t,function(){Nn(this,e).duration=t}}function A4(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?OY:kY)(t,e)):nn(this.node(),t).duration}function FY(e,t){if(typeof t!="function")throw new Error;return function(){Nn(this,e).ease=t}}function M4(e){var t=this._id;return arguments.length?this.each(FY(t,e)):nn(this.node(),t).ease}function DY(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Nn(this,e).ease=n}}function N4(e){if(typeof e!="function")throw new Error;return this.each(DY(this._id,e))}function R4(e){typeof e!="function"&&(e=Fh(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 Zn(r,this._parents,this._name,this._id)}function O4(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,i=n.length,o=Math.min(r,i),s=new Array(r),a=0;a<o;++a)for(var c=t[a],l=n[a],u=c.length,f=s[a]=new Array(u),d,h=0;h<u;++h)(d=c[h]||l[h])&&(f[h]=d);for(;a<r;++a)s[a]=t[a];return new Zn(s,this._parents,this._name,this._id)}function LY(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 CY(e,t,n){var r,i,o=LY(t)?Qh:Nn;return function(){var s=o(this,e),a=s.on;a!==r&&(i=(r=a).copy()).on(t,n),s.on=i}}function k4(e,t){var n=this._id;return arguments.length<2?nn(this.node(),n).on.on(e):this.each(CY(n,e,t))}function BY(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function F4(){return this.on("end.remove",BY(this._id))}function D4(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Yc(e));for(var r=this._groups,i=r.length,o=new Array(i),s=0;s<i;++s)for(var a=r[s],c=a.length,l=o[s]=new Array(c),u,f,d=0;d<c;++d)(u=a[d])&&(f=e.call(u,u.__data__,d,a))&&("__data__"in u&&(f.__data__=u.__data__),l[d]=f,Fa(l[d],t,n,d,l,nn(u,n)));return new Zn(o,this._parents,t,n)}function L4(e){var t=this._name,n=this._id;typeof e!="function"&&(e=kh(e));for(var r=this._groups,i=r.length,o=[],s=[],a=0;a<i;++a)for(var c=r[a],l=c.length,u,f=0;f<l;++f)if(u=c[f]){for(var d=e.call(u,u.__data__,f,c),h,p=nn(u,n),y=0,g=d.length;y<g;++y)(h=d[y])&&Fa(h,t,n,y,d,p);o.push(d),s.push(u)}return new Zn(o,s,t,n)}var PY=Ts.prototype.constructor;function C4(){return new PY(this._groups,this._parents)}function $Y(e,t){var n,r,i;return function(){var o=Ra(this,e),s=(this.style.removeProperty(e),Ra(this,e));return o===s?null:o===n&&s===r?i:i=t(n=o,r=s)}}function B4(e){return function(){this.style.removeProperty(e)}}function UY(e,t,n){var r,i=n+"",o;return function(){var s=Ra(this,e);return s===i?null:s===r?o:o=t(r=s,n)}}function zY(e,t,n){var r,i,o;return function(){var s=Ra(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),Ra(this,e))),s===c?null:s===r&&c===i?o:(i=c,o=t(r=s,a))}}function jY(e,t){var n,r,i,o="style."+t,s="end."+o,a;return function(){var c=Nn(this,e),l=c.on,u=c.value[o]==null?a||(a=B4(t)):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(s,i=u),c.on=r}}function P4(e,t,n){var r=(e+="")=="transform"?q2:fb;return t==null?this.styleTween(e,$Y(e,r)).on("end.style."+e,B4(e)):typeof t=="function"?this.styleTween(e,zY(e,r,Ou(this,"style."+e,t))).each(jY(this._id,e)):this.styleTween(e,UY(e,r,t),n).on("end.style."+e,null)}function qY(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function VY(e,t,n){var r,i;function o(){var s=t.apply(this,arguments);return s!==i&&(r=(i=s)&&qY(e,s,n)),r}return o._value=t,o}function $4(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,VY(e,t,n??""))}function YY(e){return function(){this.textContent=e}}function GY(e){return function(){var t=e(this);this.textContent=t??""}}function U4(e){return this.tween("text",typeof e=="function"?GY(Ou(this,"text",e)):YY(e==null?"":e+""))}function WY(e){return function(t){this.textContent=e.call(this,t)}}function XY(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&WY(i)),t}return r._value=e,r}function z4(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,XY(e))}function j4(){for(var e=this._name,t=this._id,n=db(),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=nn(c,t);Fa(c,e,n,l,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Zn(r,this._parents,e,n)}function q4(){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=Nn(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 HY=0;function Zn(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function V4(e){return Ts().transition(e)}function db(){return++HY}var Ms=Ts.prototype;Zn.prototype=V4.prototype={constructor:Zn,select:D4,selectAll:L4,selectChild:Ms.selectChild,selectChildren:Ms.selectChildren,filter:R4,merge:O4,selection:C4,transition:j4,call:Ms.call,nodes:Ms.nodes,node:Ms.node,size:Ms.size,empty:Ms.empty,each:Ms.each,on:k4,attr:I4,attrTween:T4,style:P4,styleTween:$4,text:U4,textTween:z4,remove:F4,tween:S4,delay:E4,duration:A4,ease:M4,easeVarying:N4,end:q4,[Symbol.iterator]:Ms[Symbol.iterator]};function hb(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var QY={time:null,delay:0,duration:250,ease:hb};function ZY(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 Y4(e){var t,n;e instanceof Zn?(t=e._id,e=e._name):(t=db(),(n=QY).time=Xh(),e=e==null?null:e+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var s=r[o],a=s.length,c,l=0;l<a;++l)(c=s[l])&&Fa(c,e,t,l,s,n||ZY(c,t));return new Zn(r,this._parents,e,t)}Ts.prototype.interrupt=v4;Ts.prototype.transition=Y4;var pb=e=>()=>e;function H2(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 mb(e){e.preventDefault(),e.stopImmediatePropagation()}var W4={name:"drag"},Q2={name:"space"},ku={name:"handle"},Fu={name:"center"},{abs:X4,max:Bn,min:Pn}=Math;function H4(e){return[+e[0],+e[1]]}function K2(e){return[H4(e[0]),H4(e[1])]}var yb={name:"x",handles:["w","e"].map(Zh),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]]}},gb={name:"y",handles:["n","s"].map(Zh),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]]}},KY={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(Zh),input:function(e){return e==null?null:K2(e)},output:function(e){return e}},Ns={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"},Q4={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},Z4={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},JY={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},tG={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function Zh(e){return{type:e}}function eG(e){return!e.ctrlKey&&!e.button}function nG(){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 rG(){return navigator.maxTouchPoints||"ontouchstart"in this}function Z2(e){for(;!e.__brush;)if(!(e=e.parentNode))return;return e.__brush}function iG(e){return e[0][0]===e[1][0]||e[0][1]===e[1][1]}function J2(){return nS(yb)}function tS(){return nS(gb)}function eS(){return nS(KY)}function nS(e){var t=nG,n=eG,r=rG,i=!0,o=Vc("start","brush","end"),s=6,a;function c(g){var m=g.property("__brush",y).selectAll(".overlay").data([Zh("overlay")]);m.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",Ns.overlay).merge(m).each(function(){var x=Z2(this).extent;zt(this).attr("x",x[0][0]).attr("y",x[0][1]).attr("width",x[1][0]-x[0][0]).attr("height",x[1][1]-x[0][1])}),g.selectAll(".selection").data([Zh("selection")]).enter().append("rect").attr("class","selection").attr("cursor",Ns.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var b=g.selectAll(".handle").data(e.handles,function(x){return x.type});b.exit().remove(),b.enter().append("rect").attr("class",function(x){return"handle handle--"+x.type}).attr("cursor",function(x){return Ns[x.type]}),g.each(l).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",d).filter(r).on("touchstart.brush",d).on("touchmove.brush",h).on("touchend.brush touchcancel.brush",p).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}c.move=function(g,m,b){g.tween?g.on("start.brush",function(x){u(this,arguments).beforestart().start(x)}).on("interrupt.brush end.brush",function(x){u(this,arguments).end(x)}).tween("brush",function(){var x=this,_=x.__brush,v=u(x,arguments),w=_.selection,T=e.input(typeof m=="function"?m.apply(this,arguments):m,_.extent),M=Pr(w,T);function R(I){_.selection=I===1&&T===null?null:M(I),l.call(x),v.brush()}return w!==null&&T!==null?R:R(1)}):g.each(function(){var x=this,_=arguments,v=x.__brush,w=e.input(typeof m=="function"?m.apply(x,_):m,v.extent),T=u(x,_).beforestart();_o(x),v.selection=w===null?null:w,l.call(x),T.start(b).brush(b).end(b)})},c.clear=function(g,m){c.move(g,null,m)};function l(){var g=zt(this),m=Z2(this).selection;m?(g.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]),g.selectAll(".handle").style("display",null).attr("x",function(b){return b.type[b.type.length-1]==="e"?m[1][0]-s/2:m[0][0]-s/2}).attr("y",function(b){return b.type[0]==="s"?m[1][1]-s/2:m[0][1]-s/2}).attr("width",function(b){return b.type==="n"||b.type==="s"?m[1][0]-m[0][0]+s:s}).attr("height",function(b){return b.type==="e"||b.type==="w"?m[1][1]-m[0][1]+s:s})):g.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function u(g,m,b){var x=g.__brush.emitter;return x&&(!b||!x.clean)?x:new f(g,m,b)}function f(g,m,b){this.that=g,this.args=m,this.state=g.__brush,this.active=0,this.clean=b}f.prototype={beforestart:function(){return++this.active===1&&(this.state.emitter=this,this.starting=!0),this},start:function(g,m){return this.starting?(this.starting=!1,this.emit("start",g,m)):this.emit("brush",g),this},brush:function(g,m){return this.emit("brush",g,m),this},end:function(g,m){return--this.active===0&&(delete this.state.emitter,this.emit("end",g,m)),this},emit:function(g,m,b){var x=zt(this.that).datum();o.call(g,this.that,new H2(g,{sourceEvent:m,target:c,selection:e.output(this.state.selection),mode:b,dispatch:o}),x)}};function d(g){if(a&&!g.touches||!n.apply(this,arguments))return;var m=this,b=g.target.__data__.type,x=(i&&g.metaKey?b="overlay":b)==="selection"?W4:i&&g.altKey?Fu:ku,_=e===gb?null:JY[b],v=e===yb?null:tG[b],w=Z2(m),T=w.extent,M=w.selection,R=T[0][0],I,E,O=T[0][1],F,S,A=T[1][0],N,D,B=T[1][1],C,P,$=0,U=0,X,tt=_&&v&&i&&g.shiftKey,nt,st,Y=Array.from(g.touches||[g],et=>{let oe=et.identifier;return et=Ln(et,m),et.point0=et.slice(),et.identifier=oe,et});_o(m);var rt=u(m,arguments,!0).beforestart();if(b==="overlay"){M&&(X=!0);let et=[Y[0],Y[1]||Y[0]];w.selection=M=[[I=e===gb?R:Pn(et[0][0],et[1][0]),F=e===yb?O:Pn(et[0][1],et[1][1])],[N=e===gb?A:Bn(et[0][0],et[1][0]),C=e===yb?B:Bn(et[0][1],et[1][1])]],Y.length>1&&Nt(g)}else I=M[0][0],F=M[0][1],N=M[1][0],C=M[1][1];E=I,S=F,D=N,P=C;var j=zt(m).attr("pointer-events","none"),H=j.selectAll(".overlay").attr("cursor",Ns[b]);if(g.touches)rt.moved=z,rt.ended=lt;else{var ot=zt(g.view).on("mousemove.brush",z,!0).on("mouseup.brush",lt,!0);i&&ot.on("keydown.brush",Wt,!0).on("keyup.brush",Xt,!0),Lh(g.view)}l.call(m),rt.start(g,x.name);function z(et){for(let oe of et.changedTouches||[et])for(let Ir of Y)Ir.identifier===oe.identifier&&(Ir.cur=Ln(oe,m));if(tt&&!nt&&!st&&Y.length===1){let oe=Y[0];X4(oe.cur[0]-oe[0])>X4(oe.cur[1]-oe[1])?st=!0:nt=!0}for(let oe of Y)oe.cur&&(oe[0]=oe.cur[0],oe[1]=oe.cur[1]);X=!0,mb(et),Nt(et)}function Nt(et){let oe=Y[0],Ir=oe.point0;var Hi;switch($=oe[0]-Ir[0],U=oe[1]-Ir[1],x){case Q2:case W4:{_&&($=Bn(R-I,Pn(A-N,$)),E=I+$,D=N+$),v&&(U=Bn(O-F,Pn(B-C,U)),S=F+U,P=C+U);break}case ku:{Y[1]?(_&&(E=Bn(R,Pn(A,Y[0][0])),D=Bn(R,Pn(A,Y[1][0])),_=1),v&&(S=Bn(O,Pn(B,Y[0][1])),P=Bn(O,Pn(B,Y[1][1])),v=1)):(_<0?($=Bn(R-I,Pn(A-I,$)),E=I+$,D=N):_>0&&($=Bn(R-N,Pn(A-N,$)),E=I,D=N+$),v<0?(U=Bn(O-F,Pn(B-F,U)),S=F+U,P=C):v>0&&(U=Bn(O-C,Pn(B-C,U)),S=F,P=C+U));break}case Fu:{_&&(E=Bn(R,Pn(A,I-$*_)),D=Bn(R,Pn(A,N+$*_))),v&&(S=Bn(O,Pn(B,F-U*v)),P=Bn(O,Pn(B,C+U*v)));break}}D<E&&(_*=-1,Hi=I,I=N,N=Hi,Hi=E,E=D,D=Hi,b in Q4&&H.attr("cursor",Ns[b=Q4[b]])),P<S&&(v*=-1,Hi=F,F=C,C=Hi,Hi=S,S=P,P=Hi,b in Z4&&H.attr("cursor",Ns[b=Z4[b]])),w.selection&&(M=w.selection),nt&&(E=M[0][0],D=M[1][0]),st&&(S=M[0][1],P=M[1][1]),(M[0][0]!==E||M[0][1]!==S||M[1][0]!==D||M[1][1]!==P)&&(w.selection=[[E,S],[D,P]],l.call(m),rt.brush(et,x.name))}function lt(et){if(G4(et),et.touches){if(et.touches.length)return;a&&clearTimeout(a),a=setTimeout(function(){a=null},500)}else Ch(et.view,X),ot.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);j.attr("pointer-events","all"),H.attr("cursor",Ns.overlay),w.selection&&(M=w.selection),iG(M)&&(w.selection=null,l.call(m)),rt.end(et,x.name)}function Wt(et){switch(et.keyCode){case 16:{tt=_&&v;break}case 18:{x===ku&&(_&&(N=D-$*_,I=E+$*_),v&&(C=P-U*v,F=S+U*v),x=Fu,Nt(et));break}case 32:{(x===ku||x===Fu)&&(_<0?N=D-$:_>0&&(I=E-$),v<0?C=P-U:v>0&&(F=S-U),x=Q2,H.attr("cursor",Ns.selection),Nt(et));break}default:return}mb(et)}function Xt(et){switch(et.keyCode){case 16:{tt&&(nt=st=tt=!1,Nt(et));break}case 18:{x===Fu&&(_<0?N=D:_>0&&(I=E),v<0?C=P:v>0&&(F=S),x=ku,Nt(et));break}case 32:{x===Q2&&(et.altKey?(_&&(N=D-$*_,I=E+$*_),v&&(C=P-U*v,F=S+U*v),x=Fu):(_<0?N=D:_>0&&(I=E),v<0?C=P:v>0&&(F=S),x=ku),H.attr("cursor",Ns[b]),Nt(et));break}default:return}mb(et)}}function h(g){u(this,arguments).moved(g)}function p(g){u(this,arguments).ended(g)}function y(){var g=this.__brush||{selection:null};return g.extent=K2(t.apply(this,arguments)),g.dim=e,g}return c.extent=function(g){return arguments.length?(t=typeof g=="function"?g:pb(K2(g)),c):t},c.filter=function(g){return arguments.length?(n=typeof g=="function"?g:pb(!!g),c):n},c.touchable=function(g){return arguments.length?(r=typeof g=="function"?g:pb(!!g),c):r},c.handleSize=function(g){return arguments.length?(s=+g,c):s},c.keyModifiers=function(g){return arguments.length?(i=!!g,c):i},c.on=function(){var g=o.on.apply(o,arguments);return g===o?c:g},c}var rS=Math.PI,iS=2*rS,Kc=1e-6,oG=iS-Kc;function K4(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function sG(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return K4;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 Da=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?K4:sG(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,r,i){this._append`Q${+t},${+n},${this._x1=+r},${this._y1=+i}`}bezierCurveTo(t,n,r,i,o,s){this._append`C${+t},${+n},${+r},${+i},${this._x1=+o},${this._y1=+s}`}arcTo(t,n,r,i,o){if(t=+t,n=+n,r=+r,i=+i,o=+o,o<0)throw new Error(`negative radius: ${o}`);let s=this._x1,a=this._y1,c=r-t,l=i-n,u=s-t,f=a-n,d=u*u+f*f;if(this._x1===null)this._append`M${this._x1=t},${this._y1=n}`;else if(d>Kc)if(!(Math.abs(f*c-l*u)>Kc)||!o)this._append`L${this._x1=t},${this._y1=n}`;else{let h=r-s,p=i-a,y=c*c+l*l,g=h*h+p*p,m=Math.sqrt(y),b=Math.sqrt(d),x=o*Math.tan((rS-Math.acos((y+d-g)/(2*m*b)))/2),_=x/b,v=x/m;Math.abs(_-1)>Kc&&this._append`L${t+_*u},${n+_*f}`,this._append`A${o},${o},0,0,${+(f*h>u*p)},${this._x1=t+v*c},${this._y1=n+v*l}`}}arc(t,n,r,i,o,s){if(t=+t,n=+n,r=+r,s=!!s,r<0)throw new Error(`negative radius: ${r}`);let a=r*Math.cos(i),c=r*Math.sin(i),l=t+a,u=n+c,f=1^s,d=s?i-o:o-i;this._x1===null?this._append`M${l},${u}`:(Math.abs(this._x1-l)>Kc||Math.abs(this._y1-u)>Kc)&&this._append`L${l},${u}`,r&&(d<0&&(d=d%iS+iS),d>oG?this._append`A${r},${r},0,1,${f},${t-a},${n-c}A${r},${r},0,1,${f},${this._x1=l},${this._y1=u}`:d>Kc&&this._append`A${r},${r},0,${+(d>=rS)},${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 J4(){return new Da}J4.prototype=Da.prototype;function Kn(e=3){return new Da(+e)}var aG=Array.prototype,bb=aG.slice;function tR(e,t){return e-t}function eR(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 wo=e=>()=>e;function nR(e,t){for(var n=-1,r=t.length,i;++n<r;)if(i=cG(e,t[n]))return i;return 0}function cG(e,t){for(var n=t[0],r=t[1],i=-1,o=0,s=e.length,a=s-1;o<s;a=o++){var c=e[o],l=c[0],u=c[1],f=e[a],d=f[0],h=f[1];if(lG(c,f,t))return 0;u>r!=h>r&&n<(d-l)*(r-u)/(h-u)+l&&(i=-i)}return i}function lG(e,t,n){var r;return uG(e,t,n)&&fG(e[r=+(e[0]===t[0])],n[r],t[r])}function uG(e,t,n){return(t[0]-e[0])*(n[1]-e[1])===(n[0]-e[0])*(t[1]-e[1])}function fG(e,t,n){return e<=t&&t<=n||n<=t&&t<=e}function rR(){}var Rs=[[],[[[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 La(){var e=1,t=1,n=Ma,r=c;function i(l){var u=n(l);if(Array.isArray(u))u=u.slice().sort(tR);else{let f=se(l,dG);for(u=An(...wu(f[0],f[1],u),u);u[u.length-1]>=f[1];)u.pop();for(;u[1]<f[0];)u.shift()}return u.map(f=>o(l,f))}function o(l,u){let f=u==null?NaN:+u;if(isNaN(f))throw new Error(`invalid value: ${u}`);var d=[],h=[];return s(l,f,function(p){r(p,l,f),eR(p)>0?d.push([p]):h.push(p)}),h.forEach(function(p){for(var y=0,g=d.length,m;y<g;++y)if(nR((m=d[y])[0],p)!==-1){m.push(p);return}}),{type:"MultiPolygon",value:u,coordinates:d}}function s(l,u,f){var d=new Array,h=new Array,p,y,g,m,b,x;for(p=y=-1,m=Jc(l[0],u),Rs[m<<1].forEach(_);++p<e-1;)g=m,m=Jc(l[p+1],u),Rs[g|m<<1].forEach(_);for(Rs[m<<0].forEach(_);++y<t-1;){for(p=-1,m=Jc(l[y*e+e],u),b=Jc(l[y*e],u),Rs[m<<1|b<<2].forEach(_);++p<e-1;)g=m,m=Jc(l[y*e+e+p+1],u),x=b,b=Jc(l[y*e+p+1],u),Rs[g|m<<1|b<<2|x<<3].forEach(_);Rs[m|b<<3].forEach(_)}for(p=-1,b=l[y*e]>=u,Rs[b<<2].forEach(_);++p<e-1;)x=b,b=Jc(l[y*e+p+1],u),Rs[b<<2|x<<3].forEach(_);Rs[b<<3].forEach(_);function _(v){var w=[v[0][0]+p,v[0][1]+y],T=[v[1][0]+p,v[1][1]+y],M=a(w),R=a(T),I,E;(I=h[M])?(E=d[R])?(delete h[I.end],delete d[E.start],I===E?(I.ring.push(T),f(I.ring)):d[I.start]=h[E.end]={start:I.start,end:E.end,ring:I.ring.concat(E.ring)}):(delete h[I.end],I.ring.push(T),h[I.end=R]=I):(I=d[R])?(E=h[M])?(delete d[I.start],delete h[E.end],I===E?(I.ring.push(T),f(I.ring)):d[E.start]=h[I.end]={start:E.start,end:I.end,ring:E.ring.concat(I.ring)}):(delete d[I.start],I.ring.unshift(w),d[I.start=M]=I):d[M]=h[R]={start:M,end:R,ring:[w,T]}}}function a(l){return l[0]*2+l[1]*(e+1)*4}function c(l,u,f){l.forEach(function(d){var h=d[0],p=d[1],y=h|0,g=p|0,m=oS(u[g*e+y]);h>0&&h<e&&y===h&&(d[0]=iR(h,oS(u[g*e+y-1]),m,f)),p>0&&p<t&&g===p&&(d[1]=iR(p,oS(u[(g-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)?wo(bb.call(l)):wo(l),i):n},i.smooth=function(l){return arguments.length?(r=l?c:rR,i):r===c},i}function dG(e){return isFinite(e)?e:NaN}function Jc(e,t){return e==null?!1:+e>=t}function oS(e){return e==null||isNaN(e=+e)?-1/0:e}function iR(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 hG(e){return e[0]}function pG(e){return e[1]}function mG(){return 1}function sS(){var e=hG,t=pG,n=mG,r=960,i=500,o=20,s=2,a=o*3,c=r+a*2>>s,l=i+a*2>>s,u=wo(20);function f(b){var x=new Float32Array(c*l),_=Math.pow(2,-s),v=-1;for(let F of b){var w=(e(F,++v,b)+a)*_,T=(t(F,v,b)+a)*_,M=+n(F,v,b);if(M&&w>=0&&w<c&&T>=0&&T<l){var R=Math.floor(w),I=Math.floor(T),E=w-R-.5,O=T-I-.5;x[R+I*c]+=(1-E)*(1-O)*M,x[R+1+I*c]+=E*(1-O)*M,x[R+1+(I+1)*c]+=E*O*M,x[R+(I+1)*c]+=(1-E)*O*M}}return Eh({data:x,width:c,height:l},o*_),x}function d(b){var x=f(b),_=u(x),v=Math.pow(2,2*s);return Array.isArray(_)||(_=An(Number.MIN_VALUE,Ut(x)/v,_)),La().size([c,l]).thresholds(_.map(w=>w*v))(x).map((w,T)=>(w.value=+_[T],h(w)))}d.contours=function(b){var x=f(b),_=La().size([c,l]),v=Math.pow(2,2*s),w=T=>{T=+T;var M=h(_.contour(x,T*v));return M.value=T,M};return Object.defineProperty(w,"max",{get:()=>Ut(x)/v}),w};function h(b){return b.coordinates.forEach(p),b}function p(b){b.forEach(y)}function y(b){b.forEach(g)}function g(b){b[0]=b[0]*Math.pow(2,s)-a,b[1]=b[1]*Math.pow(2,s)-a}function m(){return a=o*3,c=r+a*2>>s,l=i+a*2>>s,d}return d.x=function(b){return arguments.length?(e=typeof b=="function"?b:wo(+b),d):e},d.y=function(b){return arguments.length?(t=typeof b=="function"?b:wo(+b),d):t},d.weight=function(b){return arguments.length?(n=typeof b=="function"?b:wo(+b),d):n},d.size=function(b){if(!arguments.length)return[r,i];var x=+b[0],_=+b[1];if(!(x>=0&&_>=0))throw new Error("invalid size");return r=x,i=_,m()},d.cellSize=function(b){if(!arguments.length)return 1<<s;if(!((b=+b)>=1))throw new Error("invalid cell size");return s=Math.floor(Math.log(b)/Math.LN2),m()},d.thresholds=function(b){return arguments.length?(u=typeof b=="function"?b:Array.isArray(b)?wo(bb.call(b)):wo(b),d):u},d.bandwidth=function(b){if(!arguments.length)return Math.sqrt(o*(o+1));if(!((b=+b)>=0))throw new Error("invalid bandwidth");return o=(Math.sqrt(4*b*b+1)-1)/2,m()},d}var Jt=11102230246251565e-32,Ye=134217729,Kh=(3+8*Jt)*Jt;function tl(e,t,n,r,i){let o,s,a,c,l=t[0],u=r[0],f=0,d=0;u>l==u>-l?(o=l,l=t[++f]):(o=u,u=r[++d]);let h=0;if(f<e&&d<n)for(u>l==u>-l?(s=l+o,a=o-(s-l),l=t[++f]):(s=u+o,a=o-(s-u),u=r[++d]),o=s,a!==0&&(i[h++]=a);f<e&&d<n;)u>l==u>-l?(s=o+l,c=s-o,a=o-(s-c)+(l-c),l=t[++f]):(s=o+u,c=s-o,a=o-(s-c)+(u-c),u=r[++d]),o=s,a!==0&&(i[h++]=a);for(;f<e;)s=o+l,c=s-o,a=o-(s-c)+(l-c),l=t[++f],o=s,a!==0&&(i[h++]=a);for(;d<n;)s=o+u,c=s-o,a=o-(s-c)+(u-c),u=r[++d],o=s,a!==0&&(i[h++]=a);return(o!==0||h===0)&&(i[h++]=o),h}function Jh(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 yG=(3+16*Jt)*Jt,gG=(2+12*Jt)*Jt,bG=(9+64*Jt)*Jt*Jt,Du=V(4),oR=V(8),sR=V(12),aR=V(16),Jn=V(4);function xG(e,t,n,r,i,o,s){let a,c,l,u,f,d,h,p,y,g,m,b,x,_,v,w,T,M,R=e-i,I=n-i,E=t-o,O=r-o;_=R*O,d=Ye*R,h=d-(d-R),p=R-h,d=Ye*O,y=d-(d-O),g=O-y,v=p*g-(_-h*y-p*y-h*g),w=E*I,d=Ye*E,h=d-(d-E),p=E-h,d=Ye*I,y=d-(d-I),g=I-y,T=p*g-(w-h*y-p*y-h*g),m=v-T,f=v-m,Du[0]=v-(m+f)+(f-T),b=_+m,f=b-_,x=_-(b-f)+(m-f),m=x-w,f=x-m,Du[1]=x-(m+f)+(f-w),M=b+m,f=M-b,Du[2]=b-(M-f)+(m-f),Du[3]=M;let F=Jh(4,Du),S=gG*s;if(F>=S||-F>=S||(f=e-R,a=e-(R+f)+(f-i),f=n-I,l=n-(I+f)+(f-i),f=t-E,c=t-(E+f)+(f-o),f=r-O,u=r-(O+f)+(f-o),a===0&&c===0&&l===0&&u===0)||(S=bG*s+Kh*Math.abs(F),F+=R*u+O*a-(E*l+I*c),F>=S||-F>=S))return F;_=a*O,d=Ye*a,h=d-(d-a),p=a-h,d=Ye*O,y=d-(d-O),g=O-y,v=p*g-(_-h*y-p*y-h*g),w=c*I,d=Ye*c,h=d-(d-c),p=c-h,d=Ye*I,y=d-(d-I),g=I-y,T=p*g-(w-h*y-p*y-h*g),m=v-T,f=v-m,Jn[0]=v-(m+f)+(f-T),b=_+m,f=b-_,x=_-(b-f)+(m-f),m=x-w,f=x-m,Jn[1]=x-(m+f)+(f-w),M=b+m,f=M-b,Jn[2]=b-(M-f)+(m-f),Jn[3]=M;let A=tl(4,Du,4,Jn,oR);_=R*u,d=Ye*R,h=d-(d-R),p=R-h,d=Ye*u,y=d-(d-u),g=u-y,v=p*g-(_-h*y-p*y-h*g),w=E*l,d=Ye*E,h=d-(d-E),p=E-h,d=Ye*l,y=d-(d-l),g=l-y,T=p*g-(w-h*y-p*y-h*g),m=v-T,f=v-m,Jn[0]=v-(m+f)+(f-T),b=_+m,f=b-_,x=_-(b-f)+(m-f),m=x-w,f=x-m,Jn[1]=x-(m+f)+(f-w),M=b+m,f=M-b,Jn[2]=b-(M-f)+(m-f),Jn[3]=M;let N=tl(A,oR,4,Jn,sR);_=a*u,d=Ye*a,h=d-(d-a),p=a-h,d=Ye*u,y=d-(d-u),g=u-y,v=p*g-(_-h*y-p*y-h*g),w=c*l,d=Ye*c,h=d-(d-c),p=c-h,d=Ye*l,y=d-(d-l),g=l-y,T=p*g-(w-h*y-p*y-h*g),m=v-T,f=v-m,Jn[0]=v-(m+f)+(f-T),b=_+m,f=b-_,x=_-(b-f)+(m-f),m=x-w,f=x-m,Jn[1]=x-(m+f)+(f-w),M=b+m,f=M-b,Jn[2]=b-(M-f)+(m-f),Jn[3]=M;let D=tl(N,sR,4,Jn,aR);return aR[D-1]}function Lu(e,t,n,r,i,o){let s=(t-o)*(n-i),a=(e-i)*(r-o),c=s-a;if(s===0||a===0||s>0!=a>0)return c;let l=Math.abs(s+a);return Math.abs(c)>=yG*l?c:-xG(e,t,n,r,i,o,l)}var _wt=(7+56*Jt)*Jt,wwt=(3+28*Jt)*Jt,vwt=(26+288*Jt)*Jt*Jt,Swt=V(4),Iwt=V(4),Twt=V(4),Ewt=V(4),Awt=V(4),Mwt=V(4),Nwt=V(4),Rwt=V(4),Owt=V(4),kwt=V(8),Fwt=V(8),Dwt=V(8),Lwt=V(4),Cwt=V(8),Bwt=V(8),Pwt=V(8),$wt=V(12),Uwt=V(192),zwt=V(192);var Vwt=(10+96*Jt)*Jt,Ywt=(4+48*Jt)*Jt,Gwt=(44+576*Jt)*Jt*Jt,Wwt=V(4),Xwt=V(4),Hwt=V(4),Qwt=V(4),Zwt=V(4),Kwt=V(4),Jwt=V(4),tvt=V(4),evt=V(8),nvt=V(8),rvt=V(8),ivt=V(8),ovt=V(8),svt=V(8),avt=V(8),cvt=V(8),lvt=V(8),uvt=V(4),fvt=V(4),dvt=V(4),hvt=V(8),pvt=V(16),mvt=V(16),yvt=V(16),gvt=V(32),bvt=V(32),xvt=V(48),_vt=V(64),wvt=V(1152),vvt=V(1152);var Evt=(16+224*Jt)*Jt,Avt=(5+72*Jt)*Jt,Mvt=(71+1408*Jt)*Jt*Jt,Nvt=V(4),Rvt=V(4),Ovt=V(4),kvt=V(4),Fvt=V(4),Dvt=V(4),Lvt=V(4),Cvt=V(4),Bvt=V(4),Pvt=V(4),$vt=V(24),Uvt=V(24),zvt=V(24),jvt=V(24),qvt=V(24),Vvt=V(24),Yvt=V(24),Gvt=V(24),Wvt=V(24),Xvt=V(24),Hvt=V(1152),Qvt=V(1152),Zvt=V(1152),Kvt=V(1152),Jvt=V(1152),t2t=V(2304),e2t=V(2304),n2t=V(3456),r2t=V(5760),i2t=V(8),o2t=V(8),s2t=V(8),a2t=V(16),c2t=V(24),l2t=V(48),u2t=V(48),f2t=V(96),d2t=V(192),h2t=V(384),p2t=V(384),m2t=V(384),y2t=V(768);var g2t=V(96),b2t=V(96),x2t=V(96),_2t=V(1152);var lR=Math.pow(2,-52),xb=new Uint32Array(512),Bu=class e{static from(t,n=TG,r=EG){let i=t.length,o=new Float64Array(i*2);for(let s=0;s<i;s++){let a=t[s];o[2*s]=n(a),o[2*s+1]=r(a)}return new e(o)}constructor(t){let n=t.length>>1;if(n>0&&typeof t[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=t;let r=Math.max(2*n-5,0);this._triangles=new Uint32Array(r*3),this._halfedges=new Int32Array(r*3),this._hashSize=Math.ceil(Math.sqrt(n)),this._hullPrev=new Uint32Array(n),this._hullNext=new Uint32Array(n),this._hullTri=new Uint32Array(n),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(n),this._dists=new Float64Array(n),this.update()}update(){let{coords:t,_hullPrev:n,_hullNext:r,_hullTri:i,_hullHash:o}=this,s=t.length>>1,a=1/0,c=1/0,l=-1/0,u=-1/0;for(let I=0;I<s;I++){let E=t[2*I],O=t[2*I+1];E<a&&(a=E),O<c&&(c=O),E>l&&(l=E),O>u&&(u=O),this._ids[I]=I}let f=(a+l)/2,d=(c+u)/2,h=1/0,p,y,g;for(let I=0;I<s;I++){let E=aS(f,d,t[2*I],t[2*I+1]);E<h&&(p=I,h=E)}let m=t[2*p],b=t[2*p+1];h=1/0;for(let I=0;I<s;I++){if(I===p)continue;let E=aS(m,b,t[2*I],t[2*I+1]);E<h&&E>0&&(y=I,h=E)}let x=t[2*y],_=t[2*y+1],v=1/0;for(let I=0;I<s;I++){if(I===p||I===y)continue;let E=SG(m,b,x,_,t[2*I],t[2*I+1]);E<v&&(g=I,v=E)}let w=t[2*g],T=t[2*g+1];if(v===1/0){for(let O=0;O<s;O++)this._dists[O]=t[2*O]-t[0]||t[2*O+1]-t[1];Cu(this._ids,this._dists,0,s-1);let I=new Uint32Array(s),E=0;for(let O=0,F=-1/0;O<s;O++){let S=this._ids[O];this._dists[S]>F&&(I[E++]=S,F=this._dists[S])}this.hull=I.subarray(0,E),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(Lu(m,b,x,_,w,T)<0){let I=y,E=x,O=_;y=g,x=w,_=T,g=I,w=E,T=O}let M=IG(m,b,x,_,w,T);this._cx=M.x,this._cy=M.y;for(let I=0;I<s;I++)this._dists[I]=aS(t[2*I],t[2*I+1],M.x,M.y);Cu(this._ids,this._dists,0,s-1),this._hullStart=p;let R=3;r[p]=n[g]=y,r[y]=n[p]=g,r[g]=n[y]=p,i[p]=0,i[y]=1,i[g]=2,o.fill(-1),o[this._hashKey(m,b)]=p,o[this._hashKey(x,_)]=y,o[this._hashKey(w,T)]=g,this.trianglesLen=0,this._addTriangle(p,y,g,-1,-1,-1);for(let I=0,E,O;I<this._ids.length;I++){let F=this._ids[I],S=t[2*F],A=t[2*F+1];if(I>0&&Math.abs(S-E)<=lR&&Math.abs(A-O)<=lR||(E=S,O=A,F===p||F===y||F===g))continue;let N=0;for(let $=0,U=this._hashKey(S,A);$<this._hashSize&&(N=o[(U+$)%this._hashSize],!(N!==-1&&N!==r[N]));$++);N=n[N];let D=N,B;for(;B=r[D],Lu(S,A,t[2*D],t[2*D+1],t[2*B],t[2*B+1])>=0;)if(D=B,D===N){D=-1;break}if(D===-1)continue;let C=this._addTriangle(D,F,r[D],-1,-1,i[D]);i[F]=this._legalize(C+2),i[D]=C,R++;let P=r[D];for(;B=r[P],Lu(S,A,t[2*P],t[2*P+1],t[2*B],t[2*B+1])<0;)C=this._addTriangle(P,F,B,i[F],-1,i[P]),i[F]=this._legalize(C+2),r[P]=P,R--,P=B;if(D===N)for(;B=n[D],Lu(S,A,t[2*B],t[2*B+1],t[2*D],t[2*D+1])<0;)C=this._addTriangle(B,F,D,-1,i[D],i[B]),this._legalize(C+2),i[B]=C,r[D]=D,R--,D=B;this._hullStart=n[F]=D,r[D]=n[P]=F,r[F]=P,o[this._hashKey(S,A)]=F,o[this._hashKey(t[2*D],t[2*D+1])]=D}this.hull=new Uint32Array(R);for(let I=0,E=this._hullStart;I<R;I++)this.hull[I]=E,E=r[E];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,n){return Math.floor(wG(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=xb[--o];continue}let l=a-a%3,u=c+(t+1)%3,f=l+(a+2)%3,d=n[s],h=n[t],p=n[u],y=n[f];if(vG(i[2*d],i[2*d+1],i[2*h],i[2*h+1],i[2*p],i[2*p+1],i[2*y],i[2*y+1])){n[t]=y,n[a]=d;let m=r[f];if(m===-1){let x=this._hullStart;do{if(this._hullTri[x]===f){this._hullTri[x]=t;break}x=this._hullPrev[x]}while(x!==this._hullStart)}this._link(t,m),this._link(a,r[s]),this._link(s,f);let b=l+(a+1)%3;o<xb.length&&(xb[o++]=b)}else{if(o===0)break;t=xb[--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 wG(e,t){let n=e/(Math.abs(e)+Math.abs(t));return(t>0?3-n:1+n)/4}function aS(e,t,n,r){let i=e-n,o=t-r;return i*i+o*o}function vG(e,t,n,r,i,o,s,a){let c=e-s,l=t-a,u=n-s,f=r-a,d=i-s,h=o-a,p=c*c+l*l,y=u*u+f*f,g=d*d+h*h;return c*(f*g-y*h)-l*(u*g-y*d)+p*(u*h-f*d)<0}function SG(e,t,n,r,i,o){let s=n-e,a=r-t,c=i-e,l=o-t,u=s*s+a*a,f=c*c+l*l,d=.5/(s*l-a*c),h=(l*u-a*f)*d,p=(s*f-c*u)*d;return h*h+p*p}function IG(e,t,n,r,i,o){let s=n-e,a=r-t,c=i-e,l=o-t,u=s*s+a*a,f=c*c+l*l,d=.5/(s*l-a*c),h=e+(l*u-a*f)*d,p=t+(s*f-c*u)*d;return{x:h,y:p}}function Cu(e,t,n,r){if(r-n<=20)for(let i=n+1;i<=r;i++){let o=e[i],s=t[o],a=i-1;for(;a>=n&&t[e[a]]>s;)e[a+1]=e[a--];e[a+1]=o}else{let i=n+r>>1,o=n+1,s=r;tp(e,i,o),t[e[n]]>t[e[r]]&&tp(e,n,r),t[e[o]]>t[e[r]]&&tp(e,o,r),t[e[n]]>t[e[o]]&&tp(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;tp(e,o,s)}e[n+1]=e[s],e[s]=a,r-o+1>=s-n?(Cu(e,t,o,r),Cu(e,t,n,s-1)):(Cu(e,t,n,s-1),Cu(e,t,o,r))}}function tp(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function TG(e){return e[0]}function EG(e){return e[1]}var ai=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 Ca=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 ep=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,g=0,m=r.length,b,x;y<m;y+=3,g+=2){let _=r[y]*2,v=r[y+1]*2,w=r[y+2]*2,T=t[_],M=t[_+1],R=t[v],I=t[v+1],E=t[w],O=t[w+1],F=R-T,S=I-M,A=E-T,N=O-M,D=(F*N-S*A)*2;if(Math.abs(D)<1e-9){if(o===void 0){o=s=0;for(let C of n)o+=t[C*2],s+=t[C*2+1];o/=n.length,s/=n.length}let B=1e9*Math.sign((o-T)*N-(s-M)*A);b=(T+E)/2-B*N,x=(M+O)/2+B*A}else{let B=1/D,C=F*F+S*S,P=A*A+N*N;b=T+(N*C-S*P)*B,x=M+(F*P-A*C)*B}a[g]=b,a[g+1]=x}let c=n[n.length-1],l,u=c*4,f,d=t[2*c],h,p=t[2*c+1];i.fill(0);for(let y=0;y<n.length;++y)c=n[y],l=u,f=d,h=p,u=c*4,d=t[2*c],p=t[2*c+1],i[l+2]=i[u]=h-p,i[l+3]=i[u+1]=d-f}render(t){let n=t==null?t=new ai:void 0,{delaunay:{halfedges:r,inedges:i,hull:o},circumcenters:s,vectors:a}=this;if(o.length<=1)return null;for(let u=0,f=r.length;u<f;++u){let d=r[u];if(d<u)continue;let h=Math.floor(u/3)*2,p=Math.floor(d/3)*2,y=s[h],g=s[h+1],m=s[p],b=s[p+1];this._renderSegment(y,g,m,b,t)}let c,l=o[o.length-1];for(let u=0;u<o.length;++u){c=l,l=o[u];let f=Math.floor(i[l]/3)*2,d=s[f],h=s[f+1],p=c*4,y=this._project(d,h,a[p+2],a[p+3]);y&&this._renderSegment(d,h,y[0],y[1],t)}return n&&n.value()}renderBounds(t){let n=t==null?t=new ai: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 ai: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 Ca;return this.renderCell(t,n),n.value()}_renderSegment(t,n,r,i,o){let s,a=this._regioncode(t,n),c=this._regioncode(r,i);a===0&&c===0?(o.moveTo(t,n),o.lineTo(r,i)):(s=this._clipSegment(t,n,r,i,a,c))&&(o.moveTo(s[0],s[1]),o.lineTo(s[2],s[3]))}contains(t,n,r){return n=+n,n!==n||(r=+r,r!==r)?!1:this.delaunay._step(t,n,r)===t}*neighbors(t){let n=this._clip(t);if(n)for(let r of this.delaunay.neighbors(t)){let i=this._clip(r);if(i){t:for(let o=0,s=n.length;o<s;o+=2)for(let a=0,c=i.length;a<c;a+=2)if(n[o]===i[a]&&n[o+1]===i[a+1]&&n[(o+2)%s]===i[(a+c-2)%c]&&n[(o+3)%s]===i[(a+c-1)%c]){yield r;break t}}}}_cell(t){let{circumcenters:n,delaunay:{inedges:r,halfedges:i,triangles:o}}=this,s=r[t];if(s===-1)return null;let a=[],c=s;do{let l=Math.floor(c/3);if(a.push(n[l*2],n[l*2+1]),c=c%3===2?c-2:c+1,o[c]!==t)break;c=i[c]}while(c!==s&&c!==-1);return a}_clip(t){if(t===0&&this.delaunay.hull.length===1)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];let n=this._cell(t);if(n===null)return null;let{vectors:r}=this,i=t*4;return this._simplify(r[i]||r[i+1]?this._clipInfinite(t,n,r[i],r[i+1],r[i+2],r[i+3]):this._clipFinite(t,n))}_clipFinite(t,n){let r=n.length,i=null,o,s,a=n[r-2],c=n[r-1],l,u=this._regioncode(a,c),f,d=0;for(let h=0;h<r;h+=2)if(o=a,s=c,a=n[h],c=n[h+1],l=u,u=this._regioncode(a,c),l===0&&u===0)f=d,d=0,i?i.push(a,c):i=[a,c];else{let p,y,g,m,b;if(l===0){if((p=this._clipSegment(o,s,a,c,l,u))===null)continue;[y,g,m,b]=p}else{if((p=this._clipSegment(a,c,o,s,u,l))===null)continue;[m,b,y,g]=p,f=d,d=this._edgecode(y,g),f&&d&&this._edge(t,f,d,i,i.length),i?i.push(y,g):i=[y,g]}f=d,d=this._edgecode(m,b),f&&d&&this._edge(t,f,d,i,i.length),i?i.push(m,b):i=[m,b]}if(i)f=d,d=this._edgecode(i[0],i[1]),f&&d&&this._edge(t,f,d,i,i.length);else if(this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return i}_clipSegment(t,n,r,i,o,s){let a=o<s;for(a&&([t,n,r,i,o,s]=[r,i,t,n,s,o]);;){if(o===0&&s===0)return a?[r,i,t,n]:[t,n,r,i];if(o&s)return null;let c,l,u=o||s;u&8?(c=t+(r-t)*(this.ymax-n)/(i-n),l=this.ymax):u&4?(c=t+(r-t)*(this.ymin-n)/(i-n),l=this.ymin):u&2?(l=n+(i-n)*(this.xmax-t)/(r-t),c=this.xmax):(l=n+(i-n)*(this.xmin-t)/(r-t),c=this.xmin),o?(t=c,n=l,o=this._regioncode(t,n)):(r=c,i=l,s=this._regioncode(r,i))}}_clipInfinite(t,n,r,i,o,s){let a=Array.from(n),c;if((c=this._project(a[0],a[1],r,i))&&a.unshift(c[0],c[1]),(c=this._project(a[a.length-2],a[a.length-1],o,s))&&a.push(c[0],c[1]),a=this._clipFinite(t,a))for(let l=0,u=a.length,f,d=this._edgecode(a[u-2],a[u-1]);l<u;l+=2)f=d,d=this._edgecode(a[l],a[l+1]),f&&d&&(l=this._edge(t,f,d,a,l),u=a.length);else this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(a=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return a}_edge(t,n,r,i,o){for(;n!==r;){let s,a;switch(n){case 5:n=4;continue;case 4:n=6,s=this.xmax,a=this.ymin;break;case 6:n=2;continue;case 2:n=10,s=this.xmax,a=this.ymax;break;case 10:n=8;continue;case 8:n=9,s=this.xmin,a=this.ymax;break;case 9:n=1;continue;case 1:n=5,s=this.xmin,a=this.ymin;break}(i[o]!==s||i[o+1]!==a)&&this.contains(t,s,a)&&(i.splice(o,0,s,a),o+=2)}return o}_project(t,n,r,i){let o=1/0,s,a,c;if(i<0){if(n<=this.ymin)return null;(s=(this.ymin-n)/i)<o&&(c=this.ymin,a=t+(o=s)*r)}else if(i>0){if(n>=this.ymax)return null;(s=(this.ymax-n)/i)<o&&(c=this.ymax,a=t+(o=s)*r)}if(r>0){if(t>=this.xmax)return null;(s=(this.xmax-t)/r)<o&&(a=this.xmax,c=n+(o=s)*i)}else if(r<0){if(t<=this.xmin)return null;(s=(this.xmin-t)/r)<o&&(a=this.xmin,c=n+(o=s)*i)}return[a,c]}_edgecode(t,n){return(t===this.xmin?1:t===this.xmax?2:0)|(n===this.ymin?4:n===this.ymax?8:0)}_regioncode(t,n){return(t<this.xmin?1:t>this.xmax?2:0)|(n<this.ymin?4:n>this.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let n=0;n<t.length;n+=2){let r=(n+2)%t.length,i=(n+4)%t.length;(t[n]===t[r]&&t[r]===t[i]||t[n+1]===t[r+1]&&t[r+1]===t[i+1])&&(t.splice(r,2),n-=2)}t.length||(t=null)}return t}};var AG=2*Math.PI,Pu=Math.pow;function MG(e){return e[0]}function NG(e){return e[1]}function RG(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 OG(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}var ci=class e{static from(t,n=MG,r=NG,i){return new e("length"in t?kG(t,n,r,i):Float64Array.from(FG(t,n,r,i)))}constructor(t){this._delaunator=new Bu(t),this.inedges=new Int32Array(t.length/2),this._hullIndex=new Int32Array(t.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){let t=this._delaunator,n=this.points;if(t.hull&&t.hull.length>2&&RG(t)){this.collinear=Int32Array.from({length:n.length/2},(d,h)=>h).sort((d,h)=>n[2*d]-n[2*h]||n[2*d+1]-n[2*h+1]);let c=this.collinear[0],l=this.collinear[this.collinear.length-1],u=[n[2*c],n[2*c+1],n[2*l],n[2*l+1]],f=1e-8*Math.hypot(u[3]-u[1],u[2]-u[0]);for(let d=0,h=n.length/2;d<h;++d){let p=OG(n[2*d],n[2*d+1],f);n[2*d]=p[0],n[2*d+1]=p[1]}this._delaunator=new Bu(n)}else delete this.collinear;let r=this.halfedges=this._delaunator.halfedges,i=this.hull=this._delaunator.hull,o=this.triangles=this._delaunator.triangles,s=this.inedges.fill(-1),a=this._hullIndex.fill(-1);for(let c=0,l=r.length;c<l;++c){let u=o[c%3===2?c-2:c+1];(r[c]===-1||s[u]===-1)&&(s[u]=c)}for(let c=0,l=i.length;c<l;++c)a[i[c]]=c;i.length<=2&&i.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=i[0],s[i[0]]=1,i.length===2&&(s[i[1]]=0,this.triangles[1]=i[1],this.triangles[2]=i[1]))}voronoi(t){return new ep(this,t)}*neighbors(t){let{inedges:n,hull:r,_hullIndex:i,halfedges:o,triangles:s,collinear:a}=this;if(a){let f=a.indexOf(t);f>0&&(yield a[f-1]),f<a.length-1&&(yield a[f+1]);return}let c=n[t];if(c===-1)return;let l=c,u=-1;do{if(yield u=s[l],l=l%3===2?l-2:l+1,s[l]!==t)return;if(l=o[l],l===-1){let f=r[(i[t]+1)%r.length];f!==u&&(yield f);return}}while(l!==c)}find(t,n,r=0){if(t=+t,t!==t||(n=+n,n!==n))return-1;let i=r,o;for(;(o=this._step(r,t,n))>=0&&o!==r&&o!==i;)r=o;return o}_step(t,n,r){let{inedges:i,hull:o,_hullIndex:s,halfedges:a,triangles:c,points:l}=this;if(i[t]===-1||!l.length)return(t+1)%(l.length>>1);let u=t,f=Pu(n-l[t*2],2)+Pu(r-l[t*2+1],2),d=i[t],h=d;do{let p=c[h],y=Pu(n-l[p*2],2)+Pu(r-l[p*2+1],2);if(y<f&&(f=y,u=p),h=h%3===2?h-2:h+1,c[h]!==t)break;if(h=a[h],h===-1){if(h=o[(s[t]+1)%o.length],h!==p&&Pu(n-l[h*2],2)+Pu(r-l[h*2+1],2)<f)return h;break}}while(h!==d);return u}render(t){let n=t==null?t=new ai: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 ai: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,AG)}return r&&r.value()}renderHull(t){let n=t==null?t=new ai: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 Ca;return this.renderHull(t),t.value()}renderTriangle(t,n){let r=n==null?n=new ai: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 Ca;return this.renderTriangle(t,n),n.value()}};function kG(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*FG(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 uR(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function el(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 vo(e){return e=el(Math.abs(e)),e?e[1]:NaN}function fR(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 dR(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var DG=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function So(e){if(!(t=DG.exec(e)))throw new Error("invalid format: "+e);var t;return new _b({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]})}So.prototype=_b.prototype;function _b(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+""}_b.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 hR(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 cS;function pR(e,t){var n=el(e,t);if(!n)return e+"";var r=n[0],i=n[1],o=i-(cS=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")+el(e,Math.max(0,t+o-1))[0]}function lS(e,t){var n=el(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 uS={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:uR,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)=>lS(e*100,t),r:lS,s:pR,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function fS(e){return e}var mR=Array.prototype.map,yR=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function gR(e){var t=e.grouping===void 0||e.thousands===void 0?fS:fR(mR.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?fS:dR(mR.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=So(f);var d=f.fill,h=f.align,p=f.sign,y=f.symbol,g=f.zero,m=f.width,b=f.comma,x=f.precision,_=f.trim,v=f.type;v==="n"?(b=!0,v="g"):uS[v]||(x===void 0&&(x=12),_=!0,v="g"),(g||d==="0"&&h==="=")&&(g=!0,d="0",h="=");var w=y==="$"?n:y==="#"&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",T=y==="$"?r:/[%p]/.test(v)?s:"",M=uS[v],R=/[defgprs%]/.test(v);x=x===void 0?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,x)):Math.max(0,Math.min(20,x));function I(E){var O=w,F=T,S,A,N;if(v==="c")F=M(E)+F,E="";else{E=+E;var D=E<0||1/E<0;if(E=isNaN(E)?c:M(Math.abs(E),x),_&&(E=hR(E)),D&&+E==0&&p!=="+"&&(D=!1),O=(D?p==="("?p:a:p==="-"||p==="("?"":p)+O,F=(v==="s"?yR[8+cS/3]:"")+F+(D&&p==="("?")":""),R){for(S=-1,A=E.length;++S<A;)if(N=E.charCodeAt(S),48>N||N>57){F=(N===46?i+E.slice(S+1):E.slice(S))+F,E=E.slice(0,S);break}}}b&&!g&&(E=t(E,1/0));var B=O.length+E.length+F.length,C=B<m?new Array(m-B+1).join(d):"";switch(b&&g&&(E=t(C+E,C.length?m-F.length:1/0),C=""),h){case"<":E=O+E+F+C;break;case"=":E=O+C+E+F;break;case"^":E=C.slice(0,B=C.length>>1)+O+E+F+C.slice(B);break;default:E=C+O+E+F;break}return o(E)}return I.toString=function(){return f+""},I}function u(f,d){var h=l((f=So(f),f.type="f",f)),p=Math.max(-8,Math.min(8,Math.floor(vo(d)/3)))*3,y=Math.pow(10,-p),g=yR[8+p/3];return function(m){return h(y*m)+g}}return{format:l,formatPrefix:u}}var wb,li,vb;dS({thousands:",",grouping:[3],currency:["$",""]});function dS(e){return wb=gR(e),li=wb.format,vb=wb.formatPrefix,wb}function hS(e){return Math.max(0,-vo(Math.abs(e)))}function pS(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(vo(t)/3)))*3-vo(Math.abs(e)))}function mS(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,vo(t)-vo(e))+1}var J=1e-6,nl=1e-12,xt=Math.PI,de=xt/2,yS=xt/4,un=xt*2,De=180/xt,jt=xt/180,kt=Math.abs,ui=Math.atan,Ge=Math.atan2,K=Math.cos,np=Math.ceil,Sb=Math.exp;var Ib=Math.hypot,rl=Math.log,Tb=Math.pow,Z=Math.sin,$n=Math.sign||function(e){return e>0?1:e<0?-1:0},he=Math.sqrt,$u=Math.tan;function Eb(e){return e>1?0:e<-1?xt:Math.acos(e)}function we(e){return e>1?de:e<-1?-de:Math.asin(e)}function We(){}function Ab(e,t){e&&xR.hasOwnProperty(e.type)&&xR[e.type](e,t)}var bR={Feature:function(e,t){Ab(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r<i;)Ab(n[r].geometry,t)}},xR={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){gS(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)gS(n[r],t,0)},Polygon:function(e,t){_R(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)_R(n[r],t)},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,i=n.length;++r<i;)Ab(n[r],t)}};function gS(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 _R(e,t){var n=-1,r=e.length;for(t.polygonStart();++n<r;)gS(e[n],t,1);t.polygonEnd()}function $r(e,t){e&&bR.hasOwnProperty(e.type)?bR[e.type](e,t):Ab(e,t)}function rp(e){return[Ge(e[1],e[0]),we(e[2])]}function Io(e){var t=e[0],n=e[1],r=K(n);return[r*K(t),r*Z(t),Z(n)]}function ip(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Uu(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 Mb(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function op(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function sp(e){var t=he(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var ap,Nb,Rb,Ob,kb,Fb,Db,Lb,bS,xS,_S,SR,IR,tr,er,nr,qi={sphere:We,point:wS,lineStart:wR,lineEnd:vR,polygonStart:function(){qi.lineStart=BG,qi.lineEnd=PG},polygonEnd:function(){qi.lineStart=wR,qi.lineEnd=vR}};function wS(e,t){e*=jt,t*=jt;var n=K(t);cp(n*K(e),n*Z(e),Z(t))}function cp(e,t,n){++ap,Rb+=(e-Rb)/ap,Ob+=(t-Ob)/ap,kb+=(n-kb)/ap}function wR(){qi.point=LG}function LG(e,t){e*=jt,t*=jt;var n=K(t);tr=n*K(e),er=n*Z(e),nr=Z(t),qi.point=CG,cp(tr,er,nr)}function CG(e,t){e*=jt,t*=jt;var n=K(t),r=n*K(e),i=n*Z(e),o=Z(t),s=Ge(he((s=er*o-nr*i)*s+(s=nr*r-tr*o)*s+(s=tr*i-er*r)*s),tr*r+er*i+nr*o);Nb+=s,Fb+=s*(tr+(tr=r)),Db+=s*(er+(er=i)),Lb+=s*(nr+(nr=o)),cp(tr,er,nr)}function vR(){qi.point=wS}function BG(){qi.point=$G}function PG(){TR(SR,IR),qi.point=wS}function $G(e,t){SR=e,IR=t,e*=jt,t*=jt,qi.point=TR;var n=K(t);tr=n*K(e),er=n*Z(e),nr=Z(t),cp(tr,er,nr)}function TR(e,t){e*=jt,t*=jt;var n=K(t),r=n*K(e),i=n*Z(e),o=Z(t),s=er*o-nr*i,a=nr*r-tr*o,c=tr*i-er*r,l=Ib(s,a,c),u=we(l),f=l&&-u/l;bS.add(f*s),xS.add(f*a),_S.add(f*c),Nb+=u,Fb+=u*(tr+(tr=r)),Db+=u*(er+(er=i)),Lb+=u*(nr+(nr=o)),cp(tr,er,nr)}function vS(e){ap=Nb=Rb=Ob=kb=Fb=Db=Lb=0,bS=new En,xS=new En,_S=new En,$r(e,qi);var t=+bS,n=+xS,r=+_S,i=Ib(t,n,r);return i<nl&&(t=Fb,n=Db,r=Lb,Nb<J&&(t=Rb,n=Ob,r=kb),i=Ib(t,n,r),i<nl)?[NaN,NaN]:[Ge(n,t)*De,we(r/i)*De]}function lp(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 SS(e,t){return kt(e)>xt&&(e-=Math.round(e/un)*un),[e,t]}SS.invert=SS;function IS(e,t,n){return(e%=un)?t||n?lp(AR(e),MR(t,n)):AR(e):t||n?MR(t,n):SS}function ER(e){return function(t,n){return t+=e,kt(t)>xt&&(t-=Math.round(t/un)*un),[t,n]}}function AR(e){var t=ER(e);return t.invert=ER(-e),t}function MR(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,d=Z(c),h=d*n+u*r;return[Ge(f*i-h*o,u*n-d*r),we(h*i+f*o)]}return s.invert=function(a,c){var l=K(c),u=K(a)*l,f=Z(a)*l,d=Z(c),h=d*i-f*o;return[Ge(f*i+d*o,u*n+h*r),we(h*n-u*r)]},s}function NR(e){e=IS(e[0]*jt,e[1]*jt,e.length>2?e[2]*jt:0);function t(n){return n=e(n[0]*jt,n[1]*jt),n[0]*=De,n[1]*=De,n}return t.invert=function(n){return n=e.invert(n[0]*jt,n[1]*jt),n[0]*=De,n[1]*=De,n},t}function OR(e,t,n,r,i,o){if(n){var s=K(t),a=Z(t),c=r*n;i==null?(i=t+r*un,o=t-c/2):(i=RR(s,i),o=RR(s,o),(r>0?i<o:i>o)&&(i+=r*un));for(var l,u=i;r>0?u>o:u<o;u-=c)l=rp([s,-a*K(u),-a*Z(u)]),e.point(l[0],l[1])}}function RR(e,t){t=Io(t),t[0]-=e,sp(t);var n=Eb(-t[1]);return((-t[2]<0?-n:n)+un-J)%un}function Cb(){var e=[],t;return{point:function(n,r,i){t.push([n,r,i])},lineStart:function(){e.push(t=[])},lineEnd:We,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function zu(e,t){return kt(e[0]-t[0])<J&&kt(e[1]-t[1])<J}function Bb(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 Pb(e,t,n,r,i){var o=[],s=[],a,c;if(e.forEach(function(p){if(!((y=p.length-1)<=0)){var y,g=p[0],m=p[y],b;if(zu(g,m)){if(!g[2]&&!m[2]){for(i.lineStart(),a=0;a<y;++a)i.point((g=p[a])[0],g[1]);i.lineEnd();return}m[0]+=2*J}o.push(b=new Bb(g,p,null,!0)),s.push(b.o=new Bb(g,null,b,!1)),o.push(b=new Bb(m,p,null,!1)),s.push(b.o=new Bb(m,null,b,!0))}}),!!o.length){for(s.sort(t),kR(o),kR(s),a=0,c=s.length;a<c;++a)s[a].e=n=!n;for(var l=o[0],u,f;;){for(var d=l,h=!0;d.v;)if((d=d.n)===l)return;u=d.z,i.lineStart();do{if(d.v=d.o.v=!0,d.e){if(h)for(a=0,c=u.length;a<c;++a)i.point((f=u[a])[0],f[1]);else r(d.x,d.n.x,1,i);d=d.n}else{if(h)for(u=d.p.z,a=u.length-1;a>=0;--a)i.point((f=u[a])[0],f[1]);else r(d.x,d.p.x,-1,i);d=d.p}d=d.o,u=d.z,h=!h}while(!d.v);i.lineEnd()}}}function kR(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 TS(e){return kt(e[0])<=xt?e[0]:$n(e[0])*((kt(e[0])+xt)%un-xt)}function FR(e,t){var n=TS(t),r=t[1],i=Z(r),o=[Z(n),-K(n),0],s=0,a=0,c=new En;i===1?r=de+J:i===-1&&(r=-de-J);for(var l=0,u=e.length;l<u;++l)if(d=(f=e[l]).length)for(var f,d,h=f[d-1],p=TS(h),y=h[1]/2+yS,g=Z(y),m=K(y),b=0;b<d;++b,p=_,g=w,m=T,h=x){var x=f[b],_=TS(x),v=x[1]/2+yS,w=Z(v),T=K(v),M=_-p,R=M>=0?1:-1,I=R*M,E=I>xt,O=g*w;if(c.add(Ge(O*R*Z(I),m*T+O*K(I))),s+=E?M+R*un:M,E^p>=n^_>=n){var F=Uu(Io(h),Io(x));sp(F);var S=Uu(o,F);sp(S);var A=(E^M>=0?-1:1)*we(S[2]);(r>A||r===A&&(F[0]||F[1]))&&(a+=E^M>=0?1:-1)}}return(s<-J||s<J&&c<-nl)^a&1}function $b(e,t,n,r){return function(i){var o=t(i),s=Cb(),a=t(s),c=!1,l,u,f,d={point:h,lineStart:y,lineEnd:g,polygonStart:function(){d.point=m,d.lineStart=b,d.lineEnd=x,u=[],l=[]},polygonEnd:function(){d.point=h,d.lineStart=y,d.lineEnd=g,u=vu(u);var _=FR(l,r);u.length?(c||(i.polygonStart(),c=!0),Pb(u,zG,_,n,i)):_&&(c||(i.polygonStart(),c=!0),i.lineStart(),n(null,null,1,i),i.lineEnd()),c&&(i.polygonEnd(),c=!1),u=l=null},sphere:function(){i.polygonStart(),i.lineStart(),n(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function h(_,v){e(_,v)&&i.point(_,v)}function p(_,v){o.point(_,v)}function y(){d.point=p,o.lineStart()}function g(){d.point=h,o.lineEnd()}function m(_,v){f.push([_,v]),a.point(_,v)}function b(){a.lineStart(),f=[]}function x(){m(f[0][0],f[0][1]),a.lineEnd();var _=a.clean(),v=s.result(),w,T=v.length,M,R,I;if(f.pop(),l.push(f),f=null,!!T){if(_&1){if(R=v[0],(M=R.length-1)>0){for(c||(i.polygonStart(),c=!0),i.lineStart(),w=0;w<M;++w)i.point((I=R[w])[0],I[1]);i.lineEnd()}return}T>1&&_&2&&v.push(v.pop().concat(v.shift())),u.push(v.filter(UG))}}return d}}function UG(e){return e.length>1}function zG(e,t){return((e=e.x)[0]<0?e[1]-de-J:de-e[1])-((t=t.x)[0]<0?t[1]-de-J:de-t[1])}var ES=$b(function(){return!0},jG,VG,[-xt,-de]);function jG(e){var t=NaN,n=NaN,r=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(o,s){var a=o>0?xt:-xt,c=kt(o-t);kt(c-xt)<J?(e.point(t,n=(n+s)/2>0?de:-de),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(a,n),e.point(o,n),i=0):r!==a&&c>=xt&&(kt(t-r)<J&&(t-=r*J),kt(o-a)<J&&(o-=a*J),n=qG(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 qG(e,t,n,r){var i,o,s=Z(e-n);return kt(s)>J?ui((Z(t)*(o=K(r))*Z(n)-Z(r)*(i=K(t))*Z(e))/(i*o*s)):(t+r)/2}function VG(e,t,n,r){var i;if(e==null)i=n*de,r.point(-xt,i),r.point(0,i),r.point(xt,i),r.point(xt,0),r.point(xt,-i),r.point(0,-i),r.point(-xt,-i),r.point(-xt,0),r.point(-xt,i);else if(kt(e[0]-t[0])>J){var o=e[0]<t[0]?xt:-xt;i=n*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(t[0],t[1])}function DR(e){var t=K(e),n=6*jt,r=t>0,i=kt(t)>J;function o(u,f,d,h){OR(h,e,n,d,u,f)}function s(u,f){return K(u)*K(f)>t}function a(u){var f,d,h,p,y;return{lineStart:function(){p=h=!1,y=1},point:function(g,m){var b=[g,m],x,_=s(g,m),v=r?_?0:l(g,m):_?l(g+(g<0?xt:-xt),m):0;if(!f&&(p=h=_)&&u.lineStart(),_!==h&&(x=c(f,b),(!x||zu(f,x)||zu(b,x))&&(b[2]=1)),_!==h)y=0,_?(u.lineStart(),x=c(b,f),u.point(x[0],x[1])):(x=c(f,b),u.point(x[0],x[1],2),u.lineEnd()),f=x;else if(i&&f&&r^_){var w;!(v&d)&&(w=c(b,f,!0))&&(y=0,r?(u.lineStart(),u.point(w[0][0],w[0][1]),u.point(w[1][0],w[1][1]),u.lineEnd()):(u.point(w[1][0],w[1][1]),u.lineEnd(),u.lineStart(),u.point(w[0][0],w[0][1],3)))}_&&(!f||!zu(f,b))&&u.point(b[0],b[1]),f=b,h=_,d=v},lineEnd:function(){h&&u.lineEnd(),f=null},clean:function(){return y|(p&&h)<<1}}}function c(u,f,d){var h=Io(u),p=Io(f),y=[1,0,0],g=Uu(h,p),m=ip(g,g),b=g[0],x=m-b*b;if(!x)return!d&&u;var _=t*m/x,v=-t*b/x,w=Uu(y,g),T=op(y,_),M=op(g,v);Mb(T,M);var R=w,I=ip(T,R),E=ip(R,R),O=I*I-E*(ip(T,T)-1);if(!(O<0)){var F=he(O),S=op(R,(-I-F)/E);if(Mb(S,T),S=rp(S),!d)return S;var A=u[0],N=f[0],D=u[1],B=f[1],C;N<A&&(C=A,A=N,N=C);var P=N-A,$=kt(P-xt)<J,U=$||P<J;if(!$&&B<D&&(C=D,D=B,B=C),U?$?D+B>0^S[1]<(kt(S[0]-A)<J?D:B):D<=S[1]&&S[1]<=B:P>xt^(A<=S[0]&&S[0]<=N)){var X=op(R,(-I+F)/E);return Mb(X,T),[S,rp(X)]}}}function l(u,f){var d=r?e:xt-e,h=0;return u<-d?h|=1:u>d&&(h|=2),f<-d?h|=4:f>d&&(h|=8),h}return $b(s,a,o,r?[0,-e]:[-xt,e-xt])}function LR(e,t,n,r,i,o){var s=e[0],a=e[1],c=t[0],l=t[1],u=0,f=1,d=c-s,h=l-a,p;if(p=n-s,!(!d&&p>0)){if(p/=d,d<0){if(p<u)return;p<f&&(f=p)}else if(d>0){if(p>f)return;p>u&&(u=p)}if(p=i-s,!(!d&&p<0)){if(p/=d,d<0){if(p>f)return;p>u&&(u=p)}else if(d>0){if(p<u)return;p<f&&(f=p)}if(p=r-a,!(!h&&p>0)){if(p/=h,h<0){if(p<u)return;p<f&&(f=p)}else if(h>0){if(p>f)return;p>u&&(u=p)}if(p=o-a,!(!h&&p<0)){if(p/=h,h<0){if(p>f)return;p>u&&(u=p)}else if(h>0){if(p<u)return;p<f&&(f=p)}return u>0&&(e[0]=s+u*d,e[1]=a+u*h),f<1&&(t[0]=s+f*d,t[1]=a+f*h),!0}}}}}var up=1e9,Ub=-up;function ju(e,t,n,r){function i(l,u){return e<=l&&l<=n&&t<=u&&u<=r}function o(l,u,f,d){var h=0,p=0;if(l==null||(h=s(l,f))!==(p=s(u,f))||c(l,u)<0^f>0)do d.point(h===0||h===3?e:n,h>1?r:t);while((h=(h+f+4)%4)!==p);else d.point(u[0],u[1])}function s(l,u){return kt(l[0]-e)<J?u>0?0:3:kt(l[0]-n)<J?u>0?2:1:kt(l[1]-t)<J?u>0?1:0:u>0?3:2}function a(l,u){return c(l.x,u.x)}function c(l,u){var f=s(l,1),d=s(u,1);return f!==d?f-d:f===0?u[1]-l[1]:f===1?l[0]-u[0]:f===2?l[1]-u[1]:u[0]-l[0]}return function(l){var u=l,f=Cb(),d,h,p,y,g,m,b,x,_,v,w,T={point:M,lineStart:O,lineEnd:F,polygonStart:I,polygonEnd:E};function M(A,N){i(A,N)&&u.point(A,N)}function R(){for(var A=0,N=0,D=h.length;N<D;++N)for(var B=h[N],C=1,P=B.length,$=B[0],U,X,tt=$[0],nt=$[1];C<P;++C)U=tt,X=nt,$=B[C],tt=$[0],nt=$[1],X<=r?nt>r&&(tt-U)*(r-X)>(nt-X)*(e-U)&&++A:nt<=r&&(tt-U)*(r-X)<(nt-X)*(e-U)&&--A;return A}function I(){u=f,d=[],h=[],w=!0}function E(){var A=R(),N=w&&A,D=(d=vu(d)).length;(N||D)&&(l.polygonStart(),N&&(l.lineStart(),o(null,null,1,l),l.lineEnd()),D&&Pb(d,a,A,o,l),l.polygonEnd()),u=l,d=h=p=null}function O(){T.point=S,h&&h.push(p=[]),v=!0,_=!1,b=x=NaN}function F(){d&&(S(y,g),m&&_&&f.rejoin(),d.push(f.result())),T.point=M,_&&u.lineEnd()}function S(A,N){var D=i(A,N);if(h&&p.push([A,N]),v)y=A,g=N,m=D,v=!1,D&&(u.lineStart(),u.point(A,N));else if(D&&_)u.point(A,N);else{var B=[b=Math.max(Ub,Math.min(up,b)),x=Math.max(Ub,Math.min(up,x))],C=[A=Math.max(Ub,Math.min(up,A)),N=Math.max(Ub,Math.min(up,N))];LR(B,C,e,t,n,r)?(_||(u.lineStart(),u.point(B[0],B[1])),u.point(C[0],C[1]),D||u.lineEnd(),w=!1):D&&(u.lineStart(),u.point(A,N),w=!1)}b=A,x=N,_=D}return T}}function CR(e,t,n){var r=$e(e,t-J,n).concat(t);return function(i){return r.map(function(o){return[i,o]})}}function BR(e,t,n){var r=$e(e,t-J,n).concat(t);return function(i){return r.map(function(o){return[o,i]})}}function AS(){var e,t,n,r,i,o,s,a,c=10,l=c,u=90,f=360,d,h,p,y,g=2.5;function m(){return{type:"MultiLineString",coordinates:b()}}function b(){return $e(np(r/u)*u,n,u).map(p).concat($e(np(a/f)*f,s,f).map(y)).concat($e(np(t/c)*c,e,c).filter(function(x){return kt(x%u)>J}).map(d)).concat($e(np(o/l)*l,i,l).filter(function(x){return kt(x%f)>J}).map(h))}return m.lines=function(){return b().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(g)):[[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(g)):[[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?(g=+x,d=CR(o,i,90),h=BR(t,e,g),p=CR(a,s,90),y=BR(r,n,g),m):g},m.extentMajor([[-180,-90+J],[180,90-J]]).extentMinor([[-180,-80-J],[180,80+J]])}function MS(){return AS()()}var fp=e=>e;var NS=new En,RS=new En,PR,$R,OS,kS,Ba={point:We,lineStart:We,lineEnd:We,polygonStart:function(){Ba.lineStart=YG,Ba.lineEnd=WG},polygonEnd:function(){Ba.lineStart=Ba.lineEnd=Ba.point=We,NS.add(kt(RS)),RS=new En},result:function(){var e=NS/2;return NS=new En,e}};function YG(){Ba.point=GG}function GG(e,t){Ba.point=UR,PR=OS=e,$R=kS=t}function UR(e,t){RS.add(kS*e-OS*t),OS=e,kS=t}function WG(){UR(PR,$R)}var FS=Ba;var qu=1/0,zb=qu,dp=-qu,jb=dp,XG={point:HG,lineStart:We,lineEnd:We,polygonStart:We,polygonEnd:We,result:function(){var e=[[qu,zb],[dp,jb]];return dp=jb=-(zb=qu=1/0),e}};function HG(e,t){e<qu&&(qu=e),e>dp&&(dp=e),t<zb&&(zb=t),t>jb&&(jb=t)}var Vu=XG;var DS=0,LS=0,hp=0,qb=0,Vb=0,Yu=0,CS=0,BS=0,pp=0,qR,VR,To,Eo,Vi={point:il,lineStart:zR,lineEnd:jR,polygonStart:function(){Vi.lineStart=KG,Vi.lineEnd=JG},polygonEnd:function(){Vi.point=il,Vi.lineStart=zR,Vi.lineEnd=jR},result:function(){var e=pp?[CS/pp,BS/pp]:Yu?[qb/Yu,Vb/Yu]:hp?[DS/hp,LS/hp]:[NaN,NaN];return DS=LS=hp=qb=Vb=Yu=CS=BS=pp=0,e}};function il(e,t){DS+=e,LS+=t,++hp}function zR(){Vi.point=QG}function QG(e,t){Vi.point=ZG,il(To=e,Eo=t)}function ZG(e,t){var n=e-To,r=t-Eo,i=he(n*n+r*r);qb+=i*(To+e)/2,Vb+=i*(Eo+t)/2,Yu+=i,il(To=e,Eo=t)}function jR(){Vi.point=il}function KG(){Vi.point=tW}function JG(){YR(qR,VR)}function tW(e,t){Vi.point=YR,il(qR=To=e,VR=Eo=t)}function YR(e,t){var n=e-To,r=t-Eo,i=he(n*n+r*r);qb+=i*(To+e)/2,Vb+=i*(Eo+t)/2,Yu+=i,i=Eo*e-To*t,CS+=i*(To+e),BS+=i*(Eo+t),pp+=i*3,il(To=e,Eo=t)}var PS=Vi;function Yb(e){this._context=e}Yb.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,un);break}}},result:We};var US=new En,$S,GR,WR,mp,yp,Gb={point:We,lineStart:function(){Gb.point=eW},lineEnd:function(){$S&&XR(GR,WR),Gb.point=We},polygonStart:function(){$S=!0},polygonEnd:function(){$S=null},result:function(){var e=+US;return US=new En,e}};function eW(e,t){Gb.point=XR,GR=mp=e,WR=yp=t}function XR(e,t){mp-=e,yp-=t,US.add(he(mp*mp+yp*yp)),mp=e,yp=t}var zS=Gb;var HR,Wb,QR,ZR,Gu=class{constructor(t){this._append=t==null?KR:nW(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!==QR||this._append!==Wb){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`,QR=r,Wb=this._append,ZR=this._,this._=i}this._+=ZR;break}}}result(){let t=this._;return this._="",t.length?t:null}};function KR(e){let t=1;this._+=e[0];for(let n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function nW(e){let t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return KR;if(t!==HR){let n=10**t;HR=t,Wb=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 Wb}function Rn(e,t){let n=3,r=4.5,i,o;function s(a){return a&&(typeof r=="function"&&o.pointRadius(+r.apply(this,arguments)),$r(a,i(o))),o.result()}return s.area=function(a){return $r(a,i(FS)),FS.result()},s.measure=function(a){return $r(a,i(zS)),zS.result()},s.bounds=function(a){return $r(a,i(Vu)),Vu.result()},s.centroid=function(a){return $r(a,i(PS)),PS.result()},s.projection=function(a){return arguments.length?(i=a==null?(e=null,fp):(e=a).stream,s):e},s.context=function(a){return arguments.length?(o=a==null?(t=null,new Gu(n)):new Yb(t=a),typeof r!="function"&&o.pointRadius(r),s):t},s.pointRadius=function(a){return arguments.length?(r=typeof a=="function"?a:(o.pointRadius(+a),+a),s):r},s.digits=function(a){if(!arguments.length)return n;if(a==null)n=null;else{let c=Math.floor(a);if(!(c>=0))throw new RangeError(`invalid digits: ${a}`);n=c}return t===null&&(o=new Gu(n)),s},s.projection(e).digits(n).context(t)}function ol(e){return{stream:Wu(e)}}function Wu(e){return function(t){var n=new jS;for(var r in e)n[r]=e[r];return n.stream=t,n}}function jS(){}jS.prototype={constructor:jS,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 qS(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),r!=null&&e.clipExtent(null),$r(n,e.stream(Vu)),t(Vu.result()),r!=null&&e.clipExtent(r),e}function gp(e,t,n){return qS(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 Xb(e,t,n){return gp(e,[[0,0],t],n)}function Hb(e,t,n){return qS(e,function(r){var i=+t,o=i/(r[1][0]-r[0][0]),s=(i-o*(r[1][0]+r[0][0]))/2,a=-o*r[0][1];e.scale(150*o).translate([s,a])},n)}function Qb(e,t,n){return qS(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 JR=16,rW=K(30*jt);function VS(e,t){return+t?oW(e,t):iW(e)}function iW(e){return Wu({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function oW(e,t){function n(r,i,o,s,a,c,l,u,f,d,h,p,y,g){var m=l-r,b=u-i,x=m*m+b*b;if(x>4*t&&y--){var _=s+d,v=a+h,w=c+p,T=he(_*_+v*v+w*w),M=we(w/=T),R=kt(kt(w)-1)<J||kt(o-f)<J?(o+f)/2:Ge(v,_),I=e(R,M),E=I[0],O=I[1],F=E-r,S=O-i,A=b*F-m*S;(A*A/x>t||kt((m*F+b*S)/x-.5)>.3||s*d+a*h+c*p<rW)&&(n(r,i,o,s,a,c,E,O,R,_/=T,v/=T,w,y,g),g.point(E,O),n(E,O,R,_,v,w,l,u,f,d,h,p,y,g))}}return function(r){var i,o,s,a,c,l,u,f,d,h,p,y,g={point:m,lineStart:b,lineEnd:_,polygonStart:function(){r.polygonStart(),g.lineStart=v},polygonEnd:function(){r.polygonEnd(),g.lineStart=b}};function m(M,R){M=e(M,R),r.point(M[0],M[1])}function b(){f=NaN,g.point=x,r.lineStart()}function x(M,R){var I=Io([M,R]),E=e(M,R);n(f,d,u,h,p,y,f=E[0],d=E[1],u=M,h=I[0],p=I[1],y=I[2],JR,r),r.point(f,d)}function _(){g.point=m,r.lineEnd()}function v(){b(),g.point=w,g.lineEnd=T}function w(M,R){x(i=M,R),o=f,s=d,a=h,c=p,l=y,g.point=x}function T(){n(f,d,u,h,p,y,o,s,i,a,c,l,JR,r),g.lineEnd=_,_()}return g}}var sW=Wu({point:function(e,t){this.stream.point(e*jt,t*jt)}});function aW(e){return Wu({point:function(t,n){var r=e(t,n);return this.stream.point(r[0],r[1])}})}function cW(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 tO(e,t,n,r,i,o){if(!o)return cW(e,t,n,r,i);var s=K(o),a=Z(o),c=s*e,l=a*e,u=s/e,f=a/e,d=(a*n-s*t)/e,h=(a*t+s*n)/e;function p(y,g){return y*=r,g*=i,[c*y-l*g+t,n-l*y-c*g]}return p.invert=function(y,g){return[r*(u*y-f*g+d),i*(h-f*y-u*g)]},p}function On(e){return YS(function(){return e})()}function YS(e){var t,n=150,r=480,i=250,o=0,s=0,a=0,c=0,l=0,u,f=0,d=1,h=1,p=null,y=ES,g=null,m,b,x,_=fp,v=.5,w,T,M,R,I;function E(A){return M(A[0]*jt,A[1]*jt)}function O(A){return A=M.invert(A[0],A[1]),A&&[A[0]*De,A[1]*De]}E.stream=function(A){return R&&I===A?R:R=sW(aW(u)(y(w(_(I=A)))))},E.preclip=function(A){return arguments.length?(y=A,p=void 0,S()):y},E.postclip=function(A){return arguments.length?(_=A,g=m=b=x=null,S()):_},E.clipAngle=function(A){return arguments.length?(y=+A?DR(p=A*jt):(p=null,ES),S()):p*De},E.clipExtent=function(A){return arguments.length?(_=A==null?(g=m=b=x=null,fp):ju(g=+A[0][0],m=+A[0][1],b=+A[1][0],x=+A[1][1]),S()):g==null?null:[[g,m],[b,x]]},E.scale=function(A){return arguments.length?(n=+A,F()):n},E.translate=function(A){return arguments.length?(r=+A[0],i=+A[1],F()):[r,i]},E.center=function(A){return arguments.length?(o=A[0]%360*jt,s=A[1]%360*jt,F()):[o*De,s*De]},E.rotate=function(A){return arguments.length?(a=A[0]%360*jt,c=A[1]%360*jt,l=A.length>2?A[2]%360*jt:0,F()):[a*De,c*De,l*De]},E.angle=function(A){return arguments.length?(f=A%360*jt,F()):f*De},E.reflectX=function(A){return arguments.length?(d=A?-1:1,F()):d<0},E.reflectY=function(A){return arguments.length?(h=A?-1:1,F()):h<0},E.precision=function(A){return arguments.length?(w=VS(T,v=A*A),S()):he(v)},E.fitExtent=function(A,N){return gp(E,A,N)},E.fitSize=function(A,N){return Xb(E,A,N)},E.fitWidth=function(A,N){return Hb(E,A,N)},E.fitHeight=function(A,N){return Qb(E,A,N)};function F(){var A=tO(n,0,0,d,h,f).apply(null,t(o,s)),N=tO(n,r-A[0],i-A[1],d,h,f);return u=IS(a,c,l),T=lp(t,N),M=lp(u,T),w=VS(T,v),S()}function S(){return R=I=null,E}return function(){return t=e.apply(this,arguments),E.invert=t.invert&&O,F()}}function Xu(e){var t=0,n=xt/3,r=YS(e),i=r(t,n);return i.parallels=function(o){return arguments.length?r(t=o[0]*jt,n=o[1]*jt):[t*De,n*De]},i}function eO(e){var t=K(e);function n(r,i){return[r*t,Z(i)/t]}return n.invert=function(r,i){return[r/t,we(i*t)]},n}function nO(e,t){var n=Z(e),r=(n+Z(t))/2;if(kt(r)<J)return eO(e);var i=1+n*(2*r-n),o=he(i)/r;function s(a,c){var l=he(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=Ge(a,kt(l))*$n(l);return l*r<0&&(u-=xt*$n(a)*$n(l)),[u/r,we((i-(a*a+l*l)*r*r)/(2*r))]},s}function Pa(){return Xu(nO).scale(155.424).center([0,33.6442])}function bp(){return Pa().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function lW(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 GS(){var e,t,n=bp(),r,i=Pa().rotate([154,0]).center([-2,58.5]).parallels([55,65]),o,s=Pa().rotate([157,0]).center([-3,19.9]).parallels([8,18]),a,c,l={point:function(d,h){c=[d,h]}};function u(d){var h=d[0],p=d[1];return c=null,r.point(h,p),c||(o.point(h,p),c)||(a.point(h,p),c)}u.invert=function(d){var h=n.scale(),p=n.translate(),y=(d[0]-p[0])/h,g=(d[1]-p[1])/h;return(g>=.12&&g<.234&&y>=-.425&&y<-.214?i:g>=.166&&g<.234&&y>=-.214&&y<-.115?s:n).invert(d)},u.stream=function(d){return e&&t===d?e:e=lW([n.stream(t=d),i.stream(d),s.stream(d)])},u.precision=function(d){return arguments.length?(n.precision(d),i.precision(d),s.precision(d),f()):n.precision()},u.scale=function(d){return arguments.length?(n.scale(d),i.scale(d*.35),s.scale(d),u.translate(n.translate())):n.scale()},u.translate=function(d){if(!arguments.length)return n.translate();var h=n.scale(),p=+d[0],y=+d[1];return r=n.translate(d).clipExtent([[p-.455*h,y-.238*h],[p+.455*h,y+.238*h]]).stream(l),o=i.translate([p-.307*h,y+.201*h]).clipExtent([[p-.425*h+J,y+.12*h+J],[p-.214*h-J,y+.234*h-J]]).stream(l),a=s.translate([p-.205*h,y+.212*h]).clipExtent([[p-.214*h+J,y+.166*h+J],[p-.115*h-J,y+.234*h-J]]).stream(l),f()},u.fitExtent=function(d,h){return gp(u,d,h)},u.fitSize=function(d,h){return Xb(u,d,h)},u.fitWidth=function(d,h){return Hb(u,d,h)},u.fitHeight=function(d,h){return Qb(u,d,h)};function f(){return e=t=null,u}return u.scale(1070)}function Zb(e){return function(t,n){var r=K(t),i=K(n),o=e(r*i);return o===1/0?[2,0]:[o*i*Z(t),o*Z(n)]}}function Ao(e){return function(t,n){var r=he(t*t+n*n),i=e(r),o=Z(i),s=K(i);return[Ge(t*o,r*s),we(r&&n*o/r)]}}var WS=Zb(function(e){return he(2/(1+e))});WS.invert=Ao(function(e){return 2*we(e/2)});function XS(){return On(WS).scale(124.75).clipAngle(180-.001)}var HS=Zb(function(e){return(e=Eb(e))&&e/Z(e)});HS.invert=Ao(function(e){return e});function QS(){return On(HS).scale(79.4188).clipAngle(180-.001)}function Hu(e,t){return[e,rl($u((de+t)/2))]}Hu.invert=function(e,t){return[e,2*ui(Sb(t))-de]};function ZS(){return KS(Hu).scale(961/un)}function KS(e){var t=On(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=xt*r(),d=t(NR(t.rotate()).invert([0,0]));return o(s==null?[[d[0]-f,d[1]-f],[d[0]+f,d[1]+f]]:e===Hu?[[Math.max(d[0]-f,s),a],[Math.min(d[0]+f,c),l]]:[[s,Math.max(d[1]-f,a)],[c,Math.min(d[1]+f,l)]])}return u()}function Kb(e){return $u((de+e)/2)}function rO(e,t){var n=K(e),r=e===t?Z(e):rl(n/K(t))/rl(Kb(t)/Kb(e)),i=n*Tb(Kb(e),r)/r;if(!r)return Hu;function o(s,a){i>0?a<-de+J&&(a=-de+J):a>de-J&&(a=de-J);var c=i/Tb(Kb(a),r);return[c*Z(r*s),i-c*K(r*s)]}return o.invert=function(s,a){var c=i-a,l=$n(r)*he(s*s+c*c),u=Ge(s,kt(c))*$n(c);return c*r<0&&(u-=xt*$n(s)*$n(c)),[u/r,2*ui(Tb(i/l,1/r))-de]},o}function JS(){return Xu(rO).scale(109.5).parallels([30,30])}function Qu(e,t){return[e,t]}Qu.invert=Qu;function tI(){return On(Qu).scale(152.63)}function iO(e,t){var n=K(e),r=e===t?Z(e):(n-K(t))/(t-e),i=n/r+e;if(kt(r)<J)return Qu;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=Ge(s,kt(c))*$n(c);return c*r<0&&(l-=xt*$n(s)*$n(c)),[l/r,i-$n(r)*he(s*s+c*c)]},o}function eI(){return Xu(iO).scale(131.154).center([0,13.9389])}var xp=1.340264,_p=-.081106,wp=893e-6,vp=.003796,Jb=he(3)/2,uW=12;function nI(e,t){var n=we(Jb*Z(t)),r=n*n,i=r*r*r;return[e*K(n)/(Jb*(xp+3*_p*r+i*(7*wp+9*vp*r))),n*(xp+_p*r+i*(wp+vp*r))]}nI.invert=function(e,t){for(var n=t,r=n*n,i=r*r*r,o=0,s,a,c;o<uW&&(a=n*(xp+_p*r+i*(wp+vp*r))-t,c=xp+3*_p*r+i*(7*wp+9*vp*r),n-=s=a/c,r=n*n,i=r*r*r,!(kt(s)<nl));++o);return[Jb*e*(xp+3*_p*r+i*(7*wp+9*vp*r))/K(n),we(Z(n)/Jb)]};function rI(){return On(nI).scale(177.158)}function iI(e,t){var n=K(t),r=K(e)*n;return[n*Z(e)/r,Z(t)/r]}iI.invert=Ao(ui);function oI(){return On(iI).scale(144.049).clipAngle(60)}function sI(e,t){return[K(t)*Z(e),Z(t)]}sI.invert=Ao(we);function aI(){return On(sI).scale(249.5).clipAngle(90+J)}function cI(e,t){var n=K(t),r=1+K(e)*n;return[n*Z(e)/r,Z(t)/r]}cI.invert=Ao(function(e){return 2*ui(e)});function lI(){return On(cI).scale(250).clipAngle(142)}function uI(e,t){return[rl($u((de+t)/2)),-e]}uI.invert=function(e,t){return[-t,2*ui(Sb(e))-de]};function fI(){var e=KS(uI),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 fW(e,t){return e.parent===t.parent?1:2}function dW(e){return e.reduce(hW,0)/e.length}function hW(e,t){return e+t.x}function pW(e){return 1+e.reduce(mW,0)}function mW(e,t){return Math.max(e,t.y)}function yW(e){for(var t;t=e.children;)e=t[0];return e}function gW(e){for(var t;t=e.children;)e=t[t.length-1];return e}function tx(){var e=fW,t=1,n=1,r=!1;function i(o){var s,a=0;o.eachAfter(function(d){var h=d.children;h?(d.x=dW(h),d.y=pW(h)):(d.x=s?a+=e(d,s):0,d.y=0,s=d)});var c=yW(o),l=gW(o),u=c.x-e(c,l)/2,f=l.x+e(l,c)/2;return o.eachAfter(r?function(d){d.x=(d.x-o.x)*t,d.y=(o.y-d.y)*n}:function(d){d.x=(d.x-u)/(f-u)*t,d.y=(1-(o.y?d.y/o.y:1))*n})}return i.separation=function(o){return arguments.length?(e=o,i):e},i.size=function(o){return arguments.length?(r=!1,t=+o[0],n=+o[1],i):r?null:[t,n]},i.nodeSize=function(o){return arguments.length?(r=!0,t=+o[0],n=+o[1],i):r?[t,n]:null},i}function bW(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 oO(){return this.eachAfter(bW)}function sO(e,t){let n=-1;for(let r of this)e.call(t,r,++n,this);return this}function aO(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 cO(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 lO(e,t){let n=-1;for(let r of this)if(e.call(t,r,++n,this))return r}function uO(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 fO(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function dO(e){for(var t=this,n=xW(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 xW(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 hO(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function pO(){return Array.from(this)}function mO(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function yO(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*gO(){var e=this,t,n=[e],r,i,o;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,r=e.children)for(i=0,o=r.length;i<o;++i)n.push(r[i]);while(n.length)}function dI(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=vW)):t===void 0&&(t=wW);for(var n=new $a(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 $a(s[a])),o.parent=r,o.depth=r.depth+1;return n.eachBefore(hI)}function _W(){return dI(this).eachBefore(SW)}function wW(e){return e.children}function vW(e){return Array.isArray(e)?e[1]:null}function SW(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function hI(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function $a(e){this.data=e,this.depth=this.height=0,this.parent=null}$a.prototype=dI.prototype={constructor:$a,count:oO,each:sO,eachAfter:cO,eachBefore:aO,find:lO,sum:uO,sort:fO,path:dO,ancestors:hO,descendants:pO,leaves:mO,links:yO,copy:_W,[Symbol.iterator]:gO};function ex(e){return e==null?null:IW(e)}function IW(e){if(typeof e!="function")throw new Error;return e}var TW={depth:-1},bO={},pI={};function EW(e){return e.id}function AW(e){return e.parentId}function nx(){var e=EW,t=AW,n;function r(i){var o=Array.from(i),s=e,a=t,c,l,u,f,d,h,p,y,g=new Map;if(n!=null){let m=o.map((_,v)=>MW(n(_,v,i))),b=m.map(xO),x=new Set(m).add("");for(let _ of b)x.has(_)||(x.add(_),m.push(_),b.push(xO(_)),o.push(pI));s=(_,v)=>m[v],a=(_,v)=>b[v]}for(u=0,c=o.length;u<c;++u)l=o[u],h=o[u]=new $a(l),(p=s(l,u,i))!=null&&(p+="")&&(y=h.id=p,g.set(y,g.has(y)?bO:h)),(p=a(l,u,i))!=null&&(p+="")&&(h.parent=p);for(u=0;u<c;++u)if(h=o[u],p=h.parent){if(d=g.get(p),!d)throw new Error("missing: "+p);if(d===bO)throw new Error("ambiguous: "+p);d.children?d.children.push(h):d.children=[h],h.parent=d}else{if(f)throw new Error("multiple roots");f=h}if(!f)throw new Error("no root");if(n!=null){for(;f.data===pI&&f.children.length===1;)f=f.children[0],--c;for(let m=o.length-1;m>=0&&(h=o[m],h.data===pI);--m)h.data=null}if(f.parent=TW,f.eachBefore(function(m){m.depth=m.parent.depth+1,--c}).eachBefore(hI),f.parent=null,c>0)throw new Error("cycle");return f}return r.id=function(i){return arguments.length?(e=ex(i),r):e},r.parentId=function(i){return arguments.length?(t=ex(i),r):t},r.path=function(i){return arguments.length?(n=ex(i),r):n},r}function MW(e){e=`${e}`;let t=e.length;return mI(e,t-1)&&!mI(e,t-2)&&(e=e.slice(0,-1)),e[0]==="/"?e:`/${e}`}function xO(e){let t=e.length;if(t<2)return"";for(;--t>1&&!mI(e,t););return e.slice(0,t)}function mI(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if(!(n&1))return!0}return!1}function NW(e,t){return e.parent===t.parent?1:2}function yI(e){var t=e.children;return t?t[0]:e.t}function gI(e){var t=e.children;return t?t[t.length-1]:e.t}function RW(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 OW(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 kW(e,t,n){return e.a.parent===t.parent?e.a:n}function rx(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}rx.prototype=Object.create($a.prototype);function FW(e){for(var t=new rx(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 rx(o[s],s)),i.parent=n;return(t.parent=new rx(null,0)).children=[t],t}function sl(){var e=NW,t=1,n=1,r=null;function i(l){var u=FW(l);if(u.eachAfter(o),u.parent.m=-u.z,u.eachBefore(s),r)l.eachBefore(c);else{var f=l,d=l,h=l;l.eachBefore(function(b){b.x<f.x&&(f=b),b.x>d.x&&(d=b),b.depth>h.depth&&(h=b)});var p=f===d?1:e(f,d)/2,y=p-f.x,g=t/(d.x+p+y),m=n/(h.depth||1);l.eachBefore(function(b){b.x=(b.x+y)*g,b.y=b.depth*m})}return l}function o(l){var u=l.children,f=l.parent.children,d=l.i?f[l.i-1]:null;if(u){OW(l);var h=(u[0].z+u[u.length-1].z)/2;d?(l.z=d.z+e(l._,d._),l.m=l.z-h):l.z=h}else d&&(l.z=d.z+e(l._,d._));l.parent.A=a(l,d,l.parent.A||f[0])}function s(l){l._.x=l.z+l.parent.m,l.m+=l.parent.m}function a(l,u,f){if(u){for(var d=l,h=l,p=u,y=d.parent.children[0],g=d.m,m=h.m,b=p.m,x=y.m,_;p=gI(p),d=yI(d),p&&d;)y=yI(y),h=gI(h),h.a=l,_=p.z+b-d.z-g+e(p._,d._),_>0&&(RW(kW(p,l,f),l,_),g+=_,m+=_),b+=p.m,g+=d.m,x+=y.m,m+=h.m;p&&!gI(h)&&(h.t=p,h.m+=b-m),d&&!yI(y)&&(y.t=d,y.m+=g-x,f=l)}return f}function c(l){l.x*=t,l.y=l.depth*n}return i.separation=function(l){return arguments.length?(e=l,i):e},i.size=function(l){return arguments.length?(r=!1,t=+l[0],n=+l[1],i):r?null:[t,n]},i.nodeSize=function(l){return arguments.length?(r=!0,t=+l[0],n=+l[1],i):r?[t,n]:null},i}var _O=23283064365386963e-26;function al(e=Math.random()){let t=(0<=e&&e<1?e/_O:Math.abs(e))|0;return()=>(t=1664525*t+1013904223|0,_O*(t>>>0))}function Xe(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function Sp(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 Ip=Symbol("implicit");function cl(){var e=new Xn,t=[],n=[],r=Ip;function i(o){let s=e.get(o);if(s===void 0){if(r!==Ip)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 Xn;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 cl(t,n).unknown(r)},Xe.apply(i,arguments),i}function Ua(){var e=cl().unknown(void 0),t=e.domain,n=e.range,r=0,i=1,o,s,a=!1,c=0,l=0,u=.5;delete e.unknown;function f(){var d=t().length,h=i<r,p=h?i:r,y=h?r:i;o=(y-p)/Math.max(1,d-c+l*2),a&&(o=Math.floor(o)),p+=(y-p-o*(d-c))*u,s=o*(1-c),a&&(p=Math.round(p),s=Math.round(s));var g=$e(d).map(function(m){return p+o*m});return n(h?g.reverse():g)}return e.domain=function(d){return arguments.length?(t(d),f()):t()},e.range=function(d){return arguments.length?([r,i]=d,r=+r,i=+i,f()):[r,i]},e.rangeRound=function(d){return[r,i]=d,r=+r,i=+i,a=!0,f()},e.bandwidth=function(){return s},e.step=function(){return o},e.round=function(d){return arguments.length?(a=!!d,f()):a},e.padding=function(d){return arguments.length?(c=Math.min(1,l=+d),f()):c},e.paddingInner=function(d){return arguments.length?(c=Math.min(1,d),f()):c},e.paddingOuter=function(d){return arguments.length?(l=+d,f()):l},e.align=function(d){return arguments.length?(u=Math.max(0,Math.min(1,d)),f()):u},e.copy=function(){return Ua(t(),[r,i]).round(a).paddingInner(c).paddingOuter(l).align(u)},Xe.apply(f(),arguments)}function wO(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return wO(t())},e}function bI(){return wO(Ua.apply(null,arguments).paddingInner(1))}function xI(e){return function(){return e}}function Zu(e){return+e}var vO=[0,1];function vr(e){return e}function _I(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:xI(isNaN(t)?NaN:.5)}function DW(e,t){var n;return e>t&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function LW(e,t,n){var r=e[0],i=e[1],o=t[0],s=t[1];return i<r?(r=_I(i,r),o=n(s,o)):(r=_I(r,i),o=n(o,s)),function(a){return o(r(a))}}function CW(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]=_I(e[s],e[s+1]),o[s]=n(t[s],t[s+1]);return function(a){var c=_s(e,a,1,r)-1;return o[c](i[c](a))}}function Mo(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function ll(){var e=vO,t=vO,n=Pr,r,i,o,s=vr,a,c,l;function u(){var d=Math.min(e.length,t.length);return s!==vr&&(s=DW(e[0],e[d-1])),a=d>2?CW:LW,c=l=null,f}function f(d){return d==null||isNaN(d=+d)?o:(c||(c=a(e.map(r),t,n)))(r(s(d)))}return f.invert=function(d){return s(i((l||(l=a(t,e.map(r),_e)))(d)))},f.domain=function(d){return arguments.length?(e=Array.from(d,Zu),u()):e.slice()},f.range=function(d){return arguments.length?(t=Array.from(d),u()):t.slice()},f.rangeRound=function(d){return t=Array.from(d),n=Qc,u()},f.clamp=function(d){return arguments.length?(s=d?!0:vr,u()):s!==vr},f.interpolate=function(d){return arguments.length?(n=d,u()):n},f.unknown=function(d){return arguments.length?(o=d,f):o},function(d,h){return r=d,i=h,u()}}function Tp(){return ll()(vr,vr)}function wI(e,t,n,r){var i=_u(e,t,n),o;switch(r=So(r??",f"),r.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(o=pS(i,s))&&(r.precision=o),vb(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=mS(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=hS(i))&&(r.precision=o-(r.type==="%")*2);break}}return li(r)}function Os(e){var t=e.domain;return e.ticks=function(n){var r=t();return An(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return wI(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=ws(s,a,n),l===c)return r[i]=s,r[o]=a,t(r);if(l>0)s=Math.floor(s/l)*l,a=Math.ceil(a/l)*l;else if(l<0)s=Math.ceil(s*l)/l,a=Math.floor(a*l)/l;else break;c=l}return e},e}function ks(){var e=Tp();return e.copy=function(){return Mo(e,ks())},Xe.apply(e,arguments),Os(e)}function Ep(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,Zu),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return Ep(e).unknown(t)},e=arguments.length?Array.from(e,Zu):[0,1],Os(n)}function Ap(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 SO(e){return Math.log(e)}function IO(e){return Math.exp(e)}function BW(e){return-Math.log(-e)}function PW(e){return-Math.exp(-e)}function $W(e){return isFinite(e)?+("1e"+e):e<0?0:e}function UW(e){return e===10?$W:e===Math.E?Math.exp:t=>Math.pow(e,t)}function zW(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 TO(e){return(t,n)=>-e(-t,n)}function vI(e){let t=e(SO,IO),n=t.domain,r=10,i,o;function s(){return i=zW(r),o=UW(r),n()[0]<0?(i=TO(i),o=TO(o),e(BW,PW)):e(SO,IO),t}return t.base=function(a){return arguments.length?(r=+a,s()):r},t.domain=function(a){return arguments.length?(n(a),s()):n()},t.ticks=a=>{let c=n(),l=c[0],u=c[c.length-1],f=u<l;f&&([l,u]=[u,l]);let d=i(l),h=i(u),p,y,g=a==null?10:+a,m=[];if(!(r%1)&&h-d<g){if(d=Math.floor(d),h=Math.ceil(h),l>0){for(;d<=h;++d)for(p=1;p<r;++p)if(y=d<0?p/o(-d):p*o(d),!(y<l)){if(y>u)break;m.push(y)}}else for(;d<=h;++d)for(p=r-1;p>=1;--p)if(y=d>0?p/o(-d):p*o(d),!(y<l)){if(y>u)break;m.push(y)}m.length*2<g&&(m=An(l,u,g))}else m=An(d,h,Math.min(h-d,g)).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=So(c)).precision==null&&(c.trim=!0),c=li(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(Ap(n(),{floor:a=>o(Math.floor(i(a))),ceil:a=>o(Math.ceil(i(a)))})),t}function Mp(){let e=vI(ll()).domain([1,10]);return e.copy=()=>Mo(e,Mp()).base(e.base()),Xe.apply(e,arguments),e}function EO(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function AO(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function SI(e){var t=1,n=e(EO(t),AO(t));return n.constant=function(r){return arguments.length?e(EO(t=+r),AO(t)):t},Os(n)}function Np(){var e=SI(ll());return e.copy=function(){return Mo(e,Np()).constant(e.constant())},Xe.apply(e,arguments)}function MO(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function jW(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function qW(e){return e<0?-e*e:e*e}function II(e){var t=e(vr,vr),n=1;function r(){return n===1?e(vr,vr):n===.5?e(jW,qW):e(MO(n),MO(1/n))}return t.exponent=function(i){return arguments.length?(n=+i,r()):n},Os(t)}function Rp(){var e=II(ll());return e.copy=function(){return Mo(e,Rp()).exponent(e.exponent())},Xe.apply(e,arguments),e}function Op(){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]=S2(e,s/a);return o}function o(s){return s==null||isNaN(s=+s)?r:t[_s(n,s)]}return o.invertExtent=function(s){var a=t.indexOf(s);return a<0?[NaN,NaN]:[a>0?n[a-1]:e[0],a<n.length?n[a]:e[e.length-1]]},o.domain=function(s){if(!arguments.length)return e.slice();e=[];for(let a of s)a!=null&&!isNaN(a=+a)&&e.push(a);return e.sort(Gt),i()},o.range=function(s){return arguments.length?(t=Array.from(s),i()):t.slice()},o.unknown=function(s){return arguments.length?(r=s,o):r},o.quantiles=function(){return n.slice()},o.copy=function(){return Op().domain(e).range(t).unknown(r)},Xe.apply(o,arguments)}function kp(){var e=[.5],t=[0,1],n,r=1;function i(o){return o!=null&&o<=o?t[_s(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 kp().domain(e).range(t).unknown(n)},Xe.apply(i,arguments)}var TI=new Date,EI=new Date;function pe(e,t,n,r){function i(o){return e(o=arguments.length===0?new Date:new Date(+o)),o}return i.floor=o=>(e(o=new Date(+o)),o),i.ceil=o=>(e(o=new Date(o-1)),t(o,1),e(o),o),i.round=o=>{let s=i(o),a=i.ceil(o);return o-s<a-o?s:a},i.offset=(o,s)=>(t(o=new Date(+o),s==null?1:Math.floor(s)),o),i.range=(o,s,a)=>{let c=[];if(o=i.ceil(o),a=a==null?1:Math.floor(a),!(o<s)||!(a>0))return c;let l;do c.push(l=new Date(+o)),t(o,a),e(o);while(l<o&&o<s);return c},i.filter=o=>pe(s=>{if(s>=s)for(;e(s),!o(s);)s.setTime(s-1)},(s,a)=>{if(s>=s)if(a<0)for(;++a<=0;)for(;t(s,-1),!o(s););else for(;--a>=0;)for(;t(s,1),!o(s););}),n&&(i.count=(o,s)=>(TI.setTime(+o),EI.setTime(+s),e(TI),e(EI),Math.floor(n(TI,EI))),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 Fp=pe(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Fp.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?pe(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):Fp);var RMt=Fp.range;var fn=pe(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*1e3)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds()),NO=fn.range;var Fs=pe(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getMinutes()),VW=Fs.range,Ds=pe(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes()),YW=Ds.range;var Ls=pe(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3-e.getMinutes()*6e4)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getHours()),GW=Ls.range,Cs=pe(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours()),WW=Cs.range;var fi=pe(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/864e5,e=>e.getDate()-1),XW=fi.range,dl=pe(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1),HW=dl.range,hl=pe(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>Math.floor(e/864e5)),QW=hl.range;function pl(e){return pe(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/6048e5)}var Ur=pl(0),za=pl(1),ix=pl(2),ox=pl(3),Ro=pl(4),sx=pl(5),ax=pl(6),OO=Ur.range,ZW=za.range,KW=ix.range,JW=ox.range,tX=Ro.range,eX=sx.range,nX=ax.range;function ml(e){return pe(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/6048e5)}var zr=ml(0),ja=ml(1),cx=ml(2),lx=ml(3),Oo=ml(4),ux=ml(5),fx=ml(6),kO=zr.range,rX=ja.range,iX=cx.range,oX=lx.range,sX=Oo.range,aX=ux.range,cX=fx.range;var Bs=pe(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth()),lX=Bs.range,Ps=pe(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth()),uX=Ps.range;var Un=pe(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Un.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:pe(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});var fX=Un.range,zn=pe(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());zn.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:pe(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});var dX=zn.range;function DO(e,t,n,r,i,o){let s=[[fn,1,1e3],[fn,5,5*1e3],[fn,15,15*1e3],[fn,30,30*1e3],[o,1,6e4],[o,5,5*6e4],[o,15,15*6e4],[o,30,30*6e4],[i,1,36e5],[i,3,3*36e5],[i,6,6*36e5],[i,12,12*36e5],[r,1,864e5],[r,2,2*864e5],[n,1,6048e5],[t,1,2592e6],[t,3,3*2592e6],[e,1,31536e6]];function a(l,u,f){let d=u<l;d&&([l,u]=[u,l]);let h=f&&typeof f.range=="function"?f:c(l,u,f),p=h?h.range(l,+u+1):[];return d?p.reverse():p}function c(l,u,f){let d=Math.abs(u-l)/f,h=xs(([,,g])=>g).right(s,d);if(h===s.length)return e.every(_u(l/31536e6,u/31536e6,f));if(h===0)return Fp.every(Math.max(_u(l,u,f),1));let[p,y]=s[d/s[h-1][2]<s[h][2]/d?h-1:h];return p.every(y)}return[a,c]}var[AI,Lp]=DO(zn,Ps,zr,hl,Cs,Ds),[MI,NI]=DO(Un,Bs,Ur,fi,Ls,Fs);function RI(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 OI(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 Cp(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function kI(e){var t=e.dateTime,n=e.date,r=e.time,i=e.periods,o=e.days,s=e.shortDays,a=e.months,c=e.shortMonths,l=Bp(i),u=Pp(i),f=Bp(o),d=Pp(o),h=Bp(s),p=Pp(s),y=Bp(a),g=Pp(a),m=Bp(c),b=Pp(c),x={a:D,A:B,b:C,B:P,c:null,d:UO,e:UO,f:CX,g:GX,G:XX,H:FX,I:DX,j:LX,L:YO,m:BX,M:PX,p:$,q:U,Q:qO,s:VO,S:$X,u:UX,U:zX,V:jX,w:qX,W:VX,x:null,X:null,y:YX,Y:WX,Z:HX,"%":jO},_={a:X,A:tt,b:nt,B:st,c:null,d:zO,e:zO,f:JX,g:lH,G:fH,H:QX,I:ZX,j:KX,L:WO,m:tH,M:eH,p:Y,q:rt,Q:qO,s:VO,S:nH,u:rH,U:iH,V:oH,w:sH,W:aH,x:null,X:null,y:cH,Y:uH,Z:dH,"%":jO},v={a:I,A:E,b:O,B:F,c:S,d:PO,e:PO,f:NX,g:BO,G:CO,H:$O,I:$O,j:TX,L:MX,m:IX,M:EX,p:R,q:SX,Q:OX,s:kX,S:AX,u:bX,U:xX,V:_X,w:gX,W:wX,x:A,X:N,y:BO,Y:CO,Z:vX,"%":RX};x.x=w(n,x),x.X=w(r,x),x.c=w(t,x),_.x=w(n,_),_.X=w(r,_),_.c=w(t,_);function w(j,H){return function(ot){var z=[],Nt=-1,lt=0,Wt=j.length,Xt,et,oe;for(ot instanceof Date||(ot=new Date(+ot));++Nt<Wt;)j.charCodeAt(Nt)===37&&(z.push(j.slice(lt,Nt)),(et=LO[Xt=j.charAt(++Nt)])!=null?Xt=j.charAt(++Nt):et=Xt==="e"?" ":"0",(oe=H[Xt])&&(Xt=oe(ot,et)),z.push(Xt),lt=Nt+1);return z.push(j.slice(lt,Nt)),z.join("")}}function T(j,H){return function(ot){var z=Cp(1900,void 0,1),Nt=M(z,j,ot+="",0),lt,Wt;if(Nt!=ot.length)return null;if("Q"in z)return new Date(z.Q);if("s"in z)return new Date(z.s*1e3+("L"in z?z.L:0));if(H&&!("Z"in z)&&(z.Z=0),"p"in z&&(z.H=z.H%12+z.p*12),z.m===void 0&&(z.m="q"in z?z.q:0),"V"in z){if(z.V<1||z.V>53)return null;"w"in z||(z.w=1),"Z"in z?(lt=OI(Cp(z.y,0,1)),Wt=lt.getUTCDay(),lt=Wt>4||Wt===0?ja.ceil(lt):ja(lt),lt=dl.offset(lt,(z.V-1)*7),z.y=lt.getUTCFullYear(),z.m=lt.getUTCMonth(),z.d=lt.getUTCDate()+(z.w+6)%7):(lt=RI(Cp(z.y,0,1)),Wt=lt.getDay(),lt=Wt>4||Wt===0?za.ceil(lt):za(lt),lt=fi.offset(lt,(z.V-1)*7),z.y=lt.getFullYear(),z.m=lt.getMonth(),z.d=lt.getDate()+(z.w+6)%7)}else("W"in z||"U"in z)&&("w"in z||(z.w="u"in z?z.u%7:"W"in z?1:0),Wt="Z"in z?OI(Cp(z.y,0,1)).getUTCDay():RI(Cp(z.y,0,1)).getDay(),z.m=0,z.d="W"in z?(z.w+6)%7+z.W*7-(Wt+5)%7:z.w+z.U*7-(Wt+6)%7);return"Z"in z?(z.H+=z.Z/100|0,z.M+=z.Z%100,OI(z)):RI(z)}}function M(j,H,ot,z){for(var Nt=0,lt=H.length,Wt=ot.length,Xt,et;Nt<lt;){if(z>=Wt)return-1;if(Xt=H.charCodeAt(Nt++),Xt===37){if(Xt=H.charAt(Nt++),et=v[Xt in LO?H.charAt(Nt++):Xt],!et||(z=et(j,ot,z))<0)return-1}else if(Xt!=ot.charCodeAt(z++))return-1}return z}function R(j,H,ot){var z=l.exec(H.slice(ot));return z?(j.p=u.get(z[0].toLowerCase()),ot+z[0].length):-1}function I(j,H,ot){var z=h.exec(H.slice(ot));return z?(j.w=p.get(z[0].toLowerCase()),ot+z[0].length):-1}function E(j,H,ot){var z=f.exec(H.slice(ot));return z?(j.w=d.get(z[0].toLowerCase()),ot+z[0].length):-1}function O(j,H,ot){var z=m.exec(H.slice(ot));return z?(j.m=b.get(z[0].toLowerCase()),ot+z[0].length):-1}function F(j,H,ot){var z=y.exec(H.slice(ot));return z?(j.m=g.get(z[0].toLowerCase()),ot+z[0].length):-1}function S(j,H,ot){return M(j,t,H,ot)}function A(j,H,ot){return M(j,n,H,ot)}function N(j,H,ot){return M(j,r,H,ot)}function D(j){return s[j.getDay()]}function B(j){return o[j.getDay()]}function C(j){return c[j.getMonth()]}function P(j){return a[j.getMonth()]}function $(j){return i[+(j.getHours()>=12)]}function U(j){return 1+~~(j.getMonth()/3)}function X(j){return s[j.getUTCDay()]}function tt(j){return o[j.getUTCDay()]}function nt(j){return c[j.getUTCMonth()]}function st(j){return a[j.getUTCMonth()]}function Y(j){return i[+(j.getUTCHours()>=12)]}function rt(j){return 1+~~(j.getUTCMonth()/3)}return{format:function(j){var H=w(j+="",x);return H.toString=function(){return j},H},parse:function(j){var H=T(j+="",!1);return H.toString=function(){return j},H},utcFormat:function(j){var H=w(j+="",_);return H.toString=function(){return j},H},utcParse:function(j){var H=T(j+="",!0);return H.toString=function(){return j},H}}}var LO={"-":"",_:" ",0:"0"},dn=/^\s*\d+/,pX=/^%/,mX=/[\\^$*+?|[\]().{}]/g;function te(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",o=i.length;return r+(o<n?new Array(n-o+1).join(t)+i:i)}function yX(e){return e.replace(mX,"\\$&")}function Bp(e){return new RegExp("^(?:"+e.map(yX).join("|")+")","i")}function Pp(e){return new Map(e.map((t,n)=>[t.toLowerCase(),n]))}function gX(e,t,n){var r=dn.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function bX(e,t,n){var r=dn.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function xX(e,t,n){var r=dn.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function _X(e,t,n){var r=dn.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function wX(e,t,n){var r=dn.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function CO(e,t,n){var r=dn.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function BO(e,t,n){var r=dn.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function vX(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 SX(e,t,n){var r=dn.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function IX(e,t,n){var r=dn.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function PO(e,t,n){var r=dn.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function TX(e,t,n){var r=dn.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function $O(e,t,n){var r=dn.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function EX(e,t,n){var r=dn.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function AX(e,t,n){var r=dn.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function MX(e,t,n){var r=dn.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function NX(e,t,n){var r=dn.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function RX(e,t,n){var r=pX.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function OX(e,t,n){var r=dn.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function kX(e,t,n){var r=dn.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function UO(e,t){return te(e.getDate(),t,2)}function FX(e,t){return te(e.getHours(),t,2)}function DX(e,t){return te(e.getHours()%12||12,t,2)}function LX(e,t){return te(1+fi.count(Un(e),e),t,3)}function YO(e,t){return te(e.getMilliseconds(),t,3)}function CX(e,t){return YO(e,t)+"000"}function BX(e,t){return te(e.getMonth()+1,t,2)}function PX(e,t){return te(e.getMinutes(),t,2)}function $X(e,t){return te(e.getSeconds(),t,2)}function UX(e){var t=e.getDay();return t===0?7:t}function zX(e,t){return te(Ur.count(Un(e)-1,e),t,2)}function GO(e){var t=e.getDay();return t>=4||t===0?Ro(e):Ro.ceil(e)}function jX(e,t){return e=GO(e),te(Ro.count(Un(e),e)+(Un(e).getDay()===4),t,2)}function qX(e){return e.getDay()}function VX(e,t){return te(za.count(Un(e)-1,e),t,2)}function YX(e,t){return te(e.getFullYear()%100,t,2)}function GX(e,t){return e=GO(e),te(e.getFullYear()%100,t,2)}function WX(e,t){return te(e.getFullYear()%1e4,t,4)}function XX(e,t){var n=e.getDay();return e=n>=4||n===0?Ro(e):Ro.ceil(e),te(e.getFullYear()%1e4,t,4)}function HX(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+te(t/60|0,"0",2)+te(t%60,"0",2)}function zO(e,t){return te(e.getUTCDate(),t,2)}function QX(e,t){return te(e.getUTCHours(),t,2)}function ZX(e,t){return te(e.getUTCHours()%12||12,t,2)}function KX(e,t){return te(1+dl.count(zn(e),e),t,3)}function WO(e,t){return te(e.getUTCMilliseconds(),t,3)}function JX(e,t){return WO(e,t)+"000"}function tH(e,t){return te(e.getUTCMonth()+1,t,2)}function eH(e,t){return te(e.getUTCMinutes(),t,2)}function nH(e,t){return te(e.getUTCSeconds(),t,2)}function rH(e){var t=e.getUTCDay();return t===0?7:t}function iH(e,t){return te(zr.count(zn(e)-1,e),t,2)}function XO(e){var t=e.getUTCDay();return t>=4||t===0?Oo(e):Oo.ceil(e)}function oH(e,t){return e=XO(e),te(Oo.count(zn(e),e)+(zn(e).getUTCDay()===4),t,2)}function sH(e){return e.getUTCDay()}function aH(e,t){return te(ja.count(zn(e)-1,e),t,2)}function cH(e,t){return te(e.getUTCFullYear()%100,t,2)}function lH(e,t){return e=XO(e),te(e.getUTCFullYear()%100,t,2)}function uH(e,t){return te(e.getUTCFullYear()%1e4,t,4)}function fH(e,t){var n=e.getUTCDay();return e=n>=4||n===0?Oo(e):Oo.ceil(e),te(e.getUTCFullYear()%1e4,t,4)}function dH(){return"+0000"}function jO(){return"%"}function qO(e){return+e}function VO(e){return Math.floor(+e/1e3)}var Ku,Ju,HO,ko,QO;FI({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 FI(e){return Ku=kI(e),Ju=Ku.format,HO=Ku.parse,ko=Ku.utcFormat,QO=Ku.utcParse,Ku}function hH(e){return new Date(e)}function pH(e){return e instanceof Date?+e:+new Date(+e)}function dx(e,t,n,r,i,o,s,a,c,l){var u=Tp(),f=u.invert,d=u.domain,h=l(".%L"),p=l(":%S"),y=l("%I:%M"),g=l("%I %p"),m=l("%a %d"),b=l("%b %d"),x=l("%B"),_=l("%Y");function v(w){return(c(w)<w?h:a(w)<w?p:s(w)<w?y:o(w)<w?g:r(w)<w?i(w)<w?m:b:n(w)<w?x:_)(w)}return u.invert=function(w){return new Date(f(w))},u.domain=function(w){return arguments.length?d(Array.from(w,pH)):d().map(hH)},u.ticks=function(w){var T=d();return e(T[0],T[T.length-1],w??10)},u.tickFormat=function(w,T){return T==null?v:l(T)},u.nice=function(w){var T=d();return(!w||typeof w.range!="function")&&(w=t(T[0],T[T.length-1],w??10)),w?d(Ap(T,w)):u},u.copy=function(){return Mo(u,dx(e,t,n,r,i,o,s,a,c,l))},u}function hx(){return Xe.apply(dx(MI,NI,Un,Bs,Ur,fi,Ls,Fs,fn,Ju).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function px(){return Xe.apply(dx(AI,Lp,zn,Ps,zr,dl,Cs,Ds,fn,ko).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function $p(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function mx(){var e=0,t=.5,n=1,r=1,i,o,s,a,c,l=vr,u,f=!1,d;function h(y){return isNaN(y=+y)?d:(y=.5+((y=+u(y))-o)*(r*y<r*o?a:c),l(f?Math.max(0,Math.min(1,y)):y))}h.domain=function(y){return arguments.length?([e,t,n]=y,i=u(e=+e),o=u(t=+t),s=u(n=+n),a=i===o?0:.5/(o-i),c=o===s?0:.5/(s-o),r=o<i?-1:1,h):[e,t,n]},h.clamp=function(y){return arguments.length?(f=!!y,h):f},h.interpolator=function(y){return arguments.length?(l=y,h):l};function p(y){return function(g){var m,b,x;return arguments.length?([m,b,x]=g,l=xo(y,[m,b,x]),h):[l(0),l(.5),l(1)]}}return h.range=p(Pr),h.rangeRound=p(Qc),h.unknown=function(y){return arguments.length?(d=y,h):d},function(y){return u=y,i=y(e),o=y(t),s=y(n),a=i===o?0:.5/(o-i),c=o===s?0:.5/(s-o),r=o<i?-1:1,h}}function Up(){var e=Os(mx()(vr));return e.copy=function(){return $p(e,Up())},Sp.apply(e,arguments)}function yx(){var e=vI(mx()).domain([.1,1,10]);return e.copy=function(){return $p(e,yx()).base(e.base())},Sp.apply(e,arguments)}function gx(){var e=SI(mx());return e.copy=function(){return $p(e,gx()).constant(e.constant())},Sp.apply(e,arguments)}function bx(){var e=II(mx());return e.copy=function(){return $p(e,bx()).exponent(e.exponent())},Sp.apply(e,arguments)}function G(e){for(var t=e.length/6|0,n=new Array(t),r=0;r<t;)n[r]="#"+e.slice(r*6,++r*6);return n}var DI=G("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");var LI=G("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666");var CI=G("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666");var BI=G("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");var PI=G("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2");var $I=G("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc");var UI=G("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999");var zI=G("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3");var jI=G("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");var qI=G("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");var ft=e=>$2(e[e.length-1]);var xx=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(G),_x=ft(xx);var wx=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(G),vx=ft(wx);var Sx=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(G),Ix=ft(Sx);var Tx=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(G),Ex=ft(Tx);var zp=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(G),tf=ft(zp);var Ax=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(G),Mx=ft(Ax);var jp=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(G),ef=ft(jp);var Nx=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(G),Rx=ft(Nx);var Ox=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(G),kx=ft(Ox);var Fx=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(G),Dx=ft(Fx);var Lx=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(G),Cx=ft(Lx);var Bx=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(G),Px=ft(Bx);var $x=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(G),Ux=ft($x);var zx=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(G),jx=ft(zx);var qx=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(G),Vx=ft(qx);var Yx=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(G),Gx=ft(Yx);var Wx=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(G),Xx=ft(Wx);var Hx=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(G),Qx=ft(Hx);var Zx=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(G),Kx=ft(Zx);var Jx=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(G),t1=ft(Jx);var e1=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(G),n1=ft(e1);var r1=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(G),i1=ft(r1);var o1=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(G),s1=ft(o1);var a1=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(G),c1=ft(a1);var l1=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(G),u1=ft(l1);var f1=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(G),d1=ft(f1);var h1=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(G),p1=ft(h1);function m1(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 y1=Nu(Qn(300,.5,0),Qn(-240,.5,1));var b1=Nu(Qn(-100,.75,.35),Qn(80,1.5,.8)),x1=Nu(Qn(260,.75,.35),Qn(80,1.5,.8)),g1=Qn();function _1(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return g1.h=360*e-100,g1.s=1.5-1.5*t,g1.l=.8-.9*t,g1+""}var w1=ln(),mH=Math.PI/3,yH=Math.PI*2/3;function v1(e){var t;return e=(.5-e)*Math.PI,w1.r=255*(t=Math.sin(e))*t,w1.g=255*(t=Math.sin(e+mH))*t,w1.b=255*(t=Math.sin(e+yH))*t,w1+""}function S1(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 I1(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}var T1=I1(G("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),E1=I1(G("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),A1=I1(G("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),M1=I1(G("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function He(e){return function(){return e}}var VI=Math.cos;var nf=Math.min,qp=Math.sin,ee=Math.sqrt,YI=1e-12,yl=Math.PI,K4t=yl/2,rf=2*yl;function N1(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 Da(t)}var nRt=Array.prototype.slice;function R1(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function ZO(e){this._context=e}ZO.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function $s(e){return new ZO(e)}function O1(e){return e[0]}function k1(e){return e[1]}function Vp(e,t){var n=He(!0),r=null,i=$s,o=null,s=N1(a);e=typeof e=="function"?e:e===void 0?O1:He(e),t=typeof t=="function"?t:t===void 0?k1:He(t);function a(c){var l,u=(c=R1(c)).length,f,d=!1,h;for(r==null&&(o=i(h=s())),l=0;l<=u;++l)!(l<u&&n(f=c[l],l,c))===d&&((d=!d)?o.lineStart():o.lineEnd()),d&&o.point(+e(f,l,c),+t(f,l,c));if(h)return o=null,h+""||null}return a.x=function(c){return arguments.length?(e=typeof c=="function"?c:He(+c),a):e},a.y=function(c){return arguments.length?(t=typeof c=="function"?c:He(+c),a):t},a.defined=function(c){return arguments.length?(n=typeof c=="function"?c:He(!!c),a):n},a.curve=function(c){return arguments.length?(i=c,r!=null&&(o=i(r)),a):i},a.context=function(c){return arguments.length?(c==null?r=o=null:o=i(r=c),a):r},a}function of(e,t,n){var r=null,i=He(!0),o=null,s=$s,a=null,c=N1(l);e=typeof e=="function"?e:e===void 0?O1:He(+e),t=typeof t=="function"?t:t===void 0?He(0):He(+t),n=typeof n=="function"?n:n===void 0?k1:He(+n);function l(f){var d,h,p,y=(f=R1(f)).length,g,m=!1,b,x=new Array(y),_=new Array(y);for(o==null&&(a=s(b=c())),d=0;d<=y;++d){if(!(d<y&&i(g=f[d],d,f))===m)if(m=!m)h=d,a.areaStart(),a.lineStart();else{for(a.lineEnd(),a.lineStart(),p=d-1;p>=h;--p)a.point(x[p],_[p]);a.lineEnd(),a.areaEnd()}m&&(x[d]=+e(g,d,f),_[d]=+t(g,d,f),a.point(r?+r(g,d,f):x[d],n?+n(g,d,f):_[d]))}if(b)return a=null,b+""||null}function u(){return Vp().defined(i).curve(s).context(o)}return l.x=function(f){return arguments.length?(e=typeof f=="function"?f:He(+f),r=null,l):e},l.x0=function(f){return arguments.length?(e=typeof f=="function"?f:He(+f),l):e},l.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:He(+f),l):r},l.y=function(f){return arguments.length?(t=typeof f=="function"?f:He(+f),n=null,l):t},l.y0=function(f){return arguments.length?(t=typeof f=="function"?f:He(+f),l):t},l.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:He(+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:He(!!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 F1=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 GI(e){return new F1(e,!0)}function WI(e){return new F1(e,!1)}var gH=ee(3),Yp={draw(e,t){let n=ee(t+nf(t/28,.75))*.59436,r=n/2,i=r*gH;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 Us={draw(e,t){let n=ee(t/yl);e.moveTo(n,0),e.arc(0,0,n,0,rf)}};var Gp={draw(e,t){let n=ee(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}};var KO=ee(1/3),bH=KO*2,Wp={draw(e,t){let n=ee(t/bH),r=n*KO;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}};var Xp={draw(e,t){let n=ee(t)*.62625;e.moveTo(0,-n),e.lineTo(n,0),e.lineTo(0,n),e.lineTo(-n,0),e.closePath()}};var Hp={draw(e,t){let n=ee(t-nf(t/7,2))*.87559;e.moveTo(-n,0),e.lineTo(n,0),e.moveTo(0,n),e.lineTo(0,-n)}};var Qp={draw(e,t){let n=ee(t),r=-n/2;e.rect(r,r,n,n)}};var Zp={draw(e,t){let n=ee(t)*.4431;e.moveTo(n,n),e.lineTo(n,-n),e.lineTo(-n,-n),e.lineTo(-n,n),e.closePath()}};var xH=.8908130915292852,JO=qp(yl/10)/qp(7*yl/10),_H=qp(rf/10)*JO,wH=-VI(rf/10)*JO,Kp={draw(e,t){let n=ee(t*xH),r=_H*n,i=wH*n;e.moveTo(0,-n),e.lineTo(r,i);for(let o=1;o<5;++o){let s=rf*o/5,a=VI(s),c=qp(s);e.lineTo(c*n,-a*n),e.lineTo(a*r-c*i,c*r+a*i)}e.closePath()}};var XI=ee(3),Jp={draw(e,t){let n=-ee(t/(XI*3));e.moveTo(0,n*2),e.lineTo(-XI*n,-n),e.lineTo(XI*n,-n),e.closePath()}};var vH=ee(3),tm={draw(e,t){let n=ee(t)*.6824,r=n/2,i=n*vH/2;e.moveTo(0,-n),e.lineTo(i,r),e.lineTo(-i,r),e.closePath()}};var di=-.5,hi=ee(3)/2,HI=1/ee(12),SH=(HI/2+1)*3,em={draw(e,t){let n=ee(t/SH),r=n/2,i=n*HI,o=r,s=n*HI+n,a=-o,c=s;e.moveTo(r,i),e.lineTo(o,s),e.lineTo(a,c),e.lineTo(di*r-hi*i,hi*r+di*i),e.lineTo(di*o-hi*s,hi*o+di*s),e.lineTo(di*a-hi*c,hi*a+di*c),e.lineTo(di*r+hi*i,di*i-hi*r),e.lineTo(di*o+hi*s,di*s-hi*o),e.lineTo(di*a+hi*c,di*c-hi*a),e.closePath()}};var sf={draw(e,t){let n=ee(t-nf(t/6,1.7))*.6189;e.moveTo(-n,-n),e.lineTo(n,n),e.moveTo(-n,n),e.lineTo(n,-n)}};var D1=[Us,Gp,Wp,Qp,Kp,Jp,em],QI=[Us,Hp,sf,tm,Yp,Zp,Xp];function pi(){}function af(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function nm(e){this._context=e}nm.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:af(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:af(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function ZI(e){return new nm(e)}function tk(e){this._context=e}tk.prototype={areaStart:pi,areaEnd:pi,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:af(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function KI(e){return new tk(e)}function ek(e){this._context=e}ek.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:af(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function JI(e){return new ek(e)}function nk(e,t){this._basis=new nm(e),this._beta=t}nk.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 tT=function e(t){function n(r){return t===1?new nm(r):new nk(r,t)}return n.beta=function(r){return e(+r)},n}(.85);function cf(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function L1(e,t){this._context=e,this._k=(1-t)/6}L1.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:cf(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:cf(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var eT=function e(t){function n(r){return new L1(r,t)}return n.tension=function(r){return e(+r)},n}(0);function C1(e,t){this._context=e,this._k=(1-t)/6}C1.prototype={areaStart:pi,areaEnd:pi,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:cf(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var nT=function e(t){function n(r){return new C1(r,t)}return n.tension=function(r){return e(+r)},n}(0);function B1(e,t){this._context=e,this._k=(1-t)/6}B1.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:cf(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var rT=function e(t){function n(r){return new B1(r,t)}return n.tension=function(r){return e(+r)},n}(0);function rm(e,t,n){var r=e._x1,i=e._y1,o=e._x2,s=e._y2;if(e._l01_a>YI){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>YI){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 rk(e,t){this._context=e,this._alpha=t}rk.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:rm(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var iT=function e(t){function n(r){return t?new rk(r,t):new L1(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function ik(e,t){this._context=e,this._alpha=t}ik.prototype={areaStart:pi,areaEnd:pi,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:rm(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 oT=function e(t){function n(r){return t?new ik(r,t):new C1(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function ok(e,t){this._context=e,this._alpha=t}ok.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:rm(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var sT=function e(t){function n(r){return t?new ok(r,t):new B1(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function sk(e){this._context=e}sk.prototype={areaStart:pi,areaEnd:pi,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function aT(e){return new sk(e)}function ak(e){return e<0?-1:1}function ck(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(ak(o)+ak(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(a))||0}function lk(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function cT(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 P1(e){this._context=e}P1.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:cT(this,this._t0,lk(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,cT(this,lk(this,n=ck(this,e,t)),n);break;default:cT(this,this._t0,n=ck(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function uk(e){this._context=new fk(e)}(uk.prototype=Object.create(P1.prototype)).point=function(e,t){P1.prototype.point.call(this,t,e)};function fk(e){this._context=e}fk.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 lT(e){return new P1(e)}function uT(e){return new uk(e)}function hk(e){this._context=e}hk.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=dk(e),i=dk(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 dk(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 fT(e){return new hk(e)}function $1(e,t){this._context=e,this._t=t}$1.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function dT(e){return new $1(e,.5)}function hT(e){return new $1(e,0)}function pT(e){return new $1(e,1)}var im=e=>()=>e;function mT(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 jr(e,t,n){this.k=e,this.x=t,this.y=n}jr.prototype={constructor:jr,scale:function(e){return e===1?this:new jr(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new jr(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 om=new jr(1,0,0);yT.prototype=jr.prototype;function yT(e){for(;!e.__zoom;)if(!(e=e.parentNode))return om;return e.__zoom}function U1(e){e.stopImmediatePropagation()}function lf(e){e.preventDefault(),e.stopImmediatePropagation()}function IH(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function TH(){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 pk(){return this.__zoom||om}function EH(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function AH(){return navigator.maxTouchPoints||"ontouchstart"in this}function MH(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 gT(){var e=IH,t=TH,n=MH,r=EH,i=AH,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=Y2,l=Vc("start","zoom","end"),u,f,d,h=500,p=150,y=0,g=10;function m(S){S.property("__zoom",pk).on("wheel.zoom",M,{passive:!1}).on("mousedown.zoom",R).on("dblclick.zoom",I).filter(i).on("touchstart.zoom",E).on("touchmove.zoom",O).on("touchend.zoom touchcancel.zoom",F).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(S,A,N,D){var B=S.selection?S.selection():S;B.property("__zoom",pk),S!==B?v(S,A,N,D):B.interrupt().each(function(){w(this,arguments).event(D).start().zoom(null,typeof A=="function"?A.apply(this,arguments):A).end()})},m.scaleBy=function(S,A,N,D){m.scaleTo(S,function(){var B=this.__zoom.k,C=typeof A=="function"?A.apply(this,arguments):A;return B*C},N,D)},m.scaleTo=function(S,A,N,D){m.transform(S,function(){var B=t.apply(this,arguments),C=this.__zoom,P=N==null?_(B):typeof N=="function"?N.apply(this,arguments):N,$=C.invert(P),U=typeof A=="function"?A.apply(this,arguments):A;return n(x(b(C,U),P,$),B,s)},N,D)},m.translateBy=function(S,A,N,D){m.transform(S,function(){return n(this.__zoom.translate(typeof A=="function"?A.apply(this,arguments):A,typeof N=="function"?N.apply(this,arguments):N),t.apply(this,arguments),s)},null,D)},m.translateTo=function(S,A,N,D,B){m.transform(S,function(){var C=t.apply(this,arguments),P=this.__zoom,$=D==null?_(C):typeof D=="function"?D.apply(this,arguments):D;return n(om.translate($[0],$[1]).scale(P.k).translate(typeof A=="function"?-A.apply(this,arguments):-A,typeof N=="function"?-N.apply(this,arguments):-N),C,s)},D,B)};function b(S,A){return A=Math.max(o[0],Math.min(o[1],A)),A===S.k?S:new jr(A,S.x,S.y)}function x(S,A,N){var D=A[0]-N[0]*S.k,B=A[1]-N[1]*S.k;return D===S.x&&B===S.y?S:new jr(S.k,D,B)}function _(S){return[(+S[0][0]+ +S[1][0])/2,(+S[0][1]+ +S[1][1])/2]}function v(S,A,N,D){S.on("start.zoom",function(){w(this,arguments).event(D).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).event(D).end()}).tween("zoom",function(){var B=this,C=arguments,P=w(B,C).event(D),$=t.apply(B,C),U=N==null?_($):typeof N=="function"?N.apply(B,C):N,X=Math.max($[1][0]-$[0][0],$[1][1]-$[0][1]),tt=B.__zoom,nt=typeof A=="function"?A.apply(B,C):A,st=c(tt.invert(U).concat(X/tt.k),nt.invert(U).concat(X/nt.k));return function(Y){if(Y===1)Y=nt;else{var rt=st(Y),j=X/rt[2];Y=new jr(j,U[0]-rt[0]*j,U[1]-rt[1]*j)}P.zoom(null,Y)}})}function w(S,A,N){return!N&&S.__zooming||new T(S,A)}function T(S,A){this.that=S,this.args=A,this.active=0,this.sourceEvent=null,this.extent=t.apply(S,A),this.taps=0}T.prototype={event:function(S){return S&&(this.sourceEvent=S),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(S,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=zt(this.that).datum();l.call(S,this.that,new mT(S,{sourceEvent:this.sourceEvent,target:m,type:S,transform:this.that.__zoom,dispatch:l}),A)}};function M(S,...A){if(!e.apply(this,arguments))return;var N=w(this,A).event(S),D=this.__zoom,B=Math.max(o[0],Math.min(o[1],D.k*Math.pow(2,r.apply(this,arguments)))),C=Ln(S);if(N.wheel)(N.mouse[0][0]!==C[0]||N.mouse[0][1]!==C[1])&&(N.mouse[1]=D.invert(N.mouse[0]=C)),clearTimeout(N.wheel);else{if(D.k===B)return;N.mouse=[C,D.invert(C)],_o(this),N.start()}lf(S),N.wheel=setTimeout(P,p),N.zoom("mouse",n(x(b(D,B),N.mouse[0],N.mouse[1]),N.extent,s));function P(){N.wheel=null,N.end()}}function R(S,...A){if(d||!e.apply(this,arguments))return;var N=S.currentTarget,D=w(this,A,!0).event(S),B=zt(S.view).on("mousemove.zoom",U,!0).on("mouseup.zoom",X,!0),C=Ln(S,N),P=S.clientX,$=S.clientY;Lh(S.view),U1(S),D.mouse=[C,this.__zoom.invert(C)],_o(this),D.start();function U(tt){if(lf(tt),!D.moved){var nt=tt.clientX-P,st=tt.clientY-$;D.moved=nt*nt+st*st>y}D.event(tt).zoom("mouse",n(x(D.that.__zoom,D.mouse[0]=Ln(tt,N),D.mouse[1]),D.extent,s))}function X(tt){B.on("mousemove.zoom mouseup.zoom",null),Ch(tt.view,D.moved),lf(tt),D.event(tt).end()}}function I(S,...A){if(e.apply(this,arguments)){var N=this.__zoom,D=Ln(S.changedTouches?S.changedTouches[0]:S,this),B=N.invert(D),C=N.k*(S.shiftKey?.5:2),P=n(x(b(N,C),D,B),t.apply(this,A),s);lf(S),a>0?zt(this).transition().duration(a).call(v,P,D,S):zt(this).call(m.transform,P,D,S)}}function E(S,...A){if(e.apply(this,arguments)){var N=S.touches,D=N.length,B=w(this,A,S.changedTouches.length===D).event(S),C,P,$,U;for(U1(S),P=0;P<D;++P)$=N[P],U=Ln($,this),U=[U,this.__zoom.invert(U),$.identifier],B.touch0?!B.touch1&&B.touch0[2]!==U[2]&&(B.touch1=U,B.taps=0):(B.touch0=U,C=!0,B.taps=1+!!u);u&&(u=clearTimeout(u)),C&&(B.taps<2&&(f=U[0],u=setTimeout(function(){u=null},h)),_o(this),B.start())}}function O(S,...A){if(this.__zooming){var N=w(this,A).event(S),D=S.changedTouches,B=D.length,C,P,$,U;for(lf(S),C=0;C<B;++C)P=D[C],$=Ln(P,this),N.touch0&&N.touch0[2]===P.identifier?N.touch0[0]=$:N.touch1&&N.touch1[2]===P.identifier&&(N.touch1[0]=$);if(P=N.that.__zoom,N.touch1){var X=N.touch0[0],tt=N.touch0[1],nt=N.touch1[0],st=N.touch1[1],Y=(Y=nt[0]-X[0])*Y+(Y=nt[1]-X[1])*Y,rt=(rt=st[0]-tt[0])*rt+(rt=st[1]-tt[1])*rt;P=b(P,Math.sqrt(Y/rt)),$=[(X[0]+nt[0])/2,(X[1]+nt[1])/2],U=[(tt[0]+st[0])/2,(tt[1]+st[1])/2]}else if(N.touch0)$=N.touch0[0],U=N.touch0[1];else return;N.zoom("touch",n(x(P,$,U),N.extent,s))}}function F(S,...A){if(this.__zooming){var N=w(this,A).event(S),D=S.changedTouches,B=D.length,C,P;for(U1(S),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),C=0;C<B;++C)P=D[C],N.touch0&&N.touch0[2]===P.identifier?delete N.touch0:N.touch1&&N.touch1[2]===P.identifier&&delete N.touch1;if(N.touch1&&!N.touch0&&(N.touch0=N.touch1,delete N.touch1),N.touch0)N.touch0[1]=this.__zoom.invert(N.touch0[0]);else if(N.end(),N.taps===2&&(P=Ln(P,this),Math.hypot(f[0]-P[0],f[1]-P[1])<g)){var $=zt(this).on("dblclick.zoom");$&&$.apply(this,arguments)}}}return m.wheelDelta=function(S){return arguments.length?(r=typeof S=="function"?S:im(+S),m):r},m.filter=function(S){return arguments.length?(e=typeof S=="function"?S:im(!!S),m):e},m.touchable=function(S){return arguments.length?(i=typeof S=="function"?S:im(!!S),m):i},m.extent=function(S){return arguments.length?(t=typeof S=="function"?S:im([[+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?(g=+S,m):g},m}function Ue(e){return e!=null&&!Number.isNaN(e)}function hn(e,t){return+Ue(t)-+Ue(e)||Gt(e,t)}function gl(e,t){return+Ue(t)-+Ue(e)||Wn(e,t)}function sm(e){return e!=null&&`${e}`!=""}function uf(e){return isFinite(e)?e:NaN}function rr(e){return e>0&&isFinite(e)?e:NaN}function qa(e){return e<0&&isFinite(e)?e:NaN}var df=1e3,Ya=df*60,Ga=Ya*60,Do=Ga*24,Fo=Do*7,bl=Do*30,Va=Do*365,bT=[["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",df],["5 seconds",5*df],["15 seconds",15*df],["30 seconds",30*df],["minute",Ya],["5 minutes",5*Ya],["15 minutes",15*Ya],["30 minutes",30*Ya],["hour",Ga],["3 hours",3*Ga],["6 hours",6*Ga],["12 hours",12*Ga],["day",Do],["2 days",2*Do],["week",Fo],["2 weeks",2*Fo],["month",bl],["3 months",3*bl],["6 months",6*bl],["year",Va],["2 years",2*Va],["5 years",5*Va],["10 years",10*Va],["20 years",20*Va],["50 years",50*Va],["100 years",100*Va]],xT=new Map([["second",df],["minute",Ya],["hour",Ga],["day",Do],["monday",Fo],["tuesday",Fo],["wednesday",Fo],["thursday",Fo],["friday",Fo],["saturday",Fo],["sunday",Fo],["week",Fo],["month",bl],["year",Va]]),yk=new Map([["second",fn],["minute",Fs],["hour",Ls],["day",fi],["monday",za],["tuesday",ix],["wednesday",ox],["thursday",Ro],["friday",sx],["saturday",ax],["sunday",Ur],["week",Ur],["month",Bs],["year",Un]]),_T=new Map([["second",fn],["minute",Ds],["hour",Cs],["day",hl],["monday",ja],["tuesday",cx],["wednesday",lx],["thursday",Oo],["friday",ux],["saturday",fx],["sunday",zr],["week",zr],["month",Ps],["year",zn]]),hf=Symbol("intervalDuration"),j1=Symbol("intervalType");for(let[e,t]of yk)t[hf]=xT.get(e),t[j1]="time";for(let[e,t]of _T)t[hf]=xT.get(e),t[j1]="utc";var am=[["year",zn,"utc"],["month",Ps,"utc"],["day",hl,"utc",6*bl],["hour",Cs,"utc",3*Do],["minute",Ds,"utc",6*Ga],["second",fn,"utc",30*Ya]],z1=[["year",Un,"time"],["month",Bs,"time"],["day",fi,"time",6*bl],["hour",Ls,"time",3*Do],["minute",Fs,"time",6*Ga],["second",fn,"time",30*Ya]],NH=[am[0],z1[0],am[1],z1[1],am[2],z1[2],...am.slice(3)];function q1(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=_T.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 wT(e){return gk(q1(e),"time")}function cm(e){return gk(q1(e),"utc")}function gk([e,t],n){let r=(n==="time"?yk:_T).get(e);return t>1&&(r=r.every(t),r[hf]=xT.get(e)*t,r[j1]=n),r}function vT(e,t){if(!(t>1))return;let n=e[hf];if(!bT.some(([,i])=>i===n)||n%Do===0&&Do<n&&n<bl)return;let[r]=bT[xs(([,i])=>Math.log(i)).center(bT,Math.log(n*t))];return(e[j1]==="time"?wT:cm)(r)}function mk(e,t,n){let r=t==="time"?Ju:ko;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=RH(n);switch(e){case"millisecond":return ff(r(".%L"),r(":%M:%S"),i);case"second":return ff(r(":%S"),r("%-I:%M"),i);case"minute":return ff(r("%-I:%M"),r("%p"),i);case"hour":return ff(r("%-I %p"),r("%b %-d"),i);case"day":return ff(r("%-d"),r("%b"),i);case"month":return ff(r("%b"),r("%Y"),i);case"year":return r("%Y")}throw new Error("unable to format time ticks")}function RH(e){return e==="left"||e==="right"?(t,n)=>`
10
+ ]`}concat(...t){let n=this.schema,r=this.data.concat(t.flatMap(({data:i})=>i));return new e(n,r.map(i=>new ke(n,i)))}slice(t,n){let r=this.schema;[t,n]=Ed({length:this.numRows},t,n);let i=_g(this.data,this._offsets,t,n);return new e(r,i.map(o=>new ke(r,o)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(n=>n.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let n=this.data.map(r=>r.children[t]);if(n.length===0){let{type:r}=this.schema.fields[t],i=Dt({type:r,length:0,nullCount:0});n.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new Vt(n)}return null}setChild(t,n){var r;return this.setChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(i=>i.name===t),n)}setChildAt(t,n){let r=this.schema,i=[...this.batches];if(t>-1&&t<this.numCols){n||(n=new Vt([Dt({type:new Gn,length:this.numRows})]));let o=r.fields.slice(),s=o[t].clone({type:n.type}),a=this.schema.fields.map((c,l)=>this.getChildAt(l));[o[t],a[t]]=[s,n],[r,i]=Qg(r,a)}return new e(r,i)}select(t){let n=this.schema.fields.reduce((r,i,o)=>r.set(i.name,o),new Map);return this.selectAt(t.map(r=>n.get(r)).filter(r=>r>-1))}selectAt(t){let n=this.schema.selectAt(t),r=this.batches.map(i=>i.selectAt(t));return new e(n,r)}assign(t){let n=this.schema.fields,[r,i]=t.schema.fields.reduce((a,c,l)=>{let[u,f]=a,d=n.findIndex(h=>h.name===c.name);return~d?f[d]=l:u.push(l),a},[[],[]]),o=this.schema.assign(t.schema),s=[...n.map((a,c)=>[c,i[c]]).map(([a,c])=>c===void 0?this.getChildAt(a):t.getChildAt(c)),...r.map(a=>t.getChildAt(a))].filter(Boolean);return new e(...Qg(o,s))}};$O=Symbol.toStringTag;sn[$O]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e.isValid=la(Nd),e.get=la(je.getVisitFn(D.Struct)),e.set=wg(_n.getVisitFn(D.Struct)),e.indexOf=vg(Sc.getVisitFn(D.Struct)),e.getByteLength=la(Mr.getVisitFn(D.Struct)),"Table"))(sn.prototype);var zO,ke=class e{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof re))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=Dt({nullCount:0,type:new ye(this.schema.fields),children:this.schema.fields.map(n=>Dt({type:n.type,nullCount:0}))})]=t,!(this.data instanceof se))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=UO(this.schema,this.data.children);break}case 1:{let[n]=t,{fields:r,children:i,length:o}=Object.keys(n).reduce((c,l,u)=>(c.children[u]=n[l],c.length=Math.max(c.length,n[l].length),c.fields[u]=$t.new({name:l,type:n[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),s=new re(r),a=Dt({type:new ye(r),length:o,children:i,nullCount:0});[this.schema,this.data]=UO(s,a.children,o);break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get dictionaries(){return this._dictionaries||(this._dictionaries=qO(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(t){return this.data.getValid(t)}get(t){return je.visit(this.data,t)}set(t,n){return _n.visit(this.data,t,n)}indexOf(t,n){return Sc.visit(this.data,t,n)}getByteLength(t){return Mr.visit(this.data,t)}[Symbol.iterator](){return Jl.visit(new Vt([this.data]))}toArray(){return[...this]}concat(...t){return new sn(this.schema,[this,...t])}slice(t,n){let[r]=new Vt([this.data]).slice(t,n).data;return new e(this.schema,r)}getChild(t){var n;return this.getChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(r=>r.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new Vt([this.data.children[t]]):null}setChild(t,n){var r;return this.setChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(i=>i.name===t),n)}setChildAt(t,n){let r=this.schema,i=this.data;if(t>-1&&t<this.numCols){n||(n=new Vt([Dt({type:new Gn,length:this.numRows})]));let o=r.fields.slice(),s=i.children.slice(),a=o[t].clone({type:n.type});[o[t],s[t]]=[a,n.data[0]],r=new re(o,new Map(this.schema.metadata)),i=Dt({type:new ye(o),children:s})}return new e(r,i)}select(t){let n=this.schema.select(t),r=new ye(n.fields),i=[];for(let o of t){let s=this.schema.fields.findIndex(a=>a.name===o);~s&&(i[s]=this.data.children[s])}return new e(n,Dt({type:r,length:this.numRows,children:i}))}selectAt(t){let n=this.schema.selectAt(t),r=t.map(o=>this.data.children[o]).filter(Boolean),i=Dt({type:new ye(n.fields),length:this.numRows,children:r});return new e(n,i)}};zO=Symbol.toStringTag;ke[zO]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(ke.prototype);function UO(e,t,n=t.reduce((r,i)=>Math.max(r,i.length),0)){var r;let i=[...e.fields],o=[...t],s=(n+63&-64)>>3;for(let[a,c]of e.fields.entries()){let l=t[a];(!l||l.length!==n)&&(i[a]=c.clone({nullable:!0}),o[a]=(r=l?._changeLengthAndBackfillNullBitmap(n))!==null&&r!==void 0?r:Dt({type:c.type,length:n,nullCount:n,nullBitmap:new Uint8Array(s)}))}return[e.assign(i),Dt({type:new ye(i),length:n,children:o})]}function qO(e,t,n=new Map){var r,i;if(((r=e?.length)!==null&&r!==void 0?r:0)>0&&e?.length===t?.length)for(let o=-1,s=e.length;++o<s;){let{type:a}=e[o],c=t[o];for(let l of[c,...((i=c?.dictionary)===null||i===void 0?void 0:i.data)||[]])qO(a.children,l?.children,n);if(at.isDictionary(a)){let{id:l}=a;if(!n.has(l))c?.dictionary&&n.set(l,c.dictionary);else if(n.get(l)!==c.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return n}var Dc=class extends ke{constructor(t){let n=t.fields.map(i=>Dt({type:i.type})),r=Dt({type:new ye(t.fields),nullCount:0,children:n});super(t,r)}};var yh;(function(e){e[e.BUFFER=0]="BUFFER"})(yh||(yh={}));var gh;(function(e){e[e.LZ4_FRAME=0]="LZ4_FRAME",e[e.ZSTD=1]="ZSTD"})(gh||(gh={}));var Kg=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsBodyCompression(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}codec(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):gh.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):yh.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,n){t.addFieldInt8(0,n,gh.LZ4_FRAME)}static addMethod(t,n){t.addFieldInt8(1,n,yh.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,n,r){return e.startBodyCompression(t),e.addCodec(t,n),e.addMethod(t,r),e.endBodyCompression(t)}};var au=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(t,n,r){return t.prep(8,16),t.writeInt64(BigInt(r??0)),t.writeInt64(BigInt(n??0)),t.offset()}};var cu=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(t,n,r){return t.prep(8,16),t.writeInt64(BigInt(r??0)),t.writeInt64(BigInt(n??0)),t.offset()}};var Or=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsRecordBatch(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}length(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,n){let r=this.bb.__offset(this.bb_pos,6);return r?(n||new cu).__init(this.bb.__vector(this.bb_pos+r)+t*16,this.bb):null}nodesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,n){let r=this.bb.__offset(this.bb_pos,8);return r?(n||new au).__init(this.bb.__vector(this.bb_pos+r)+t*16,this.bb):null}buffersLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){let n=this.bb.__offset(this.bb_pos,10);return n?(t||new Kg).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}static startRecordBatch(t){t.startObject(4)}static addLength(t,n){t.addFieldInt64(0,n,BigInt("0"))}static addNodes(t,n){t.addFieldOffset(1,n,0)}static startNodesVector(t,n){t.startVector(16,n,8)}static addBuffers(t,n){t.addFieldOffset(2,n,0)}static startBuffersVector(t,n){t.startVector(16,n,8)}static addCompression(t,n){t.addFieldOffset(3,n,0)}static endRecordBatch(t){return t.endObject()}};var ds=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDictionaryBatch(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new Or).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}isDelta(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startDictionaryBatch(t){t.startObject(3)}static addId(t,n){t.addFieldInt64(0,n,BigInt("0"))}static addData(t,n){t.addFieldOffset(1,n,0)}static addIsDelta(t,n){t.addFieldInt8(2,+n,0)}static endDictionaryBatch(t){return t.endObject()}};var lu;(function(e){e[e.NONE=0]="NONE",e[e.Schema=1]="Schema",e[e.DictionaryBatch=2]="DictionaryBatch",e[e.RecordBatch=3]="RecordBatch",e[e.Tensor=4]="Tensor",e[e.SparseTensor=5]="SparseTensor"})(lu||(lu={}));var ki=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsMessage(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):fa.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):lu.NONE}header(t){let n=this.bb.__offset(this.bb_pos,8);return n?this.bb.__union(t,this.bb_pos+n):null}bodyLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,n){let r=this.bb.__offset(this.bb_pos,12);return r?(n||new en).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,n){t.addFieldInt16(0,n,fa.V1)}static addHeaderType(t,n){t.addFieldInt8(1,n,lu.NONE)}static addHeader(t,n){t.addFieldOffset(2,n,0)}static addBodyLength(t,n){t.addFieldInt64(3,n,BigInt("0"))}static addCustomMetadata(t,n){t.addFieldOffset(4,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,n){t.finish(n)}static finishSizePrefixedMessageBuffer(t,n){t.finish(n,void 0,!0)}static createMessage(t,n,r,i,o,s){return e.startMessage(t),e.addVersion(t,n),e.addHeaderType(t,r),e.addHeader(t,i),e.addBodyLength(t,o),e.addCustomMetadata(t,s),e.endMessage(t)}};var sv=class extends ut{visit(t,n){return t==null||n==null?void 0:super.visit(t,n)}visitNull(t,n){return Pd.startNull(n),Pd.endNull(n)}visitInt(t,n){return Ri.startInt(n),Ri.addBitWidth(n,t.bitWidth),Ri.addIsSigned(n,t.isSigned),Ri.endInt(n)}visitFloat(t,n){return ga.startFloatingPoint(n),ga.addPrecision(n,t.precision),ga.endFloatingPoint(n)}visitBinary(t,n){return Dd.startBinary(n),Dd.endBinary(n)}visitBool(t,n){return kd.startBool(n),kd.endBool(n)}visitUtf8(t,n){return zd.startUtf8(n),zd.endUtf8(n)}visitDecimal(t,n){return eo.startDecimal(n),eo.addScale(n,t.scale),eo.addPrecision(n,t.precision),eo.addBitWidth(n,t.bitWidth),eo.endDecimal(n)}visitDate(t,n){return ha.startDate(n),ha.addUnit(n,t.unit),ha.endDate(n)}visitTime(t,n){return ns.startTime(n),ns.addUnit(n,t.unit),ns.addBitWidth(n,t.bitWidth),ns.endTime(n)}visitTimestamp(t,n){let r=t.timezone&&n.createString(t.timezone)||void 0;return rs.startTimestamp(n),rs.addUnit(n,t.unit),r!==void 0&&rs.addTimezone(n,r),rs.endTimestamp(n)}visitInterval(t,n){return ba.startInterval(n),ba.addUnit(n,t.unit),ba.endInterval(n)}visitDuration(t,n){return pa.startDuration(n),pa.addUnit(n,t.unit),pa.endDuration(n)}visitList(t,n){return Bd.startList(n),Bd.endList(n)}visitStruct(t,n){return $d.startStruct_(n),$d.endStruct_(n)}visitUnion(t,n){Di.startTypeIdsVector(n,t.typeIds.length);let r=Di.createTypeIdsVector(n,t.typeIds);return Di.startUnion(n),Di.addMode(n,t.mode),Di.addTypeIds(n,r),Di.endUnion(n)}visitDictionary(t,n){let r=this.visit(t.indices,n);return to.startDictionaryEncoding(n),to.addId(n,BigInt(t.id)),to.addIsOrdered(n,t.isOrdered),r!==void 0&&to.addIndexType(n,r),to.endDictionaryEncoding(n)}visitFixedSizeBinary(t,n){return ma.startFixedSizeBinary(n),ma.addByteWidth(n,t.byteWidth),ma.endFixedSizeBinary(n)}visitFixedSizeList(t,n){return ya.startFixedSizeList(n),ya.addListSize(n,t.listSize),ya.endFixedSizeList(n)}visitMap(t,n){return xa.startMap(n),xa.addKeysSorted(n,t.keysSorted),xa.endMap(n)}},Jg=new sv;function GO(e,t=new Map){return new re(Lz(e,t),t0(e.metadata),t)}function av(e){return new wn(e.count,XO(e.columns),HO(e.columns))}function WO(e){return new mr(av(e.data),e.id,e.isDelta)}function Lz(e,t){return(e.fields||[]).filter(Boolean).map(n=>$t.fromJSON(n,t))}function jO(e,t){return(e.children||[]).filter(Boolean).map(n=>$t.fromJSON(n,t))}function XO(e){return(e||[]).reduce((t,n)=>[...t,new Kr(n.count,Cz(n.VALIDITY)),...XO(n.children)],[])}function HO(e,t=[]){for(let n=-1,r=(e||[]).length;++n<r;){let i=e[n];i.VALIDITY&&t.push(new pr(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new pr(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new pr(t.length,i.OFFSET.length)),i.DATA&&t.push(new pr(t.length,i.DATA.length)),t=HO(i.children,t)}return t}function Cz(e){return(e||[]).reduce((t,n)=>t+ +(n===0),0)}function ZO(e,t){let n,r,i,o,s,a;return!t||!(o=e.dictionary)?(s=YO(e,jO(e,t)),i=new $t(e.name,s,e.nullable,t0(e.metadata))):t.has(n=o.id)?(r=(r=o.indexType)?VO(r):new Hi,a=new Er(t.get(n),r,n,o.isOrdered),i=new $t(e.name,a,e.nullable,t0(e.metadata))):(r=(r=o.indexType)?VO(r):new Hi,t.set(n,s=YO(e,jO(e,t))),a=new Er(s,r,n,o.isOrdered),i=new $t(e.name,a,e.nullable,t0(e.metadata))),i||null}function t0(e=[]){return new Map(e.map(({key:t,value:n})=>[t,n]))}function VO(e){return new Pe(e.isSigned,e.bitWidth)}function YO(e,t){let n=e.type.name;switch(n){case"NONE":return new Gn;case"null":return new Gn;case"binary":return new Yo;case"utf8":return new Go;case"bool":return new Wo;case"list":return new Ii((t||[])[0]);case"struct":return new ye(t||[]);case"struct_":return new ye(t||[])}switch(n){case"int":{let r=e.type;return new Pe(r.isSigned,r.bitWidth)}case"floatingpoint":{let r=e.type;return new dr(xe[r.precision])}case"decimal":{let r=e.type;return new Xo(r.scale,r.precision,r.bitWidth)}case"date":{let r=e.type;return new Ho(xn[r.unit])}case"time":{let r=e.type;return new Si(pt[r.unit],r.bitWidth)}case"timestamp":{let r=e.type;return new Zo(pt[r.unit],r.timezone)}case"interval":{let r=e.type;return new Qo(Yn[r.unit])}case"duration":{let r=e.type;return new Ko(pt[r.unit])}case"union":{let r=e.type,[i,...o]=(r.mode+"").toLowerCase(),s=i.toUpperCase()+o.join("");return new Ti(me[s],r.typeIds||[],t||[])}case"fixedsizebinary":{let r=e.type;return new Jo(r.byteWidth)}case"fixedsizelist":{let r=e.type;return new Ei(r.listSize,(t||[])[0])}case"map":{let r=e.type;return new Ai((t||[])[0],r.keysSorted)}}throw new Error(`Unrecognized type: "${n}"`)}var Bz=Tc,Pz=Nr,yr=class e{static fromJSON(t,n){let r=new e(0,Ie.V5,n);return r._createHeader=$z(t,n),r}static decode(t){t=new Pz(Ot(t));let n=ki.getRootAsMessage(t),r=n.bodyLength(),i=n.version(),o=n.headerType(),s=new e(r,i,o);return s._createHeader=Uz(n,o),s}static encode(t){let n=new Bz,r=-1;return t.isSchema()?r=re.encode(n,t.header()):t.isRecordBatch()?r=wn.encode(n,t.header()):t.isDictionaryBatch()&&(r=mr.encode(n,t.header())),ki.startMessage(n),ki.addVersion(n,Ie.V5),ki.addHeader(n,r),ki.addHeaderType(n,t.headerType),ki.addBodyLength(n,BigInt(t.bodyLength)),ki.finishMessageBuffer(n,ki.endMessage(n)),n.asUint8Array()}static from(t,n=0){if(t instanceof re)return new e(0,Ie.V5,Qt.Schema,t);if(t instanceof wn)return new e(n,Ie.V5,Qt.RecordBatch,t);if(t instanceof mr)return new e(n,Ie.V5,Qt.DictionaryBatch,t);throw new Error(`Unrecognized Message header: ${t}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===Qt.Schema}isRecordBatch(){return this.headerType===Qt.RecordBatch}isDictionaryBatch(){return this.headerType===Qt.DictionaryBatch}constructor(t,n,r,i){this._version=n,this._headerType=r,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=fr(t)}},wn=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,n,r){this._nodes=n,this._buffers=r,this._length=fr(t)}},mr=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,n,r=!1){this._data=t,this._isDelta=r,this._id=fr(n)}},pr=class{constructor(t,n){this.offset=fr(t),this.length=fr(n)}},Kr=class{constructor(t,n){this.length=fr(t),this.nullCount=fr(n)}};function $z(e,t){return()=>{switch(t){case Qt.Schema:return re.fromJSON(e);case Qt.RecordBatch:return wn.fromJSON(e);case Qt.DictionaryBatch:return mr.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${Qt[t]}, type: ${t} }`)}}function Uz(e,t){return()=>{switch(t){case Qt.Schema:return re.decode(e.header(new hr),new Map,e.version());case Qt.RecordBatch:return wn.decode(e.header(new Or),e.version());case Qt.DictionaryBatch:return mr.decode(e.header(new ds),e.version())}throw new Error(`Unrecognized Message type: { name: ${Qt[t]}, type: ${t} }`)}}$t.encode=Qz;$t.decode=Hz;$t.fromJSON=ZO;re.encode=Zz;re.decode=zz;re.fromJSON=GO;wn.encode=Kz;wn.decode=qz;wn.fromJSON=av;mr.encode=Jz;mr.decode=jz;mr.fromJSON=WO;Kr.encode=tq;Kr.decode=Yz;pr.encode=eq;pr.decode=Vz;function zz(e,t=new Map,n=Ie.V5){let r=Xz(e,t);return new re(r,e0(e),t,n)}function qz(e,t=Ie.V5){if(e.compression()!==null)throw new Error("Record batch compression not implemented");return new wn(e.length(),Gz(e),Wz(e,t))}function jz(e,t=Ie.V5){return new mr(wn.decode(e.data(),t),e.id(),e.isDelta())}function Vz(e){return new pr(e.offset(),e.length())}function Yz(e){return new Kr(e.length(),e.nullCount())}function Gz(e){let t=[];for(let n,r=-1,i=-1,o=e.nodesLength();++r<o;)(n=e.nodes(r))&&(t[++i]=Kr.decode(n));return t}function Wz(e,t){let n=[];for(let r,i=-1,o=-1,s=e.buffersLength();++i<s;)(r=e.buffers(i))&&(t<Ie.V4&&(r.bb_pos+=8*(i+1)),n[++o]=pr.decode(r));return n}function Xz(e,t){let n=[];for(let r,i=-1,o=-1,s=e.fieldsLength();++i<s;)(r=e.fields(i))&&(n[++o]=$t.decode(r,t));return n}function QO(e,t){let n=[];for(let r,i=-1,o=-1,s=e.childrenLength();++i<s;)(r=e.children(i))&&(n[++o]=$t.decode(r,t));return n}function Hz(e,t){let n,r,i,o,s,a;return!t||!(a=e.dictionary())?(i=JO(e,QO(e,t)),r=new $t(e.name(),i,e.nullable(),e0(e))):t.has(n=fr(a.id()))?(o=(o=a.indexType())?KO(o):new Hi,s=new Er(t.get(n),o,n,a.isOrdered()),r=new $t(e.name(),s,e.nullable(),e0(e))):(o=(o=a.indexType())?KO(o):new Hi,t.set(n,i=JO(e,QO(e,t))),s=new Er(i,o,n,a.isOrdered()),r=new $t(e.name(),s,e.nullable(),e0(e))),r||null}function e0(e){let t=new Map;if(e)for(let n,r,i=-1,o=Math.trunc(e.customMetadataLength());++i<o;)(n=e.customMetadata(i))&&(r=n.key())!=null&&t.set(r,n.value());return t}function KO(e){return new Pe(e.isSigned(),e.bitWidth())}function JO(e,t){let n=e.typeType();switch(n){case ge.NONE:return new Gn;case ge.Null:return new Gn;case ge.Binary:return new Yo;case ge.Utf8:return new Go;case ge.Bool:return new Wo;case ge.List:return new Ii((t||[])[0]);case ge.Struct_:return new ye(t||[])}switch(n){case ge.Int:{let r=e.type(new Ri);return new Pe(r.isSigned(),r.bitWidth())}case ge.FloatingPoint:{let r=e.type(new ga);return new dr(r.precision())}case ge.Decimal:{let r=e.type(new eo);return new Xo(r.scale(),r.precision(),r.bitWidth())}case ge.Date:{let r=e.type(new ha);return new Ho(r.unit())}case ge.Time:{let r=e.type(new ns);return new Si(r.unit(),r.bitWidth())}case ge.Timestamp:{let r=e.type(new rs);return new Zo(r.unit(),r.timezone())}case ge.Interval:{let r=e.type(new ba);return new Qo(r.unit())}case ge.Duration:{let r=e.type(new pa);return new Ko(r.unit())}case ge.Union:{let r=e.type(new Di);return new Ti(r.mode(),r.typeIdsArray()||[],t||[])}case ge.FixedSizeBinary:{let r=e.type(new ma);return new Jo(r.byteWidth())}case ge.FixedSizeList:{let r=e.type(new ya);return new Ei(r.listSize(),(t||[])[0])}case ge.Map:{let r=e.type(new xa);return new Ai((t||[])[0],r.keysSorted())}}throw new Error(`Unrecognized type: "${ge[n]}" (${n})`)}function Zz(e,t){let n=t.fields.map(o=>$t.encode(e,o));hr.startFieldsVector(e,n.length);let r=hr.createFieldsVector(e,n),i=t.metadata&&t.metadata.size>0?hr.createCustomMetadataVector(e,[...t.metadata].map(([o,s])=>{let a=e.createString(`${o}`),c=e.createString(`${s}`);return en.startKeyValue(e),en.addKey(e,a),en.addValue(e,c),en.endKeyValue(e)})):-1;return hr.startSchema(e),hr.addFields(e,r),hr.addEndianness(e,nq?da.Little:da.Big),i!==-1&&hr.addCustomMetadata(e,i),hr.endSchema(e)}function Qz(e,t){let n=-1,r=-1,i=-1,o=t.type,s=t.typeId;at.isDictionary(o)?(s=o.dictionary.typeId,i=Jg.visit(o,e),r=Jg.visit(o.dictionary,e)):r=Jg.visit(o,e);let a=(o.children||[]).map(u=>$t.encode(e,u)),c=Fn.createChildrenVector(e,a),l=t.metadata&&t.metadata.size>0?Fn.createCustomMetadataVector(e,[...t.metadata].map(([u,f])=>{let d=e.createString(`${u}`),h=e.createString(`${f}`);return en.startKeyValue(e),en.addKey(e,d),en.addValue(e,h),en.endKeyValue(e)})):-1;return t.name&&(n=e.createString(t.name)),Fn.startField(e),Fn.addType(e,r),Fn.addTypeType(e,s),Fn.addChildren(e,c),Fn.addNullable(e,!!t.nullable),n!==-1&&Fn.addName(e,n),i!==-1&&Fn.addDictionary(e,i),l!==-1&&Fn.addCustomMetadata(e,l),Fn.endField(e)}function Kz(e,t){let n=t.nodes||[],r=t.buffers||[];Or.startNodesVector(e,n.length);for(let s of n.slice().reverse())Kr.encode(e,s);let i=e.endVector();Or.startBuffersVector(e,r.length);for(let s of r.slice().reverse())pr.encode(e,s);let o=e.endVector();return Or.startRecordBatch(e),Or.addLength(e,BigInt(t.length)),Or.addNodes(e,i),Or.addBuffers(e,o),Or.endRecordBatch(e)}function Jz(e,t){let n=wn.encode(e,t.data);return ds.startDictionaryBatch(e),ds.addId(e,BigInt(t.id)),ds.addIsDelta(e,t.isDelta),ds.addData(e,n),ds.endDictionaryBatch(e)}function tq(e,t){return cu.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function eq(e,t){return au.createBuffer(e,BigInt(t.offset),BigInt(t.length))}var nq=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})();var lv=e=>`Expected ${Qt[e]} Message in stream, but was null or length 0.`,uv=e=>`Header pointer of flatbuffer-encoded ${Qt[e]} Message is null or length 0.`,tD=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,eD=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,uu=class{constructor(t){this.source=t instanceof ro?t:new ro(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?be:t.value===-1&&(t=this.readMetadataLength()).done?be:(t=this.readMetadata(t.value)).done?be:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let n;if((n=this.next()).done)return null;if(t!=null&&n.value.headerType!==t)throw new Error(lv(t));return n.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let n=Ot(this.source.read(t));if(n.byteLength<t)throw new Error(eD(t,n.byteLength));return n.byteOffset%8===0&&n.byteOffset+n.byteLength<=n.buffer.byteLength?n:n.slice()}readSchema(t=!1){let n=Qt.Schema,r=this.readMessage(n),i=r?.header();if(t&&!i)throw new Error(uv(n));return i}readMetadataLength(){let t=this.source.read(n0),n=t&&new Nr(t),r=n?.readInt32(0)||0;return{done:r===0,value:r}}readMetadata(t){let n=this.source.read(t);if(!n)return be;if(n.byteLength<t)throw new Error(tD(t,n.byteLength));return{done:!1,value:yr.decode(n)}}},bh=class{constructor(t,n){this.source=t instanceof Zr?t:Cy(t)?new _a(t,n):new Zr(t)}[Symbol.asyncIterator](){return this}next(){return Z(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?be:t.value===-1&&(t=yield this.readMetadataLength()).done?be:(t=yield this.readMetadata(t.value)).done?be:t})}throw(t){return Z(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return Z(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return Z(this,void 0,void 0,function*(){let n;if((n=yield this.next()).done)return null;if(t!=null&&n.value.headerType!==t)throw new Error(lv(t));return n.value})}readMessageBody(t){return Z(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let n=Ot(yield this.source.read(t));if(n.byteLength<t)throw new Error(eD(t,n.byteLength));return n.byteOffset%8===0&&n.byteOffset+n.byteLength<=n.buffer.byteLength?n:n.slice()})}readSchema(t=!1){return Z(this,void 0,void 0,function*(){let n=Qt.Schema,r=yield this.readMessage(n),i=r?.header();if(t&&!i)throw new Error(uv(n));return i})}readMetadataLength(){return Z(this,void 0,void 0,function*(){let t=yield this.source.read(n0),n=t&&new Nr(t),r=n?.readInt32(0)||0;return{done:r===0,value:r}})}readMetadata(t){return Z(this,void 0,void 0,function*(){let n=yield this.source.read(t);if(!n)return be;if(n.byteLength<t)throw new Error(tD(t,n.byteLength));return{done:!1,value:yr.decode(n)}})}},xh=class extends uu{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof qd?t:new qd(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:yr.fromJSON(t.schema,Qt.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let n=t.dictionaries[this._dictionaryIndex++];return this._body=n.data.columns,{done:!1,value:yr.fromJSON(n,Qt.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let n=t.batches[this._batchIndex++];return this._body=n.columns,{done:!1,value:yr.fromJSON(n,Qt.RecordBatch)}}return this._body=[],be}readMessageBody(t){return n(this._body);function n(r){return(r||[]).reduce((i,o)=>[...i,...o.VALIDITY&&[o.VALIDITY]||[],...o.TYPE_ID&&[o.TYPE_ID]||[],...o.OFFSET&&[o.OFFSET]||[],...o.DATA&&[o.DATA]||[],...n(o.children)],[])}}readMessage(t){let n;if((n=this.next()).done)return null;if(t!=null&&n.value.headerType!==t)throw new Error(lv(t));return n.value}readSchema(){let t=Qt.Schema,n=this.readMessage(t),r=n?.header();if(!n||!r)throw new Error(uv(t));return r}},n0=4,cv="ARROW1",fu=new Uint8Array(cv.length);for(let e=0;e<cv.length;e+=1)fu[e]=cv.codePointAt(e);function r0(e,t=0){for(let n=-1,r=fu.length;++n<r;)if(fu[n]!==e[t+n])return!1;return!0}var du=fu.length,fv=du+n0,nD=du*2+n0;var nn=class e extends Ec{constructor(t){super(),this._impl=t}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(t){return this._impl.throw(t)}return(t){return this._impl.return(t)}cancel(){return this._impl.cancel()}reset(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}open(t){let n=this._impl.open(t);return Ir(n)?n.then(()=>this):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return bn.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return bn.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,n){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof e?t:Fy(t)?iq(t):Cy(t)?aq(t):Ir(t)?Z(this,void 0,void 0,function*(){return yield e.from(yield t)}):By(t)||vd(t)||$y(t)||Gr(t)?sq(new Zr(t)):oq(new ro(t))}static readAll(t){return t instanceof e?t.isSync()?rD(t):iD(t):Fy(t)||ArrayBuffer.isView(t)||xi(t)||Ly(t)?rD(t):iD(t)}},oo=class extends nn{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return Sr(this,arguments,function*(){yield Ct(yield*Vl(bi(this[Symbol.iterator]())))})}},wa=class extends nn{constructor(t){super(t),this._impl=t}readAll(){var t,n,r,i;return Z(this,void 0,void 0,function*(){let o=new Array;try{for(var s=!0,a=bi(this),c;c=yield a.next(),t=c.done,!t;s=!0){i=c.value,s=!1;let l=i;o.push(l)}}catch(l){n={error:l}}finally{try{!s&&!t&&(r=a.return)&&(yield r.call(a))}finally{if(n)throw n.error}}return o})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},va=class extends oo{constructor(t){super(t),this._impl=t}},_h=class extends wa{constructor(t){super(t),this._impl=t}},i0=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,n){let r=this._loadVectors(t,n,this.schema.fields),i=Dt({type:new ye(this.schema.fields),length:t.length,children:r});return new ke(this.schema,i)}_loadDictionaryBatch(t,n){let{id:r,isDelta:i}=t,{dictionaries:o,schema:s}=this,a=o.get(r);if(i||!a){let c=s.dictionaries.get(r),l=this._loadVectors(t.data,n,[c]);return(a&&i?a.concat(new Vt(l)):new Vt(l)).memoize()}return a.memoize()}_loadVectors(t,n,r){return new Gd(n,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(r)}},hu=class extends i0{constructor(t,n){super(n),this._reader=Fy(t)?new xh(this._handle=t):new uu(this._handle=t)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(t){return this.closed||(this.autoDestroy=oD(this,t),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(t):be}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):be}next(){if(this.closed)return be;let t,{_reader:n}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let r=t.header(),i=n.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(r,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let r=t.header(),i=n.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(r,i);this.dictionaries.set(r.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Dc(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},pu=class extends i0{constructor(t,n){super(n),this._reader=new bh(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return Z(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(t){return Z(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=oD(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return Z(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):be})}return(t){return Z(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):be})}next(){return Z(this,void 0,void 0,function*(){if(this.closed)return be;let t,{_reader:n}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let r=t.header(),i=yield n.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(r,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let r=t.header(),i=yield n.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(r,i);this.dictionaries.set(r.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Dc(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return Z(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},o0=class extends hu{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,n){super(t instanceof jd?t:new jd(t),n)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let n of this._footer.dictionaryBatches())n&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var n;if(this.closed)return null;this._footer||this.open();let r=(n=this._footer)===null||n===void 0?void 0:n.getRecordBatch(t);if(r&&this._handle.seek(r.offset)){let i=this._reader.readMessage(Qt.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s)}}return null}_readDictionaryBatch(t){var n;let r=(n=this._footer)===null||n===void 0?void 0:n.getDictionaryBatch(t);if(r&&this._handle.seek(r.offset)){let i=this._reader.readMessage(Qt.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}}_readFooter(){let{_handle:t}=this,n=t.size-fv,r=t.readInt32(n),i=t.readAt(n-r,r);return is.decode(i)}_readNextMessageAndValidate(t){var n;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let r=(n=this._footer)===null||n===void 0?void 0:n.getRecordBatch(this._recordBatchIndex);if(r&&this._handle.seek(r.offset))return this._reader.readMessage(t)}return null}},dv=class extends pu{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,...n){let r=typeof n[0]!="number"?n.shift():void 0,i=n[0]instanceof Map?n.shift():void 0;super(t instanceof _a?t:new _a(t,r),i)}isFile(){return!0}isAsync(){return!0}open(t){let n=Object.create(null,{open:{get:()=>super.open}});return Z(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let r of this._footer.dictionaryBatches())r&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield n.open.call(this,t)})}readRecordBatch(t){var n;return Z(this,void 0,void 0,function*(){if(this.closed)return null;this._footer||(yield this.open());let r=(n=this._footer)===null||n===void 0?void 0:n.getRecordBatch(t);if(r&&(yield this._handle.seek(r.offset))){let i=yield this._reader.readMessage(Qt.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s)}}return null})}_readDictionaryBatch(t){var n;return Z(this,void 0,void 0,function*(){let r=(n=this._footer)===null||n===void 0?void 0:n.getDictionaryBatch(t);if(r&&(yield this._handle.seek(r.offset))){let i=yield this._reader.readMessage(Qt.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}})}_readFooter(){return Z(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let n=t.size-fv,r=yield t.readInt32(n),i=yield t.readAt(n-r,r);return is.decode(i)})}_readNextMessageAndValidate(t){return Z(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let n=this._footer.getRecordBatch(this._recordBatchIndex);if(n&&(yield this._handle.seek(n.offset)))return yield this._reader.readMessage(t)}return null})}},hv=class extends hu{constructor(t,n){super(t,n)}_loadVectors(t,n,r){return new Ng(n,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(r)}};function oD(e,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:e.autoDestroy}function*rD(e){let t=nn.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function iD(e){return Sr(this,arguments,function*(){let n=yield Ct(nn.from(e));try{if(!(yield Ct(n.open({autoDestroy:!1}))).closed)do yield yield Ct(n);while(!(yield Ct(n.reset().open())).closed)}finally{yield Ct(n.cancel())}})}function iq(e){return new oo(new hv(e))}function oq(e){let t=e.peek(du+7&-8);return t&&t.byteLength>=4?r0(t)?new va(new o0(e.read())):new oo(new hu(e)):new oo(new hu(function*(){}()))}function sq(e){return Z(this,void 0,void 0,function*(){let t=yield e.peek(du+7&-8);return t&&t.byteLength>=4?r0(t)?new va(new o0(yield e.read())):new wa(new pu(e)):new wa(new pu(function(){return Sr(this,arguments,function*(){})}()))})}function aq(e){return Z(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),n=new _a(e,t);return t>=nD&&r0(yield n.readAt(0,du+7&-8))?new _h(new dv(n)):new wa(new pu(n))})}var Fe=class e extends ut{static assemble(...t){let n=i=>i.flatMap(o=>Array.isArray(o)?n(o):o instanceof ke?o.data.children:o.data),r=new e;return r.visitMany(n(t)),r}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof Vt)return this.visitMany(t.data),this;let{type:n}=t;if(!at.isDictionary(n)){let{length:r}=t;if(r>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(at.isUnion(n))this.nodes.push(new Kr(r,0));else{let{nullCount:i}=t;at.isNull(n)||Fi.call(this,i<=0?new Uint8Array(0):wc(t.offset,r,t.nullBitmap)),this.nodes.push(new Kr(r,i))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}};function Fi(e){let t=e.byteLength+7&-8;return this.buffers.push(e),this.bufferRegions.push(new pr(this._byteLength,t)),this._byteLength+=t,this}function cq(e){var t;let{type:n,length:r,typeIds:i,valueOffsets:o}=e;if(Fi.call(this,i),n.mode===me.Sparse)return pv.call(this,e);if(n.mode===me.Dense){if(e.offset<=0)return Fi.call(this,o),pv.call(this,e);{let s=new Int32Array(r),a=Object.create(null),c=Object.create(null);for(let l,u,f=-1;++f<r;)(l=i[f])!==void 0&&((u=a[l])===void 0&&(u=a[l]=o[f]),s[f]=o[f]-u,c[l]=((t=c[l])!==null&&t!==void 0?t:0)+1);Fi.call(this,s),this.visitMany(e.children.map((l,u)=>{let f=n.typeIds[u],d=a[f],h=c[f];return l.slice(d,Math.min(r,h))}))}}return this}function lq(e){let t;return e.nullCount>=e.length?Fi.call(this,new Uint8Array(0)):(t=e.values)instanceof Uint8Array?Fi.call(this,wc(e.offset,e.length,t)):Fi.call(this,vc(e.values))}function hs(e){return Fi.call(this,e.values.subarray(0,e.length*e.stride))}function sD(e){let{length:t,values:n,valueOffsets:r}=e,{[0]:i,[t]:o}=r,s=Math.min(o-i,n.byteLength-i);return Fi.call(this,Uy(-i,t+1,r)),Fi.call(this,n.subarray(i,i+s)),this}function mv(e){let{length:t,valueOffsets:n}=e;if(n){let{[0]:r,[t]:i}=n;return Fi.call(this,Uy(-r,t+1,n)),this.visit(e.children[0].slice(r,i-r))}return this.visit(e.children[0])}function pv(e){return this.visitMany(e.type.children.map((t,n)=>e.children[n]).filter(Boolean))[0]}Fe.prototype.visitBool=lq;Fe.prototype.visitInt=hs;Fe.prototype.visitFloat=hs;Fe.prototype.visitUtf8=sD;Fe.prototype.visitBinary=sD;Fe.prototype.visitFixedSizeBinary=hs;Fe.prototype.visitDate=hs;Fe.prototype.visitTimestamp=hs;Fe.prototype.visitTime=hs;Fe.prototype.visitDecimal=hs;Fe.prototype.visitList=mv;Fe.prototype.visitStruct=pv;Fe.prototype.visitUnion=cq;Fe.prototype.visitInterval=hs;Fe.prototype.visitDuration=hs;Fe.prototype.visitFixedSizeList=mv;Fe.prototype.visitMap=mv;var kc=class extends Ec{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,n){throw new Error('"throughDOM" not available in this environment')}constructor(t){super(),this._position=0,this._started=!1,this._sink=new no,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,Vn(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return Ir(t)?t.then(n=>this.writeAll(n)):Gr(t)?gv(this,t):yv(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,n=null){return t===this._sink||t instanceof no?this._sink=t:(this._sink=new no,t&&TR(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&ER(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,(!n||!Oc(n,this._schema))&&(n==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=n,this._writeSchema(n))),this}write(t){let n=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof sn&&!(n=t.schema))return this.finish()&&void 0;if(t instanceof ke&&!(n=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(n&&!Oc(n,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,n)}t instanceof ke?t instanceof Dc||this._writeRecordBatch(t):t instanceof sn?this.writeAll(t.batches):xi(t)&&this.writeAll(t)}_writeMessage(t,n=8){let r=n-1,i=yr.encode(t),o=i.byteLength,s=this._writeLegacyIpcFormat?4:8,a=o+s+r&~r,c=a-o-s;return t.headerType===Qt.RecordBatch?this._recordBatchBlocks.push(new os(a,t.bodyLength,this._position)):t.headerType===Qt.DictionaryBatch&&this._dictionaryBlocks.push(new os(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-s)),o>0&&this._write(i),this._writePadding(c)}_write(t){if(this._started){let n=Ot(t);n&&n.byteLength>0&&(this._sink.write(n),this._position+=n.byteLength)}return this}_writeSchema(t){return this._writeMessage(yr.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(fu)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:n,nodes:r,bufferRegions:i,buffers:o}=Fe.assemble(t),s=new wn(t.numRows,r,i),a=yr.from(s,n);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(o)}_writeDictionaryBatch(t,n,r=!1){this._dictionaryDeltaOffsets.set(n,t.length+(this._dictionaryDeltaOffsets.get(n)||0));let{byteLength:i,nodes:o,bufferRegions:s,buffers:a}=Fe.assemble(new Vt([t])),c=new wn(t.length,o,s),l=new mr(c,n,r),u=yr.from(l,i);return this._writeMessage(u)._writeBodyBuffers(a)}_writeBodyBuffers(t){let n,r,i;for(let o=-1,s=t.length;++o<s;)(n=t[o])&&(r=n.byteLength)>0&&(this._write(n),(i=(r+7&-8)-r)>0&&this._writePadding(i));return this}_writeDictionaries(t){for(let[n,r]of t.dictionaries){let i=this._dictionaryDeltaOffsets.get(n)||0;if(i===0||(r=r?.slice(i)).length>0)for(let o of r.data)this._writeDictionaryBatch(o,n,i>0),i+=o.length}return this}},Fc=class e extends kc{static writeAll(t,n){let r=new e(n);return Ir(t)?t.then(i=>r.writeAll(i)):Gr(t)?gv(r,t):yv(r,t)}},Lc=class e extends kc{static writeAll(t){let n=new e;return Ir(t)?t.then(r=>n.writeAll(r)):Gr(t)?gv(n,t):yv(n,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){let n=is.encode(new is(t,Ie.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(n)._write(Int32Array.of(n.byteLength))._writeMagic()}};function yv(e,t){let n=t;t instanceof sn&&(n=t.batches,e.reset(void 0,t.schema));for(let r of n)e.write(r);return e.finish()}function gv(e,t){var n,r,i,o,s,a,c;return Z(this,void 0,void 0,function*(){try{for(n=!0,r=bi(t);i=yield r.next(),o=i.done,!o;n=!0){c=i.value,n=!1;let l=c;e.write(l)}}catch(l){s={error:l}}finally{try{!n&&!o&&(a=r.return)&&(yield a.call(r))}finally{if(s)throw s.error}}return e.finish()})}function aD(e,t){if(Gr(e))return fq(e,t);if(xi(e))return uq(e,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function uq(e,t){let n=null,r=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){o(s,n||(n=e[Symbol.iterator]()))},pull(s){n?o(s,n):s.close()},cancel(){(n?.return&&n.return()||!0)&&(n=null)}}),Object.assign({highWaterMark:r?i:void 0},t));function o(s,a){let c,l=null,u=s.desiredSize||null;for(;!(l=a.next(r?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=Ot(l.value))&&(u!=null&&r&&(u=u-c.byteLength+1),l.value=c),s.enqueue(l.value),u!=null&&--u<=0)return;s.close()}}function fq(e,t){let n=null,r=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){return Z(this,void 0,void 0,function*(){yield o(s,n||(n=e[Symbol.asyncIterator]()))})},pull(s){return Z(this,void 0,void 0,function*(){n?yield o(s,n):s.close()})},cancel(){return Z(this,void 0,void 0,function*(){(n?.return&&(yield n.return())||!0)&&(n=null)})}}),Object.assign({highWaterMark:r?i:void 0},t));function o(s,a){return Z(this,void 0,void 0,function*(){let c,l=null,u=s.desiredSize||null;for(;!(l=yield a.next(r?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=Ot(l.value))&&(u!=null&&r&&(u=u-c.byteLength+1),l.value=c),s.enqueue(l.value),u!=null&&--u<=0)return;s.close()})}}function uD(e){return new bv(e)}var bv=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:n,["writableStrategy"]:r,["queueingStrategy"]:i="count"}=t,o=SR(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=Mc(o),this._getSize=i!=="bytes"?cD:lD;let{["highWaterMark"]:s=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},n),{["highWaterMark"]:a=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},r);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:c=>{this._maybeFlush(this._builder,this._controller=c)},start:c=>{this._maybeFlush(this._builder,this._controller=c)}},{highWaterMark:s,size:i!=="bytes"?cD:lD}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:a,size:c=>this._writeValueAndReturnChunkSize(c)})}_writeValueAndReturnChunkSize(t){let n=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-n}_maybeFlush(t,n){n!=null&&(this._bufferedSize>=n.desiredSize&&++this._numChunks&&this._enqueue(n,t.toVector()),t.finished&&((t.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(n,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(n,null)))}_enqueue(t,n){this._bufferedSize=0,this._controller=null,n==null?t.close():t.enqueue(n)}},cD=e=>{var t;return(t=e?.length)!==null&&t!==void 0?t:0},lD=e=>{var t;return(t=e?.byteLength)!==null&&t!==void 0?t:0};function s0(e,t){let n=new no,r=null,i=new ReadableStream({cancel(){return Z(this,void 0,void 0,function*(){yield n.close()})},start(a){return Z(this,void 0,void 0,function*(){yield s(a,r||(r=yield o()))})},pull(a){return Z(this,void 0,void 0,function*(){r?yield s(a,r):a.close()})}});return{writable:new WritableStream(n,Object.assign({highWaterMark:Math.pow(2,14)},e)),readable:i};function o(){return Z(this,void 0,void 0,function*(){return yield(yield nn.from(n)).open(t)})}function s(a,c){return Z(this,void 0,void 0,function*(){let l=a.desiredSize,u=null;for(;!(u=yield c.next()).done;)if(a.enqueue(u.value),l!=null&&--l<=0)return;a.close()})}}function a0(e,t){let n=new this(e),r=new Zr(n),i=new ReadableStream({cancel(){return Z(this,void 0,void 0,function*(){yield r.cancel()})},pull(s){return Z(this,void 0,void 0,function*(){yield o(s)})},start(s){return Z(this,void 0,void 0,function*(){yield o(s)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(n,e),readable:i};function o(s){return Z(this,void 0,void 0,function*(){let a=null,c=s.desiredSize;for(;a=yield r.read(c||null);)if(s.enqueue(a),c!=null&&(c-=a.byteLength)<=0)return;s.close()})}}function Cc(e){let t=nn.from(e);return Ir(t)?t.then(n=>Cc(n)):t.isAsync()?t.readAll().then(n=>new sn(n)):new sn(t.readAll())}function c0(e,t="stream"){return(t==="stream"?Fc:Lc).writeAll(e).toUint8Array(!0)}var pq=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Nw),ev),Gw),Rw),Iw),Yw),Aw),{compareSchemas:Oc,compareFields:BO,compareTypes:PO});bn.toDOMStream=aD;_e.throughDOM=uD;nn.throughDOM=s0;va.throughDOM=s0;oo.throughDOM=s0;kc.throughDOM=a0;Lc.throughDOM=a0;Fc.throughDOM=a0;function l0(e="ws://localhost:3000/"){let t=[],n=!1,r=null,i,o={open(){n=!0,c()},close(){for(n=!1,r=null,i=null;t.length;)t.shift().reject("Socket closed")},error(l){if(r){let{reject:u}=r;r=null,c(),u(l)}else console.error("WebSocket error: ",l)},message({data:l}){if(r){let{query:u,resolve:f,reject:d}=r;if(r=null,c(),typeof l=="string"){let h=JSON.parse(l);h.error?d(h.error):f(h)}else if(u.type==="exec")f();else if(u.type==="arrow")f(Cc(l.arrayBuffer()));else throw new Error(`Unexpected socket data: ${l}`)}else console.log("WebSocket message: ",l)}};function s(){i=new WebSocket(e);for(let l in o)i.addEventListener(l,o[l])}function a(l,u,f){i==null&&s(),t.push({query:l,resolve:u,reject:f}),n&&!r&&c()}function c(){t.length&&(r=t.shift(),i.send(JSON.stringify(r.query)))}return{get connected(){return n},query(l){return new Promise((u,f)=>a(l,u,f))}}}var gr=class{constructor(t,n){t&&(this.table=String(t)),n&&(this.column=n)}get columns(){return this.column?[this.column]:[]}toString(){let{table:t,column:n}=this;if(n){let r=n.startsWith("*")?n:`"${n}"`;return`${t?`${dD(t)}.`:""}${r}`}else return t?dD(t):"NULL"}};function dD(e){return e.split(".").map(n=>`"${n}"`).join(".")}function hD(e,t){return e instanceof gr&&e.column===t}function zt(e){return typeof e=="string"?Sa(e):e}function Bc(e){return typeof e=="string"?pD(e):e}function pD(e){return new gr(e)}function Sa(e,t){return arguments.length===1&&(t=e,e=null),new gr(e,t)}function so(e){switch(typeof e){case"boolean":return e?"TRUE":"FALSE";case"string":return`'${e}'`;case"number":return Number.isFinite(e)?String(e):"NULL";default:if(e==null)return"NULL";if(e instanceof Date){let t=+e;if(Number.isNaN(t))return"NULL";let n=e.getUTCFullYear(),r=e.getUTCMonth(),i=e.getUTCDate();return t===Date.UTC(n,r,i)?`MAKE_DATE(${n}, ${r+1}, ${i})`:`EPOCH_MS(${t})`}else return e instanceof RegExp?`'${e.source}'`:String(e)}}var ps=e=>typeof e?.addEventListener=="function";function u0(e){return e instanceof Ia}var Ia=class{constructor(t,n,r){this._expr=Array.isArray(t)?t:[t],this._deps=n||[],this.annotate(r);let i=this._expr.filter(o=>ps(o));i.length>0?(this._params=Array.from(new Set(i)),this._params.forEach(o=>{o.addEventListener("value",()=>mq(this,this.map?.get("value")))})):this.addEventListener=void 0}get value(){return this}get columns(){let{_params:t,_deps:n}=this;if(t){let r=new Set(t.flatMap(i=>{let o=i.value?.columns;return Array.isArray(o)?o:[]}));if(r.size){let i=new Set(n);return r.forEach(o=>i.add(o)),Array.from(i)}}return n}get column(){return this._deps.length?this._deps[0]:this.columns[0]}annotate(...t){return Object.assign(this,...t)}toString(){return this._expr.map(t=>ps(t)&&!u0(t)?so(t.value):t).join("")}addEventListener(t,n){let r=this.map||(this.map=new Map);(r.get(t)||(r.set(t,new Set),r.get(t))).add(n)}};function mq(e,t){if(t?.size)return Promise.allSettled(Array.from(t,n=>n(e)))}function xv(e,t){let n=[e[0]],r=new Set,i=t.length;for(let o=0,s=0;o<i;){let a=t[o];ps(a)?n[++s]=a:(Array.isArray(a?.columns)&&a.columns.forEach(l=>r.add(l)),n[s]+=typeof a=="string"?a:so(a));let c=e[++o];ps(n[s])?n[++s]=c:n[s]+=c}return{spans:n,cols:Array.from(r)}}function j(e,...t){let{spans:n,cols:r}=xv(e,t);return new Ia(n,r)}function _v(e){let t=zt(e);return j`${t} DESC NULLS LAST`.annotate({label:t?.label,desc:!0})}var Dr=e=>({value:e,toString:()=>so(e)});function wh(e){e(this.op,this),this.children?.forEach(t=>t.visit(e))}function mD(e,t){let n=t.filter(i=>i!=null).map(zt),r=n.map((i,o)=>o?` ${e} `:"");return n.length===1?r.push(""):n.length>1&&(r[0]="(",r.push(")")),j(r,...n).annotate({op:e,children:n,visit:wh})}var Xn=(...e)=>mD("AND",e.flat()),Pc=(...e)=>mD("OR",e.flat()),yq=e=>t=>j`(${e} ${zt(t)})`.annotate({op:e,a:t,visit:wh}),wv=yq("NOT"),yD=e=>t=>j`(${zt(t)} ${e})`.annotate({op:e,a:t,visit:wh}),$c=yD("IS NULL"),ms=yD("IS NOT NULL"),Ta=e=>(t,n)=>j`(${zt(t)} ${e} ${zt(n)})`.annotate({op:e,a:t,b:n,visit:wh}),ys=Ta("="),Uc=Ta("<>"),gs=Ta("<"),vh=Ta(">"),bs=Ta("<="),vv=Ta(">="),Sv=Ta("IS DISTINCT FROM"),Sh=Ta("IS NOT DISTINCT FROM");function gD(e,t,n,r){t=zt(t);let i=e.startsWith("NOT ")?"NOT ":"";return(n?r?j`${i}(${n[0]} <= ${t} AND ${t} < ${n[1]})`:j`(${t} ${e} ${n[0]} AND ${n[1]})`:j``).annotate({op:e,visit:wh,field:t,range:n})}var Te=(e,t,n)=>gD("BETWEEN",e,t,n),Iv=(e,t,n)=>gD("NOT BETWEEN",e,t,n);function zc(e,t){return Array.from({length:e},()=>t)}function vn(e,t){return(...n)=>{let r=n.map(zt),i=t?`::${t}`:"";return(r.length?j([`${e}(`,...zc(r.length-1,", "),`)${i}`],...r):j`${e}()${i}`).annotate({func:e,args:r})}}var Tv=vn("REGEXP_MATCHES"),Ev=vn("CONTAINS"),Av=vn("PREFIX"),Mv=vn("SUFFIX"),gq=vn("LOWER"),bq=vn("UPPER"),xq=vn("LENGTH"),_q=vn("ISNAN"),wq=vn("ISFINITE"),vq=vn("ISINF");var Ih=class e extends Ia{constructor(t,n,r,i,o="",s="",a=""){let c;if(i&&!(o||s||a))c=i?j`${n} OVER "${i}"`:j`${n} OVER ()`;else{let d=o&&s?" ":"",h=(o||s)&&a?" ":"";c=j`${n} OVER (${i?`"${i}" `:""}${o}${d}${s}${h}${a})`}r&&(c=j`(${c})::${r}`);let{_expr:u,_deps:f}=c;super(u,f,{window:t,func:n,type:r,name:i,group:o,order:s,frame:a})}get basis(){return this.column}get label(){let{func:t}=this;return t.label??t.toString()}over(t){let{window:n,func:r,type:i,group:o,order:s,frame:a}=this;return new e(n,r,i,t,o,s,a)}partitionby(...t){let n=t.flat().filter(u=>u).map(zt),r=j(["PARTITION BY ",zc(n.length-1,", "),""],...n),{window:i,func:o,type:s,name:a,order:c,frame:l}=this;return new e(i,o,s,a,r,c,l)}orderby(...t){let n=t.flat().filter(u=>u).map(zt),r=j(["ORDER BY ",zc(n.length-1,", "),""],...n),{window:i,func:o,type:s,name:a,group:c,frame:l}=this;return new e(i,o,s,a,c,r,l)}rows(t){let n=bD("ROWS",t),{window:r,func:i,type:o,name:s,group:a,order:c}=this;return new e(r,i,o,s,a,c,n)}range(t){let n=bD("RANGE",t),{window:r,func:i,type:o,name:s,group:a,order:c}=this;return new e(r,i,o,s,a,c,n)}};function bD(e,t){if(ps(t)){let n=j`${t}`;return n.toString=()=>`${e} ${xD(t.value)}`,n}return`${e} ${xD(t)}`}function xD(e){let[t,n]=e,r=t===0?"CURRENT ROW":Number.isFinite(t)?`${Math.abs(t)} PRECEDING`:"UNBOUNDED PRECEDING",i=n===0?"CURRENT ROW":Number.isFinite(n)?`${Math.abs(n)} FOLLOWING`:"UNBOUNDED FOLLOWING";return`BETWEEN ${r} AND ${i}`}function Li(e,t){return(...n)=>{let r=vn(e)(...n);return new Ih(e,r,t)}}var Nv=Li("ROW_NUMBER","INTEGER"),Rv=Li("RANK","INTEGER"),Ov=Li("DENSE_RANK","INTEGER"),Dv=Li("PERCENT_RANK"),kv=Li("CUME_DIST"),Fv=Li("NTILE"),Lv=Li("LAG"),Cv=Li("LEAD"),Bv=Li("FIRST_VALUE"),Pv=Li("LAST_VALUE"),$v=Li("NTH_VALUE");function zv(e,...t){return j(e,...t).annotate({aggregate:!0})}var Uv=class e extends Ia{constructor(t,n,r,i,o){n=(n||[]).map(zt);let{strings:s,exprs:a}=Sq(t,n,r,i,o),{spans:c,cols:l}=xv(s,a);super(c,l,{aggregate:t,args:n,type:r,isDistinct:i,filter:o})}get basis(){return this.column}get label(){let{aggregate:t,args:n,isDistinct:r}=this,i=r?"DISTINCT"+(n.length?" ":""):"",o=n.length?`(${i}${n.map(Iq).join(", ")})`:"";return`${t.toLowerCase()}${o}`}distinct(){let{aggregate:t,args:n,type:r,filter:i}=this;return new e(t,n,r,!0,i)}where(t){let{aggregate:n,args:r,type:i,isDistinct:o}=this;return new e(n,r,i,o,t)}window(){let{aggregate:t,args:n,type:r,isDistinct:i}=this,o=new e(t,n,null,i);return new Ih(t,o,r)}partitionby(...t){return this.window().partitionby(...t)}orderby(...t){return this.window().orderby(...t)}rows(t,n){return this.window().rows(t,n)}range(t,n){return this.window().range(t,n)}};function Sq(e,t,n,r,i){let o=`)${n?`::${n}`:""}`,s=[`${e}(${r?"DISTINCT ":""}`],a=[];return t.length?(s=s.concat([...zc(t.length-1,", "),`${o}${i?" FILTER (WHERE ":""}`,...i?[")"]:[]]),a=[...t,...i?[i]:[]]):s[0]+="*"+o,{exprs:a,strings:s}}function Iq(e){let t=so(e);return t&&t.startsWith('"')&&t.endsWith('"')?t.slice(1,-1):t}function Ht(e,t){return(...n)=>new Uv(e,n,t)}var kr=Ht("COUNT","INTEGER"),qv=Ht("AVG"),Tq=Ht("AVG"),jv=Ht("MAD"),Jr=Ht("MAX"),ti=Ht("MIN"),Fr=Ht("SUM","DOUBLE"),Vv=Ht("PRODUCT"),Yv=Ht("MEDIAN"),Gv=Ht("QUANTILE"),Wv=Ht("MODE"),Xv=Ht("VARIANCE"),Hv=Ht("STDDEV"),Zv=Ht("SKEWNESS"),Qv=Ht("KURTOSIS"),Kv=Ht("ENTROPY"),Jv=Ht("VAR_POP"),t2=Ht("STDDEV_POP"),e2=Ht("CORR"),n2=Ht("COVAR_POP"),r2=Ht("REGR_INTERCEPT"),i2=Ht("REGR_SLOPE"),o2=Ht("REGR_COUNT"),Eq=Ht("REGR_R2"),s2=Ht("REGR_SYY"),a2=Ht("REGR_SXX"),Aq=Ht("REGR_SXY"),c2=Ht("REGR_AVGX"),Mq=Ht("REGR_AVGY"),l2=Ht("FIRST"),u2=Ht("LAST"),mu=Ht("ARG_MIN"),yu=Ht("ARG_MAX"),f2=Ht("STRING_AGG"),d2=Ht("ARRAY_AGG");function Th(e,t){let n=zt(e),r=j`CAST(${n} AS ${t})`;return Object.defineProperty(r,"label",{enumerable:!0,get(){return e.label}}),Object.defineProperty(r,"aggregate",{enumerable:!0,get(){return e.aggregate||!1}}),r}var gu=e=>Th(e,"DOUBLE"),h2=e=>Th(e,"INTEGER");var p2=e=>j`epoch_ms(${zt(e)})`,m2=e=>{let t=zt(e);return j`MAKE_DATE(2012, MONTH(${t}), 1)`.annotate({label:"month"})},y2=e=>{let t=zt(e);return j`MAKE_DATE(2012, MONTH(${t}), DAY(${t}))`.annotate({label:"date"})},g2=e=>{let t=zt(e);return j`MAKE_DATE(2012, 1, DAY(${t}))`.annotate({label:"date"})};var Eh=vn("ST_AsGeoJSON"),_D=vn("ST_X"),wD=vn("ST_Y"),Ah=vn("ST_CENTROID"),b2=e=>_D(Ah(e)),x2=e=>wD(Ah(e));var yt=class e{static select(...t){return new e().select(...t)}static from(...t){return new e().from(...t)}static with(...t){return new e().with(...t)}static union(...t){return new qc("UNION",t.flat())}static unionAll(...t){return new qc("UNION ALL",t.flat())}static intersect(...t){return new qc("INTERSECT",t.flat())}static except(...t){return new qc("EXCEPT",t.flat())}constructor(){this.query={with:[],select:[],from:[],where:[],groupby:[],having:[],window:[],qualify:[],orderby:[]}}clone(){let t=new e;return t.query={...this.query},t}with(...t){let{query:n}=this;if(t.length===0)return n.with;{let r=[],i=(o,s)=>{let a=s.clone();a.cteFor=this,r.push({as:o,query:a})};return t.flat().forEach(o=>{if(o!=null)if(o.as&&o.query)i(o.as,o.query);else for(let s in o)i(s,o[s])}),n.with=n.with.concat(r),this}}select(...t){let{query:n}=this;if(t.length===0)return n.select;{let r=[];for(let i of t.flat())if(i!=null)if(typeof i=="string")r.push({as:i,expr:zt(i)});else if(i instanceof gr)r.push({as:i.column,expr:i});else if(Array.isArray(i))r.push({as:i[0],expr:i[1]});else for(let o in i)r.push({as:f0(o),expr:zt(i[o])});return n.select=n.select.concat(r),this}}$select(...t){return this.query.select=[],this.select(...t)}distinct(t=!0){return this.query.distinct=!!t,this}from(...t){let{query:n}=this;if(t.length===0)return n.from;{let r=[];return t.flat().forEach(i=>{if(i!=null)if(typeof i=="string")r.push({as:i,from:Bc(i)});else if(i instanceof gr)r.push({as:i.table,from:i});else if(d0(i)||u0(i))r.push({from:i});else if(Array.isArray(i))r.push({as:f0(i[0]),from:Bc(i[1])});else for(let o in i)r.push({as:f0(o),from:Bc(i[o])})}),n.from=n.from.concat(r),this}}$from(...t){return this.query.from=[],this.from(...t)}sample(t,n){let{query:r}=this;if(arguments.length===0)return r.sample;{let i=t;return typeof t=="number"&&(i=t>0&&t<1?{perc:100*t,method:n}:{rows:Math.round(t),method:n}),r.sample=i,this}}where(...t){let{query:n}=this;return t.length===0?n.where:(n.where=n.where.concat(t.flat().filter(r=>r)),this)}$where(...t){return this.query.where=[],this.where(...t)}groupby(...t){let{query:n}=this;return t.length===0?n.groupby:(n.groupby=n.groupby.concat(t.flat().filter(r=>r).map(zt)),this)}$groupby(...t){return this.query.groupby=[],this.groupby(...t)}having(...t){let{query:n}=this;return t.length===0?n.having:(n.having=n.having.concat(t.flat().filter(r=>r)),this)}window(...t){let{query:n}=this;if(t.length===0)return n.window;{let r=[];return t.flat().forEach(i=>{if(i!=null)for(let o in i)r.push({as:f0(o),expr:i[o]})}),n.window=n.window.concat(r),this}}qualify(...t){let{query:n}=this;return t.length===0?n.qualify:(n.qualify=n.qualify.concat(t.flat().filter(r=>r)),this)}orderby(...t){let{query:n}=this;return t.length===0?n.orderby:(n.orderby=n.orderby.concat(t.flat().filter(r=>r).map(zt)),this)}limit(t){let{query:n}=this;return arguments.length===0?n.limit:(n.limit=Number.isFinite(t)?t:void 0,this)}offset(t){let{query:n}=this;return arguments.length===0?n.offset:(n.offset=Number.isFinite(t)?t:void 0,this)}get subqueries(){let{query:t,cteFor:n}=this,i=(n?.query||t).with?.reduce((s,{as:a,query:c})=>(s[a]=c,s),{}),o=[];return t.from.forEach(({from:s})=>{if(d0(s))o.push(s);else if(i[s.table]){let a=i[s.table];o.push(a)}}),o}toString(){let{select:t,distinct:n,from:r,sample:i,where:o,groupby:s,having:a,window:c,qualify:l,orderby:u,limit:f,offset:d,with:h}=this.query,p=[];if(h.length){let g=h.map(({as:y,query:b})=>`"${y}" AS (${b})`);p.push(`WITH ${g.join(", ")}`)}let m=t.map(({as:g,expr:y})=>hD(y,g)&&!y.table?`${y}`:`${y} AS "${g}"`);if(p.push(`SELECT${n?" DISTINCT":""} ${m.join(", ")}`),r.length){let g=r.map(({as:y,from:b})=>{let x=d0(b)?`(${b})`:`${b}`;return!y||y===b.table?x:`${x} AS "${y}"`});p.push(`FROM ${g.join(", ")}`)}if(o.length){let g=o.map(String).filter(y=>y).join(" AND ");g&&p.push(`WHERE ${g}`)}if(i){let{rows:g,perc:y,method:b,seed:x}=i,_=g?`${g} ROWS`:`${y} PERCENT`,v=b?` (${b}${x!=null?`, ${x}`:""})`:"";p.push(`USING SAMPLE ${_}${v}`)}if(s.length&&p.push(`GROUP BY ${s.join(", ")}`),a.length){let g=a.map(String).filter(y=>y).join(" AND ");g&&p.push(`HAVING ${g}`)}if(c.length){let g=c.map(({as:y,expr:b})=>`"${y}" AS (${b})`);p.push(`WINDOW ${g.join(", ")}`)}if(l.length){let g=l.map(String).filter(y=>y).join(" AND ");g&&p.push(`QUALIFY ${g}`)}return u.length&&p.push(`ORDER BY ${u.join(", ")}`),Number.isFinite(f)&&p.push(`LIMIT ${f}`),Number.isFinite(d)&&p.push(`OFFSET ${d}`),p.join(" ")}},qc=class e{constructor(t,n){this.op=t,this.queries=n.map(r=>r.clone()),this.query={orderby:[]}}clone(){let t=new e(this.op,this.queries);return t.query={...this.query},t}orderby(...t){let{query:n}=this;return t.length===0?n.orderby:(n.orderby=n.orderby.concat(t.flat().filter(r=>r).map(zt)),this)}limit(t){let{query:n}=this;return arguments.length===0?n.limit:(n.limit=Number.isFinite(t)?t:void 0,this)}offset(t){let{query:n}=this;return arguments.length===0?n.offset:(n.offset=Number.isFinite(t)?t:void 0,this)}get subqueries(){let{queries:t,cteFor:n}=this;return n&&t.forEach(r=>r.cteFor=n),t}toString(){let{op:t,queries:n,query:{orderby:r,limit:i,offset:o}}=this,s=[n.join(` ${t} `)];return r.length&&s.push(`ORDER BY ${r.join(", ")}`),Number.isFinite(i)&&s.push(`LIMIT ${i}`),Number.isFinite(o)&&s.push(`OFFSET ${o}`),s.join(" ")}};function d0(e){return e instanceof yt||e instanceof qc}function f0(e){return Nq(e)?e.slice(1,-1):e}function Nq(e){return e[0]==='"'&&e[e.length-1]==='"'}var h0=e=>e;function Rq(){return{apply:h0,invert:h0,sqlApply:zt,sqlInvert:h0}}function Oq({base:e}={}){if(e==null||e===Math.E)return{apply:Math.log,invert:Math.exp,sqlApply:t=>j`LN(${zt(t)})`,sqlInvert:t=>j`EXP(${t})`};if(e===10)return{apply:Math.log10,invert:t=>Math.pow(10,t),sqlApply:t=>j`LOG(${zt(t)})`,sqlInvert:t=>j`POW(10, ${t})`};{let t=+e;return{apply:n=>Math.log(n)/Math.log(t),invert:n=>Math.pow(t,n),sqlApply:n=>j`LN(${zt(n)}) / LN(${t})`,sqlInvert:n=>j`POW(${t}, ${n})`}}}function Dq({constant:e=1}={}){let t=+e;return{apply:n=>Math.sign(n)*Math.log1p(Math.abs(n)),invert:n=>Math.sign(n)*Math.exp(Math.abs(n)-t),sqlApply:n=>(n=zt(n),j`SIGN(${n}) * LN(${t} + ABS(${n}))`),sqlInvert:n=>j`SIGN(${n}) * (EXP(ABS(${n})) - ${t})`}}function kq(){return{apply:e=>Math.sign(e)*Math.sqrt(Math.abs(e)),invert:e=>Math.sign(e)*e*e,sqlApply:e=>(e=zt(e),j`SIGN(${e}) * SQRT(ABS(${e}))`),sqlInvert:e=>j`SIGN(${e}) * (${e}) ** 2`}}function Fq({exponent:e=1}={}){let t=+e;return{apply:n=>Math.sign(n)*Math.pow(Math.abs(n),t),invert:n=>Math.sign(n)*Math.pow(Math.abs(n),1/t),sqlApply:n=>(n=zt(n),j`SIGN(${n}) * POW(ABS(${n}), ${t})`),sqlInvert:n=>j`SIGN(${n}) * POW(ABS(${n}), 1/${t})`}}function vD(){return{apply:e=>+e,invert:e=>new Date(e),sqlApply:e=>e instanceof Date?+e:p2(zt(e)),sqlInvert:h0}}var Lq={linear:Rq,log:Oq,symlog:Dq,sqrt:kq,pow:Fq,time:vD,utc:vD};function Mh(e){let t=Lq[e.type];return t?{...e,...t(e)}:null}function Ea(e,t,{replace:n=!1,temp:r=!0,view:i=!1}={}){return"CREATE"+(n?" OR REPLACE ":" ")+(r?"TEMP ":"")+(i?"VIEW":"TABLE")+(n?" ":" IF NOT EXISTS ")+e+" AS "+t}function _2(e){return`INSTALL ${e}; LOAD ${e}`}function SD(e,{columns:t=Object.keys(e?.[0]||{})}={}){let n=[];if(Array.isArray(t)?(n=t,t=n.reduce((i,o)=>(i[o]=o,i),{})):t&&(n=Object.keys(t)),!n.length)throw new Error("Can not create table from empty column set.");let r=[];for(let i of e){let o=n.map(s=>`${so(i[s])} AS "${t[s]}"`);r.push(`(SELECT ${o.join(", ")})`)}return r.join(" UNION ALL ")}function p0(e,t,n,r={},i={}){let{select:o=["*"],where:s,view:a,temp:c,replace:l,...u}=r,f=Cq({...i,...u}),d=`${e}('${n}'${f?", "+f:""})`,h=s?` WHERE ${s}`:"",p=`SELECT ${o.join(", ")} FROM ${d}${h}`;return Ea(t,p,{view:a,temp:c,replace:l})}function v2(e,t,n){return p0("read_csv",e,t,n,{auto_detect:!0,sample_size:-1})}function S2(e,t,n){return p0("read_json",e,t,n,{auto_detect:!0,json_format:"auto"})}function I2(e,t,n){return p0("read_parquet",e,t,n)}function T2(e,t,n={}){let{options:r,...i}=n;if(r){let o=Array.isArray(r)?r.join(", "):typeof r=="string"?r:Object.entries(r).map(([s,a])=>`${s}=${a}`).join(", ");i.open_options=o.toUpperCase()}return p0("st_read",e,t,i)}function E2(e,t,n={}){let{select:r=["*"],...i}=n,o=SD(t),s=r.length===1&&r[0]==="*"?o:`SELECT ${r} FROM ${o}`;return Ea(e,s,i)}function Cq(e){return Object.entries(e).map(([t,n])=>`${t}=${w2(n)}`).join(", ")}function w2(e){switch(typeof e){case"boolean":return String(e);case"string":return`'${e}'`;case"undefined":case"object":return e==null?"NULL":Array.isArray(e)?"["+e.map(t=>w2(t)).join(", ")+"]":"{"+Object.entries(e).map(([t,n])=>`'${t}': ${w2(n)}`).join(", ")+"}";default:return e}}function ID(e){switch(e){case"BIGINT":case"HUGEINT":case"INTEGER":case"SMALLINT":case"TINYINT":case"UBIGINT":case"UINTEGER":case"USMALLINT":case"UTINYINT":case"DOUBLE":case"FLOAT":case"REAL":case"DECIMAL":return"number";case"DATE":case"TIMESTAMP":case"TIMESTAMPTZ":case"TIMESTAMP WITH TIME ZONE":case"TIME":case"TIMESTAMP_NS":return"date";case"BOOLEAN":return"boolean";case"VARCHAR":case"UUID":return"string";case"LIST":return"array";case"BLOB":case"STRUCT":case"MAP":return"object";default:throw new Error(`Unsupported type: ${e}`)}}var Bq="count",Pq="nulls",$q="max",Uq="min",zq="distinct";var qq={[Bq]:kr,[zq]:e=>kr(e).distinct(),[$q]:Jr,[Uq]:ti,[Pq]:e=>kr().where($c(e))};function TD({table:e,column:t},n){return yt.from(e).select(n.map(r=>[r,qq[r](t)]))}var ED=()=>Object.create(null),m0=class{constructor(t){this.mc=t,this.clear()}clear(){this.tables=ED()}tableInfo(t){let n=this.tables;if(n[t])return n[t];let r=jq(this.mc,t).catch(i=>{throw n[t]=null,i});return n[t]=r}async fieldInfo({table:t,column:n,stats:r}){let o=(await this.tableInfo(t))[n];if(o==null)return;if(!r?.length)return o;let s=await this.mc.query(TD(o,r),{persist:!0}),a={...o,...Array.from(s)[0]};for(let c in a){let l=a[c];typeof l=="bigint"&&(a[c]=Number(l))}return a}async queryFields(t){let n=await Vq(this,t);return(await Promise.all(n.map(i=>this.fieldInfo(i)))).filter(i=>i)}};async function jq(e,t){let n=await e.query(`DESCRIBE ${Bc(t)}`,{type:"json",cache:!1}),r=ED();for(let i of n)r[i.column_name]={table:t,column:i.column_name,sqlType:i.column_type,type:ID(i.column_type),nullable:i.null==="YES"};return r}async function Vq(e,t){return t.length===1&&t[0].column==="*"?Object.values(await e.tableInfo(t[0].table)):t}function MD(e){let t=2166136261;for(let n=0,r=e.length;n<r;++n){let i=e.charCodeAt(n),o=i&65280;o&&(t=AD(t^o>>8)),t=AD(t^i&255)}return Yq(t)}function AD(e){return e+(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24)}function Yq(e){return e+=e<<13,e^=e>>>7,e+=e<<3,e^=e>>>17,e+=e<<5,e&4294967295}var y0=class{constructor(t,{selection:n,temp:r=!0}){this.mc=t,this.selection=n,this.temp=r,this.reset()}reset(){this.enabled=!1,this.clients=null,this.indices=null,this.activeView=null}clear(){this.indices&&(this.mc.cancel(Array.from(this.indices.values(),t=>t.result)),this.indices=null)}index(t,n){if(this.clients!==t){let l=Array.from(t,RD),u=l[0]?.from;this.enabled=l.every(f=>f&&f.from===u),this.clients=t,this.activeView=null,this.clear()}if(!this.enabled)return!1;n=n||this.selection.active;let{source:r}=n;if(r&&r===this.activeView?.source)return!0;if(this.clear(),!r)return!1;let i=this.activeView=Gq(n);if(!i)return!1;this.mc.logger().warn("DATA CUBE INDEX CONSTRUCTION");let o=this.selection.remove(r),s=this.indices=new Map,{mc:a,temp:c}=this;for(let l of t){if(o.skip(l,n))continue;let u=RD(l),f=l.query(o.predicate(l)).select({...i.columns,...u.count}).groupby(Object.keys(i.columns)),[d]=f.subqueries;if(d){let b=Object.values(i.columns).map(x=>x.columns[0]);Xq(d,b)}let h=f.orderby();f.query.orderby=[];let p=f.toString(),g=`cube_index_${(MD(p)>>>0).toString(16)}`,y=a.exec(Ea(g,p,{temp:c}));s.set(l,{table:g,result:y,order:h,...u})}}async update(){let{clients:t,selection:n,activeView:r}=this,i=r.predicate(n.active.predicate);return Promise.all(Array.from(t).map(o=>this.updateClient(o,i)))}async updateClient(t,n){let r=this.indices.get(t);if(!r)return;n||(n=this.activeView.predicate(this.selection.active.predicate));let{table:i,dims:o,aggr:s,order:a=[]}=r,c=yt.select(o,s).from(i).groupby(o).where(n).orderby(a);return this.mc.updateClient(t,c)}};function Gq(e){let{source:t,schema:n}=e,r=e.predicate?.columns;if(!n||!r)return null;let{type:i,scales:o,pixelSize:s=1}=n,a;if(i==="interval"&&o){let c=o.map(l=>Wq(l,s));if(c.some(l=>l==null))return null;c.length===1?(a=l=>l?Te("active0",l.range.map(c[0])):[],r={active0:c[0](e.predicate.field)}):(a=l=>l?Xn(l.children.map(({range:u},f)=>Te(`active${f}`,u.map(c[f])))):[],r=Object.fromEntries(e.predicate.children.map((l,u)=>[`active${u}`,c[u](l.field)])))}else if(i==="point")a=c=>c,r=Object.fromEntries(r.map(c=>[c.toString(),c]));else return null;return{source:t,columns:r,predicate:a}}function Wq(e,t){let{apply:n,sqlApply:r}=Mh(e);if(n){let{domain:i,range:o}=e,s=n(Math.min(...i)),a=n(Math.max(...i)),c=Math.abs(o[1]-o[0])/(a-s)/t,l=t===1?"":`${t}::INTEGER * `;return u=>j`${l}FLOOR(${c}::DOUBLE * (${r(u)} - ${s}::DOUBLE))::INTEGER`}}var ND={from:NaN};function RD(e){if(!e.filterIndexable)return ND;let t=e.query(),n=A2(t);if(!n||!t.groupby)return ND;let r=new Set(t.groupby().map(a=>a.column)),i=[],o=[],s;for(let{as:a,expr:{aggregate:c}}of t.select())switch(c?.toUpperCase?.()){case"COUNT":case"SUM":i.push({[a]:j`SUM("${a}")::DOUBLE`});break;case"AVG":s="_count_",i.push({[a]:j`(SUM("${a}" * ${s}) / SUM(${s}))::DOUBLE`});break;case"MAX":i.push({[a]:j`MAX("${a}")`});break;case"MIN":i.push({[a]:j`MIN("${a}")`});break;default:if(r.has(a))o.push(a);else return null}return{aggr:i,dims:o,count:s?{[s]:j`COUNT(*)`}:{},from:n}}function A2(e){let t=e.subqueries;if(e.select){let r=e.from();if(!r.length)return;if(t.length===0)return r[0].from.table}let n=A2(t[0]);for(let r=1;r<t.length;++r){let i=A2(t[r]);if(i!==void 0&&i!==n)return NaN}return n}function Xq(e,t){let n=new Set,r=i=>{n.has(i)||(n.add(i),i.select&&i.from().length&&i.select(t),i.subqueries.forEach(r))};r(e)}var g0=class{constructor(t,n,r=!0){this.mc=t,this.selection=n,this.clients=new Set,this.indexer=r?new y0(this.mc,{...r,selection:n}):null;let{value:i,activate:o}=this.handlers={value:()=>this.update(),activate:s=>this.indexer?.index(this.clients,s)};n.addEventListener("value",i),n.addEventListener("activate",o)}finalize(){let{value:t,activate:n}=this.handlers;this.selection.removeEventListener("value",t),this.selection.removeEventListener("activate",n)}reset(){this.indexer?.reset()}add(t){return(this.clients=new Set(this.clients)).add(t),this}remove(t){return this.clients.has(t)&&(this.clients=new Set(this.clients)).delete(t),this}update(){let{mc:t,indexer:n,clients:r,selection:i}=this;return n?.index(r)?n.update():Hq(t,r,i)}};function Hq(e,t,n){return Promise.all(Array.from(t).map(r=>{let i=n.predicate(r);if(i!=null)return e.updateClient(r,r.query(i))}))}function b0(){let e,t,n=new Promise((r,i)=>{e=r,t=i});return n.fulfill=r=>(e(r),n),n.reject=r=>(t(r),n),n}function Zq(e){return(typeof requestAnimationFrame<"u"?requestAnimationFrame:typeof setImmediate<"u"?setImmediate:setTimeout)(e)}function OD(e,t,n){let r=[],i=0;function o(){let s=Qq(r,t);r=[],i=0;for(let a of s)Jq(a,e,n),nj(a,t)}return{add(s,a){s.request.type==="arrow"?(i=i||Zq(()=>o()),r.push({entry:s,priority:a,index:r.length})):e(s,a)}}}function Qq(e,t){let n=[],r=new Map;for(let i of e){let{entry:{request:o}}=i,s=Kq(o.query,t);if(!r.has(s)){let a=[];n.push(a),r.set(s,a)}r.get(s).push(i)}return n}function Kq(e,t){let n=`${e}`;if(e instanceof yt&&!t.get(n)){if(e.orderby().length||e.where().length||e.qualify().length||e.having().length)return n;let r=e.clone().$select("*"),i=e.groupby();if(i.length){let o={};e.select().forEach(({as:s,expr:a})=>o[s]=a),r.$groupby(i.map(s=>s instanceof gr&&o[s.column]||s))}return`${r}`}else return n}function Jq(e,t,n){if(tj(e))t({request:{type:"arrow",cache:!1,record:!1,query:ej(e,n)},result:e.result=b0()});else for(let{entry:r,priority:i}of e)t(r,i)}function tj(e){if(e.length>1){let t=`${e[0].entry.request.query}`;for(let n=1;n<e.length;++n)if(t!==`${e[n].entry.request.query}`)return!0}return!1}function ej(e,t){let n=e.maps=[],r=new Map;for(let s of e){let{query:a}=s.entry.request,c=[];n.push(c);for(let{as:l,expr:u}of a.select()){let f=`${u}`;r.has(f)||r.set(f,[`col${r.size}`,u]);let[d]=r.get(f);c.push([d,l])}t(`${a}`)}let i=e[0].entry.request.query.clone(),o=i.groupby();if(o.length){let s={};e.maps[0].forEach(([a,c])=>s[c]=a),i.$groupby(o.map(a=>a instanceof gr&&s[a.column]||a))}return i.$select(Array.from(r.values()))}async function nj(e,t){let{maps:n,result:r}=e;if(!n)return;let i;try{i=await r}catch(o){for(let{entry:s}of e)s.result.reject(o);return}e.forEach(({entry:o},s)=>{let{request:a,result:c}=o,l=rj(i,n[s]);a.cache&&t.set(String(a.query),l),c.fulfill(l)})}function rj(e,t){if(t){let n={};for(let[r,i]of t)n[i]=e.getChild(r);return new e.constructor(n)}else return e}var ij=typeof requestIdleCallback<"u"?requestIdleCallback:setTimeout,DD=()=>({get:()=>{},set:(e,t)=>t,clear:()=>{}});function kD({max:e=1e3,ttl:t=3*60*60*1e3}={}){let n=new Map;function r(){let i=performance.now()-t,o=null,s=1/0;for(let[a,c]of n){let{last:l}=c;l<s&&(o=a,s=l),i>l&&n.delete(a)}o&&n.delete(o)}return{get(i){let o=n.get(i);if(o)return o.last=performance.now(),o.value},set(i,o){return n.set(i,{last:performance.now(),value:o}),n.size>e&&ij(r),o},clear(){n=new Map}}}function FD(e){let t=Array.from({length:e},()=>({head:null,tail:null}));return{isEmpty(){return t.every(n=>!n.head)},insert(n,r){let i=t[r];if(!i)throw new Error(`Invalid queue priority rank: ${r}`);let o={item:n,next:null};i.head===null?i.head=i.tail=o:i.tail=i.tail.next=o},remove(n){for(let r of t){let{head:i,tail:o}=r;for(let s=null,a=i;a;s=a,a=a.next)n(a.item)&&(a===i?i=a.next:s.next=a.next,a===o&&(o=s||i));r.head=i,r.tail=o}},next(){for(let n of t){let{head:r}=n;if(r!==null)return n.head=r.next,n.tail===r&&(n.tail=null),r.item}}}}var ao={High:0,Normal:1,Low:2};function LD(){let e=FD(3),t,n,r,i=[],o=null,s;function a(){if(o||e.isEmpty())return;let{request:f,result:d}=e.next();o=u(f,d),o.finally(()=>{o=null,a()})}function c(f,d=ao.Normal){e.insert(f,d),a()}function l(f){i.length&&f&&i.forEach(d=>d.add(f))}async function u(f,d){try{let{query:h,type:p,cache:m=!1,record:g=!0,options:y}=f,b=h?`${h}`:null;if(g&&l(b),m){let v=n.get(b);if(v){r.debug("Cache"),d.fulfill(v);return}}let x=performance.now(),_=await t.query({type:p,sql:b,...y});m&&n.set(b,_),r.debug(`Request: ${(performance.now()-x).toFixed(1)}`),d.fulfill(_)}catch(h){d.reject(h)}}return{cache(f){return f!==void 0?n=f===!0?kD():f||DD():n},logger(f){return f?r=f:r},connector(f){return f?t=f:t},consolidate(f){f&&!s?s=OD(c,n,l):!f&&s&&(s=null)},request(f,d=ao.Normal){let h=b0(),p={request:f,result:h};return s?s.add(p,d):c(p,d),h},cancel(f){let d=new Set(f);e.remove(({result:h})=>d.has(h))},clear(){e.remove(({result:f})=>(f.reject("Cleared"),!0))},record(){let f=[],d={add(h){f.push(h)},reset(){f=[]},snapshot(){return f.slice()},stop(){return i=i.filter(h=>h!==d),f}};return i.push(d),d}}}function CD(){return{debug(){},info(){},log(){},warn(){},error(){}}}var x0;function ei(e){return e?x0=e:x0==null&&(x0=new Nh),x0}var Nh=class{constructor(t=l0(),n={}){let{logger:r=console,manager:i=LD()}=n;this.catalog=new m0(this),this.manager=i,this.logger(r),this.configure(n),this.databaseConnector(t),this.clear()}logger(t){return arguments.length&&(this._logger=t||CD(),this.manager.logger(this._logger)),this._logger}configure({cache:t=!0,consolidate:n=!0,indexes:r=!0}){this.manager.cache(t),this.manager.consolidate(n),this.indexes=r}clear({clients:t=!0,cache:n=!0,catalog:r=!1}={}){this.manager.clear(),t&&(this.clients?.forEach(i=>this.disconnect(i)),this.filterGroups?.forEach(i=>i.finalize()),this.clients=new Set,this.filterGroups=new Map),n&&this.manager.cache().clear(),r&&this.catalog.clear()}databaseConnector(t){return this.manager.connector(t)}cancel(t){this.manager.cancel(t)}exec(t,{priority:n=ao.Normal}={}){return t=Array.isArray(t)?t.join(`;
11
+ `):t,this.manager.request({type:"exec",query:t},n)}query(t,{type:n="arrow",cache:r=!0,priority:i=ao.Normal,...o}={}){return this.manager.request({type:n,query:t,cache:r,options:o},i)}prefetch(t,n={}){return this.query(t,{...n,cache:!0,priority:ao.Low})}createBundle(t,n,r=ao.Low){let i={name:t,queries:n};return this.manager.request({type:"create-bundle",options:i},r)}loadBundle(t,n=ao.High){let r={name:t};return this.manager.request({type:"load-bundle",options:r},n)}updateClient(t,n,r=ao.Normal){return t.queryPending(),this.query(n,{priority:r}).then(i=>t.queryResult(i).update(),i=>{t.queryError(i),this._logger.error(i)})}requestQuery(t,n){return this.filterGroups.get(t.filterBy)?.reset(),n?this.updateClient(t,n):t.update()}async connect(t){let{catalog:n,clients:r,filterGroups:i,indexes:o}=this;if(r.has(t))throw new Error("Client already connected.");r.add(t),t.coordinator=this;let s=t.fields();s?.length&&t.fieldInfo(await n.queryFields(s));let a=t.filterBy;if(a)if(i.has(a))i.get(a).add(t);else{let c=new g0(this,a,o);i.set(a,c.add(t))}t.requestQuery()}disconnect(t){let{clients:n,filterGroups:r}=this;n.has(t)&&(n.delete(t),r.get(t.filterBy)?.remove(t),t.coordinator=null)}};var _0=class{constructor(){this._callbacks=new Map}addEventListener(t,n){this._callbacks.has(t)||this._callbacks.set(t,{callbacks:new Set,pending:null,queue:new M2}),this._callbacks.get(t).callbacks.add(n)}removeEventListener(t,n){let r=this._callbacks.get(t);r&&r.callbacks.delete(n)}willEmit(t,n){return n}emitQueueFilter(){return null}cancel(t){this._callbacks.get(t)?.queue.clear()}emit(t,n){let r=this._callbacks.get(t)||{};if(r.pending)r.queue.enqueue(n,this.emitQueueFilter(t,n));else{let i=this.willEmit(t,n),{callbacks:o,queue:s}=r;if(o?.size){let a=Promise.allSettled(Array.from(o,c=>c(i))).then(()=>{r.pending=null,s.isEmpty()||this.emit(t,s.dequeue())});r.pending=a}}}},M2=class{constructor(){this.clear()}clear(){this.next=null}isEmpty(){return!this.next}enqueue(t,n){let r={value:t};if(n&&this.next){let i=this;for(;i.next;)n(i.next.value)?i=i.next:i.next=i.next.next;i.next=r}else this.next=r}dequeue(){let{next:t}=this;return this.next=t?.next,t?.value}};function Rh(e,t){return e===t?!1:e instanceof Date&&t instanceof Date?+e!=+t:Array.isArray(e)&&Array.isArray(t)?oj(e,t):!0}function oj(e,t){if(e.length!==t.length)return!0;for(let n=0;n<e.length;++n)if(e[n]!==t[n])return!0;return!1}function br(e){return e instanceof Aa}var Aa=class e extends _0{constructor(t){super(),this._value=t}static value(t){return new e(t)}static array(t){if(t.some(n=>br(n))){let n=new e,r=()=>n.update(t.map(i=>br(i)?i.value:i));return r(),t.forEach(i=>br(i)?i.addEventListener("value",r):0),n}return new e(t)}get value(){return this._value}update(t,{force:n}={}){return Rh(this._value,t)||n?this.emit("value",t):this.cancel("value"),this}willEmit(t,n){return t==="value"&&(this._value=n),n}};function ni(e){return e instanceof xs}var xs=class e extends Aa{static intersect({cross:t=!1}={}){return new e(new jc({cross:t}))}static union({cross:t=!1}={}){return new e(new jc({cross:t,union:!0}))}static single({cross:t=!1}={}){return new e(new jc({cross:t,single:!0}))}static crossfilter(){return new e(new jc({cross:!0}))}constructor(t=new jc){super([]),this._resolved=this._value,this._resolver=t}clone(){let t=new e(this._resolver);return t._value=t._resolved=this._value,t}remove(t){let n=this.clone();return n._value=n._resolved=n._resolver.resolve(this._resolved,{source:t}),n._value.active={source:t},n}get active(){return this.clauses.active}get value(){return this.active?.value}get clauses(){return super.value}get single(){return this._resolver.single}activate(t){this.emit("activate",t)}update(t){return this._resolved=this._resolver.resolve(this._resolved,t,!0),this._resolved.active=t,super.update(this._resolved)}willEmit(t,n){return t==="value"?(this._value=n,this.value):n}emitQueueFilter(t,n){return t==="value"?this._resolver.queueFilter(n):null}skip(t,n){return this._resolver.skip(t,n)}predicate(t,n=!1){let{clauses:r}=this,i=n?null:r.active;return this._resolver.predicate(r,i,t)}},jc=class{constructor({union:t,cross:n,single:r}={}){this.union=!!t,this.cross=!!n,this.single=!!r}resolve(t,n,r=!1){let{source:i,predicate:o}=n,s=t.filter(c=>i!==c.source),a=this.single?[]:s;return this.single&&r&&s.forEach(c=>c.source?.reset?.()),o&&a.push(n),a}skip(t,n){return this.cross&&n?.clients?.has(t)}predicate(t,n,r){let{union:i}=this;if(this.skip(r,n))return;let o=t.filter(s=>!this.skip(r,s)).map(s=>s.predicate);return i&&o.length>1?Pc(o):o}queueFilter(t){if(this.cross){let n=t.active?.source;return r=>r.active?.source!==n}}};function BD(e="http://localhost:3000/"){return{async query(t){let n=fetch(e,{method:"POST",mode:"cors",cache:"no-cache",credentials:"omit",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return t.type==="exec"?n:t.type==="arrow"?Cc(n):(await n).json()}}}var sj=Object.create,PD=Object.defineProperty,aj=Object.getOwnPropertyDescriptor,cj=Object.getOwnPropertyNames,lj=Object.getPrototypeOf,uj=Object.prototype.hasOwnProperty,fj=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),dj=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of cj(t))!uj.call(e,i)&&i!==n&&PD(e,i,{get:()=>t[i],enumerable:!(r=aj(t,i))||r.enumerable});return e},hj=(e,t,n)=>(n=e!=null?sj(lj(e)):{},dj(t||!e||!e.__esModule?PD(n,"default",{value:e,enumerable:!0}):n,e)),pj=fj((e,t)=>{t.exports=Worker}),mj=(e=>(e[e.UNDEFINED=0]="UNDEFINED",e[e.AUTOMATIC=1]="AUTOMATIC",e[e.READ_ONLY=2]="READ_ONLY",e[e.READ_WRITE=3]="READ_WRITE",e))(mj||{}),yj=(e=>(e[e.IDENTIFIER=0]="IDENTIFIER",e[e.NUMERIC_CONSTANT=1]="NUMERIC_CONSTANT",e[e.STRING_CONSTANT=2]="STRING_CONSTANT",e[e.OPERATOR=3]="OPERATOR",e[e.KEYWORD=4]="KEYWORD",e[e.COMMENT=5]="COMMENT",e))(yj||{}),gj=(e=>(e[e.NONE=0]="NONE",e[e.DEBUG=1]="DEBUG",e[e.INFO=2]="INFO",e[e.WARNING=3]="WARNING",e[e.ERROR=4]="ERROR",e))(gj||{}),bj=(e=>(e[e.NONE=0]="NONE",e[e.CONNECT=1]="CONNECT",e[e.DISCONNECT=2]="DISCONNECT",e[e.OPEN=3]="OPEN",e[e.QUERY=4]="QUERY",e[e.INSTANTIATE=5]="INSTANTIATE",e))(bj||{}),xj=(e=>(e[e.NONE=0]="NONE",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR",e[e.START=3]="START",e[e.RUN=4]="RUN",e[e.CAPTURE=5]="CAPTURE",e))(xj||{}),_j=(e=>(e[e.NONE=0]="NONE",e[e.WEB_WORKER=1]="WEB_WORKER",e[e.NODE_WORKER=2]="NODE_WORKER",e[e.BINDINGS=3]="BINDINGS",e[e.ASYNC_DUCKDB=4]="ASYNC_DUCKDB",e))(_j||{}),$D=class{log(e){}},UD=class{constructor(e=2){this.level=e}log(e){e.level>=this.level&&console.log(e)}};var wj=(e=>(e[e.SUCCESS=0]="SUCCESS",e))(wj||{}),vj=class{constructor(e,t){this._bindings=e,this._conn=t}get bindings(){return this._bindings}async close(){return this._bindings.disconnect(this._conn)}useUnsafe(e){return e(this._bindings,this._conn)}async query(e){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:e});let t=await this._bindings.runQuery(this._conn,e),n=nn.from(t);return console.assert(n.isSync(),"Reader is not sync"),console.assert(n.isFile(),"Reader is not file"),new sn(n)}async send(e){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:e});let t=await this._bindings.startPendingQuery(this._conn,e);for(;t==null;)t=await this._bindings.pollPendingQuery(this._conn);let n=new zD(this._bindings,this._conn,t),r=await nn.from(n);return console.assert(r.isAsync()),console.assert(r.isStream()),r}async cancelSent(){return await this._bindings.cancelPendingQuery(this._conn)}async getTableNames(e){return await this._bindings.getTableNames(this._conn,e)}async prepare(e){let t=await this._bindings.createPrepared(this._conn,e);return new Sj(this._bindings,this._conn,t)}async insertArrowTable(e,t){let n=c0(e,"stream");await this.insertArrowFromIPCStream(n,t)}async insertArrowFromIPCStream(e,t){await this._bindings.insertArrowFromIPCStream(this._conn,e,t)}async insertCSVFromPath(e,t){await this._bindings.insertCSVFromPath(this._conn,e,t)}async insertJSONFromPath(e,t){await this._bindings.insertJSONFromPath(this._conn,e,t)}},zD=class{constructor(e,t,n){this.db=e,this.conn=t,this.header=n,this._first=!0,this._depleted=!1,this._inFlight=null}async next(){if(this._first)return this._first=!1,{done:!1,value:this.header};if(this._depleted)return{done:!0,value:null};let e;return this._inFlight!=null?(e=await this._inFlight,this._inFlight=null):e=await this.db.fetchQueryResults(this.conn),this._depleted=e.length==0,this._depleted||(this._inFlight=this.db.fetchQueryResults(this.conn)),{done:this._depleted,value:e}}[Symbol.asyncIterator](){return this}},Sj=class{constructor(e,t,n){this.bindings=e,this.connectionId=t,this.statementId=n}async close(){await this.bindings.closePrepared(this.connectionId,this.statementId)}async query(...e){let t=await this.bindings.runPrepared(this.connectionId,this.statementId,e),n=nn.from(t);return console.assert(n.isSync()),console.assert(n.isFile()),new sn(n)}async send(...e){let t=await this.bindings.sendPrepared(this.connectionId,this.statementId,e),n=new zD(this.bindings,this.connectionId,t),r=await nn.from(n);return console.assert(r.isAsync()),console.assert(r.isStream()),r}},Ij=(e=>(e.CANCEL_PENDING_QUERY="CANCEL_PENDING_QUERY",e.CLOSE_PREPARED="CLOSE_PREPARED",e.COLLECT_FILE_STATISTICS="COLLECT_FILE_STATISTICS",e.CONNECT="CONNECT",e.COPY_FILE_TO_BUFFER="COPY_FILE_TO_BUFFER",e.COPY_FILE_TO_PATH="COPY_FILE_TO_PATH",e.CREATE_PREPARED="CREATE_PREPARED",e.DISCONNECT="DISCONNECT",e.DROP_FILE="DROP_FILE",e.DROP_FILES="DROP_FILES",e.EXPORT_FILE_STATISTICS="EXPORT_FILE_STATISTICS",e.FETCH_QUERY_RESULTS="FETCH_QUERY_RESULTS",e.FLUSH_FILES="FLUSH_FILES",e.GET_FEATURE_FLAGS="GET_FEATURE_FLAGS",e.GET_TABLE_NAMES="GET_TABLE_NAMES",e.GET_VERSION="GET_VERSION",e.GLOB_FILE_INFOS="GLOB_FILE_INFOS",e.INSERT_ARROW_FROM_IPC_STREAM="INSERT_ARROW_FROM_IPC_STREAM",e.INSERT_CSV_FROM_PATH="IMPORT_CSV_FROM_PATH",e.INSERT_JSON_FROM_PATH="IMPORT_JSON_FROM_PATH",e.INSTANTIATE="INSTANTIATE",e.OPEN="OPEN",e.PING="PING",e.POLL_PENDING_QUERY="POLL_PENDING_QUERY",e.REGISTER_FILE_BUFFER="REGISTER_FILE_BUFFER",e.REGISTER_FILE_HANDLE="REGISTER_FILE_HANDLE",e.REGISTER_FILE_URL="REGISTER_FILE_URL",e.RESET="RESET",e.RUN_PREPARED="RUN_PREPARED",e.RUN_QUERY="RUN_QUERY",e.SEND_PREPARED="SEND_PREPARED",e.START_PENDING_QUERY="START_PENDING_QUERY",e.TOKENIZE="TOKENIZE",e))(Ij||{}),Tj=(e=>(e.CONNECTION_INFO="CONNECTION_INFO",e.ERROR="ERROR",e.FEATURE_FLAGS="FEATURE_FLAGS",e.FILE_BUFFER="FILE_BUFFER",e.FILE_INFOS="FILE_INFOS",e.FILE_SIZE="FILE_SIZE",e.FILE_STATISTICS="FILE_STATISTICS",e.INSTANTIATE_PROGRESS="INSTANTIATE_PROGRESS",e.LOG="LOG",e.OK="OK",e.PREPARED_STATEMENT_ID="PREPARED_STATEMENT_ID",e.QUERY_PLAN="QUERY_PLAN",e.QUERY_RESULT="QUERY_RESULT",e.QUERY_RESULT_CHUNK="QUERY_RESULT_CHUNK",e.QUERY_RESULT_HEADER="QUERY_RESULT_HEADER",e.QUERY_RESULT_HEADER_OR_NULL="QUERY_RESULT_HEADER_OR_NULL",e.REGISTERED_FILE="REGISTERED_FILE",e.SCRIPT_TOKENS="SCRIPT_TOKENS",e.SUCCESS="SUCCESS",e.TABLE_NAMES="TABLE_NAMES",e.VERSION_STRING="VERSION_STRING",e))(Tj||{}),Kt=class{constructor(e,t){this.promiseResolver=()=>{},this.promiseRejecter=()=>{},this.type=e,this.data=t,this.promise=new Promise((n,r)=>{this.promiseResolver=n,this.promiseRejecter=r})}};function w0(e){switch(e.typeId){case D.Binary:return{sqlType:"binary"};case D.Bool:return{sqlType:"bool"};case D.Date:return{sqlType:"date"};case D.DateDay:return{sqlType:"date32[d]"};case D.DateMillisecond:return{sqlType:"date64[ms]"};case D.Decimal:{let t=e;return{sqlType:"decimal",precision:t.precision,scale:t.scale}}case D.Float:return{sqlType:"float"};case D.Float16:return{sqlType:"float16"};case D.Float32:return{sqlType:"float32"};case D.Float64:return{sqlType:"float64"};case D.Int:return{sqlType:"int32"};case D.Int16:return{sqlType:"int16"};case D.Int32:return{sqlType:"int32"};case D.Int64:return{sqlType:"int64"};case D.Uint16:return{sqlType:"uint16"};case D.Uint32:return{sqlType:"uint32"};case D.Uint64:return{sqlType:"uint64"};case D.Uint8:return{sqlType:"uint8"};case D.IntervalDayTime:return{sqlType:"interval[dt]"};case D.IntervalYearMonth:return{sqlType:"interval[m]"};case D.List:return{sqlType:"list",valueType:w0(e.valueType)};case D.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:e.byteWidth};case D.Null:return{sqlType:"null"};case D.Utf8:return{sqlType:"utf8"};case D.Struct:return{sqlType:"struct",fields:e.children.map(t=>F2(t.name,t.type))};case D.Map:{let t=e;return{sqlType:"map",keyType:w0(t.keyType),valueType:w0(t.valueType)}}case D.Time:return{sqlType:"time[s]"};case D.TimeMicrosecond:return{sqlType:"time[us]"};case D.TimeMillisecond:return{sqlType:"time[ms]"};case D.TimeNanosecond:return{sqlType:"time[ns]"};case D.TimeSecond:return{sqlType:"time[s]"};case D.Timestamp:return{sqlType:"timestamp",timezone:e.timezone||void 0};case D.TimestampSecond:return{sqlType:"timestamp[s]",timezone:e.timezone||void 0};case D.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:e.timezone||void 0};case D.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:e.timezone||void 0};case D.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:e.timezone||void 0}}throw new Error("unsupported arrow type: ".concat(e.toString()))}function F2(e,t){let n=w0(t);return n.name=e,n}var Ej=new TextEncoder,qD=class{constructor(e,t=null){this._onInstantiationProgress=[],this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{},this._nextMessageId=0,this._pendingRequests=new Map,this._logger=e,this._onMessageHandler=this.onMessage.bind(this),this._onErrorHandler=this.onError.bind(this),this._onCloseHandler=this.onClose.bind(this),t!=null&&this.attach(t)}get logger(){return this._logger}attach(e){this._worker=e,this._worker.addEventListener("message",this._onMessageHandler),this._worker.addEventListener("error",this._onErrorHandler),this._worker.addEventListener("close",this._onCloseHandler),this._workerShutdownPromise=new Promise((t,n)=>{this._workerShutdownResolver=t})}detach(){this._worker&&(this._worker.removeEventListener("message",this._onMessageHandler),this._worker.removeEventListener("error",this._onErrorHandler),this._worker.removeEventListener("close",this._onCloseHandler),this._worker=null,this._workerShutdownResolver(null),this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async terminate(){this._worker&&(this._worker.terminate(),this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async postTask(e,t=[]){if(!this._worker){console.error("cannot send a message since the worker is not set!");return}let n=this._nextMessageId++;return this._pendingRequests.set(n,e),this._worker.postMessage({messageId:n,type:e.type,data:e.data},t),await e.promise}onMessage(e){var t;let n=e.data;switch(n.type){case"LOG":{this._logger.log(n.data);return}case"INSTANTIATE_PROGRESS":{for(let i of this._onInstantiationProgress)i(n.data);return}}let r=this._pendingRequests.get(n.requestId);if(!r){console.warn("unassociated response: [".concat(n.requestId,", ").concat(n.type.toString(),"]"));return}if(this._pendingRequests.delete(n.requestId),n.type=="ERROR"){let i=new Error(n.data.message);i.name=n.data.name,(t=Object.getOwnPropertyDescriptor(i,"stack"))!=null&&t.writable&&(i.stack=n.data.stack),r.promiseRejecter(i);return}switch(r.type){case"CLOSE_PREPARED":case"COLLECT_FILE_STATISTICS":case"COPY_FILE_TO_PATH":case"DISCONNECT":case"DROP_FILE":case"DROP_FILES":case"FLUSH_FILES":case"INSERT_ARROW_FROM_IPC_STREAM":case"IMPORT_CSV_FROM_PATH":case"IMPORT_JSON_FROM_PATH":case"OPEN":case"PING":case"REGISTER_FILE_BUFFER":case"REGISTER_FILE_HANDLE":case"REGISTER_FILE_URL":case"RESET":if(n.type=="OK"){r.promiseResolver(n.data);return}break;case"INSTANTIATE":if(this._onInstantiationProgress=[],n.type=="OK"){r.promiseResolver(n.data);return}break;case"GLOB_FILE_INFOS":if(n.type=="FILE_INFOS"){r.promiseResolver(n.data);return}break;case"GET_VERSION":if(n.type=="VERSION_STRING"){r.promiseResolver(n.data);return}break;case"GET_FEATURE_FLAGS":if(n.type=="FEATURE_FLAGS"){r.promiseResolver(n.data);return}break;case"GET_TABLE_NAMES":if(n.type=="TABLE_NAMES"){r.promiseResolver(n.data);return}break;case"TOKENIZE":if(n.type=="SCRIPT_TOKENS"){r.promiseResolver(n.data);return}break;case"COPY_FILE_TO_BUFFER":if(n.type=="FILE_BUFFER"){r.promiseResolver(n.data);return}break;case"EXPORT_FILE_STATISTICS":if(n.type=="FILE_STATISTICS"){r.promiseResolver(n.data);return}break;case"CONNECT":if(n.type=="CONNECTION_INFO"){r.promiseResolver(n.data);return}break;case"RUN_PREPARED":case"RUN_QUERY":if(n.type=="QUERY_RESULT"){r.promiseResolver(n.data);return}break;case"SEND_PREPARED":if(n.type=="QUERY_RESULT_HEADER"){r.promiseResolver(n.data);return}break;case"START_PENDING_QUERY":if(n.type=="QUERY_RESULT_HEADER_OR_NULL"){r.promiseResolver(n.data);return}break;case"POLL_PENDING_QUERY":if(n.type=="QUERY_RESULT_HEADER_OR_NULL"){r.promiseResolver(n.data);return}break;case"CANCEL_PENDING_QUERY":if(this._onInstantiationProgress=[],n.type=="SUCCESS"){r.promiseResolver(n.data);return}break;case"FETCH_QUERY_RESULTS":if(n.type=="QUERY_RESULT_CHUNK"){r.promiseResolver(n.data);return}break;case"CREATE_PREPARED":if(n.type=="PREPARED_STATEMENT_ID"){r.promiseResolver(n.data);return}break}r.promiseRejecter(new Error("unexpected response type: ".concat(n.type.toString())))}onError(e){console.error(e),console.error("error in duckdb worker: ".concat(e.message)),this._pendingRequests.clear()}onClose(){if(this._workerShutdownResolver(null),this._pendingRequests.size!=0){console.warn("worker terminated with ".concat(this._pendingRequests.size," pending requests"));return}this._pendingRequests.clear()}async reset(){let e=new Kt("RESET",null);return await this.postTask(e)}async ping(){let e=new Kt("PING",null);await this.postTask(e)}async dropFile(e){let t=new Kt("DROP_FILE",e);return await this.postTask(t)}async dropFiles(){let e=new Kt("DROP_FILES",null);return await this.postTask(e)}async flushFiles(){let e=new Kt("FLUSH_FILES",null);return await this.postTask(e)}async instantiate(e,t=null,n=r=>{}){this._onInstantiationProgress.push(n);let r=new Kt("INSTANTIATE",[e,t]);return await this.postTask(r)}async getVersion(){let e=new Kt("GET_VERSION",null);return await this.postTask(e)}async getFeatureFlags(){let e=new Kt("GET_FEATURE_FLAGS",null);return await this.postTask(e)}async open(e){let t=new Kt("OPEN",e);await this.postTask(t)}async tokenize(e){let t=new Kt("TOKENIZE",e);return await this.postTask(t)}async connectInternal(){let e=new Kt("CONNECT",null);return await this.postTask(e)}async connect(){let e=await this.connectInternal();return new vj(this,e)}async disconnect(e){let t=new Kt("DISCONNECT",e);await this.postTask(t)}async runQuery(e,t){let n=new Kt("RUN_QUERY",[e,t]);return await this.postTask(n)}async startPendingQuery(e,t){let n=new Kt("START_PENDING_QUERY",[e,t]);return await this.postTask(n)}async pollPendingQuery(e){let t=new Kt("POLL_PENDING_QUERY",e);return await this.postTask(t)}async cancelPendingQuery(e){let t=new Kt("CANCEL_PENDING_QUERY",e);return await this.postTask(t)}async fetchQueryResults(e){let t=new Kt("FETCH_QUERY_RESULTS",e);return await this.postTask(t)}async getTableNames(e,t){let n=new Kt("GET_TABLE_NAMES",[e,t]);return await this.postTask(n)}async createPrepared(e,t){let n=new Kt("CREATE_PREPARED",[e,t]);return await this.postTask(n)}async closePrepared(e,t){let n=new Kt("CLOSE_PREPARED",[e,t]);await this.postTask(n)}async runPrepared(e,t,n){let r=new Kt("RUN_PREPARED",[e,t,n]);return await this.postTask(r)}async sendPrepared(e,t,n){let r=new Kt("SEND_PREPARED",[e,t,n]);return await this.postTask(r)}async globFiles(e){let t=new Kt("GLOB_FILE_INFOS",e);return await this.postTask(t)}async registerFileText(e,t){let n=Ej.encode(t);await this.registerFileBuffer(e,n)}async registerFileURL(e,t,n,r){t===void 0&&(t=e);let i=new Kt("REGISTER_FILE_URL",[e,t,n,r]);await this.postTask(i)}async registerEmptyFileBuffer(e){let t=new Kt("REGISTER_FILE_BUFFER",[e,new Uint8Array]);await this.postTask(t)}async registerFileBuffer(e,t){let n=new Kt("REGISTER_FILE_BUFFER",[e,t]);await this.postTask(n,[t.buffer])}async registerFileHandle(e,t,n,r){let i=new Kt("REGISTER_FILE_HANDLE",[e,t,n,r]);await this.postTask(i,[])}async collectFileStatistics(e,t){let n=new Kt("COLLECT_FILE_STATISTICS",[e,t]);await this.postTask(n,[])}async exportFileStatistics(e){let t=new Kt("EXPORT_FILE_STATISTICS",e);return await this.postTask(t,[])}async copyFileToBuffer(e){let t=new Kt("COPY_FILE_TO_BUFFER",e);return await this.postTask(t)}async copyFileToPath(e,t){let n=new Kt("COPY_FILE_TO_PATH",[e,t]);await this.postTask(n)}async insertArrowFromIPCStream(e,t,n){if(t.length==0)return;let r=new Kt("INSERT_ARROW_FROM_IPC_STREAM",[e,t,n]);await this.postTask(r,[t.buffer])}async insertCSVFromPath(e,t,n){if(n.columns!==void 0){let i=[];for(let o in n.columns){let s=n.columns[o];i.push(F2(o,s))}n.columnsFlat=i,delete n.columns}let r=new Kt("IMPORT_CSV_FROM_PATH",[e,t,n]);await this.postTask(r)}async insertJSONFromPath(e,t,n){if(n.columns!==void 0){let i=[];for(let o in n.columns){let s=n.columns[o];i.push(F2(o,s))}n.columnsFlat=i,delete n.columns}let r=new Kt("IMPORT_JSON_FROM_PATH",[e,t,n]);await this.postTask(r)}};var Aj=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11])),Mj=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,6,64,25,11,11])),Nj=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),Rj=()=>(async e=>{try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(e)}catch{return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11])),L2={name:"@duckdb/duckdb-wasm",version:"1.28.1-dev99.0",description:"DuckDB powered by WebAssembly",license:"MIT",repository:{type:"git",url:"https://github.com/duckdb/duckdb-wasm.git"},keywords:["sql","duckdb","relational","database","data","query","wasm","analytics","olap","arrow","parquet","json","csv"],dependencies:{"apache-arrow":"^14.0.1"},devDependencies:{"@types/emscripten":"^1.39.10","@types/jasmine":"^5.1.4","@typescript-eslint/eslint-plugin":"^6.18.0","@typescript-eslint/parser":"^6.18.0",esbuild:"^0.19.10",eslint:"^8.56.0","eslint-plugin-jasmine":"^4.1.3","eslint-plugin-react":"^7.33.2","fast-glob":"^3.3.2",jasmine:"^5.1.0","jasmine-core":"^5.1.1","jasmine-spec-reporter":"^7.0.0","js-sha256":"^0.10.1",karma:"^6.4.2","karma-chrome-launcher":"^3.2.0","karma-coverage":"^2.2.1","karma-firefox-launcher":"^2.1.2","karma-jasmine":"^5.1.0","karma-jasmine-html-reporter":"^2.1.0","karma-sourcemap-loader":"^0.4.0","karma-spec-reporter":"^0.0.36","make-dir":"^4.0.0",nyc:"^15.1.0",prettier:"^3.2.2",puppeteer:"^21.7.0",rimraf:"^5.0.5",s3rver:"^3.7.1",typedoc:"^0.25.7",typescript:"^5.3.3","wasm-feature-detect":"^1.6.1","web-worker":"^1.2.0"},scripts:{"build:debug":"node bundle.mjs debug && tsc --emitDeclarationOnly","build:release":"node bundle.mjs release && tsc --emitDeclarationOnly",docs:"typedoc",report:"node ./coverage.mjs","test:node":"node --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:node:debug":"node --inspect-brk --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:node:coverage":"nyc -r json --report-dir ./coverage/node node ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:firefox":"karma start ./karma/tests-firefox.cjs","test:chrome":"karma start ./karma/tests-chrome.cjs","test:chrome:eh":"karma start ./karma/tests-chrome-eh.cjs","test:chrome:coverage":"karma start ./karma/tests-chrome-coverage.cjs","test:browser":"karma start ./karma/tests-all.cjs","test:browser:debug":"karma start ./karma/tests-debug.cjs",test:"npm run test:chrome && npm run test:node","test:coverage":"npm run test:chrome:coverage && npm run test:node:coverage && npm run report",lint:"eslint src test"},files:["dist","!dist/types/test"],main:"dist/duckdb-browser.cjs",module:"dist/duckdb-browser.mjs",types:"dist/duckdb-browser.d.ts",jsdelivr:"dist/duckdb-browser.cjs",unpkg:"dist/duckdb-browser.mjs",sideEffects:!1,browser:{fs:!1,path:!1,perf_hooks:!1,os:!1,worker_threads:!1},exports:{"./dist/duckdb-mvp.wasm":"./dist/duckdb-mvp.wasm","./dist/duckdb-eh.wasm":"./dist/duckdb-eh.wasm","./dist/duckdb-coi.wasm":"./dist/duckdb-coi.wasm","./dist/duckdb-browser":"./dist/duckdb-browser.mjs","./dist/duckdb-browser.cjs":"./dist/duckdb-browser.cjs","./dist/duckdb-browser.mjs":"./dist/duckdb-browser.mjs","./dist/duckdb-browser-blocking":"./dist/duckdb-browser-blocking.mjs","./dist/duckdb-browser-blocking.mjs":"./dist/duckdb-browser-blocking.mjs","./dist/duckdb-browser-blocking.cjs":"./dist/duckdb-browser-blocking.cjs","./dist/duckdb-browser-coi.pthread.worker.js":"./dist/duckdb-browser-coi.pthread.worker.js","./dist/duckdb-browser-coi.worker.js":"./dist/duckdb-browser-coi.worker.js","./dist/duckdb-browser-eh.worker.js":"./dist/duckdb-browser-eh.worker.js","./dist/duckdb-browser-mvp.worker.js":"./dist/duckdb-browser-mvp.worker.js","./dist/duckdb-node":"./dist/duckdb-node.cjs","./dist/duckdb-node.cjs":"./dist/duckdb-node.cjs","./dist/duckdb-node-blocking":"./dist/duckdb-node-blocking.cjs","./dist/duckdb-node-blocking.cjs":"./dist/duckdb-node-blocking.cjs","./dist/duckdb-node-eh.worker.cjs":"./dist/duckdb-node-eh.worker.cjs","./dist/duckdb-node-mvp.worker.cjs":"./dist/duckdb-node-mvp.worker.cjs","./blocking":{browser:{types:"./dist/duckdb-browser-blocking.d.ts",import:"./dist/duckdb-browser-blocking.mjs",require:"./dist/duckdb-browser-blocking.cjs"},node:{types:"./dist/duckdb-node-blocking.d.ts",require:"./dist/duckdb-node-blocking.cjs",import:"./dist/duckdb-node-blocking.cjs"},types:"./dist/duckdb-browser-blocking.d.ts",import:"./dist/duckdb-browser-blocking.mjs",require:"./dist/duckdb-browser-blocking.cjs"},".":{browser:{types:"./dist/duckdb-browser.d.ts",import:"./dist/duckdb-browser.mjs",require:"./dist/duckdb-browser.cjs"},node:{types:"./dist/duckdb-node.d.ts",import:"./dist/duckdb-node.cjs",require:"./dist/duckdb-node.cjs"},types:"./dist/duckdb-browser.d.ts",import:"./dist/duckdb-browser.mjs",require:"./dist/duckdb-browser.cjs"}}},Oj=L2.name,Dj=L2.version,C2=L2.version.split("."),eht=C2[0],nht=C2[1],rht=C2[2],kj=()=>typeof navigator>"u";function jD(){let e="https://cdn.jsdelivr.net/npm/".concat(Oj,"@").concat(Dj,"/dist/");return{mvp:{mainModule:"".concat(e,"duckdb-mvp.wasm"),mainWorker:"".concat(e,"duckdb-browser-mvp.worker.js")},eh:{mainModule:"".concat(e,"duckdb-eh.wasm"),mainWorker:"".concat(e,"duckdb-browser-eh.worker.js")}}}var N2=null,R2=null,O2=null,D2=null,k2=null;async function Fj(){return N2==null&&(N2=typeof BigInt64Array<"u"),R2==null&&(R2=await Mj()),O2==null&&(O2=await Rj()),D2==null&&(D2=await Nj()),k2==null&&(k2=await Aj()),{bigInt64Array:N2,crossOriginIsolated:kj()||globalThis.crossOriginIsolated||!1,wasmExceptions:R2,wasmSIMD:D2,wasmThreads:O2,wasmBulkMemory:k2}}async function VD(e){let t=await Fj();if(t.wasmExceptions){if(t.wasmSIMD&&t.wasmThreads&&t.crossOriginIsolated&&e.coi)return{mainModule:e.coi.mainModule,mainWorker:e.coi.mainWorker,pthreadWorker:e.coi.pthreadWorker};if(e.eh)return{mainModule:e.eh.mainModule,mainWorker:e.eh.mainWorker,pthreadWorker:null}}return{mainModule:e.mvp.mainModule,mainWorker:e.mvp.mainWorker,pthreadWorker:null}}var iht=hj(pj());function Lj(){let e=new TextDecoder;return t=>(typeof SharedArrayBuffer<"u"&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),e.decode(t))}var oht=Lj(),Cj=(e=>(e[e.BUFFER=0]="BUFFER",e[e.NODE_FS=1]="NODE_FS",e[e.BROWSER_FILEREADER=2]="BROWSER_FILEREADER",e[e.BROWSER_FSACCESS=3]="BROWSER_FSACCESS",e[e.HTTP=4]="HTTP",e[e.S3=5]="S3",e))(Cj||{});function YD(e={}){let{duckdb:t,connection:n,...r}=e,i=t,o=n,s;function a(){return s||(s=(i?Promise.resolve(i):Pj(r).then(u=>i=u)).then(u=>u.connect()).then(u=>o=u)),s}async function c(){return i||await a(),i}async function l(){return o||await a(),o}return{getDuckDB:c,getConnection:l,query:async u=>{let{type:f,sql:d}=u,p=await(await l()).query(d);return f==="exec"?void 0:f==="arrow"?p:Array.from(p)}}}async function Pj({log:e=!1}={}){let t=jD(),n=await VD(t),r=URL.createObjectURL(new Blob([`importScripts("${n.mainWorker}");`],{type:"text/javascript"})),i=new Worker(r),o=e?new UD:new $D,s=new qD(o,i);return await s.instantiate(n.mainModule,n.pthreadWorker),URL.revokeObjectURL(r),s}function B2(){let e=new Set,t,n=new Promise(r=>t=r);return{pending(r){e.add(r)},ready(r){return e.delete(r),e.size===0},resolve(){n=new Promise(r=>{t(),t=r})},get promise(){return n}}}var yR={};vr(yR,{Fixed:()=>co,Param:()=>Aa,Query:()=>yt,Selection:()=>xs,agg:()=>zv,align:()=>dM,and:()=>Xn,area:()=>VN,areaX:()=>YN,areaY:()=>GN,argmax:()=>yu,argmin:()=>mu,arrayAgg:()=>d2,arrow:()=>B4,aspectRatio:()=>hM,avg:()=>qv,axis:()=>pM,axisFx:()=>q4,axisFy:()=>j4,axisX:()=>U4,axisY:()=>z4,barX:()=>ZN,barY:()=>QN,bin:()=>mw,cast:()=>Th,castDouble:()=>gu,castInteger:()=>h2,cell:()=>KN,cellX:()=>JN,cellY:()=>t4,centroid:()=>Ah,centroidX:()=>b2,centroidY:()=>x2,circle:()=>a4,colorBase:()=>J6,colorClamp:()=>q6,colorConstant:()=>eN,colorDomain:()=>U6,colorExponent:()=>tN,colorInterpolate:()=>G6,colorLabel:()=>H6,colorLegend:()=>hR,colorN:()=>j6,colorNice:()=>V6,colorPivot:()=>W6,colorRange:()=>z6,colorReverse:()=>Z6,colorScale:()=>$6,colorScheme:()=>Y6,colorSymmetric:()=>X6,colorTickFormat:()=>K6,colorZero:()=>Q6,column:()=>Sa,contour:()=>T4,coordinator:()=>ei,corr:()=>e2,count:()=>kr,covarPop:()=>n2,create:()=>Ea,cume_dist:()=>kv,dateDay:()=>g2,dateMonth:()=>m2,dateMonthDay:()=>y2,delaunayLink:()=>F4,delaunayMesh:()=>L4,denseLine:()=>I4,dense_rank:()=>Ov,density:()=>S4,densityX:()=>w4,densityY:()=>v4,dot:()=>i4,dotX:()=>o4,dotY:()=>s4,entropy:()=>Kv,eq:()=>ys,facetGrid:()=>B3,facetLabel:()=>P3,facetMargin:()=>D3,facetMarginBottom:()=>F3,facetMarginLeft:()=>L3,facetMarginRight:()=>C3,facetMarginTop:()=>k3,first:()=>l2,first_value:()=>Bv,frame:()=>$4,from:()=>p$,fxAlign:()=>G3,fxAriaDescription:()=>u6,fxAriaLabel:()=>l6,fxAxis:()=>Z3,fxDomain:()=>$3,fxFontVariant:()=>c6,fxGrid:()=>r6,fxInset:()=>q3,fxInsetLeft:()=>j3,fxInsetRight:()=>V3,fxLabel:()=>o6,fxLabelAnchor:()=>s6,fxLabelOffset:()=>a6,fxLine:()=>i6,fxNice:()=>z3,fxPadding:()=>W3,fxPaddingInner:()=>X3,fxPaddingOuter:()=>H3,fxRange:()=>U3,fxReverse:()=>f6,fxRound:()=>Y3,fxTickFormat:()=>e6,fxTickPadding:()=>t6,fxTickRotate:()=>n6,fxTickSize:()=>K3,fxTickSpacing:()=>J3,fxTicks:()=>Q3,fyAlign:()=>x6,fyAriaDescription:()=>B6,fyAriaLabel:()=>C6,fyAxis:()=>S6,fyDomain:()=>d6,fyFontVariant:()=>L6,fyGrid:()=>R6,fyInset:()=>m6,fyInsetBottom:()=>g6,fyInsetTop:()=>y6,fyLabel:()=>D6,fyLabelAnchor:()=>k6,fyLabelOffset:()=>F6,fyLine:()=>O6,fyNice:()=>p6,fyPadding:()=>_6,fyPaddingInner:()=>w6,fyPaddingOuter:()=>v6,fyRange:()=>h6,fyReverse:()=>P6,fyRound:()=>b6,fyTickFormat:()=>M6,fyTickPadding:()=>A6,fyTickRotate:()=>N6,fyTickSize:()=>T6,fyTickSpacing:()=>E6,fyTicks:()=>I6,geo:()=>X4,geojson:()=>Eh,graticule:()=>Z4,grid:()=>yM,gridFx:()=>G4,gridFy:()=>W4,gridX:()=>V4,gridY:()=>Y4,gt:()=>vh,gte:()=>vv,hconcat:()=>a$,heatmap:()=>E4,height:()=>aM,hexagon:()=>c4,hexbin:()=>N4,hexgrid:()=>R4,highlight:()=>Q4,hspace:()=>u$,hull:()=>C4,image:()=>_4,inset:()=>mM,intervalX:()=>rR,intervalXY:()=>oR,intervalY:()=>iR,isBetween:()=>Te,isDistinct:()=>Sv,isNotBetween:()=>Iv,isNotDistinct:()=>Sh,isNotNull:()=>ms,isNull:()=>$c,kurtosis:()=>Qv,label:()=>gM,lag:()=>Lv,last:()=>u2,last_value:()=>Pv,lead:()=>Cv,lengthBase:()=>NN,lengthClamp:()=>EN,lengthConstant:()=>ON,lengthDomain:()=>IN,lengthExponent:()=>RN,lengthNice:()=>AN,lengthRange:()=>TN,lengthScale:()=>SN,lengthZero:()=>MN,line:()=>WN,lineX:()=>XN,lineY:()=>HN,link:()=>P4,literal:()=>Dr,loadCSV:()=>v2,loadExtension:()=>_2,loadJSON:()=>S2,loadObjects:()=>E2,loadParquet:()=>I2,loadSpatial:()=>T2,lt:()=>gs,lte:()=>bs,mad:()=>jv,margin:()=>rM,marginBottom:()=>fM,marginLeft:()=>cM,marginRight:()=>lM,marginTop:()=>uM,margins:()=>nM,max:()=>Jr,median:()=>Yv,menu:()=>e$,min:()=>ti,mode:()=>Wv,name:()=>tM,nearestX:()=>eR,nearestY:()=>nR,neq:()=>Uc,not:()=>wv,nth_value:()=>$v,ntile:()=>Fv,opacityBase:()=>fN,opacityClamp:()=>oN,opacityConstant:()=>hN,opacityDomain:()=>rN,opacityExponent:()=>dN,opacityLabel:()=>aN,opacityLegend:()=>pR,opacityNice:()=>sN,opacityRange:()=>iN,opacityReverse:()=>cN,opacityScale:()=>nN,opacityTickFormat:()=>uN,opacityZero:()=>lN,or:()=>Pc,padding:()=>bM,pan:()=>sR,panX:()=>aR,panY:()=>cR,panZoom:()=>lR,panZoomX:()=>uR,panZoomY:()=>fR,percent_rank:()=>Dv,plot:()=>b$,product:()=>Vv,projectionClip:()=>qN,projectionDomain:()=>CN,projectionInset:()=>BN,projectionInsetBottom:()=>zN,projectionInsetLeft:()=>PN,projectionInsetRight:()=>$N,projectionInsetTop:()=>UN,projectionParallels:()=>kN,projectionPrecision:()=>FN,projectionRotate:()=>LN,projectionType:()=>DN,quantile:()=>Gv,rBase:()=>_N,rClamp:()=>gN,rConstant:()=>vN,rDomain:()=>mN,rExponent:()=>wN,rNice:()=>bN,rRange:()=>yN,rScale:()=>pN,rZero:()=>xN,rank:()=>Rv,raster:()=>A4,rasterTile:()=>M4,rect:()=>e4,rectX:()=>n4,rectY:()=>r4,regressionY:()=>O4,round:()=>xM,row_number:()=>Nv,ruleX:()=>d4,ruleY:()=>h4,search:()=>n$,skewness:()=>Zv,slider:()=>r$,sphere:()=>H4,spike:()=>x4,sql:()=>j,stddev:()=>Hv,stddevPop:()=>t2,stringAgg:()=>f2,style:()=>oM,sum:()=>Fr,symbolLegend:()=>mR,table:()=>i$,text:()=>l4,textX:()=>u4,textY:()=>f4,tickX:()=>p4,tickY:()=>m4,toggle:()=>gd,toggleColor:()=>tR,toggleX:()=>K4,toggleY:()=>J4,varPop:()=>Jv,variance:()=>Xv,vconcat:()=>s$,vector:()=>y4,vectorX:()=>g4,vectorY:()=>b4,voronoi:()=>D4,voronoiMesh:()=>k4,vspace:()=>l$,width:()=>sM,xAlign:()=>NM,xAriaDescription:()=>WM,xAriaLabel:()=>GM,xAxis:()=>kM,xBase:()=>ZM,xClamp:()=>AM,xConstant:()=>KM,xDomain:()=>wM,xExponent:()=>QM,xFontVariant:()=>YM,xGrid:()=>UM,xInset:()=>IM,xInsetLeft:()=>TM,xInsetRight:()=>EM,xLabel:()=>qM,xLabelAnchor:()=>jM,xLabelOffset:()=>VM,xLine:()=>zM,xNice:()=>SM,xPadding:()=>RM,xPaddingInner:()=>OM,xPaddingOuter:()=>DM,xRange:()=>vM,xReverse:()=>XM,xRound:()=>MM,xScale:()=>_M,xTickFormat:()=>PM,xTickPadding:()=>BM,xTickRotate:()=>$M,xTickSize:()=>LM,xTickSpacing:()=>CM,xTicks:()=>FM,xZero:()=>HM,xyDomain:()=>iM,yAlign:()=>c3,yAriaDescription:()=>E3,yAriaLabel:()=>T3,yAxis:()=>d3,yBase:()=>N3,yClamp:()=>s3,yConstant:()=>O3,yDomain:()=>t3,yExponent:()=>R3,yFontVariant:()=>I3,yGrid:()=>x3,yInset:()=>r3,yInsetBottom:()=>o3,yInsetTop:()=>i3,yLabel:()=>w3,yLabelAnchor:()=>v3,yLabelOffset:()=>S3,yLine:()=>_3,yNice:()=>n3,yPadding:()=>l3,yPaddingInner:()=>u3,yPaddingOuter:()=>f3,yRange:()=>e3,yReverse:()=>A3,yRound:()=>a3,yScale:()=>JM,yTickFormat:()=>g3,yTickPadding:()=>y3,yTickRotate:()=>b3,yTickSize:()=>p3,yTickSpacing:()=>m3,yTicks:()=>h3,yZero:()=>M3});var co=Symbol("Fixed"),Sn=Symbol("Transient"),Oh=Symbol("Transform");var ow={};vr(ow,{Area:()=>Fl,Arrow:()=>jm,BarX:()=>Vm,BarY:()=>Ym,Cell:()=>Ll,Contour:()=>ty,Density:()=>ry,Dot:()=>Cl,Frame:()=>Lm,Geo:()=>iy,Hexgrid:()=>oy,Image:()=>sy,Line:()=>Bl,Link:()=>zm,Mark:()=>wt,Raster:()=>Jm,Rect:()=>$l,RuleX:()=>Rm,RuleY:()=>Om,Text:()=>Ol,TickX:()=>Hm,TickY:()=>Zm,Tip:()=>Cm,Vector:()=>kl,area:()=>Um,areaX:()=>cc,areaY:()=>ea,arrow:()=>U7,auto:()=>Q7,autoSpec:()=>rA,axisFx:()=>I_,axisFy:()=>S_,axisX:()=>km,axisY:()=>Dm,barX:()=>Uo,barY:()=>zo,bin:()=>ta,binX:()=>Po,binY:()=>$o,bollinger:()=>dc,bollingerX:()=>rP,bollingerY:()=>iP,boxX:()=>oP,boxY:()=>sP,cell:()=>lc,cellX:()=>q7,cellY:()=>j7,centroid:()=>n9,circle:()=>G7,cluster:()=>e9,column:()=>pn,contour:()=>mP,crosshair:()=>bP,crosshairX:()=>xP,crosshairY:()=>_P,delaunayLink:()=>SP,delaunayMesh:()=>IP,density:()=>NP,differenceY:()=>DP,dodgeX:()=>y9,dodgeY:()=>g9,dot:()=>yi,dotX:()=>V7,dotY:()=>Y7,filter:()=>JC,find:()=>c5,formatIsoDate:()=>dE,formatMonth:()=>h5,formatWeekday:()=>p5,frame:()=>Uf,geo:()=>X_,geoCentroid:()=>r9,graticule:()=>FP,gridFx:()=>M_,gridFy:()=>E_,gridX:()=>A_,gridY:()=>T_,group:()=>vm,groupX:()=>tc,groupY:()=>ec,groupZ:()=>wm,hexagon:()=>W7,hexbin:()=>LP,hexgrid:()=>CP,hull:()=>TP,identity:()=>W,image:()=>PP,indexOf:()=>Ae,initializer:()=>Se,interpolateNearest:()=>uA,interpolateNone:()=>W_,interpolatorBarycentric:()=>lA,interpolatorRandomWalk:()=>fA,legend:()=>c7,line:()=>Pl,lineX:()=>uc,lineY:()=>fc,linearRegressionX:()=>zP,linearRegressionY:()=>qP,link:()=>P_,map:()=>_r,mapX:()=>Jf,mapY:()=>td,marks:()=>Je,normalize:()=>rw,normalizeX:()=>w9,normalizeY:()=>v9,plot:()=>Pm,pointer:()=>Lf,pointerX:()=>Cf,pointerY:()=>Al,raster:()=>fP,rect:()=>Wm,rectX:()=>Zf,rectY:()=>Qf,reverse:()=>t5,ruleX:()=>jr,ruleY:()=>Vr,scale:()=>kf,select:()=>I9,selectFirst:()=>DA,selectLast:()=>kA,selectMaxX:()=>A9,selectMaxY:()=>M9,selectMinX:()=>T9,selectMinY:()=>E9,shiftX:()=>S9,shuffle:()=>e5,sort:()=>z1,sphere:()=>kP,spike:()=>qB,stackX:()=>tA,stackX1:()=>O7,stackX2:()=>D7,stackY:()=>eA,stackY1:()=>k7,stackY2:()=>F7,text:()=>Bo,textX:()=>y_,textY:()=>g_,tickX:()=>V_,tickY:()=>Y_,tip:()=>O_,transform:()=>mn,tree:()=>EA,treeLink:()=>J_,treeNode:()=>ay,valueof:()=>mt,vector:()=>jE,vectorX:()=>__,vectorY:()=>w_,voronoi:()=>EP,voronoiMesh:()=>AP,window:()=>ed,windowX:()=>K7,windowY:()=>J7});function Ut(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Hn(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function _s(e){let t,n,r;e.length!==2?(t=Ut,n=(a,c)=>Ut(e(a),c),r=(a,c)=>e(a)-c):(t=e===Ut||e===Hn?e:$j,n=e,r=e);function i(a,c,l=0,u=a.length){if(l<u){if(t(c,c)!==0)return u;do{let f=l+u>>>1;n(a[f],c)<0?l=f+1:u=f}while(l<u)}return l}function o(a,c,l=0,u=a.length){if(l<u){if(t(c,c)!==0)return u;do{let f=l+u>>>1;n(a[f],c)<=0?l=f+1:u=f}while(l<u)}return l}function s(a,c,l=0,u=a.length){let f=i(a,c,l,u-1);return f>l&&r(a[f-1],c)>-r(a[f],c)?f-1:f}return{left:i,center:s,right:o}}function $j(){return 0}function Dh(e){return e===null?NaN:+e}function*GD(e,t){if(t===void 0)for(let n of e)n!=null&&(n=+n)>=n&&(yield n);else{let n=-1;for(let r of e)(r=t(r,++n,e))!=null&&(r=+r)>=r&&(yield r)}}var WD=_s(Ut),XD=WD.right,Uj=WD.left,zj=_s(Dh).center,ws=XD;var kh=HD(ZD),P2=HD(qj);function HD(e){return function(t,n,r=n){if(!((n=+n)>=0))throw new RangeError("invalid rx");if(!((r=+r)>=0))throw new RangeError("invalid ry");let{data:i,width:o,height:s}=t;if(!((o=Math.floor(o))>=0))throw new RangeError("invalid width");if(!((s=Math.floor(s!==void 0?s:i.length/o))>=0))throw new RangeError("invalid height");if(!o||!s||!n&&!r)return t;let a=n&&e(n),c=r&&e(r),l=i.slice();return a&&c?(bu(a,l,i,o,s),bu(a,i,l,o,s),bu(a,l,i,o,s),xu(c,i,l,o,s),xu(c,l,i,o,s),xu(c,i,l,o,s)):a?(bu(a,i,l,o,s),bu(a,l,i,o,s),bu(a,i,l,o,s)):c&&(xu(c,i,l,o,s),xu(c,l,i,o,s),xu(c,i,l,o,s)),t}}function bu(e,t,n,r,i){for(let o=0,s=r*i;o<s;)e(t,n,o,o+=r,1)}function xu(e,t,n,r,i){for(let o=0,s=r*i;o<r;++o)e(t,n,o,o+s,r)}function qj(e){let t=ZD(e);return(n,r,i,o,s)=>{i<<=2,o<<=2,s<<=2,t(n,r,i+0,o+0,s),t(n,r,i+1,o+1,s),t(n,r,i+2,o+2,s),t(n,r,i+3,o+3,s)}}function ZD(e){let t=Math.floor(e);if(t===e)return jj(e);let n=e-t,r=2*e+1;return(i,o,s,a,c)=>{if(!((a-=c)>=s))return;let l=t*o[s],u=c*t,f=u+c;for(let d=s,h=s+u;d<h;d+=c)l+=o[Math.min(a,d)];for(let d=s,h=a;d<=h;d+=c)l+=o[Math.min(a,d+u)],i[d]=(l+n*(o[Math.max(s,d-f)]+o[Math.min(a,d+f)]))/r,l-=o[Math.max(s,d-u)]}}function jj(e){let t=2*e+1;return(n,r,i,o,s)=>{if(!((o-=s)>=i))return;let a=e*r[i],c=s*e;for(let l=i,u=i+c;l<u;l+=s)a+=r[Math.min(o,l)];for(let l=i,u=o;l<=u;l+=s)a+=r[Math.min(o,l+c)],n[l]=a/t,a-=r[Math.max(i,l-c)]}}function lo(e,t){let n=0;if(t===void 0)for(let r of e)r!=null&&(r=+r)>=r&&++n;else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(i=+i)>=i&&++n}return n}function Vj(e){return e.length|0}function Yj(e){return!(e>0)}function Gj(e){return typeof e!="object"||"length"in e?e:Array.from(e)}function Wj(e){return t=>e(...t)}function v0(...e){let t=typeof e[e.length-1]=="function"&&Wj(e.pop());e=e.map(Gj);let n=e.map(Vj),r=e.length-1,i=new Array(r+1).fill(0),o=[];if(r<0||n.some(Yj))return o;for(;;){o.push(i.map((a,c)=>e[c][a]));let s=r;for(;++i[s]===n[s];){if(s===0)return t?o.map(t):o;i[s--]=0}}}function S0(e,t){var n=0,r=0;return Float64Array.from(e,t===void 0?i=>n+=+i||0:i=>n+=+t(i,r++,e)||0)}function Ma(e,t){let n=0,r,i=0,o=0;if(t===void 0)for(let s of e)s!=null&&(s=+s)>=s&&(r=s-i,i+=r/++n,o+=r*(s-i));else{let s=-1;for(let a of e)(a=t(a,++s,e))!=null&&(a=+a)>=a&&(r=a-i,i+=r/++n,o+=r*(a-i))}if(n>1)return o/(n-1)}function ri(e,t){let n=Ma(e,t);return n&&Math.sqrt(n)}function ae(e,t){let n,r;if(t===void 0)for(let i of e)i!=null&&(n===void 0?i>=i&&(n=r=i):(n>i&&(n=i),r<i&&(r=i)));else{let i=-1;for(let o of e)(o=t(o,++i,e))!=null&&(n===void 0?o>=o&&(n=r=o):(n>o&&(n=o),r<o&&(r=o)))}return[n,r]}var In=class{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){let n=this._partials,r=0;for(let i=0;i<this._n&&i<32;i++){let o=n[i],s=t+o,a=Math.abs(t)<Math.abs(o)?t-(s-o):o-(s-t);a&&(n[r++]=a),t=s}return n[r]=t,this._n=r+1,this}valueOf(){let t=this._partials,n=this._n,r,i,o,s=0;if(n>0){for(s=t[--n];n>0&&(r=s,i=t[--n],s=r+i,o=i-(s-r),!o););n>0&&(o<0&&t[n-1]<0||o>0&&t[n-1]>0)&&(i=o*2,r=s+i,i==r-s&&(s=r))}return s}};var Zn=class extends Map{constructor(t,n=JD){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(let[r,i]of t)this.set(r,i)}get(t){return super.get($2(this,t))}has(t){return super.has($2(this,t))}set(t,n){return super.set(QD(this,t),n)}delete(t){return super.delete(KD(this,t))}},Qn=class extends Set{constructor(t,n=JD){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(let r of t)this.add(r)}has(t){return super.has($2(this,t))}add(t){return super.add(QD(this,t))}delete(t){return super.delete(KD(this,t))}};function $2({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function QD({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function KD({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function JD(e){return e!==null&&typeof e=="object"?e.valueOf():e}function Fh(e){return e}function an(e,...t){return z2(e,Fh,Fh,t)}function Ci(e,t,...n){return z2(e,Fh,t,n)}function U2(e,t,...n){return z2(e,Array.from,t,n)}function z2(e,t,n,r){return function i(o,s){if(s>=r.length)return n(o);let a=new Zn,c=r[s++],l=-1;for(let u of o){let f=c(u,++l,o),d=a.get(f);d?d.push(u):a.set(f,[u])}for(let[u,f]of a)a.set(u,i(f,s));return t(a)}(e,0)}function q2(e,t){return Array.from(t,n=>e[n])}function uo(e,...t){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");e=Array.from(e);let[n]=t;if(n&&n.length!==2||t.length>1){let r=Uint32Array.from(e,(i,o)=>o);return t.length>1?(t=t.map(i=>e.map(i)),r.sort((i,o)=>{for(let s of t){let a=Vc(s[i],s[o]);if(a)return a}})):(n=e.map(n),r.sort((i,o)=>Vc(n[i],n[o]))),q2(e,r)}return e.sort(Lh(n))}function Lh(e=Ut){if(e===Ut)return Vc;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{let r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function Vc(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}function _u(e,t,n){return(t.length!==2?uo(Ci(e,t,n),([r,i],[o,s])=>Ut(i,s)||Ut(r,o)):uo(an(e,n),([r,i],[o,s])=>t(i,s)||Ut(r,o))).map(([r])=>r)}var Xj=Math.sqrt(50),Hj=Math.sqrt(10),Zj=Math.sqrt(2);function I0(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),s=o>=Xj?10:o>=Hj?5:o>=Zj?2:1,a,c,l;return i<0?(l=Math.pow(10,-i)/s,a=Math.round(e*l),c=Math.round(t*l),a/l<e&&++a,c/l>t&&--c,l=-l):(l=Math.pow(10,i)*s,a=Math.round(e/l),c=Math.round(t/l),a*l<e&&++a,c*l>t&&--c),c<a&&.5<=n&&n<2?I0(e,t,n*2):[a,c,l]}function Tn(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];let r=t<e,[i,o,s]=r?I0(t,e,n):I0(e,t,n);if(!(o>=i))return[];let a=o-i+1,c=new Array(a);if(r)if(s<0)for(let l=0;l<a;++l)c[l]=(o-l)/-s;else for(let l=0;l<a;++l)c[l]=(o-l)*s;else if(s<0)for(let l=0;l<a;++l)c[l]=(i+l)/-s;else for(let l=0;l<a;++l)c[l]=(i+l)*s;return c}function vs(e,t,n){return t=+t,e=+e,n=+n,I0(e,t,n)[2]}function wu(e,t,n){t=+t,e=+e,n=+n;let r=t<e,i=r?vs(t,e,n):vs(e,t,n);return(r?-1:1)*(i<0?1/-i:i)}function vu(e,t,n){let r;for(;;){let i=vs(e,t,n);if(i===r||i===0||!isFinite(i))return[e,t];i>0?(e=Math.floor(e/i)*i,t=Math.ceil(t/i)*i):i<0&&(e=Math.ceil(e*i)/i,t=Math.floor(t*i)/i),r=i}}function Na(e){return Math.max(1,Math.ceil(Math.log(lo(e))/Math.LN2)+1)}function Gt(e,t){let n;if(t===void 0)for(let r of e)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n<i||n===void 0&&i>=i)&&(n=i)}return n}function T0(e,t){let n,r=-1,i=-1;if(t===void 0)for(let o of e)++i,o!=null&&(n<o||n===void 0&&o>=o)&&(n=o,r=i);else for(let o of e)(o=t(o,++i,e))!=null&&(n<o||n===void 0&&o>=o)&&(n=o,r=i);return r}function ce(e,t){let n;if(t===void 0)for(let r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function E0(e,t){let n,r=-1,i=-1;if(t===void 0)for(let o of e)++i,o!=null&&(n>o||n===void 0&&o>=o)&&(n=o,r=i);else for(let o of e)(o=t(o,++i,e))!=null&&(n>o||n===void 0&&o>=o)&&(n=o,r=i);return r}function A0(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?Vc:Lh(i);r>n;){if(r-n>600){let c=r-n+1,l=t-n+1,u=Math.log(c),f=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*f*(c-f)/c)*(l-c/2<0?-1:1),h=Math.max(n,Math.floor(t-l*f/c+d)),p=Math.min(r,Math.floor(t+(c-l)*f/c+d));A0(e,t,h,p,i)}let o=e[t],s=n,a=r;for(Ch(e,n,t),i(e[r],o)>0&&Ch(e,n,r);s<a;){for(Ch(e,s,a),++s,--a;i(e[s],o)<0;)++s;for(;i(e[a],o)>0;)--a}i(e[n],o)===0?Ch(e,n,a):(++a,Ch(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}return e}function Ch(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function Yc(e,t=Ut){let n,r=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(r?Ut(s,i)>0:Ut(s,s)===0)&&(n=o,i=s,r=!0)}}else for(let i of e)(r?t(i,n)>0:t(i,i)===0)&&(n=i,r=!0);return n}function Kn(e,t,n){if(e=Float64Array.from(GD(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return ce(e);if(t>=1)return Gt(e);var r,i=(r-1)*t,o=Math.floor(i),s=Gt(A0(e,o).subarray(0,o+1)),a=ce(e.subarray(o+1));return s+(a-s)*(i-o)}}function j2(e,t,n=Dh){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,o=Math.floor(i),s=+n(e[o],o,e),a=+n(e[o+1],o+1,e);return s+(a-s)*(i-o)}}function M0(e,t,n){let r=lo(e),i=Kn(e,.75)-Kn(e,.25);return r&&i?Math.ceil((n-t)/(2*i*Math.pow(r,-1/3))):1}function Bh(e,t,n){let r=lo(e),i=ri(e);return r&&i?Math.ceil((n-t)*Math.cbrt(r)/(3.49*i)):1}function Ss(e,t){let n=0,r=0;if(t===void 0)for(let i of e)i!=null&&(i=+i)>=i&&(++n,r+=i);else{let i=-1;for(let o of e)(o=t(o,++i,e))!=null&&(o=+o)>=o&&(++n,r+=o)}if(n)return r/n}function Bi(e,t){return Kn(e,.5,t)}function*Kj(e){for(let t of e)yield*t}function Su(e){return Array.from(Kj(e))}function Iu(e,t){let n=new Zn;if(t===void 0)for(let o of e)o!=null&&o>=o&&n.set(o,(n.get(o)||0)+1);else{let o=-1;for(let s of e)(s=t(s,++o,e))!=null&&s>=s&&n.set(s,(n.get(s)||0)+1)}let r,i=0;for(let[o,s]of n)s>i&&(i=s,r=o);return r}function N0(e,t=Jj){let n=[],r,i=!1;for(let o of e)i&&n.push(t(r,o)),r=o,i=!0;return n}function Jj(e,t){return[e,t]}function $e(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,o=new Array(i);++r<i;)o[r]=e+r*n;return o}function Ph(e,t=Ut){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");let n=Array.from(e),r=new Float64Array(n.length);t.length!==2&&(n=n.map(t),t=Ut);let i=(a,c)=>t(n[a],n[c]),o,s;return e=Uint32Array.from(n,(a,c)=>c),e.sort(t===Ut?(a,c)=>Vc(n[a],n[c]):Lh(i)),e.forEach((a,c)=>{let l=i(a,o===void 0?a:o);l>=0?((o===void 0||l>0)&&(o=a,s=c),r[a]=s):r[a]=NaN}),r}function R0(e,t=Ut){let n,r=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(r?Ut(s,i)<0:Ut(s,s)===0)&&(n=o,i=s,r=!0)}}else for(let i of e)(r?t(i,n)<0:t(i,i)===0)&&(n=i,r=!0);return n}function En(e,t){let n=0;if(t===void 0)for(let r of e)(r=+r)&&(n+=r);else{let r=-1;for(let i of e)(i=+t(i,++r,e))&&(n+=i)}return n}function Ra(e){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");return Array.from(e).reverse()}function t8(e){return e}var V2=1,Y2=2,G2=3,O0=4,e8=1e-6;function tV(e){return"translate("+e+",0)"}function eV(e){return"translate(0,"+e+")"}function nV(e){return t=>+e(t)}function rV(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),n=>+e(n)+t}function iV(){return!this.__axis}function oV(e,t){var n=[],r=null,i=null,o=6,s=6,a=3,c=typeof window<"u"&&window.devicePixelRatio>1?0:.5,l=e===V2||e===O0?-1:1,u=e===O0||e===Y2?"x":"y",f=e===V2||e===G2?tV:eV;function d(h){var p=r??(t.ticks?t.ticks.apply(t,n):t.domain()),m=i??(t.tickFormat?t.tickFormat.apply(t,n):t8),g=Math.max(o,0)+a,y=t.range(),b=+y[0]+c,x=+y[y.length-1]+c,_=(t.bandwidth?rV:nV)(t.copy(),c),v=h.selection?h.selection():h,w=v.selectAll(".domain").data([null]),T=v.selectAll(".tick").data(p,t).order(),M=T.exit(),R=T.enter().append("g").attr("class","tick"),I=T.select("line"),A=T.select("text");w=w.merge(w.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),T=T.merge(R),I=I.merge(R.append("line").attr("stroke","currentColor").attr(u+"2",l*o)),A=A.merge(R.append("text").attr("fill","currentColor").attr(u,l*g).attr("dy",e===V2?"0em":e===G2?"0.71em":"0.32em")),h!==v&&(w=w.transition(h),T=T.transition(h),I=I.transition(h),A=A.transition(h),M=M.transition(h).attr("opacity",e8).attr("transform",function(O){return isFinite(O=_(O))?f(O+c):this.getAttribute("transform")}),R.attr("opacity",e8).attr("transform",function(O){var F=this.parentNode.__axis;return f((F&&isFinite(F=F(O))?F:_(O))+c)})),M.remove(),w.attr("d",e===O0||e===Y2?s?"M"+l*s+","+b+"H"+c+"V"+x+"H"+l*s:"M"+c+","+b+"V"+x:s?"M"+b+","+l*s+"V"+c+"H"+x+"V"+l*s:"M"+b+","+c+"H"+x),T.attr("opacity",1).attr("transform",function(O){return f(_(O)+c)}),I.attr(u+"2",l*o),A.attr(u,l*g).text(m),v.filter(iV).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===Y2?"start":e===O0?"end":"middle"),v.each(function(){this.__axis=_})}return d.scale=function(h){return arguments.length?(t=h,d):t},d.ticks=function(){return n=Array.from(arguments),d},d.tickArguments=function(h){return arguments.length?(n=h==null?[]:Array.from(h),d):n.slice()},d.tickValues=function(h){return arguments.length?(r=h==null?null:Array.from(h),d):r&&r.slice()},d.tickFormat=function(h){return arguments.length?(i=h,d):i},d.tickSize=function(h){return arguments.length?(o=s=+h,d):o},d.tickSizeInner=function(h){return arguments.length?(o=+h,d):o},d.tickSizeOuter=function(h){return arguments.length?(s=+h,d):s},d.tickPadding=function(h){return arguments.length?(a=+h,d):a},d.offset=function(h){return arguments.length?(c=+h,d):c},d}function W2(e){return oV(G2,e)}var sV={value:()=>{}};function r8(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new D0(n)}function D0(e){this._=e}function aV(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}D0.prototype=r8.prototype={constructor:D0,on:function(e,t){var n=this._,r=aV(e+"",n),i,o=-1,s=r.length;if(arguments.length<2){for(;++o<s;)if((i=(e=r[o]).type)&&(i=cV(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++o<s;)if(i=(e=r[o]).type)n[i]=n8(n[i],e.name,t);else if(t==null)for(i in n)n[i]=n8(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new D0(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,o;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],i=0,o=r.length;i<o;++i)r[i].value.apply(t,n)}};function cV(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function n8(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=sV,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Gc=r8;var k0="http://www.w3.org/1999/xhtml",ii={svg:"http://www.w3.org/2000/svg",xhtml:k0,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Is(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),ii.hasOwnProperty(t)?{space:ii[t],local:e}:e}function lV(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===k0&&t.documentElement.namespaceURI===k0?t.createElement(e):t.createElementNS(n,e)}}function uV(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ts(e){var t=Is(e);return(t.local?uV:lV)(t)}function fV(){}function Wc(e){return e==null?fV:function(){return this.querySelector(e)}}function i8(e){typeof e!="function"&&(e=Wc(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],s=o.length,a=r[i]=new Array(s),c,l,u=0;u<s;++u)(c=o[u])&&(l=e.call(c,c.__data__,u,o))&&("__data__"in c&&(l.__data__=c.__data__),a[u]=l);return new Le(r,this._parents)}function X2(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function dV(){return[]}function $h(e){return e==null?dV:function(){return this.querySelectorAll(e)}}function hV(e){return function(){return X2(e.apply(this,arguments))}}function o8(e){typeof e=="function"?e=hV(e):e=$h(e);for(var t=this._groups,n=t.length,r=[],i=[],o=0;o<n;++o)for(var s=t[o],a=s.length,c,l=0;l<a;++l)(c=s[l])&&(r.push(e.call(c,c.__data__,l,s)),i.push(c));return new Le(r,i)}function Uh(e){return function(){return this.matches(e)}}function F0(e){return function(t){return t.matches(e)}}var pV=Array.prototype.find;function mV(e){return function(){return pV.call(this.children,e)}}function yV(){return this.firstElementChild}function s8(e){return this.select(e==null?yV:mV(typeof e=="function"?e:F0(e)))}var gV=Array.prototype.filter;function bV(){return Array.from(this.children)}function xV(e){return function(){return gV.call(this.children,e)}}function a8(e){return this.selectAll(e==null?bV:xV(typeof e=="function"?e:F0(e)))}function c8(e){typeof e!="function"&&(e=Uh(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],s=o.length,a=r[i]=[],c,l=0;l<s;++l)(c=o[l])&&e.call(c,c.__data__,l,o)&&a.push(c);return new Le(r,this._parents)}function L0(e){return new Array(e.length)}function l8(){return new Le(this._enter||this._groups.map(L0),this._parents)}function zh(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}zh.prototype={constructor:zh,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function u8(e){return function(){return e}}function _V(e,t,n,r,i,o){for(var s=0,a,c=t.length,l=o.length;s<l;++s)(a=t[s])?(a.__data__=o[s],r[s]=a):n[s]=new zh(e,o[s]);for(;s<c;++s)(a=t[s])&&(i[s]=a)}function wV(e,t,n,r,i,o,s){var a,c,l=new Map,u=t.length,f=o.length,d=new Array(u),h;for(a=0;a<u;++a)(c=t[a])&&(d[a]=h=s.call(c,c.__data__,a,t)+"",l.has(h)?i[a]=c:l.set(h,c));for(a=0;a<f;++a)h=s.call(e,o[a],a,o)+"",(c=l.get(h))?(r[a]=c,c.__data__=o[a],l.delete(h)):n[a]=new zh(e,o[a]);for(a=0;a<u;++a)(c=t[a])&&l.get(d[a])===c&&(i[a]=c)}function vV(e){return e.__data__}function f8(e,t){if(!arguments.length)return Array.from(this,vV);var n=t?wV:_V,r=this._parents,i=this._groups;typeof e!="function"&&(e=u8(e));for(var o=i.length,s=new Array(o),a=new Array(o),c=new Array(o),l=0;l<o;++l){var u=r[l],f=i[l],d=f.length,h=SV(e.call(u,u&&u.__data__,l,r)),p=h.length,m=a[l]=new Array(p),g=s[l]=new Array(p),y=c[l]=new Array(d);n(u,f,m,g,y,h,t);for(var b=0,x=0,_,v;b<p;++b)if(_=m[b]){for(b>=x&&(x=b+1);!(v=g[x])&&++x<p;);_._next=v||null}}return s=new Le(s,r),s._enter=a,s._exit=c,s}function SV(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function d8(){return new Le(this._exit||this._groups.map(L0),this._parents)}function h8(e,t,n){var r=this.enter(),i=this,o=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),n==null?o.remove():n(o),r&&i?r.merge(i).order():i}function p8(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,o=r.length,s=Math.min(i,o),a=new Array(i),c=0;c<s;++c)for(var l=n[c],u=r[c],f=l.length,d=a[c]=new Array(f),h,p=0;p<f;++p)(h=l[p]||u[p])&&(d[p]=h);for(;c<i;++c)a[c]=n[c];return new Le(a,this._parents)}function m8(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,o=r[i],s;--i>=0;)(s=r[i])&&(o&&s.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(s,o),o=s);return this}function y8(e){e||(e=IV);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var s=n[o],a=s.length,c=i[o]=new Array(a),l,u=0;u<a;++u)(l=s[u])&&(c[u]=l);c.sort(t)}return new Le(i,this._parents).order()}function IV(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function g8(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function b8(){return Array.from(this)}function x8(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,o=r.length;i<o;++i){var s=r[i];if(s)return s}return null}function _8(){let e=0;for(let t of this)++e;return e}function w8(){return!this.node()}function v8(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],o=0,s=i.length,a;o<s;++o)(a=i[o])&&e.call(a,a.__data__,o,i);return this}function TV(e){return function(){this.removeAttribute(e)}}function EV(e){return function(){this.removeAttributeNS(e.space,e.local)}}function AV(e,t){return function(){this.setAttribute(e,t)}}function MV(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function NV(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function RV(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function S8(e,t){var n=Is(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?EV:TV:typeof t=="function"?n.local?RV:NV:n.local?MV:AV)(n,t))}function C0(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function OV(e){return function(){this.style.removeProperty(e)}}function DV(e,t,n){return function(){this.style.setProperty(e,t,n)}}function kV(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function I8(e,t,n){return arguments.length>1?this.each((t==null?OV:typeof t=="function"?kV:DV)(e,t,n??"")):Oa(this.node(),e)}function Oa(e,t){return e.style.getPropertyValue(t)||C0(e).getComputedStyle(e,null).getPropertyValue(t)}function FV(e){return function(){delete this[e]}}function LV(e,t){return function(){this[e]=t}}function CV(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function T8(e,t){return arguments.length>1?this.each((t==null?FV:typeof t=="function"?CV:LV)(e,t)):this.node()[e]}function E8(e){return e.trim().split(/^|\s+/)}function H2(e){return e.classList||new A8(e)}function A8(e){this._node=e,this._names=E8(e.getAttribute("class")||"")}A8.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function M8(e,t){for(var n=H2(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function N8(e,t){for(var n=H2(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function BV(e){return function(){M8(this,e)}}function PV(e){return function(){N8(this,e)}}function $V(e,t){return function(){(t.apply(this,arguments)?M8:N8)(this,e)}}function R8(e,t){var n=E8(e+"");if(arguments.length<2){for(var r=H2(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?$V:t?BV:PV)(n,t))}function UV(){this.textContent=""}function zV(e){return function(){this.textContent=e}}function qV(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function O8(e){return arguments.length?this.each(e==null?UV:(typeof e=="function"?qV:zV)(e)):this.node().textContent}function jV(){this.innerHTML=""}function VV(e){return function(){this.innerHTML=e}}function YV(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function D8(e){return arguments.length?this.each(e==null?jV:(typeof e=="function"?YV:VV)(e)):this.node().innerHTML}function GV(){this.nextSibling&&this.parentNode.appendChild(this)}function k8(){return this.each(GV)}function WV(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function F8(){return this.each(WV)}function L8(e){var t=typeof e=="function"?e:Ts(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function XV(){return null}function C8(e,t){var n=typeof e=="function"?e:Ts(e),r=t==null?XV:typeof t=="function"?t:Wc(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function HV(){var e=this.parentNode;e&&e.removeChild(this)}function B8(){return this.each(HV)}function ZV(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function QV(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function P8(e){return this.select(e?QV:ZV)}function $8(e){return arguments.length?this.property("__data__",e):this.node().__data__}function KV(e){return function(t){e.call(this,t,this.__data__)}}function JV(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function tY(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,o;n<i;++n)o=t[n],(!e.type||o.type===e.type)&&o.name===e.name?this.removeEventListener(o.type,o.listener,o.options):t[++r]=o;++r?t.length=r:delete this.__on}}}function eY(e,t,n){return function(){var r=this.__on,i,o=KV(t);if(r){for(var s=0,a=r.length;s<a;++s)if((i=r[s]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=o,i.options=n),i.value=t;return}}this.addEventListener(e.type,o,n),i={type:e.type,name:e.name,value:t,listener:o,options:n},r?r.push(i):this.__on=[i]}}function U8(e,t,n){var r=JV(e+""),i,o=r.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,u;c<l;++c)for(i=0,u=a[c];i<o;++i)if((s=r[i]).type===u.type&&s.name===u.name)return u.value}return}for(a=t?eY:tY,i=0;i<o;++i)this.each(a(r[i],t,n));return this}function z8(e,t,n){var r=C0(e),i=r.CustomEvent;typeof i=="function"?i=new i(t,n):(i=r.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function nY(e,t){return function(){return z8(this,e,t)}}function rY(e,t){return function(){return z8(this,e,t.apply(this,arguments))}}function q8(e,t){return this.each((typeof t=="function"?rY:nY)(e,t))}function*j8(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,o=r.length,s;i<o;++i)(s=r[i])&&(yield s)}var Z2=[null];function Le(e,t){this._groups=e,this._parents=t}function V8(){return new Le([[document.documentElement]],Z2)}function iY(){return this}Le.prototype=V8.prototype={constructor:Le,select:i8,selectAll:o8,selectChild:s8,selectChildren:a8,filter:c8,data:f8,enter:l8,exit:d8,join:h8,merge:p8,selection:iY,order:m8,sort:y8,call:g8,nodes:b8,node:x8,size:_8,empty:w8,each:v8,attr:S8,style:I8,property:T8,classed:R8,text:O8,html:D8,raise:k8,lower:F8,append:L8,insert:C8,remove:B8,clone:P8,datum:$8,on:U8,dispatch:q8,[Symbol.iterator]:j8};var Es=V8;function qt(e){return typeof e=="string"?new Le([[document.querySelector(e)]],[document.documentElement]):new Le([[e]],Z2)}function Y8(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Ln(e,t){if(e=Y8(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var B0={capture:!0,passive:!1};function P0(e){e.preventDefault(),e.stopImmediatePropagation()}function qh(e){var t=e.document.documentElement,n=qt(e).on("dragstart.drag",P0,B0);"onselectstart"in t?n.on("selectstart.drag",P0,B0):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function jh(e,t){var n=e.document.documentElement,r=qt(e).on("dragstart.drag",null);t&&(r.on("click.drag",P0,B0),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}function As(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Da(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function ho(){}var ka=.7,Zc=1/ka,Tu="\\s*([+-]?\\d+)\\s*",Vh="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",fo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",oY=/^#([0-9a-f]{3,8})$/,sY=new RegExp(`^rgb\\(${Tu},${Tu},${Tu}\\)$`),aY=new RegExp(`^rgb\\(${fo},${fo},${fo}\\)$`),cY=new RegExp(`^rgba\\(${Tu},${Tu},${Tu},${Vh}\\)$`),lY=new RegExp(`^rgba\\(${fo},${fo},${fo},${Vh}\\)$`),uY=new RegExp(`^hsl\\(${Vh},${fo},${fo}\\)$`),fY=new RegExp(`^hsla\\(${Vh},${fo},${fo},${Vh}\\)$`),G8={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};As(ho,Lr,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:W8,formatHex:W8,formatHex8:dY,formatHsl:hY,formatRgb:X8,toString:X8});function W8(){return this.rgb().formatHex()}function dY(){return this.rgb().formatHex8()}function hY(){return tk(this).formatHsl()}function X8(){return this.rgb().formatRgb()}function Lr(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=oY.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?H8(t):n===3?new Ye(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?$0(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?$0(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=sY.exec(e))?new Ye(t[1],t[2],t[3],1):(t=aY.exec(e))?new Ye(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=cY.exec(e))?$0(t[1],t[2],t[3],t[4]):(t=lY.exec(e))?$0(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=uY.exec(e))?K8(t[1],t[2]/100,t[3]/100,1):(t=fY.exec(e))?K8(t[1],t[2]/100,t[3]/100,t[4]):G8.hasOwnProperty(e)?H8(G8[e]):e==="transparent"?new Ye(NaN,NaN,NaN,0):null}function H8(e){return new Ye(e>>16&255,e>>8&255,e&255,1)}function $0(e,t,n,r){return r<=0&&(e=t=n=NaN),new Ye(e,t,n,r)}function Yh(e){return e instanceof ho||(e=Lr(e)),e?(e=e.rgb(),new Ye(e.r,e.g,e.b,e.opacity)):new Ye}function rn(e,t,n,r){return arguments.length===1?Yh(e):new Ye(e,t,n,r??1)}function Ye(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}As(Ye,rn,Da(ho,{brighter(e){return e=e==null?Zc:Math.pow(Zc,e),new Ye(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ka:Math.pow(ka,e),new Ye(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ye(Hc(this.r),Hc(this.g),Hc(this.b),z0(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Z8,formatHex:Z8,formatHex8:pY,formatRgb:Q8,toString:Q8}));function Z8(){return`#${Xc(this.r)}${Xc(this.g)}${Xc(this.b)}`}function pY(){return`#${Xc(this.r)}${Xc(this.g)}${Xc(this.b)}${Xc((isNaN(this.opacity)?1:this.opacity)*255)}`}function Q8(){let e=z0(this.opacity);return`${e===1?"rgb(":"rgba("}${Hc(this.r)}, ${Hc(this.g)}, ${Hc(this.b)}${e===1?")":`, ${e})`}`}function z0(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Hc(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Xc(e){return e=Hc(e),(e<16?"0":"")+e.toString(16)}function K8(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Pi(e,t,n,r)}function tk(e){if(e instanceof Pi)return new Pi(e.h,e.s,e.l,e.opacity);if(e instanceof ho||(e=Lr(e)),!e)return new Pi;if(e instanceof Pi)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),s=NaN,a=o-i,c=(o+i)/2;return a?(t===o?s=(n-r)/a+(n<r)*6:n===o?s=(r-t)/a+2:s=(t-n)/a+4,a/=c<.5?o+i:2-o-i,s*=60):a=c>0&&c<1?0:s,new Pi(s,a,c,e.opacity)}function Gh(e,t,n,r){return arguments.length===1?tk(e):new Pi(e,t,n,r??1)}function Pi(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}As(Pi,Gh,Da(ho,{brighter(e){return e=e==null?Zc:Math.pow(Zc,e),new Pi(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ka:Math.pow(ka,e),new Pi(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Ye(Q2(e>=240?e-240:e+120,i,r),Q2(e,i,r),Q2(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Pi(J8(this.h),U0(this.s),U0(this.l),z0(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=z0(this.opacity);return`${e===1?"hsl(":"hsla("}${J8(this.h)}, ${U0(this.s)*100}%, ${U0(this.l)*100}%${e===1?")":`, ${e})`}`}}));function J8(e){return e=(e||0)%360,e<0?e+360:e}function U0(e){return Math.max(0,Math.min(1,e||0))}function Q2(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var q0=Math.PI/180,j0=180/Math.PI;var V0=18,ek=.96422,nk=1,rk=.82521,ik=4/29,Eu=6/29,ok=3*Eu*Eu,mY=Eu*Eu*Eu;function sk(e){if(e instanceof po)return new po(e.l,e.a,e.b,e.opacity);if(e instanceof Ms)return ak(e);e instanceof Ye||(e=Yh(e));var t=eS(e.r),n=eS(e.g),r=eS(e.b),i=K2((.2225045*t+.7168786*n+.0606169*r)/nk),o,s;return t===n&&n===r?o=s=i:(o=K2((.4360747*t+.3850649*n+.1430804*r)/ek),s=K2((.0139322*t+.0971045*n+.7141733*r)/rk)),new po(116*i-16,500*(o-i),200*(i-s),e.opacity)}function Au(e,t,n,r){return arguments.length===1?sk(e):new po(e,t,n,r??1)}function po(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}As(po,Au,Da(ho,{brighter(e){return new po(this.l+V0*(e??1),this.a,this.b,this.opacity)},darker(e){return new po(this.l-V0*(e??1),this.a,this.b,this.opacity)},rgb(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,n=isNaN(this.b)?e:e-this.b/200;return t=ek*J2(t),e=nk*J2(e),n=rk*J2(n),new Ye(tS(3.1338561*t-1.6168667*e-.4906146*n),tS(-.9787684*t+1.9161415*e+.033454*n),tS(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}}));function K2(e){return e>mY?Math.pow(e,1/3):e/ok+ik}function J2(e){return e>Eu?e*e*e:ok*(e-ik)}function tS(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function eS(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function yY(e){if(e instanceof Ms)return new Ms(e.h,e.c,e.l,e.opacity);if(e instanceof po||(e=sk(e)),e.a===0&&e.b===0)return new Ms(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*j0;return new Ms(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function Wh(e,t,n,r){return arguments.length===1?yY(e):new Ms(e,t,n,r??1)}function Ms(e,t,n,r){this.h=+e,this.c=+t,this.l=+n,this.opacity=+r}function ak(e){if(isNaN(e.h))return new po(e.l,0,0,e.opacity);var t=e.h*q0;return new po(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}As(Ms,Wh,Da(ho,{brighter(e){return new Ms(this.h,this.c,this.l+V0*(e??1),this.opacity)},darker(e){return new Ms(this.h,this.c,this.l-V0*(e??1),this.opacity)},rgb(){return ak(this).rgb()}}));var fk=-.14861,nS=1.78277,rS=-.29227,Y0=-.90649,Xh=1.97294,ck=Xh*Y0,lk=Xh*nS,uk=nS*rS-Y0*fk;function gY(e){if(e instanceof Qc)return new Qc(e.h,e.s,e.l,e.opacity);e instanceof Ye||(e=Yh(e));var t=e.r/255,n=e.g/255,r=e.b/255,i=(uk*r+ck*t-lk*n)/(uk+ck-lk),o=r-i,s=(Xh*(n-i)-rS*o)/Y0,a=Math.sqrt(s*s+o*o)/(Xh*i*(1-i)),c=a?Math.atan2(s,o)*j0-120:NaN;return new Qc(c<0?c+360:c,a,i,e.opacity)}function Jn(e,t,n,r){return arguments.length===1?gY(e):new Qc(e,t,n,r??1)}function Qc(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}As(Qc,Jn,Da(ho,{brighter(e){return e=e==null?Zc:Math.pow(Zc,e),new Qc(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ka:Math.pow(ka,e),new Qc(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*q0,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(e),i=Math.sin(e);return new Ye(255*(t+n*(fk*r+nS*i)),255*(t+n*(rS*r+Y0*i)),255*(t+n*(Xh*r)),this.opacity)}}));function iS(e,t,n,r,i){var o=e*e,s=o*e;return((1-3*e+3*o-s)*t+(4-6*o+3*s)*n+(1+3*e+3*o-3*s)*r+s*i)/6}function dk(e){var t=e.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),i=e[r],o=e[r+1],s=r>0?e[r-1]:2*i-o,a=r<t-1?e[r+2]:2*o-i;return iS((n-r/t)*t,s,i,o,a)}}function hk(e){var t=e.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*t),i=e[(r+t-1)%t],o=e[r%t],s=e[(r+1)%t],a=e[(r+2)%t];return iS((n-r/t)*t,i,o,s,a)}}var Mu=e=>()=>e;function pk(e,t){return function(n){return e+n*t}}function bY(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function Nu(e,t){var n=t-e;return n?pk(e,n>180||n<-180?n-360*Math.round(n/360):n):Mu(isNaN(e)?t:e)}function mk(e){return(e=+e)==1?Ee:function(t,n){return n-t?bY(t,n,e):Mu(isNaN(t)?n:t)}}function Ee(e,t){var n=t-e;return n?pk(e,n):Mu(isNaN(e)?t:e)}var oi=function e(t){var n=mk(t);function r(i,o){var s=n((i=rn(i)).r,(o=rn(o)).r),a=n(i.g,o.g),c=n(i.b,o.b),l=Ee(i.opacity,o.opacity);return function(u){return i.r=s(u),i.g=a(u),i.b=c(u),i.opacity=l(u),i+""}}return r.gamma=e,r}(1);function yk(e){return function(t){var n=t.length,r=new Array(n),i=new Array(n),o=new Array(n),s,a;for(s=0;s<n;++s)a=rn(t[s]),r[s]=a.r||0,i[s]=a.g||0,o[s]=a.b||0;return r=e(r),i=e(i),o=e(o),a.opacity=1,function(c){return a.r=r(c),a.g=i(c),a.b=o(c),a+""}}}var oS=yk(dk),xY=yk(hk);function gk(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(o){for(i=0;i<n;++i)r[i]=e[i]*(1-o)+t[i]*o;return r}}function bk(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function xk(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=new Array(r),o=new Array(n),s;for(s=0;s<r;++s)i[s]=Cr(e[s],t[s]);for(;s<n;++s)o[s]=t[s];return function(a){for(s=0;s<r;++s)o[s]=i[s](a);return o}}function _k(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function we(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function wk(e,t){var n={},r={},i;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(i in t)i in e?n[i]=Cr(e[i],t[i]):r[i]=t[i];return function(o){for(i in n)r[i]=n[i](o);return r}}var aS=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,sS=new RegExp(aS.source,"g");function _Y(e){return function(){return e}}function wY(e){return function(t){return e(t)+""}}function Hh(e,t){var n=aS.lastIndex=sS.lastIndex=0,r,i,o,s=-1,a=[],c=[];for(e=e+"",t=t+"";(r=aS.exec(e))&&(i=sS.exec(t));)(o=i.index)>n&&(o=t.slice(n,o),a[s]?a[s]+=o:a[++s]=o),(r=r[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,c.push({i:s,x:we(r,i)})),n=sS.lastIndex;return n<t.length&&(o=t.slice(n),a[s]?a[s]+=o:a[++s]=o),a.length<2?c[0]?wY(c[0].x):_Y(t):(t=c.length,function(l){for(var u=0,f;u<t;++u)a[(f=c[u]).i]=f.x(l);return a.join("")})}function Cr(e,t){var n=typeof t,r;return t==null||n==="boolean"?Mu(t):(n==="number"?we:n==="string"?(r=Lr(t))?(t=r,oi):Hh:t instanceof Lr?oi:t instanceof Date?_k:bk(t)?gk:Array.isArray(t)?xk:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?wk:we)(e,t)}function Kc(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}var vk=180/Math.PI,G0={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function cS(e,t,n,r,i,o){var s,a,c;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,c/=a),e*r<t*n&&(e=-e,t=-t,c=-c,s=-s),{translateX:i,translateY:o,rotate:Math.atan2(t,e)*vk,skewX:Math.atan(c)*vk,scaleX:s,scaleY:a}}var W0;function Sk(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?G0:cS(t.a,t.b,t.c,t.d,t.e,t.f)}function Ik(e){return e==null?G0:(W0||(W0=document.createElementNS("http://www.w3.org/2000/svg","g")),W0.setAttribute("transform",e),(e=W0.transform.baseVal.consolidate())?(e=e.matrix,cS(e.a,e.b,e.c,e.d,e.e,e.f)):G0)}function Tk(e,t,n,r){function i(l){return l.length?l.pop()+" ":""}function o(l,u,f,d,h,p){if(l!==f||u!==d){var m=h.push("translate(",null,t,null,n);p.push({i:m-4,x:we(l,f)},{i:m-2,x:we(u,d)})}else(f||d)&&h.push("translate("+f+t+d+n)}function s(l,u,f,d){l!==u?(l-u>180?u+=360:u-l>180&&(l+=360),d.push({i:f.push(i(f)+"rotate(",null,r)-2,x:we(l,u)})):u&&f.push(i(f)+"rotate("+u+r)}function a(l,u,f,d){l!==u?d.push({i:f.push(i(f)+"skewX(",null,r)-2,x:we(l,u)}):u&&f.push(i(f)+"skewX("+u+r)}function c(l,u,f,d,h,p){if(l!==f||u!==d){var m=h.push(i(h)+"scale(",null,",",null,")");p.push({i:m-4,x:we(l,f)},{i:m-2,x:we(u,d)})}else(f!==1||d!==1)&&h.push(i(h)+"scale("+f+","+d+")")}return function(l,u){var f=[],d=[];return l=e(l),u=e(u),o(l.translateX,l.translateY,u.translateX,u.translateY,f,d),s(l.rotate,u.rotate,f,d),a(l.skewX,u.skewX,f,d),c(l.scaleX,l.scaleY,u.scaleX,u.scaleY,f,d),l=u=null,function(h){for(var p=-1,m=d.length,g;++p<m;)f[(g=d[p]).i]=g.x(h);return f.join("")}}}var lS=Tk(Sk,"px, ","px)","deg)"),uS=Tk(Ik,", ",")",")");var vY=1e-12;function Ek(e){return((e=Math.exp(e))+1/e)/2}function SY(e){return((e=Math.exp(e))-1/e)/2}function IY(e){return((e=Math.exp(2*e))-1)/(e+1)}var fS=function e(t,n,r){function i(o,s){var a=o[0],c=o[1],l=o[2],u=s[0],f=s[1],d=s[2],h=u-a,p=f-c,m=h*h+p*p,g,y;if(m<vY)y=Math.log(d/l)/t,g=function(T){return[a+T*h,c+T*p,l*Math.exp(t*T*y)]};else{var b=Math.sqrt(m),x=(d*d-l*l+r*m)/(2*l*n*b),_=(d*d-l*l-r*m)/(2*d*n*b),v=Math.log(Math.sqrt(x*x+1)-x),w=Math.log(Math.sqrt(_*_+1)-_);y=(w-v)/t,g=function(T){var M=T*y,R=Ek(v),I=l/(n*b)*(R*IY(t*M+v)-SY(v));return[a+I*h,c+I*p,l*R/Ek(t*M+v)]}}return g.duration=y*1e3*t/Math.SQRT2,g}return i.rho=function(o){var s=Math.max(.001,+o),a=s*s,c=a*a;return e(s,a,c)},i}(Math.SQRT2,2,4);function Ak(e){return function(t,n){var r=e((t=Gh(t)).h,(n=Gh(n)).h),i=Ee(t.s,n.s),o=Ee(t.l,n.l),s=Ee(t.opacity,n.opacity);return function(a){return t.h=r(a),t.s=i(a),t.l=o(a),t.opacity=s(a),t+""}}}var dS=Ak(Nu),TY=Ak(Ee);function X0(e,t){var n=Ee((e=Au(e)).l,(t=Au(t)).l),r=Ee(e.a,t.a),i=Ee(e.b,t.b),o=Ee(e.opacity,t.opacity);return function(s){return e.l=n(s),e.a=r(s),e.b=i(s),e.opacity=o(s),e+""}}function Mk(e){return function(t,n){var r=e((t=Wh(t)).h,(n=Wh(n)).h),i=Ee(t.c,n.c),o=Ee(t.l,n.l),s=Ee(t.opacity,n.opacity);return function(a){return t.h=r(a),t.c=i(a),t.l=o(a),t.opacity=s(a),t+""}}}var hS=Mk(Nu),EY=Mk(Ee);function Nk(e){return function t(n){n=+n;function r(i,o){var s=e((i=Jn(i)).h,(o=Jn(o)).h),a=Ee(i.s,o.s),c=Ee(i.l,o.l),l=Ee(i.opacity,o.opacity);return function(u){return i.h=s(u),i.s=a(u),i.l=c(Math.pow(u,n)),i.opacity=l(u),i+""}}return r.gamma=t,r}(1)}var AY=Nk(Nu),Ru=Nk(Ee);function mo(e,t){t===void 0&&(t=e,e=Cr);for(var n=0,r=t.length-1,i=t[0],o=new Array(r<0?0:r);n<r;)o[n]=e(i,i=t[++n]);return function(s){var a=Math.max(0,Math.min(r-1,Math.floor(s*=r)));return o[a](s-a)}}function Cn(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e(r/(t-1));return n}var Ou=0,Qh=0,Zh=0,Ok=1e3,H0,Kh,Z0=0,Jc=0,Q0=0,Jh=typeof performance=="object"&&performance.now?performance:Date,Dk=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function ep(){return Jc||(Dk(MY),Jc=Jh.now()+Q0)}function MY(){Jc=0}function tp(){this._call=this._time=this._next=null}tp.prototype=K0.prototype={constructor:tp,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?ep():+n)+(t==null?0:+t),!this._next&&Kh!==this&&(Kh?Kh._next=this:H0=this,Kh=this),this._call=e,this._time=n,pS()},stop:function(){this._call&&(this._call=null,this._time=1/0,pS())}};function K0(e,t,n){var r=new tp;return r.restart(e,t,n),r}function kk(){ep(),++Ou;for(var e=H0,t;e;)(t=Jc-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ou}function Rk(){Jc=(Z0=Jh.now())+Q0,Ou=Qh=0;try{kk()}finally{Ou=0,RY(),Jc=0}}function NY(){var e=Jh.now(),t=e-Z0;t>Ok&&(Q0-=t,Z0=e)}function RY(){for(var e,t=H0,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:H0=n);Kh=e,pS(r)}function pS(e){if(!Ou){Qh&&(Qh=clearTimeout(Qh));var t=e-Jc;t>24?(e<1/0&&(Qh=setTimeout(Rk,e-Jh.now()-Q0)),Zh&&(Zh=clearInterval(Zh))):(Zh||(Z0=Jh.now(),Zh=setInterval(NY,Ok)),Ou=1,Dk(Rk))}}function J0(e,t,n){var r=new tp;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var OY=Gc("start","end","cancel","interrupt"),DY=[],Ck=0,Fk=1,eb=2,tb=3,Lk=4,nb=5,np=6;function Fa(e,t,n,r,i,o){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;kY(e,n,{name:t,index:r,group:i,on:OY,tween:DY,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:Ck})}function rp(e,t){var n=on(e,t);if(n.state>Ck)throw new Error("too late; already scheduled");return n}function An(e,t){var n=on(e,t);if(n.state>tb)throw new Error("too late; already running");return n}function on(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function kY(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=K0(o,0,n.time);function o(l){n.state=Fk,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var u,f,d,h;if(n.state!==Fk)return c();for(u in r)if(h=r[u],h.name===n.name){if(h.state===tb)return J0(s);h.state===Lk?(h.state=np,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[u]):+u<t&&(h.state=np,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[u])}if(J0(function(){n.state===tb&&(n.state=Lk,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=eb,n.on.call("start",e,e.__data__,n.index,n.group),n.state===eb){for(n.state=tb,i=new Array(d=n.tween.length),u=0,f=-1;u<d;++u)(h=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(i[++f]=h);i.length=f+1}}function a(l){for(var u=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=nb,1),f=-1,d=i.length;++f<d;)i[f].call(e,u);n.state===nb&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=np,n.timer.stop(),delete r[t];for(var l in r)return;delete e.__transition}}function yo(e,t){var n=e.__transition,r,i,o=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((r=n[s]).name!==t){o=!1;continue}i=r.state>eb&&r.state<nb,r.state=np,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[s]}o&&delete e.__transition}}function Bk(e){return this.each(function(){yo(this,e)})}function FY(e,t){var n,r;return function(){var i=An(this,e),o=i.tween;if(o!==n){r=n=o;for(var s=0,a=r.length;s<a;++s)if(r[s].name===t){r=r.slice(),r.splice(s,1);break}}i.tween=r}}function LY(e,t,n){var r,i;if(typeof n!="function")throw new Error;return function(){var o=An(this,e),s=o.tween;if(s!==r){i=(r=s).slice();for(var a={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=a;break}c===l&&i.push(a)}o.tween=i}}function Pk(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=on(this.node(),n).tween,i=0,o=r.length,s;i<o;++i)if((s=r[i]).name===e)return s.value;return null}return this.each((t==null?FY:LY)(n,e,t))}function Du(e,t,n){var r=e._id;return e.each(function(){var i=An(this,r);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return on(i,r).value[t]}}function rb(e,t){var n;return(typeof t=="number"?we:t instanceof Lr?oi:(n=Lr(t))?(t=n,oi):Hh)(e,t)}function CY(e){return function(){this.removeAttribute(e)}}function BY(e){return function(){this.removeAttributeNS(e.space,e.local)}}function PY(e,t,n){var r,i=n+"",o;return function(){var s=this.getAttribute(e);return s===i?null:s===r?o:o=t(r=s,n)}}function $Y(e,t,n){var r,i=n+"",o;return function(){var s=this.getAttributeNS(e.space,e.local);return s===i?null:s===r?o:o=t(r=s,n)}}function UY(e,t,n){var r,i,o;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),c=a+"",s===c?null:s===r&&c===i?o:(i=c,o=t(r=s,a)))}}function zY(e,t,n){var r,i,o;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),c=a+"",s===c?null:s===r&&c===i?o:(i=c,o=t(r=s,a)))}}function $k(e,t){var n=Is(e),r=n==="transform"?uS:rb;return this.attrTween(e,typeof t=="function"?(n.local?zY:UY)(n,r,Du(this,"attr."+e,t)):t==null?(n.local?BY:CY)(n):(n.local?$Y:PY)(n,r,t))}function qY(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function jY(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function VY(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&jY(e,o)),n}return i._value=t,i}function YY(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&qY(e,o)),n}return i._value=t,i}function Uk(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=Is(e);return this.tween(n,(r.local?VY:YY)(r,t))}function GY(e,t){return function(){rp(this,e).delay=+t.apply(this,arguments)}}function WY(e,t){return t=+t,function(){rp(this,e).delay=t}}function zk(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?GY:WY)(t,e)):on(this.node(),t).delay}function XY(e,t){return function(){An(this,e).duration=+t.apply(this,arguments)}}function HY(e,t){return t=+t,function(){An(this,e).duration=t}}function qk(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?XY:HY)(t,e)):on(this.node(),t).duration}function ZY(e,t){if(typeof t!="function")throw new Error;return function(){An(this,e).ease=t}}function jk(e){var t=this._id;return arguments.length?this.each(ZY(t,e)):on(this.node(),t).ease}function QY(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;An(this,e).ease=n}}function Vk(e){if(typeof e!="function")throw new Error;return this.each(QY(this._id,e))}function Yk(e){typeof e!="function"&&(e=Uh(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],s=o.length,a=r[i]=[],c,l=0;l<s;++l)(c=o[l])&&e.call(c,c.__data__,l,o)&&a.push(c);return new tr(r,this._parents,this._name,this._id)}function Gk(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,i=n.length,o=Math.min(r,i),s=new Array(r),a=0;a<o;++a)for(var c=t[a],l=n[a],u=c.length,f=s[a]=new Array(u),d,h=0;h<u;++h)(d=c[h]||l[h])&&(f[h]=d);for(;a<r;++a)s[a]=t[a];return new tr(s,this._parents,this._name,this._id)}function KY(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function JY(e,t,n){var r,i,o=KY(t)?rp:An;return function(){var s=o(this,e),a=s.on;a!==r&&(i=(r=a).copy()).on(t,n),s.on=i}}function Wk(e,t){var n=this._id;return arguments.length<2?on(this.node(),n).on.on(e):this.each(JY(n,e,t))}function tG(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Xk(){return this.on("end.remove",tG(this._id))}function Hk(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Wc(e));for(var r=this._groups,i=r.length,o=new Array(i),s=0;s<i;++s)for(var a=r[s],c=a.length,l=o[s]=new Array(c),u,f,d=0;d<c;++d)(u=a[d])&&(f=e.call(u,u.__data__,d,a))&&("__data__"in u&&(f.__data__=u.__data__),l[d]=f,Fa(l[d],t,n,d,l,on(u,n)));return new tr(o,this._parents,t,n)}function Zk(e){var t=this._name,n=this._id;typeof e!="function"&&(e=$h(e));for(var r=this._groups,i=r.length,o=[],s=[],a=0;a<i;++a)for(var c=r[a],l=c.length,u,f=0;f<l;++f)if(u=c[f]){for(var d=e.call(u,u.__data__,f,c),h,p=on(u,n),m=0,g=d.length;m<g;++m)(h=d[m])&&Fa(h,t,n,m,d,p);o.push(d),s.push(u)}return new tr(o,s,t,n)}var eG=Es.prototype.constructor;function Qk(){return new eG(this._groups,this._parents)}function nG(e,t){var n,r,i;return function(){var o=Oa(this,e),s=(this.style.removeProperty(e),Oa(this,e));return o===s?null:o===n&&s===r?i:i=t(n=o,r=s)}}function Kk(e){return function(){this.style.removeProperty(e)}}function rG(e,t,n){var r,i=n+"",o;return function(){var s=Oa(this,e);return s===i?null:s===r?o:o=t(r=s,n)}}function iG(e,t,n){var r,i,o;return function(){var s=Oa(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),Oa(this,e))),s===c?null:s===r&&c===i?o:(i=c,o=t(r=s,a))}}function oG(e,t){var n,r,i,o="style."+t,s="end."+o,a;return function(){var c=An(this,e),l=c.on,u=c.value[o]==null?a||(a=Kk(t)):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(s,i=u),c.on=r}}function Jk(e,t,n){var r=(e+="")=="transform"?lS:rb;return t==null?this.styleTween(e,nG(e,r)).on("end.style."+e,Kk(e)):typeof t=="function"?this.styleTween(e,iG(e,r,Du(this,"style."+e,t))).each(oG(this._id,e)):this.styleTween(e,rG(e,r,t),n).on("end.style."+e,null)}function sG(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function aG(e,t,n){var r,i;function o(){var s=t.apply(this,arguments);return s!==i&&(r=(i=s)&&sG(e,s,n)),r}return o._value=t,o}function tF(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,aG(e,t,n??""))}function cG(e){return function(){this.textContent=e}}function lG(e){return function(){var t=e(this);this.textContent=t??""}}function eF(e){return this.tween("text",typeof e=="function"?lG(Du(this,"text",e)):cG(e==null?"":e+""))}function uG(e){return function(t){this.textContent=e.call(this,t)}}function fG(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&uG(i)),t}return r._value=e,r}function nF(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,fG(e))}function rF(){for(var e=this._name,t=this._id,n=ib(),r=this._groups,i=r.length,o=0;o<i;++o)for(var s=r[o],a=s.length,c,l=0;l<a;++l)if(c=s[l]){var u=on(c,t);Fa(c,e,n,l,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new tr(r,this._parents,e,n)}function iF(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(o,s){var a={value:s},c={value:function(){--i===0&&o()}};n.each(function(){var l=An(this,r),u=l.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),l.on=t}),i===0&&o()})}var dG=0;function tr(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function oF(e){return Es().transition(e)}function ib(){return++dG}var Ns=Es.prototype;tr.prototype=oF.prototype={constructor:tr,select:Hk,selectAll:Zk,selectChild:Ns.selectChild,selectChildren:Ns.selectChildren,filter:Yk,merge:Gk,selection:Qk,transition:rF,call:Ns.call,nodes:Ns.nodes,node:Ns.node,size:Ns.size,empty:Ns.empty,each:Ns.each,on:Wk,attr:$k,attrTween:Uk,style:Jk,styleTween:tF,text:eF,textTween:nF,remove:Xk,tween:Pk,delay:zk,duration:qk,ease:jk,easeVarying:Vk,end:iF,[Symbol.iterator]:Ns[Symbol.iterator]};function ob(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var hG={time:null,delay:0,duration:250,ease:ob};function pG(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function sF(e){var t,n;e instanceof tr?(t=e._id,e=e._name):(t=ib(),(n=hG).time=ep(),e=e==null?null:e+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var s=r[o],a=s.length,c,l=0;l<a;++l)(c=s[l])&&Fa(c,e,t,l,s,n||pG(c,t));return new tr(r,this._parents,e,t)}Es.prototype.interrupt=Bk;Es.prototype.transition=sF;var sb=e=>()=>e;function mS(e,{sourceEvent:t,target:n,selection:r,mode:i,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},selection:{value:r,enumerable:!0,configurable:!0},mode:{value:i,enumerable:!0,configurable:!0},_:{value:o}})}function aF(e){e.stopImmediatePropagation()}function ab(e){e.preventDefault(),e.stopImmediatePropagation()}var cF={name:"drag"},yS={name:"space"},ku={name:"handle"},Fu={name:"center"},{abs:lF,max:Bn,min:Pn}=Math;function uF(e){return[+e[0],+e[1]]}function bS(e){return[uF(e[0]),uF(e[1])]}var cb={name:"x",handles:["w","e"].map(ip),input:function(e,t){return e==null?null:[[+e[0],t[0][1]],[+e[1],t[1][1]]]},output:function(e){return e&&[e[0][0],e[1][0]]}},lb={name:"y",handles:["n","s"].map(ip),input:function(e,t){return e==null?null:[[t[0][0],+e[0]],[t[1][0],+e[1]]]},output:function(e){return e&&[e[0][1],e[1][1]]}},mG={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(ip),input:function(e){return e==null?null:bS(e)},output:function(e){return e}},Rs={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},fF={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},dF={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},yG={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},gG={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function ip(e){return{type:e}}function bG(e){return!e.ctrlKey&&!e.button}function xG(){var e=this.ownerSVGElement||this;return e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]}function _G(){return navigator.maxTouchPoints||"ontouchstart"in this}function gS(e){for(;!e.__brush;)if(!(e=e.parentNode))return;return e.__brush}function wG(e){return e[0][0]===e[1][0]||e[0][1]===e[1][1]}function xS(){return vS(cb)}function _S(){return vS(lb)}function wS(){return vS(mG)}function vS(e){var t=xG,n=bG,r=_G,i=!0,o=Gc("start","brush","end"),s=6,a;function c(g){var y=g.property("__brush",m).selectAll(".overlay").data([ip("overlay")]);y.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",Rs.overlay).merge(y).each(function(){var x=gS(this).extent;qt(this).attr("x",x[0][0]).attr("y",x[0][1]).attr("width",x[1][0]-x[0][0]).attr("height",x[1][1]-x[0][1])}),g.selectAll(".selection").data([ip("selection")]).enter().append("rect").attr("class","selection").attr("cursor",Rs.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var b=g.selectAll(".handle").data(e.handles,function(x){return x.type});b.exit().remove(),b.enter().append("rect").attr("class",function(x){return"handle handle--"+x.type}).attr("cursor",function(x){return Rs[x.type]}),g.each(l).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",d).filter(r).on("touchstart.brush",d).on("touchmove.brush",h).on("touchend.brush touchcancel.brush",p).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}c.move=function(g,y,b){g.tween?g.on("start.brush",function(x){u(this,arguments).beforestart().start(x)}).on("interrupt.brush end.brush",function(x){u(this,arguments).end(x)}).tween("brush",function(){var x=this,_=x.__brush,v=u(x,arguments),w=_.selection,T=e.input(typeof y=="function"?y.apply(this,arguments):y,_.extent),M=Cr(w,T);function R(I){_.selection=I===1&&T===null?null:M(I),l.call(x),v.brush()}return w!==null&&T!==null?R:R(1)}):g.each(function(){var x=this,_=arguments,v=x.__brush,w=e.input(typeof y=="function"?y.apply(x,_):y,v.extent),T=u(x,_).beforestart();yo(x),v.selection=w===null?null:w,l.call(x),T.start(b).brush(b).end(b)})},c.clear=function(g,y){c.move(g,null,y)};function l(){var g=qt(this),y=gS(this).selection;y?(g.selectAll(".selection").style("display",null).attr("x",y[0][0]).attr("y",y[0][1]).attr("width",y[1][0]-y[0][0]).attr("height",y[1][1]-y[0][1]),g.selectAll(".handle").style("display",null).attr("x",function(b){return b.type[b.type.length-1]==="e"?y[1][0]-s/2:y[0][0]-s/2}).attr("y",function(b){return b.type[0]==="s"?y[1][1]-s/2:y[0][1]-s/2}).attr("width",function(b){return b.type==="n"||b.type==="s"?y[1][0]-y[0][0]+s:s}).attr("height",function(b){return b.type==="e"||b.type==="w"?y[1][1]-y[0][1]+s:s})):g.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function u(g,y,b){var x=g.__brush.emitter;return x&&(!b||!x.clean)?x:new f(g,y,b)}function f(g,y,b){this.that=g,this.args=y,this.state=g.__brush,this.active=0,this.clean=b}f.prototype={beforestart:function(){return++this.active===1&&(this.state.emitter=this,this.starting=!0),this},start:function(g,y){return this.starting?(this.starting=!1,this.emit("start",g,y)):this.emit("brush",g),this},brush:function(g,y){return this.emit("brush",g,y),this},end:function(g,y){return--this.active===0&&(delete this.state.emitter,this.emit("end",g,y)),this},emit:function(g,y,b){var x=qt(this.that).datum();o.call(g,this.that,new mS(g,{sourceEvent:y,target:c,selection:e.output(this.state.selection),mode:b,dispatch:o}),x)}};function d(g){if(a&&!g.touches||!n.apply(this,arguments))return;var y=this,b=g.target.__data__.type,x=(i&&g.metaKey?b="overlay":b)==="selection"?cF:i&&g.altKey?Fu:ku,_=e===lb?null:yG[b],v=e===cb?null:gG[b],w=gS(y),T=w.extent,M=w.selection,R=T[0][0],I,A,O=T[0][1],F,S,E=T[1][0],N,L,B=T[1][1],C,P,$=0,U=0,X,tt=_&&v&&i&&g.shiftKey,nt,st,Y=Array.from(g.touches||[g],et=>{let oe=et.identifier;return et=Ln(et,y),et.point0=et.slice(),et.identifier=oe,et});yo(y);var rt=u(y,arguments,!0).beforestart();if(b==="overlay"){M&&(X=!0);let et=[Y[0],Y[1]||Y[0]];w.selection=M=[[I=e===lb?R:Pn(et[0][0],et[1][0]),F=e===cb?O:Pn(et[0][1],et[1][1])],[N=e===lb?E:Bn(et[0][0],et[1][0]),C=e===cb?B:Bn(et[0][1],et[1][1])]],Y.length>1&&Lt(g)}else I=M[0][0],F=M[0][1],N=M[1][0],C=M[1][1];A=I,S=F,L=N,P=C;var q=qt(y).attr("pointer-events","none"),H=q.selectAll(".overlay").attr("cursor",Rs[b]);if(g.touches)rt.moved=z,rt.ended=dt;else{var ot=qt(g.view).on("mousemove.brush",z,!0).on("mouseup.brush",dt,!0);i&&ot.on("keydown.brush",Wt,!0).on("keyup.brush",Xt,!0),qh(g.view)}l.call(y),rt.start(g,x.name);function z(et){for(let oe of et.changedTouches||[et])for(let wr of Y)wr.identifier===oe.identifier&&(wr.cur=Ln(oe,y));if(tt&&!nt&&!st&&Y.length===1){let oe=Y[0];lF(oe.cur[0]-oe[0])>lF(oe.cur[1]-oe[1])?st=!0:nt=!0}for(let oe of Y)oe.cur&&(oe[0]=oe.cur[0],oe[1]=oe.cur[1]);X=!0,ab(et),Lt(et)}function Lt(et){let oe=Y[0],wr=oe.point0;var Gi;switch($=oe[0]-wr[0],U=oe[1]-wr[1],x){case yS:case cF:{_&&($=Bn(R-I,Pn(E-N,$)),A=I+$,L=N+$),v&&(U=Bn(O-F,Pn(B-C,U)),S=F+U,P=C+U);break}case ku:{Y[1]?(_&&(A=Bn(R,Pn(E,Y[0][0])),L=Bn(R,Pn(E,Y[1][0])),_=1),v&&(S=Bn(O,Pn(B,Y[0][1])),P=Bn(O,Pn(B,Y[1][1])),v=1)):(_<0?($=Bn(R-I,Pn(E-I,$)),A=I+$,L=N):_>0&&($=Bn(R-N,Pn(E-N,$)),A=I,L=N+$),v<0?(U=Bn(O-F,Pn(B-F,U)),S=F+U,P=C):v>0&&(U=Bn(O-C,Pn(B-C,U)),S=F,P=C+U));break}case Fu:{_&&(A=Bn(R,Pn(E,I-$*_)),L=Bn(R,Pn(E,N+$*_))),v&&(S=Bn(O,Pn(B,F-U*v)),P=Bn(O,Pn(B,C+U*v)));break}}L<A&&(_*=-1,Gi=I,I=N,N=Gi,Gi=A,A=L,L=Gi,b in fF&&H.attr("cursor",Rs[b=fF[b]])),P<S&&(v*=-1,Gi=F,F=C,C=Gi,Gi=S,S=P,P=Gi,b in dF&&H.attr("cursor",Rs[b=dF[b]])),w.selection&&(M=w.selection),nt&&(A=M[0][0],L=M[1][0]),st&&(S=M[0][1],P=M[1][1]),(M[0][0]!==A||M[0][1]!==S||M[1][0]!==L||M[1][1]!==P)&&(w.selection=[[A,S],[L,P]],l.call(y),rt.brush(et,x.name))}function dt(et){if(aF(et),et.touches){if(et.touches.length)return;a&&clearTimeout(a),a=setTimeout(function(){a=null},500)}else jh(et.view,X),ot.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);q.attr("pointer-events","all"),H.attr("cursor",Rs.overlay),w.selection&&(M=w.selection),wG(M)&&(w.selection=null,l.call(y)),rt.end(et,x.name)}function Wt(et){switch(et.keyCode){case 16:{tt=_&&v;break}case 18:{x===ku&&(_&&(N=L-$*_,I=A+$*_),v&&(C=P-U*v,F=S+U*v),x=Fu,Lt(et));break}case 32:{(x===ku||x===Fu)&&(_<0?N=L-$:_>0&&(I=A-$),v<0?C=P-U:v>0&&(F=S-U),x=yS,H.attr("cursor",Rs.selection),Lt(et));break}default:return}ab(et)}function Xt(et){switch(et.keyCode){case 16:{tt&&(nt=st=tt=!1,Lt(et));break}case 18:{x===Fu&&(_<0?N=L:_>0&&(I=A),v<0?C=P:v>0&&(F=S),x=ku,Lt(et));break}case 32:{x===yS&&(et.altKey?(_&&(N=L-$*_,I=A+$*_),v&&(C=P-U*v,F=S+U*v),x=Fu):(_<0?N=L:_>0&&(I=A),v<0?C=P:v>0&&(F=S),x=ku),H.attr("cursor",Rs[b]),Lt(et));break}default:return}ab(et)}}function h(g){u(this,arguments).moved(g)}function p(g){u(this,arguments).ended(g)}function m(){var g=this.__brush||{selection:null};return g.extent=bS(t.apply(this,arguments)),g.dim=e,g}return c.extent=function(g){return arguments.length?(t=typeof g=="function"?g:sb(bS(g)),c):t},c.filter=function(g){return arguments.length?(n=typeof g=="function"?g:sb(!!g),c):n},c.touchable=function(g){return arguments.length?(r=typeof g=="function"?g:sb(!!g),c):r},c.handleSize=function(g){return arguments.length?(s=+g,c):s},c.keyModifiers=function(g){return arguments.length?(i=!!g,c):i},c.on=function(){var g=o.on.apply(o,arguments);return g===o?c:g},c}var SS=Math.PI,IS=2*SS,tl=1e-6,vG=IS-tl;function hF(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function SG(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return hF;let n=10**t;return function(r){this._+=r[0];for(let i=1,o=r.length;i<o;++i)this._+=Math.round(arguments[i]*n)/n+r[i]}}var La=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?hF:SG(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,r,i){this._append`Q${+t},${+n},${this._x1=+r},${this._y1=+i}`}bezierCurveTo(t,n,r,i,o,s){this._append`C${+t},${+n},${+r},${+i},${this._x1=+o},${this._y1=+s}`}arcTo(t,n,r,i,o){if(t=+t,n=+n,r=+r,i=+i,o=+o,o<0)throw new Error(`negative radius: ${o}`);let s=this._x1,a=this._y1,c=r-t,l=i-n,u=s-t,f=a-n,d=u*u+f*f;if(this._x1===null)this._append`M${this._x1=t},${this._y1=n}`;else if(d>tl)if(!(Math.abs(f*c-l*u)>tl)||!o)this._append`L${this._x1=t},${this._y1=n}`;else{let h=r-s,p=i-a,m=c*c+l*l,g=h*h+p*p,y=Math.sqrt(m),b=Math.sqrt(d),x=o*Math.tan((SS-Math.acos((m+d-g)/(2*y*b)))/2),_=x/b,v=x/y;Math.abs(_-1)>tl&&this._append`L${t+_*u},${n+_*f}`,this._append`A${o},${o},0,0,${+(f*h>u*p)},${this._x1=t+v*c},${this._y1=n+v*l}`}}arc(t,n,r,i,o,s){if(t=+t,n=+n,r=+r,s=!!s,r<0)throw new Error(`negative radius: ${r}`);let a=r*Math.cos(i),c=r*Math.sin(i),l=t+a,u=n+c,f=1^s,d=s?i-o:o-i;this._x1===null?this._append`M${l},${u}`:(Math.abs(this._x1-l)>tl||Math.abs(this._y1-u)>tl)&&this._append`L${l},${u}`,r&&(d<0&&(d=d%IS+IS),d>vG?this._append`A${r},${r},0,1,${f},${t-a},${n-c}A${r},${r},0,1,${f},${this._x1=l},${this._y1=u}`:d>tl&&this._append`A${r},${r},0,${+(d>=SS)},${f},${this._x1=t+r*Math.cos(o)},${this._y1=n+r*Math.sin(o)}`)}rect(t,n,r,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}};function pF(){return new La}pF.prototype=La.prototype;function er(e=3){return new La(+e)}var IG=Array.prototype,ub=IG.slice;function mF(e,t){return e-t}function yF(e){for(var t=0,n=e.length,r=e[n-1][1]*e[0][0]-e[n-1][0]*e[0][1];++t<n;)r+=e[t-1][1]*e[t][0]-e[t-1][0]*e[t][1];return r}var go=e=>()=>e;function gF(e,t){for(var n=-1,r=t.length,i;++n<r;)if(i=TG(e,t[n]))return i;return 0}function TG(e,t){for(var n=t[0],r=t[1],i=-1,o=0,s=e.length,a=s-1;o<s;a=o++){var c=e[o],l=c[0],u=c[1],f=e[a],d=f[0],h=f[1];if(EG(c,f,t))return 0;u>r!=h>r&&n<(d-l)*(r-u)/(h-u)+l&&(i=-i)}return i}function EG(e,t,n){var r;return AG(e,t,n)&&MG(e[r=+(e[0]===t[0])],n[r],t[r])}function AG(e,t,n){return(t[0]-e[0])*(n[1]-e[1])===(n[0]-e[0])*(t[1]-e[1])}function MG(e,t,n){return e<=t&&t<=n||n<=t&&t<=e}function bF(){}var Os=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function Ca(){var e=1,t=1,n=Na,r=c;function i(l){var u=n(l);if(Array.isArray(u))u=u.slice().sort(mF);else{let f=ae(l,NG);for(u=Tn(...vu(f[0],f[1],u),u);u[u.length-1]>=f[1];)u.pop();for(;u[1]<f[0];)u.shift()}return u.map(f=>o(l,f))}function o(l,u){let f=u==null?NaN:+u;if(isNaN(f))throw new Error(`invalid value: ${u}`);var d=[],h=[];return s(l,f,function(p){r(p,l,f),yF(p)>0?d.push([p]):h.push(p)}),h.forEach(function(p){for(var m=0,g=d.length,y;m<g;++m)if(gF((y=d[m])[0],p)!==-1){y.push(p);return}}),{type:"MultiPolygon",value:u,coordinates:d}}function s(l,u,f){var d=new Array,h=new Array,p,m,g,y,b,x;for(p=m=-1,y=el(l[0],u),Os[y<<1].forEach(_);++p<e-1;)g=y,y=el(l[p+1],u),Os[g|y<<1].forEach(_);for(Os[y<<0].forEach(_);++m<t-1;){for(p=-1,y=el(l[m*e+e],u),b=el(l[m*e],u),Os[y<<1|b<<2].forEach(_);++p<e-1;)g=y,y=el(l[m*e+e+p+1],u),x=b,b=el(l[m*e+p+1],u),Os[g|y<<1|b<<2|x<<3].forEach(_);Os[y|b<<3].forEach(_)}for(p=-1,b=l[m*e]>=u,Os[b<<2].forEach(_);++p<e-1;)x=b,b=el(l[m*e+p+1],u),Os[b<<2|x<<3].forEach(_);Os[b<<3].forEach(_);function _(v){var w=[v[0][0]+p,v[0][1]+m],T=[v[1][0]+p,v[1][1]+m],M=a(w),R=a(T),I,A;(I=h[M])?(A=d[R])?(delete h[I.end],delete d[A.start],I===A?(I.ring.push(T),f(I.ring)):d[I.start]=h[A.end]={start:I.start,end:A.end,ring:I.ring.concat(A.ring)}):(delete h[I.end],I.ring.push(T),h[I.end=R]=I):(I=d[R])?(A=h[M])?(delete d[I.start],delete h[A.end],I===A?(I.ring.push(T),f(I.ring)):d[A.start]=h[I.end]={start:A.start,end:I.end,ring:A.ring.concat(I.ring)}):(delete d[I.start],I.ring.unshift(w),d[I.start=M]=I):d[M]=h[R]={start:M,end:R,ring:[w,T]}}}function a(l){return l[0]*2+l[1]*(e+1)*4}function c(l,u,f){l.forEach(function(d){var h=d[0],p=d[1],m=h|0,g=p|0,y=TS(u[g*e+m]);h>0&&h<e&&m===h&&(d[0]=xF(h,TS(u[g*e+m-1]),y,f)),p>0&&p<t&&g===p&&(d[1]=xF(p,TS(u[(g-1)*e+m]),y,f))})}return i.contour=o,i.size=function(l){if(!arguments.length)return[e,t];var u=Math.floor(l[0]),f=Math.floor(l[1]);if(!(u>=0&&f>=0))throw new Error("invalid size");return e=u,t=f,i},i.thresholds=function(l){return arguments.length?(n=typeof l=="function"?l:Array.isArray(l)?go(ub.call(l)):go(l),i):n},i.smooth=function(l){return arguments.length?(r=l?c:bF,i):r===c},i}function NG(e){return isFinite(e)?e:NaN}function el(e,t){return e==null?!1:+e>=t}function TS(e){return e==null||isNaN(e=+e)?-1/0:e}function xF(e,t,n,r){let i=r-t,o=n-t,s=isFinite(i)||isFinite(o)?i/o:Math.sign(i)/Math.sign(o);return isNaN(s)?e:e+s-.5}function RG(e){return e[0]}function OG(e){return e[1]}function DG(){return 1}function ES(){var e=RG,t=OG,n=DG,r=960,i=500,o=20,s=2,a=o*3,c=r+a*2>>s,l=i+a*2>>s,u=go(20);function f(b){var x=new Float32Array(c*l),_=Math.pow(2,-s),v=-1;for(let F of b){var w=(e(F,++v,b)+a)*_,T=(t(F,v,b)+a)*_,M=+n(F,v,b);if(M&&w>=0&&w<c&&T>=0&&T<l){var R=Math.floor(w),I=Math.floor(T),A=w-R-.5,O=T-I-.5;x[R+I*c]+=(1-A)*(1-O)*M,x[R+1+I*c]+=A*(1-O)*M,x[R+1+(I+1)*c]+=A*O*M,x[R+(I+1)*c]+=(1-A)*O*M}}return kh({data:x,width:c,height:l},o*_),x}function d(b){var x=f(b),_=u(x),v=Math.pow(2,2*s);return Array.isArray(_)||(_=Tn(Number.MIN_VALUE,Gt(x)/v,_)),Ca().size([c,l]).thresholds(_.map(w=>w*v))(x).map((w,T)=>(w.value=+_[T],h(w)))}d.contours=function(b){var x=f(b),_=Ca().size([c,l]),v=Math.pow(2,2*s),w=T=>{T=+T;var M=h(_.contour(x,T*v));return M.value=T,M};return Object.defineProperty(w,"max",{get:()=>Gt(x)/v}),w};function h(b){return b.coordinates.forEach(p),b}function p(b){b.forEach(m)}function m(b){b.forEach(g)}function g(b){b[0]=b[0]*Math.pow(2,s)-a,b[1]=b[1]*Math.pow(2,s)-a}function y(){return a=o*3,c=r+a*2>>s,l=i+a*2>>s,d}return d.x=function(b){return arguments.length?(e=typeof b=="function"?b:go(+b),d):e},d.y=function(b){return arguments.length?(t=typeof b=="function"?b:go(+b),d):t},d.weight=function(b){return arguments.length?(n=typeof b=="function"?b:go(+b),d):n},d.size=function(b){if(!arguments.length)return[r,i];var x=+b[0],_=+b[1];if(!(x>=0&&_>=0))throw new Error("invalid size");return r=x,i=_,y()},d.cellSize=function(b){if(!arguments.length)return 1<<s;if(!((b=+b)>=1))throw new Error("invalid cell size");return s=Math.floor(Math.log(b)/Math.LN2),y()},d.thresholds=function(b){return arguments.length?(u=typeof b=="function"?b:Array.isArray(b)?go(ub.call(b)):go(b),d):u},d.bandwidth=function(b){if(!arguments.length)return Math.sqrt(o*(o+1));if(!((b=+b)>=0))throw new Error("invalid bandwidth");return o=(Math.sqrt(4*b*b+1)-1)/2,y()},d}var Jt=11102230246251565e-32,Ge=134217729,op=(3+8*Jt)*Jt;function nl(e,t,n,r,i){let o,s,a,c,l=t[0],u=r[0],f=0,d=0;u>l==u>-l?(o=l,l=t[++f]):(o=u,u=r[++d]);let h=0;if(f<e&&d<n)for(u>l==u>-l?(s=l+o,a=o-(s-l),l=t[++f]):(s=u+o,a=o-(s-u),u=r[++d]),o=s,a!==0&&(i[h++]=a);f<e&&d<n;)u>l==u>-l?(s=o+l,c=s-o,a=o-(s-c)+(l-c),l=t[++f]):(s=o+u,c=s-o,a=o-(s-c)+(u-c),u=r[++d]),o=s,a!==0&&(i[h++]=a);for(;f<e;)s=o+l,c=s-o,a=o-(s-c)+(l-c),l=t[++f],o=s,a!==0&&(i[h++]=a);for(;d<n;)s=o+u,c=s-o,a=o-(s-c)+(u-c),u=r[++d],o=s,a!==0&&(i[h++]=a);return(o!==0||h===0)&&(i[h++]=o),h}function sp(e,t){let n=t[0];for(let r=1;r<e;r++)n+=t[r];return n}function V(e){return new Float64Array(e)}var kG=(3+16*Jt)*Jt,FG=(2+12*Jt)*Jt,LG=(9+64*Jt)*Jt*Jt,Lu=V(4),_F=V(8),wF=V(12),vF=V(16),nr=V(4);function CG(e,t,n,r,i,o,s){let a,c,l,u,f,d,h,p,m,g,y,b,x,_,v,w,T,M,R=e-i,I=n-i,A=t-o,O=r-o;_=R*O,d=Ge*R,h=d-(d-R),p=R-h,d=Ge*O,m=d-(d-O),g=O-m,v=p*g-(_-h*m-p*m-h*g),w=A*I,d=Ge*A,h=d-(d-A),p=A-h,d=Ge*I,m=d-(d-I),g=I-m,T=p*g-(w-h*m-p*m-h*g),y=v-T,f=v-y,Lu[0]=v-(y+f)+(f-T),b=_+y,f=b-_,x=_-(b-f)+(y-f),y=x-w,f=x-y,Lu[1]=x-(y+f)+(f-w),M=b+y,f=M-b,Lu[2]=b-(M-f)+(y-f),Lu[3]=M;let F=sp(4,Lu),S=FG*s;if(F>=S||-F>=S||(f=e-R,a=e-(R+f)+(f-i),f=n-I,l=n-(I+f)+(f-i),f=t-A,c=t-(A+f)+(f-o),f=r-O,u=r-(O+f)+(f-o),a===0&&c===0&&l===0&&u===0)||(S=LG*s+op*Math.abs(F),F+=R*u+O*a-(A*l+I*c),F>=S||-F>=S))return F;_=a*O,d=Ge*a,h=d-(d-a),p=a-h,d=Ge*O,m=d-(d-O),g=O-m,v=p*g-(_-h*m-p*m-h*g),w=c*I,d=Ge*c,h=d-(d-c),p=c-h,d=Ge*I,m=d-(d-I),g=I-m,T=p*g-(w-h*m-p*m-h*g),y=v-T,f=v-y,nr[0]=v-(y+f)+(f-T),b=_+y,f=b-_,x=_-(b-f)+(y-f),y=x-w,f=x-y,nr[1]=x-(y+f)+(f-w),M=b+y,f=M-b,nr[2]=b-(M-f)+(y-f),nr[3]=M;let E=nl(4,Lu,4,nr,_F);_=R*u,d=Ge*R,h=d-(d-R),p=R-h,d=Ge*u,m=d-(d-u),g=u-m,v=p*g-(_-h*m-p*m-h*g),w=A*l,d=Ge*A,h=d-(d-A),p=A-h,d=Ge*l,m=d-(d-l),g=l-m,T=p*g-(w-h*m-p*m-h*g),y=v-T,f=v-y,nr[0]=v-(y+f)+(f-T),b=_+y,f=b-_,x=_-(b-f)+(y-f),y=x-w,f=x-y,nr[1]=x-(y+f)+(f-w),M=b+y,f=M-b,nr[2]=b-(M-f)+(y-f),nr[3]=M;let N=nl(E,_F,4,nr,wF);_=a*u,d=Ge*a,h=d-(d-a),p=a-h,d=Ge*u,m=d-(d-u),g=u-m,v=p*g-(_-h*m-p*m-h*g),w=c*l,d=Ge*c,h=d-(d-c),p=c-h,d=Ge*l,m=d-(d-l),g=l-m,T=p*g-(w-h*m-p*m-h*g),y=v-T,f=v-y,nr[0]=v-(y+f)+(f-T),b=_+y,f=b-_,x=_-(b-f)+(y-f),y=x-w,f=x-y,nr[1]=x-(y+f)+(f-w),M=b+y,f=M-b,nr[2]=b-(M-f)+(y-f),nr[3]=M;let L=nl(N,wF,4,nr,vF);return vF[L-1]}function Cu(e,t,n,r,i,o){let s=(t-o)*(n-i),a=(e-i)*(r-o),c=s-a;if(s===0||a===0||s>0!=a>0)return c;let l=Math.abs(s+a);return Math.abs(c)>=kG*l?c:-CG(e,t,n,r,i,o,l)}var D_t=(7+56*Jt)*Jt,k_t=(3+28*Jt)*Jt,F_t=(26+288*Jt)*Jt*Jt,L_t=V(4),C_t=V(4),B_t=V(4),P_t=V(4),$_t=V(4),U_t=V(4),z_t=V(4),q_t=V(4),j_t=V(4),V_t=V(8),Y_t=V(8),G_t=V(8),W_t=V(4),X_t=V(8),H_t=V(8),Z_t=V(8),Q_t=V(12),K_t=V(192),J_t=V(192);var nwt=(10+96*Jt)*Jt,rwt=(4+48*Jt)*Jt,iwt=(44+576*Jt)*Jt*Jt,owt=V(4),swt=V(4),awt=V(4),cwt=V(4),lwt=V(4),uwt=V(4),fwt=V(4),dwt=V(4),hwt=V(8),pwt=V(8),mwt=V(8),ywt=V(8),gwt=V(8),bwt=V(8),xwt=V(8),_wt=V(8),wwt=V(8),vwt=V(4),Swt=V(4),Iwt=V(4),Twt=V(8),Ewt=V(16),Awt=V(16),Mwt=V(16),Nwt=V(32),Rwt=V(32),Owt=V(48),Dwt=V(64),kwt=V(1152),Fwt=V(1152);var Pwt=(16+224*Jt)*Jt,$wt=(5+72*Jt)*Jt,Uwt=(71+1408*Jt)*Jt*Jt,zwt=V(4),qwt=V(4),jwt=V(4),Vwt=V(4),Ywt=V(4),Gwt=V(4),Wwt=V(4),Xwt=V(4),Hwt=V(4),Zwt=V(4),Qwt=V(24),Kwt=V(24),Jwt=V(24),tvt=V(24),evt=V(24),nvt=V(24),rvt=V(24),ivt=V(24),ovt=V(24),svt=V(24),avt=V(1152),cvt=V(1152),lvt=V(1152),uvt=V(1152),fvt=V(1152),dvt=V(2304),hvt=V(2304),pvt=V(3456),mvt=V(5760),yvt=V(8),gvt=V(8),bvt=V(8),xvt=V(16),_vt=V(24),wvt=V(48),vvt=V(48),Svt=V(96),Ivt=V(192),Tvt=V(384),Evt=V(384),Avt=V(384),Mvt=V(768);var Nvt=V(96),Rvt=V(96),Ovt=V(96),Dvt=V(1152);var IF=Math.pow(2,-52),fb=new Uint32Array(512),Pu=class e{static from(t,n=qG,r=jG){let i=t.length,o=new Float64Array(i*2);for(let s=0;s<i;s++){let a=t[s];o[2*s]=n(a),o[2*s+1]=r(a)}return new e(o)}constructor(t){let n=t.length>>1;if(n>0&&typeof t[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=t;let r=Math.max(2*n-5,0);this._triangles=new Uint32Array(r*3),this._halfedges=new Int32Array(r*3),this._hashSize=Math.ceil(Math.sqrt(n)),this._hullPrev=new Uint32Array(n),this._hullNext=new Uint32Array(n),this._hullTri=new Uint32Array(n),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(n),this._dists=new Float64Array(n),this.update()}update(){let{coords:t,_hullPrev:n,_hullNext:r,_hullTri:i,_hullHash:o}=this,s=t.length>>1,a=1/0,c=1/0,l=-1/0,u=-1/0;for(let I=0;I<s;I++){let A=t[2*I],O=t[2*I+1];A<a&&(a=A),O<c&&(c=O),A>l&&(l=A),O>u&&(u=O),this._ids[I]=I}let f=(a+l)/2,d=(c+u)/2,h=1/0,p,m,g;for(let I=0;I<s;I++){let A=AS(f,d,t[2*I],t[2*I+1]);A<h&&(p=I,h=A)}let y=t[2*p],b=t[2*p+1];h=1/0;for(let I=0;I<s;I++){if(I===p)continue;let A=AS(y,b,t[2*I],t[2*I+1]);A<h&&A>0&&(m=I,h=A)}let x=t[2*m],_=t[2*m+1],v=1/0;for(let I=0;I<s;I++){if(I===p||I===m)continue;let A=UG(y,b,x,_,t[2*I],t[2*I+1]);A<v&&(g=I,v=A)}let w=t[2*g],T=t[2*g+1];if(v===1/0){for(let O=0;O<s;O++)this._dists[O]=t[2*O]-t[0]||t[2*O+1]-t[1];Bu(this._ids,this._dists,0,s-1);let I=new Uint32Array(s),A=0;for(let O=0,F=-1/0;O<s;O++){let S=this._ids[O];this._dists[S]>F&&(I[A++]=S,F=this._dists[S])}this.hull=I.subarray(0,A),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(Cu(y,b,x,_,w,T)<0){let I=m,A=x,O=_;m=g,x=w,_=T,g=I,w=A,T=O}let M=zG(y,b,x,_,w,T);this._cx=M.x,this._cy=M.y;for(let I=0;I<s;I++)this._dists[I]=AS(t[2*I],t[2*I+1],M.x,M.y);Bu(this._ids,this._dists,0,s-1),this._hullStart=p;let R=3;r[p]=n[g]=m,r[m]=n[p]=g,r[g]=n[m]=p,i[p]=0,i[m]=1,i[g]=2,o.fill(-1),o[this._hashKey(y,b)]=p,o[this._hashKey(x,_)]=m,o[this._hashKey(w,T)]=g,this.trianglesLen=0,this._addTriangle(p,m,g,-1,-1,-1);for(let I=0,A,O;I<this._ids.length;I++){let F=this._ids[I],S=t[2*F],E=t[2*F+1];if(I>0&&Math.abs(S-A)<=IF&&Math.abs(E-O)<=IF||(A=S,O=E,F===p||F===m||F===g))continue;let N=0;for(let $=0,U=this._hashKey(S,E);$<this._hashSize&&(N=o[(U+$)%this._hashSize],!(N!==-1&&N!==r[N]));$++);N=n[N];let L=N,B;for(;B=r[L],Cu(S,E,t[2*L],t[2*L+1],t[2*B],t[2*B+1])>=0;)if(L=B,L===N){L=-1;break}if(L===-1)continue;let C=this._addTriangle(L,F,r[L],-1,-1,i[L]);i[F]=this._legalize(C+2),i[L]=C,R++;let P=r[L];for(;B=r[P],Cu(S,E,t[2*P],t[2*P+1],t[2*B],t[2*B+1])<0;)C=this._addTriangle(P,F,B,i[F],-1,i[P]),i[F]=this._legalize(C+2),r[P]=P,R--,P=B;if(L===N)for(;B=n[L],Cu(S,E,t[2*B],t[2*B+1],t[2*L],t[2*L+1])<0;)C=this._addTriangle(B,F,L,-1,i[L],i[B]),this._legalize(C+2),i[B]=C,r[L]=L,R--,L=B;this._hullStart=n[F]=L,r[L]=n[P]=F,r[F]=P,o[this._hashKey(S,E)]=F,o[this._hashKey(t[2*L],t[2*L+1])]=L}this.hull=new Uint32Array(R);for(let I=0,A=this._hullStart;I<R;I++)this.hull[I]=A,A=r[A];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,n){return Math.floor(PG(t-this._cx,n-this._cy)*this._hashSize)%this._hashSize}_legalize(t){let{_triangles:n,_halfedges:r,coords:i}=this,o=0,s=0;for(;;){let a=r[t],c=t-t%3;if(s=c+(t+2)%3,a===-1){if(o===0)break;t=fb[--o];continue}let l=a-a%3,u=c+(t+1)%3,f=l+(a+2)%3,d=n[s],h=n[t],p=n[u],m=n[f];if($G(i[2*d],i[2*d+1],i[2*h],i[2*h+1],i[2*p],i[2*p+1],i[2*m],i[2*m+1])){n[t]=m,n[a]=d;let y=r[f];if(y===-1){let x=this._hullStart;do{if(this._hullTri[x]===f){this._hullTri[x]=t;break}x=this._hullPrev[x]}while(x!==this._hullStart)}this._link(t,y),this._link(a,r[s]),this._link(s,f);let b=l+(a+1)%3;o<fb.length&&(fb[o++]=b)}else{if(o===0)break;t=fb[--o]}}return s}_link(t,n){this._halfedges[t]=n,n!==-1&&(this._halfedges[n]=t)}_addTriangle(t,n,r,i,o,s){let a=this.trianglesLen;return this._triangles[a]=t,this._triangles[a+1]=n,this._triangles[a+2]=r,this._link(a,i),this._link(a+1,o),this._link(a+2,s),this.trianglesLen+=3,a}};function PG(e,t){let n=e/(Math.abs(e)+Math.abs(t));return(t>0?3-n:1+n)/4}function AS(e,t,n,r){let i=e-n,o=t-r;return i*i+o*o}function $G(e,t,n,r,i,o,s,a){let c=e-s,l=t-a,u=n-s,f=r-a,d=i-s,h=o-a,p=c*c+l*l,m=u*u+f*f,g=d*d+h*h;return c*(f*g-m*h)-l*(u*g-m*d)+p*(u*h-f*d)<0}function UG(e,t,n,r,i,o){let s=n-e,a=r-t,c=i-e,l=o-t,u=s*s+a*a,f=c*c+l*l,d=.5/(s*l-a*c),h=(l*u-a*f)*d,p=(s*f-c*u)*d;return h*h+p*p}function zG(e,t,n,r,i,o){let s=n-e,a=r-t,c=i-e,l=o-t,u=s*s+a*a,f=c*c+l*l,d=.5/(s*l-a*c),h=e+(l*u-a*f)*d,p=t+(s*f-c*u)*d;return{x:h,y:p}}function Bu(e,t,n,r){if(r-n<=20)for(let i=n+1;i<=r;i++){let o=e[i],s=t[o],a=i-1;for(;a>=n&&t[e[a]]>s;)e[a+1]=e[a--];e[a+1]=o}else{let i=n+r>>1,o=n+1,s=r;ap(e,i,o),t[e[n]]>t[e[r]]&&ap(e,n,r),t[e[o]]>t[e[r]]&&ap(e,o,r),t[e[n]]>t[e[o]]&&ap(e,n,o);let a=e[o],c=t[a];for(;;){do o++;while(t[e[o]]<c);do s--;while(t[e[s]]>c);if(s<o)break;ap(e,o,s)}e[n+1]=e[s],e[s]=a,r-o+1>=s-n?(Bu(e,t,o,r),Bu(e,t,n,s-1)):(Bu(e,t,n,s-1),Bu(e,t,o,r))}}function ap(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function qG(e){return e[0]}function jG(e){return e[1]}var si=class{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,n){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,n){this._+=`L${this._x1=+t},${this._y1=+n}`}arc(t,n,r){t=+t,n=+n,r=+r;let i=t+r,o=n;if(r<0)throw new Error("negative radius");this._x1===null?this._+=`M${i},${o}`:(Math.abs(this._x1-i)>1e-6||Math.abs(this._y1-o)>1e-6)&&(this._+="L"+i+","+o),r&&(this._+=`A${r},${r},0,1,1,${t-r},${n}A${r},${r},0,1,1,${this._x1=i},${this._y1=o}`)}rect(t,n,r,i){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${+r}v${+i}h${-r}Z`}value(){return this._||null}};var Ba=class{constructor(){this._=[]}moveTo(t,n){this._.push([t,n])}closePath(){this._.push(this._[0].slice())}lineTo(t,n){this._.push([t,n])}value(){return this._.length?this._:null}};var cp=class{constructor(t,[n,r,i,o]=[0,0,960,500]){if(!((i=+i)>=(n=+n))||!((o=+o)>=(r=+r)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(t.points.length*2),this.vectors=new Float64Array(t.points.length*2),this.xmax=i,this.xmin=n,this.ymax=o,this.ymin=r,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){let{delaunay:{points:t,hull:n,triangles:r},vectors:i}=this,o,s,a=this.circumcenters=this._circumcenters.subarray(0,r.length/3*2);for(let m=0,g=0,y=r.length,b,x;m<y;m+=3,g+=2){let _=r[m]*2,v=r[m+1]*2,w=r[m+2]*2,T=t[_],M=t[_+1],R=t[v],I=t[v+1],A=t[w],O=t[w+1],F=R-T,S=I-M,E=A-T,N=O-M,L=(F*N-S*E)*2;if(Math.abs(L)<1e-9){if(o===void 0){o=s=0;for(let C of n)o+=t[C*2],s+=t[C*2+1];o/=n.length,s/=n.length}let B=1e9*Math.sign((o-T)*N-(s-M)*E);b=(T+A)/2-B*N,x=(M+O)/2+B*E}else{let B=1/L,C=F*F+S*S,P=E*E+N*N;b=T+(N*C-S*P)*B,x=M+(F*P-E*C)*B}a[g]=b,a[g+1]=x}let c=n[n.length-1],l,u=c*4,f,d=t[2*c],h,p=t[2*c+1];i.fill(0);for(let m=0;m<n.length;++m)c=n[m],l=u,f=d,h=p,u=c*4,d=t[2*c],p=t[2*c+1],i[l+2]=i[u]=h-p,i[l+3]=i[u+1]=d-f}render(t){let n=t==null?t=new si:void 0,{delaunay:{halfedges:r,inedges:i,hull:o},circumcenters:s,vectors:a}=this;if(o.length<=1)return null;for(let u=0,f=r.length;u<f;++u){let d=r[u];if(d<u)continue;let h=Math.floor(u/3)*2,p=Math.floor(d/3)*2,m=s[h],g=s[h+1],y=s[p],b=s[p+1];this._renderSegment(m,g,y,b,t)}let c,l=o[o.length-1];for(let u=0;u<o.length;++u){c=l,l=o[u];let f=Math.floor(i[l]/3)*2,d=s[f],h=s[f+1],p=c*4,m=this._project(d,h,a[p+2],a[p+3]);m&&this._renderSegment(d,h,m[0],m[1],t)}return n&&n.value()}renderBounds(t){let n=t==null?t=new si:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),n&&n.value()}renderCell(t,n){let r=n==null?n=new si:void 0,i=this._clip(t);if(i===null||!i.length)return;n.moveTo(i[0],i[1]);let o=i.length;for(;i[0]===i[o-2]&&i[1]===i[o-1]&&o>1;)o-=2;for(let s=2;s<o;s+=2)(i[s]!==i[s-2]||i[s+1]!==i[s-1])&&n.lineTo(i[s],i[s+1]);return n.closePath(),r&&r.value()}*cellPolygons(){let{delaunay:{points:t}}=this;for(let n=0,r=t.length/2;n<r;++n){let i=this.cellPolygon(n);i&&(i.index=n,yield i)}}cellPolygon(t){let n=new Ba;return this.renderCell(t,n),n.value()}_renderSegment(t,n,r,i,o){let s,a=this._regioncode(t,n),c=this._regioncode(r,i);a===0&&c===0?(o.moveTo(t,n),o.lineTo(r,i)):(s=this._clipSegment(t,n,r,i,a,c))&&(o.moveTo(s[0],s[1]),o.lineTo(s[2],s[3]))}contains(t,n,r){return n=+n,n!==n||(r=+r,r!==r)?!1:this.delaunay._step(t,n,r)===t}*neighbors(t){let n=this._clip(t);if(n)for(let r of this.delaunay.neighbors(t)){let i=this._clip(r);if(i){t:for(let o=0,s=n.length;o<s;o+=2)for(let a=0,c=i.length;a<c;a+=2)if(n[o]===i[a]&&n[o+1]===i[a+1]&&n[(o+2)%s]===i[(a+c-2)%c]&&n[(o+3)%s]===i[(a+c-1)%c]){yield r;break t}}}}_cell(t){let{circumcenters:n,delaunay:{inedges:r,halfedges:i,triangles:o}}=this,s=r[t];if(s===-1)return null;let a=[],c=s;do{let l=Math.floor(c/3);if(a.push(n[l*2],n[l*2+1]),c=c%3===2?c-2:c+1,o[c]!==t)break;c=i[c]}while(c!==s&&c!==-1);return a}_clip(t){if(t===0&&this.delaunay.hull.length===1)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];let n=this._cell(t);if(n===null)return null;let{vectors:r}=this,i=t*4;return this._simplify(r[i]||r[i+1]?this._clipInfinite(t,n,r[i],r[i+1],r[i+2],r[i+3]):this._clipFinite(t,n))}_clipFinite(t,n){let r=n.length,i=null,o,s,a=n[r-2],c=n[r-1],l,u=this._regioncode(a,c),f,d=0;for(let h=0;h<r;h+=2)if(o=a,s=c,a=n[h],c=n[h+1],l=u,u=this._regioncode(a,c),l===0&&u===0)f=d,d=0,i?i.push(a,c):i=[a,c];else{let p,m,g,y,b;if(l===0){if((p=this._clipSegment(o,s,a,c,l,u))===null)continue;[m,g,y,b]=p}else{if((p=this._clipSegment(a,c,o,s,u,l))===null)continue;[y,b,m,g]=p,f=d,d=this._edgecode(m,g),f&&d&&this._edge(t,f,d,i,i.length),i?i.push(m,g):i=[m,g]}f=d,d=this._edgecode(y,b),f&&d&&this._edge(t,f,d,i,i.length),i?i.push(y,b):i=[y,b]}if(i)f=d,d=this._edgecode(i[0],i[1]),f&&d&&this._edge(t,f,d,i,i.length);else if(this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return i}_clipSegment(t,n,r,i,o,s){let a=o<s;for(a&&([t,n,r,i,o,s]=[r,i,t,n,s,o]);;){if(o===0&&s===0)return a?[r,i,t,n]:[t,n,r,i];if(o&s)return null;let c,l,u=o||s;u&8?(c=t+(r-t)*(this.ymax-n)/(i-n),l=this.ymax):u&4?(c=t+(r-t)*(this.ymin-n)/(i-n),l=this.ymin):u&2?(l=n+(i-n)*(this.xmax-t)/(r-t),c=this.xmax):(l=n+(i-n)*(this.xmin-t)/(r-t),c=this.xmin),o?(t=c,n=l,o=this._regioncode(t,n)):(r=c,i=l,s=this._regioncode(r,i))}}_clipInfinite(t,n,r,i,o,s){let a=Array.from(n),c;if((c=this._project(a[0],a[1],r,i))&&a.unshift(c[0],c[1]),(c=this._project(a[a.length-2],a[a.length-1],o,s))&&a.push(c[0],c[1]),a=this._clipFinite(t,a))for(let l=0,u=a.length,f,d=this._edgecode(a[u-2],a[u-1]);l<u;l+=2)f=d,d=this._edgecode(a[l],a[l+1]),f&&d&&(l=this._edge(t,f,d,a,l),u=a.length);else this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(a=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return a}_edge(t,n,r,i,o){for(;n!==r;){let s,a;switch(n){case 5:n=4;continue;case 4:n=6,s=this.xmax,a=this.ymin;break;case 6:n=2;continue;case 2:n=10,s=this.xmax,a=this.ymax;break;case 10:n=8;continue;case 8:n=9,s=this.xmin,a=this.ymax;break;case 9:n=1;continue;case 1:n=5,s=this.xmin,a=this.ymin;break}(i[o]!==s||i[o+1]!==a)&&this.contains(t,s,a)&&(i.splice(o,0,s,a),o+=2)}return o}_project(t,n,r,i){let o=1/0,s,a,c;if(i<0){if(n<=this.ymin)return null;(s=(this.ymin-n)/i)<o&&(c=this.ymin,a=t+(o=s)*r)}else if(i>0){if(n>=this.ymax)return null;(s=(this.ymax-n)/i)<o&&(c=this.ymax,a=t+(o=s)*r)}if(r>0){if(t>=this.xmax)return null;(s=(this.xmax-t)/r)<o&&(a=this.xmax,c=n+(o=s)*i)}else if(r<0){if(t<=this.xmin)return null;(s=(this.xmin-t)/r)<o&&(a=this.xmin,c=n+(o=s)*i)}return[a,c]}_edgecode(t,n){return(t===this.xmin?1:t===this.xmax?2:0)|(n===this.ymin?4:n===this.ymax?8:0)}_regioncode(t,n){return(t<this.xmin?1:t>this.xmax?2:0)|(n<this.ymin?4:n>this.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let n=0;n<t.length;n+=2){let r=(n+2)%t.length,i=(n+4)%t.length;(t[n]===t[r]&&t[r]===t[i]||t[n+1]===t[r+1]&&t[r+1]===t[i+1])&&(t.splice(r,2),n-=2)}t.length||(t=null)}return t}};var VG=2*Math.PI,$u=Math.pow;function YG(e){return e[0]}function GG(e){return e[1]}function WG(e){let{triangles:t,coords:n}=e;for(let r=0;r<t.length;r+=3){let i=2*t[r],o=2*t[r+1],s=2*t[r+2];if((n[s]-n[i])*(n[o+1]-n[i+1])-(n[o]-n[i])*(n[s+1]-n[i+1])>1e-10)return!1}return!0}function XG(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}var ai=class e{static from(t,n=YG,r=GG,i){return new e("length"in t?HG(t,n,r,i):Float64Array.from(ZG(t,n,r,i)))}constructor(t){this._delaunator=new Pu(t),this.inedges=new Int32Array(t.length/2),this._hullIndex=new Int32Array(t.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){let t=this._delaunator,n=this.points;if(t.hull&&t.hull.length>2&&WG(t)){this.collinear=Int32Array.from({length:n.length/2},(d,h)=>h).sort((d,h)=>n[2*d]-n[2*h]||n[2*d+1]-n[2*h+1]);let c=this.collinear[0],l=this.collinear[this.collinear.length-1],u=[n[2*c],n[2*c+1],n[2*l],n[2*l+1]],f=1e-8*Math.hypot(u[3]-u[1],u[2]-u[0]);for(let d=0,h=n.length/2;d<h;++d){let p=XG(n[2*d],n[2*d+1],f);n[2*d]=p[0],n[2*d+1]=p[1]}this._delaunator=new Pu(n)}else delete this.collinear;let r=this.halfedges=this._delaunator.halfedges,i=this.hull=this._delaunator.hull,o=this.triangles=this._delaunator.triangles,s=this.inedges.fill(-1),a=this._hullIndex.fill(-1);for(let c=0,l=r.length;c<l;++c){let u=o[c%3===2?c-2:c+1];(r[c]===-1||s[u]===-1)&&(s[u]=c)}for(let c=0,l=i.length;c<l;++c)a[i[c]]=c;i.length<=2&&i.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=i[0],s[i[0]]=1,i.length===2&&(s[i[1]]=0,this.triangles[1]=i[1],this.triangles[2]=i[1]))}voronoi(t){return new cp(this,t)}*neighbors(t){let{inedges:n,hull:r,_hullIndex:i,halfedges:o,triangles:s,collinear:a}=this;if(a){let f=a.indexOf(t);f>0&&(yield a[f-1]),f<a.length-1&&(yield a[f+1]);return}let c=n[t];if(c===-1)return;let l=c,u=-1;do{if(yield u=s[l],l=l%3===2?l-2:l+1,s[l]!==t)return;if(l=o[l],l===-1){let f=r[(i[t]+1)%r.length];f!==u&&(yield f);return}}while(l!==c)}find(t,n,r=0){if(t=+t,t!==t||(n=+n,n!==n))return-1;let i=r,o;for(;(o=this._step(r,t,n))>=0&&o!==r&&o!==i;)r=o;return o}_step(t,n,r){let{inedges:i,hull:o,_hullIndex:s,halfedges:a,triangles:c,points:l}=this;if(i[t]===-1||!l.length)return(t+1)%(l.length>>1);let u=t,f=$u(n-l[t*2],2)+$u(r-l[t*2+1],2),d=i[t],h=d;do{let p=c[h],m=$u(n-l[p*2],2)+$u(r-l[p*2+1],2);if(m<f&&(f=m,u=p),h=h%3===2?h-2:h+1,c[h]!==t)break;if(h=a[h],h===-1){if(h=o[(s[t]+1)%o.length],h!==p&&$u(n-l[h*2],2)+$u(r-l[h*2+1],2)<f)return h;break}}while(h!==d);return u}render(t){let n=t==null?t=new si:void 0,{points:r,halfedges:i,triangles:o}=this;for(let s=0,a=i.length;s<a;++s){let c=i[s];if(c<s)continue;let l=o[s]*2,u=o[c]*2;t.moveTo(r[l],r[l+1]),t.lineTo(r[u],r[u+1])}return this.renderHull(t),n&&n.value()}renderPoints(t,n){n===void 0&&(!t||typeof t.moveTo!="function")&&(n=t,t=null),n=n==null?2:+n;let r=t==null?t=new si:void 0,{points:i}=this;for(let o=0,s=i.length;o<s;o+=2){let a=i[o],c=i[o+1];t.moveTo(a+n,c),t.arc(a,c,n,0,VG)}return r&&r.value()}renderHull(t){let n=t==null?t=new si:void 0,{hull:r,points:i}=this,o=r[0]*2,s=r.length;t.moveTo(i[o],i[o+1]);for(let a=1;a<s;++a){let c=2*r[a];t.lineTo(i[c],i[c+1])}return t.closePath(),n&&n.value()}hullPolygon(){let t=new Ba;return this.renderHull(t),t.value()}renderTriangle(t,n){let r=n==null?n=new si:void 0,{points:i,triangles:o}=this,s=o[t*=3]*2,a=o[t+1]*2,c=o[t+2]*2;return n.moveTo(i[s],i[s+1]),n.lineTo(i[a],i[a+1]),n.lineTo(i[c],i[c+1]),n.closePath(),r&&r.value()}*trianglePolygons(){let{triangles:t}=this;for(let n=0,r=t.length/3;n<r;++n)yield this.trianglePolygon(n)}trianglePolygon(t){let n=new Ba;return this.renderTriangle(t,n),n.value()}};function HG(e,t,n,r){let i=e.length,o=new Float64Array(i*2);for(let s=0;s<i;++s){let a=e[s];o[s*2]=t.call(r,a,s,e),o[s*2+1]=n.call(r,a,s,e)}return o}function*ZG(e,t,n,r){let i=0;for(let o of e)yield t.call(r,o,i,e),yield n.call(r,o,i,e),++i}function TF(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function rl(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function bo(e){return e=rl(Math.abs(e)),e?e[1]:NaN}function EF(e,t){return function(n,r){for(var i=n.length,o=[],s=0,a=e[0],c=0;i>0&&a>0&&(c+a+1>r&&(a=Math.max(1,r-c)),o.push(n.substring(i-=a,i+a)),!((c+=a+1)>r));)a=e[s=(s+1)%e.length];return o.reverse().join(t)}}function AF(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var QG=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function xo(e){if(!(t=QG.exec(e)))throw new Error("invalid format: "+e);var t;return new db({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}xo.prototype=db.prototype;function db(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}db.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function MF(e){t:for(var t=e.length,n=1,r=-1,i;n<t;++n)switch(e[n]){case".":r=i=n;break;case"0":r===0&&(r=n),i=n;break;default:if(!+e[n])break t;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var MS;function NF(e,t){var n=rl(e,t);if(!n)return e+"";var r=n[0],i=n[1],o=i-(MS=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,s=r.length;return o===s?r:o>s?r+new Array(o-s+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+rl(e,Math.max(0,t+o-1))[0]}function NS(e,t){var n=rl(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}var RS={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:TF,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>NS(e*100,t),r:NS,s:NF,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function OS(e){return e}var RF=Array.prototype.map,OF=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function DF(e){var t=e.grouping===void 0||e.thousands===void 0?OS:EF(RF.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",o=e.numerals===void 0?OS:AF(RF.call(e.numerals,String)),s=e.percent===void 0?"%":e.percent+"",a=e.minus===void 0?"\u2212":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function l(f){f=xo(f);var d=f.fill,h=f.align,p=f.sign,m=f.symbol,g=f.zero,y=f.width,b=f.comma,x=f.precision,_=f.trim,v=f.type;v==="n"?(b=!0,v="g"):RS[v]||(x===void 0&&(x=12),_=!0,v="g"),(g||d==="0"&&h==="=")&&(g=!0,d="0",h="=");var w=m==="$"?n:m==="#"&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",T=m==="$"?r:/[%p]/.test(v)?s:"",M=RS[v],R=/[defgprs%]/.test(v);x=x===void 0?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,x)):Math.max(0,Math.min(20,x));function I(A){var O=w,F=T,S,E,N;if(v==="c")F=M(A)+F,A="";else{A=+A;var L=A<0||1/A<0;if(A=isNaN(A)?c:M(Math.abs(A),x),_&&(A=MF(A)),L&&+A==0&&p!=="+"&&(L=!1),O=(L?p==="("?p:a:p==="-"||p==="("?"":p)+O,F=(v==="s"?OF[8+MS/3]:"")+F+(L&&p==="("?")":""),R){for(S=-1,E=A.length;++S<E;)if(N=A.charCodeAt(S),48>N||N>57){F=(N===46?i+A.slice(S+1):A.slice(S))+F,A=A.slice(0,S);break}}}b&&!g&&(A=t(A,1/0));var B=O.length+A.length+F.length,C=B<y?new Array(y-B+1).join(d):"";switch(b&&g&&(A=t(C+A,C.length?y-F.length:1/0),C=""),h){case"<":A=O+A+F+C;break;case"=":A=O+C+A+F;break;case"^":A=C.slice(0,B=C.length>>1)+O+A+F+C.slice(B);break;default:A=C+O+A+F;break}return o(A)}return I.toString=function(){return f+""},I}function u(f,d){var h=l((f=xo(f),f.type="f",f)),p=Math.max(-8,Math.min(8,Math.floor(bo(d)/3)))*3,m=Math.pow(10,-p),g=OF[8+p/3];return function(y){return h(m*y)+g}}return{format:l,formatPrefix:u}}var hb,ci,pb;DS({thousands:",",grouping:[3],currency:["$",""]});function DS(e){return hb=DF(e),ci=hb.format,pb=hb.formatPrefix,hb}function kS(e){return Math.max(0,-bo(Math.abs(e)))}function FS(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(bo(t)/3)))*3-bo(Math.abs(e)))}function LS(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,bo(t)-bo(e))+1}var J=1e-6,il=1e-12,Mt=Math.PI,de=Mt/2,CS=Mt/4,cn=Mt*2,Ce=180/Mt,jt=Mt/180,Bt=Math.abs,li=Math.atan,We=Math.atan2,K=Math.cos,lp=Math.ceil,mb=Math.exp;var yb=Math.hypot,ol=Math.log,gb=Math.pow,Q=Math.sin,$n=Math.sign||function(e){return e>0?1:e<0?-1:0},he=Math.sqrt,Uu=Math.tan;function bb(e){return e>1?0:e<-1?Mt:Math.acos(e)}function ve(e){return e>1?de:e<-1?-de:Math.asin(e)}function Xe(){}function xb(e,t){e&&FF.hasOwnProperty(e.type)&&FF[e.type](e,t)}var kF={Feature:function(e,t){xb(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r<i;)xb(n[r].geometry,t)}},FF={Sphere:function(e,t){t.sphere()},Point:function(e,t){e=e.coordinates,t.point(e[0],e[1],e[2])},MultiPoint:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)e=n[r],t.point(e[0],e[1],e[2])},LineString:function(e,t){BS(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)BS(n[r],t,0)},Polygon:function(e,t){LF(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)LF(n[r],t)},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,i=n.length;++r<i;)xb(n[r],t)}};function BS(e,t,n){var r=-1,i=e.length-n,o;for(t.lineStart();++r<i;)o=e[r],t.point(o[0],o[1],o[2]);t.lineEnd()}function LF(e,t){var n=-1,r=e.length;for(t.polygonStart();++n<r;)BS(e[n],t,1);t.polygonEnd()}function Br(e,t){e&&kF.hasOwnProperty(e.type)?kF[e.type](e,t):xb(e,t)}function up(e){return[We(e[1],e[0]),ve(e[2])]}function _o(e){var t=e[0],n=e[1],r=K(n);return[r*K(t),r*Q(t),Q(n)]}function fp(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function zu(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function _b(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function dp(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function hp(e){var t=he(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var pp,wb,vb,Sb,Ib,Tb,Eb,Ab,PS,$S,US,PF,$F,rr,ir,or,$i={sphere:Xe,point:zS,lineStart:CF,lineEnd:BF,polygonStart:function(){$i.lineStart=tW,$i.lineEnd=eW},polygonEnd:function(){$i.lineStart=CF,$i.lineEnd=BF}};function zS(e,t){e*=jt,t*=jt;var n=K(t);mp(n*K(e),n*Q(e),Q(t))}function mp(e,t,n){++pp,vb+=(e-vb)/pp,Sb+=(t-Sb)/pp,Ib+=(n-Ib)/pp}function CF(){$i.point=KG}function KG(e,t){e*=jt,t*=jt;var n=K(t);rr=n*K(e),ir=n*Q(e),or=Q(t),$i.point=JG,mp(rr,ir,or)}function JG(e,t){e*=jt,t*=jt;var n=K(t),r=n*K(e),i=n*Q(e),o=Q(t),s=We(he((s=ir*o-or*i)*s+(s=or*r-rr*o)*s+(s=rr*i-ir*r)*s),rr*r+ir*i+or*o);wb+=s,Tb+=s*(rr+(rr=r)),Eb+=s*(ir+(ir=i)),Ab+=s*(or+(or=o)),mp(rr,ir,or)}function BF(){$i.point=zS}function tW(){$i.point=nW}function eW(){UF(PF,$F),$i.point=zS}function nW(e,t){PF=e,$F=t,e*=jt,t*=jt,$i.point=UF;var n=K(t);rr=n*K(e),ir=n*Q(e),or=Q(t),mp(rr,ir,or)}function UF(e,t){e*=jt,t*=jt;var n=K(t),r=n*K(e),i=n*Q(e),o=Q(t),s=ir*o-or*i,a=or*r-rr*o,c=rr*i-ir*r,l=yb(s,a,c),u=ve(l),f=l&&-u/l;PS.add(f*s),$S.add(f*a),US.add(f*c),wb+=u,Tb+=u*(rr+(rr=r)),Eb+=u*(ir+(ir=i)),Ab+=u*(or+(or=o)),mp(rr,ir,or)}function qS(e){pp=wb=vb=Sb=Ib=Tb=Eb=Ab=0,PS=new In,$S=new In,US=new In,Br(e,$i);var t=+PS,n=+$S,r=+US,i=yb(t,n,r);return i<il&&(t=Tb,n=Eb,r=Ab,wb<J&&(t=vb,n=Sb,r=Ib),i=yb(t,n,r),i<il)?[NaN,NaN]:[We(n,t)*Ce,ve(r/i)*Ce]}function yp(e,t){function n(r,i){return r=e(r,i),t(r[0],r[1])}return e.invert&&t.invert&&(n.invert=function(r,i){return r=t.invert(r,i),r&&e.invert(r[0],r[1])}),n}function jS(e,t){return Bt(e)>Mt&&(e-=Math.round(e/cn)*cn),[e,t]}jS.invert=jS;function VS(e,t,n){return(e%=cn)?t||n?yp(qF(e),jF(t,n)):qF(e):t||n?jF(t,n):jS}function zF(e){return function(t,n){return t+=e,Bt(t)>Mt&&(t-=Math.round(t/cn)*cn),[t,n]}}function qF(e){var t=zF(e);return t.invert=zF(-e),t}function jF(e,t){var n=K(e),r=Q(e),i=K(t),o=Q(t);function s(a,c){var l=K(c),u=K(a)*l,f=Q(a)*l,d=Q(c),h=d*n+u*r;return[We(f*i-h*o,u*n-d*r),ve(h*i+f*o)]}return s.invert=function(a,c){var l=K(c),u=K(a)*l,f=Q(a)*l,d=Q(c),h=d*i-f*o;return[We(f*i+d*o,u*n+h*r),ve(h*n-u*r)]},s}function VF(e){e=VS(e[0]*jt,e[1]*jt,e.length>2?e[2]*jt:0);function t(n){return n=e(n[0]*jt,n[1]*jt),n[0]*=Ce,n[1]*=Ce,n}return t.invert=function(n){return n=e.invert(n[0]*jt,n[1]*jt),n[0]*=Ce,n[1]*=Ce,n},t}function GF(e,t,n,r,i,o){if(n){var s=K(t),a=Q(t),c=r*n;i==null?(i=t+r*cn,o=t-c/2):(i=YF(s,i),o=YF(s,o),(r>0?i<o:i>o)&&(i+=r*cn));for(var l,u=i;r>0?u>o:u<o;u-=c)l=up([s,-a*K(u),-a*Q(u)]),e.point(l[0],l[1])}}function YF(e,t){t=_o(t),t[0]-=e,hp(t);var n=bb(-t[1]);return((-t[2]<0?-n:n)+cn-J)%cn}function Mb(){var e=[],t;return{point:function(n,r,i){t.push([n,r,i])},lineStart:function(){e.push(t=[])},lineEnd:Xe,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function qu(e,t){return Bt(e[0]-t[0])<J&&Bt(e[1]-t[1])<J}function Nb(e,t,n,r){this.x=e,this.z=t,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function Rb(e,t,n,r,i){var o=[],s=[],a,c;if(e.forEach(function(p){if(!((m=p.length-1)<=0)){var m,g=p[0],y=p[m],b;if(qu(g,y)){if(!g[2]&&!y[2]){for(i.lineStart(),a=0;a<m;++a)i.point((g=p[a])[0],g[1]);i.lineEnd();return}y[0]+=2*J}o.push(b=new Nb(g,p,null,!0)),s.push(b.o=new Nb(g,null,b,!1)),o.push(b=new Nb(y,p,null,!1)),s.push(b.o=new Nb(y,null,b,!0))}}),!!o.length){for(s.sort(t),WF(o),WF(s),a=0,c=s.length;a<c;++a)s[a].e=n=!n;for(var l=o[0],u,f;;){for(var d=l,h=!0;d.v;)if((d=d.n)===l)return;u=d.z,i.lineStart();do{if(d.v=d.o.v=!0,d.e){if(h)for(a=0,c=u.length;a<c;++a)i.point((f=u[a])[0],f[1]);else r(d.x,d.n.x,1,i);d=d.n}else{if(h)for(u=d.p.z,a=u.length-1;a>=0;--a)i.point((f=u[a])[0],f[1]);else r(d.x,d.p.x,-1,i);d=d.p}d=d.o,u=d.z,h=!h}while(!d.v);i.lineEnd()}}}function WF(e){if(t=e.length){for(var t,n=0,r=e[0],i;++n<t;)r.n=i=e[n],i.p=r,r=i;r.n=i=e[0],i.p=r}}function YS(e){return Bt(e[0])<=Mt?e[0]:$n(e[0])*((Bt(e[0])+Mt)%cn-Mt)}function XF(e,t){var n=YS(t),r=t[1],i=Q(r),o=[Q(n),-K(n),0],s=0,a=0,c=new In;i===1?r=de+J:i===-1&&(r=-de-J);for(var l=0,u=e.length;l<u;++l)if(d=(f=e[l]).length)for(var f,d,h=f[d-1],p=YS(h),m=h[1]/2+CS,g=Q(m),y=K(m),b=0;b<d;++b,p=_,g=w,y=T,h=x){var x=f[b],_=YS(x),v=x[1]/2+CS,w=Q(v),T=K(v),M=_-p,R=M>=0?1:-1,I=R*M,A=I>Mt,O=g*w;if(c.add(We(O*R*Q(I),y*T+O*K(I))),s+=A?M+R*cn:M,A^p>=n^_>=n){var F=zu(_o(h),_o(x));hp(F);var S=zu(o,F);hp(S);var E=(A^M>=0?-1:1)*ve(S[2]);(r>E||r===E&&(F[0]||F[1]))&&(a+=A^M>=0?1:-1)}}return(s<-J||s<J&&c<-il)^a&1}function Ob(e,t,n,r){return function(i){var o=t(i),s=Mb(),a=t(s),c=!1,l,u,f,d={point:h,lineStart:m,lineEnd:g,polygonStart:function(){d.point=y,d.lineStart=b,d.lineEnd=x,u=[],l=[]},polygonEnd:function(){d.point=h,d.lineStart=m,d.lineEnd=g,u=Su(u);var _=XF(l,r);u.length?(c||(i.polygonStart(),c=!0),Rb(u,iW,_,n,i)):_&&(c||(i.polygonStart(),c=!0),i.lineStart(),n(null,null,1,i),i.lineEnd()),c&&(i.polygonEnd(),c=!1),u=l=null},sphere:function(){i.polygonStart(),i.lineStart(),n(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function h(_,v){e(_,v)&&i.point(_,v)}function p(_,v){o.point(_,v)}function m(){d.point=p,o.lineStart()}function g(){d.point=h,o.lineEnd()}function y(_,v){f.push([_,v]),a.point(_,v)}function b(){a.lineStart(),f=[]}function x(){y(f[0][0],f[0][1]),a.lineEnd();var _=a.clean(),v=s.result(),w,T=v.length,M,R,I;if(f.pop(),l.push(f),f=null,!!T){if(_&1){if(R=v[0],(M=R.length-1)>0){for(c||(i.polygonStart(),c=!0),i.lineStart(),w=0;w<M;++w)i.point((I=R[w])[0],I[1]);i.lineEnd()}return}T>1&&_&2&&v.push(v.pop().concat(v.shift())),u.push(v.filter(rW))}}return d}}function rW(e){return e.length>1}function iW(e,t){return((e=e.x)[0]<0?e[1]-de-J:de-e[1])-((t=t.x)[0]<0?t[1]-de-J:de-t[1])}var GS=Ob(function(){return!0},oW,aW,[-Mt,-de]);function oW(e){var t=NaN,n=NaN,r=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(o,s){var a=o>0?Mt:-Mt,c=Bt(o-t);Bt(c-Mt)<J?(e.point(t,n=(n+s)/2>0?de:-de),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(a,n),e.point(o,n),i=0):r!==a&&c>=Mt&&(Bt(t-r)<J&&(t-=r*J),Bt(o-a)<J&&(o-=a*J),n=sW(t,n,o,s),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(a,n),i=0),e.point(t=o,n=s),r=a},lineEnd:function(){e.lineEnd(),t=n=NaN},clean:function(){return 2-i}}}function sW(e,t,n,r){var i,o,s=Q(e-n);return Bt(s)>J?li((Q(t)*(o=K(r))*Q(n)-Q(r)*(i=K(t))*Q(e))/(i*o*s)):(t+r)/2}function aW(e,t,n,r){var i;if(e==null)i=n*de,r.point(-Mt,i),r.point(0,i),r.point(Mt,i),r.point(Mt,0),r.point(Mt,-i),r.point(0,-i),r.point(-Mt,-i),r.point(-Mt,0),r.point(-Mt,i);else if(Bt(e[0]-t[0])>J){var o=e[0]<t[0]?Mt:-Mt;i=n*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(t[0],t[1])}function HF(e){var t=K(e),n=6*jt,r=t>0,i=Bt(t)>J;function o(u,f,d,h){GF(h,e,n,d,u,f)}function s(u,f){return K(u)*K(f)>t}function a(u){var f,d,h,p,m;return{lineStart:function(){p=h=!1,m=1},point:function(g,y){var b=[g,y],x,_=s(g,y),v=r?_?0:l(g,y):_?l(g+(g<0?Mt:-Mt),y):0;if(!f&&(p=h=_)&&u.lineStart(),_!==h&&(x=c(f,b),(!x||qu(f,x)||qu(b,x))&&(b[2]=1)),_!==h)m=0,_?(u.lineStart(),x=c(b,f),u.point(x[0],x[1])):(x=c(f,b),u.point(x[0],x[1],2),u.lineEnd()),f=x;else if(i&&f&&r^_){var w;!(v&d)&&(w=c(b,f,!0))&&(m=0,r?(u.lineStart(),u.point(w[0][0],w[0][1]),u.point(w[1][0],w[1][1]),u.lineEnd()):(u.point(w[1][0],w[1][1]),u.lineEnd(),u.lineStart(),u.point(w[0][0],w[0][1],3)))}_&&(!f||!qu(f,b))&&u.point(b[0],b[1]),f=b,h=_,d=v},lineEnd:function(){h&&u.lineEnd(),f=null},clean:function(){return m|(p&&h)<<1}}}function c(u,f,d){var h=_o(u),p=_o(f),m=[1,0,0],g=zu(h,p),y=fp(g,g),b=g[0],x=y-b*b;if(!x)return!d&&u;var _=t*y/x,v=-t*b/x,w=zu(m,g),T=dp(m,_),M=dp(g,v);_b(T,M);var R=w,I=fp(T,R),A=fp(R,R),O=I*I-A*(fp(T,T)-1);if(!(O<0)){var F=he(O),S=dp(R,(-I-F)/A);if(_b(S,T),S=up(S),!d)return S;var E=u[0],N=f[0],L=u[1],B=f[1],C;N<E&&(C=E,E=N,N=C);var P=N-E,$=Bt(P-Mt)<J,U=$||P<J;if(!$&&B<L&&(C=L,L=B,B=C),U?$?L+B>0^S[1]<(Bt(S[0]-E)<J?L:B):L<=S[1]&&S[1]<=B:P>Mt^(E<=S[0]&&S[0]<=N)){var X=dp(R,(-I+F)/A);return _b(X,T),[S,up(X)]}}}function l(u,f){var d=r?e:Mt-e,h=0;return u<-d?h|=1:u>d&&(h|=2),f<-d?h|=4:f>d&&(h|=8),h}return Ob(s,a,o,r?[0,-e]:[-Mt,e-Mt])}function ZF(e,t,n,r,i,o){var s=e[0],a=e[1],c=t[0],l=t[1],u=0,f=1,d=c-s,h=l-a,p;if(p=n-s,!(!d&&p>0)){if(p/=d,d<0){if(p<u)return;p<f&&(f=p)}else if(d>0){if(p>f)return;p>u&&(u=p)}if(p=i-s,!(!d&&p<0)){if(p/=d,d<0){if(p>f)return;p>u&&(u=p)}else if(d>0){if(p<u)return;p<f&&(f=p)}if(p=r-a,!(!h&&p>0)){if(p/=h,h<0){if(p<u)return;p<f&&(f=p)}else if(h>0){if(p>f)return;p>u&&(u=p)}if(p=o-a,!(!h&&p<0)){if(p/=h,h<0){if(p>f)return;p>u&&(u=p)}else if(h>0){if(p<u)return;p<f&&(f=p)}return u>0&&(e[0]=s+u*d,e[1]=a+u*h),f<1&&(t[0]=s+f*d,t[1]=a+f*h),!0}}}}}var gp=1e9,Db=-gp;function ju(e,t,n,r){function i(l,u){return e<=l&&l<=n&&t<=u&&u<=r}function o(l,u,f,d){var h=0,p=0;if(l==null||(h=s(l,f))!==(p=s(u,f))||c(l,u)<0^f>0)do d.point(h===0||h===3?e:n,h>1?r:t);while((h=(h+f+4)%4)!==p);else d.point(u[0],u[1])}function s(l,u){return Bt(l[0]-e)<J?u>0?0:3:Bt(l[0]-n)<J?u>0?2:1:Bt(l[1]-t)<J?u>0?1:0:u>0?3:2}function a(l,u){return c(l.x,u.x)}function c(l,u){var f=s(l,1),d=s(u,1);return f!==d?f-d:f===0?u[1]-l[1]:f===1?l[0]-u[0]:f===2?l[1]-u[1]:u[0]-l[0]}return function(l){var u=l,f=Mb(),d,h,p,m,g,y,b,x,_,v,w,T={point:M,lineStart:O,lineEnd:F,polygonStart:I,polygonEnd:A};function M(E,N){i(E,N)&&u.point(E,N)}function R(){for(var E=0,N=0,L=h.length;N<L;++N)for(var B=h[N],C=1,P=B.length,$=B[0],U,X,tt=$[0],nt=$[1];C<P;++C)U=tt,X=nt,$=B[C],tt=$[0],nt=$[1],X<=r?nt>r&&(tt-U)*(r-X)>(nt-X)*(e-U)&&++E:nt<=r&&(tt-U)*(r-X)<(nt-X)*(e-U)&&--E;return E}function I(){u=f,d=[],h=[],w=!0}function A(){var E=R(),N=w&&E,L=(d=Su(d)).length;(N||L)&&(l.polygonStart(),N&&(l.lineStart(),o(null,null,1,l),l.lineEnd()),L&&Rb(d,a,E,o,l),l.polygonEnd()),u=l,d=h=p=null}function O(){T.point=S,h&&h.push(p=[]),v=!0,_=!1,b=x=NaN}function F(){d&&(S(m,g),y&&_&&f.rejoin(),d.push(f.result())),T.point=M,_&&u.lineEnd()}function S(E,N){var L=i(E,N);if(h&&p.push([E,N]),v)m=E,g=N,y=L,v=!1,L&&(u.lineStart(),u.point(E,N));else if(L&&_)u.point(E,N);else{var B=[b=Math.max(Db,Math.min(gp,b)),x=Math.max(Db,Math.min(gp,x))],C=[E=Math.max(Db,Math.min(gp,E)),N=Math.max(Db,Math.min(gp,N))];ZF(B,C,e,t,n,r)?(_||(u.lineStart(),u.point(B[0],B[1])),u.point(C[0],C[1]),L||u.lineEnd(),w=!1):L&&(u.lineStart(),u.point(E,N),w=!1)}b=E,x=N,_=L}return T}}function QF(e,t,n){var r=$e(e,t-J,n).concat(t);return function(i){return r.map(function(o){return[i,o]})}}function KF(e,t,n){var r=$e(e,t-J,n).concat(t);return function(i){return r.map(function(o){return[o,i]})}}function WS(){var e,t,n,r,i,o,s,a,c=10,l=c,u=90,f=360,d,h,p,m,g=2.5;function y(){return{type:"MultiLineString",coordinates:b()}}function b(){return $e(lp(r/u)*u,n,u).map(p).concat($e(lp(a/f)*f,s,f).map(m)).concat($e(lp(t/c)*c,e,c).filter(function(x){return Bt(x%u)>J}).map(d)).concat($e(lp(o/l)*l,i,l).filter(function(x){return Bt(x%f)>J}).map(h))}return y.lines=function(){return b().map(function(x){return{type:"LineString",coordinates:x}})},y.outline=function(){return{type:"Polygon",coordinates:[p(r).concat(m(s).slice(1),p(n).reverse().slice(1),m(a).reverse().slice(1))]}},y.extent=function(x){return arguments.length?y.extentMajor(x).extentMinor(x):y.extentMinor()},y.extentMajor=function(x){return arguments.length?(r=+x[0][0],n=+x[1][0],a=+x[0][1],s=+x[1][1],r>n&&(x=r,r=n,n=x),a>s&&(x=a,a=s,s=x),y.precision(g)):[[r,a],[n,s]]},y.extentMinor=function(x){return arguments.length?(t=+x[0][0],e=+x[1][0],o=+x[0][1],i=+x[1][1],t>e&&(x=t,t=e,e=x),o>i&&(x=o,o=i,i=x),y.precision(g)):[[t,o],[e,i]]},y.step=function(x){return arguments.length?y.stepMajor(x).stepMinor(x):y.stepMinor()},y.stepMajor=function(x){return arguments.length?(u=+x[0],f=+x[1],y):[u,f]},y.stepMinor=function(x){return arguments.length?(c=+x[0],l=+x[1],y):[c,l]},y.precision=function(x){return arguments.length?(g=+x,d=QF(o,i,90),h=KF(t,e,g),p=QF(a,s,90),m=KF(r,n,g),y):g},y.extentMajor([[-180,-90+J],[180,90-J]]).extentMinor([[-180,-80-J],[180,80+J]])}function XS(){return WS()()}var bp=e=>e;var HS=new In,ZS=new In,JF,tL,QS,KS,Pa={point:Xe,lineStart:Xe,lineEnd:Xe,polygonStart:function(){Pa.lineStart=cW,Pa.lineEnd=uW},polygonEnd:function(){Pa.lineStart=Pa.lineEnd=Pa.point=Xe,HS.add(Bt(ZS)),ZS=new In},result:function(){var e=HS/2;return HS=new In,e}};function cW(){Pa.point=lW}function lW(e,t){Pa.point=eL,JF=QS=e,tL=KS=t}function eL(e,t){ZS.add(KS*e-QS*t),QS=e,KS=t}function uW(){eL(JF,tL)}var JS=Pa;var Vu=1/0,kb=Vu,xp=-Vu,Fb=xp,fW={point:dW,lineStart:Xe,lineEnd:Xe,polygonStart:Xe,polygonEnd:Xe,result:function(){var e=[[Vu,kb],[xp,Fb]];return xp=Fb=-(kb=Vu=1/0),e}};function dW(e,t){e<Vu&&(Vu=e),e>xp&&(xp=e),t<kb&&(kb=t),t>Fb&&(Fb=t)}var Yu=fW;var tI=0,eI=0,_p=0,Lb=0,Cb=0,Gu=0,nI=0,rI=0,wp=0,iL,oL,wo,vo,Ui={point:sl,lineStart:nL,lineEnd:rL,polygonStart:function(){Ui.lineStart=mW,Ui.lineEnd=yW},polygonEnd:function(){Ui.point=sl,Ui.lineStart=nL,Ui.lineEnd=rL},result:function(){var e=wp?[nI/wp,rI/wp]:Gu?[Lb/Gu,Cb/Gu]:_p?[tI/_p,eI/_p]:[NaN,NaN];return tI=eI=_p=Lb=Cb=Gu=nI=rI=wp=0,e}};function sl(e,t){tI+=e,eI+=t,++_p}function nL(){Ui.point=hW}function hW(e,t){Ui.point=pW,sl(wo=e,vo=t)}function pW(e,t){var n=e-wo,r=t-vo,i=he(n*n+r*r);Lb+=i*(wo+e)/2,Cb+=i*(vo+t)/2,Gu+=i,sl(wo=e,vo=t)}function rL(){Ui.point=sl}function mW(){Ui.point=gW}function yW(){sL(iL,oL)}function gW(e,t){Ui.point=sL,sl(iL=wo=e,oL=vo=t)}function sL(e,t){var n=e-wo,r=t-vo,i=he(n*n+r*r);Lb+=i*(wo+e)/2,Cb+=i*(vo+t)/2,Gu+=i,i=vo*e-wo*t,nI+=i*(wo+e),rI+=i*(vo+t),wp+=i*3,sl(wo=e,vo=t)}var iI=Ui;function Bb(e){this._context=e}Bb.prototype={_radius:4.5,pointRadius:function(e){return this._radius=e,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(e,t){switch(this._point){case 0:{this._context.moveTo(e,t),this._point=1;break}case 1:{this._context.lineTo(e,t);break}default:{this._context.moveTo(e+this._radius,t),this._context.arc(e,t,this._radius,0,cn);break}}},result:Xe};var sI=new In,oI,aL,cL,vp,Sp,Pb={point:Xe,lineStart:function(){Pb.point=bW},lineEnd:function(){oI&&lL(aL,cL),Pb.point=Xe},polygonStart:function(){oI=!0},polygonEnd:function(){oI=null},result:function(){var e=+sI;return sI=new In,e}};function bW(e,t){Pb.point=lL,aL=vp=e,cL=Sp=t}function lL(e,t){vp-=e,Sp-=t,sI.add(he(vp*vp+Sp*Sp)),vp=e,Sp=t}var aI=Pb;var uL,$b,fL,dL,Wu=class{constructor(t){this._append=t==null?hL:xW(t),this._radius=4.5,this._=""}pointRadius(t){return this._radius=+t,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){this._line===0&&(this._+="Z"),this._point=NaN}point(t,n){switch(this._point){case 0:{this._append`M${t},${n}`,this._point=1;break}case 1:{this._append`L${t},${n}`;break}default:{if(this._append`M${t},${n}`,this._radius!==fL||this._append!==$b){let r=this._radius,i=this._;this._="",this._append`m0,${r}a${r},${r} 0 1,1 0,${-2*r}a${r},${r} 0 1,1 0,${2*r}z`,fL=r,$b=this._append,dL=this._,this._=i}this._+=dL;break}}}result(){let t=this._;return this._="",t.length?t:null}};function hL(e){let t=1;this._+=e[0];for(let n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function xW(e){let t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return hL;if(t!==uL){let n=10**t;uL=t,$b=function(i){let o=1;this._+=i[0];for(let s=i.length;o<s;++o)this._+=Math.round(arguments[o]*n)/n+i[o]}}return $b}function Mn(e,t){let n=3,r=4.5,i,o;function s(a){return a&&(typeof r=="function"&&o.pointRadius(+r.apply(this,arguments)),Br(a,i(o))),o.result()}return s.area=function(a){return Br(a,i(JS)),JS.result()},s.measure=function(a){return Br(a,i(aI)),aI.result()},s.bounds=function(a){return Br(a,i(Yu)),Yu.result()},s.centroid=function(a){return Br(a,i(iI)),iI.result()},s.projection=function(a){return arguments.length?(i=a==null?(e=null,bp):(e=a).stream,s):e},s.context=function(a){return arguments.length?(o=a==null?(t=null,new Wu(n)):new Bb(t=a),typeof r!="function"&&o.pointRadius(r),s):t},s.pointRadius=function(a){return arguments.length?(r=typeof a=="function"?a:(o.pointRadius(+a),+a),s):r},s.digits=function(a){if(!arguments.length)return n;if(a==null)n=null;else{let c=Math.floor(a);if(!(c>=0))throw new RangeError(`invalid digits: ${a}`);n=c}return t===null&&(o=new Wu(n)),s},s.projection(e).digits(n).context(t)}function al(e){return{stream:Xu(e)}}function Xu(e){return function(t){var n=new cI;for(var r in e)n[r]=e[r];return n.stream=t,n}}function cI(){}cI.prototype={constructor:cI,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function lI(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),r!=null&&e.clipExtent(null),Br(n,e.stream(Yu)),t(Yu.result()),r!=null&&e.clipExtent(r),e}function Ip(e,t,n){return lI(e,function(r){var i=t[1][0]-t[0][0],o=t[1][1]-t[0][1],s=Math.min(i/(r[1][0]-r[0][0]),o/(r[1][1]-r[0][1])),a=+t[0][0]+(i-s*(r[1][0]+r[0][0]))/2,c=+t[0][1]+(o-s*(r[1][1]+r[0][1]))/2;e.scale(150*s).translate([a,c])},n)}function Ub(e,t,n){return Ip(e,[[0,0],t],n)}function zb(e,t,n){return lI(e,function(r){var i=+t,o=i/(r[1][0]-r[0][0]),s=(i-o*(r[1][0]+r[0][0]))/2,a=-o*r[0][1];e.scale(150*o).translate([s,a])},n)}function qb(e,t,n){return lI(e,function(r){var i=+t,o=i/(r[1][1]-r[0][1]),s=-o*r[0][0],a=(i-o*(r[1][1]+r[0][1]))/2;e.scale(150*o).translate([s,a])},n)}var pL=16,_W=K(30*jt);function uI(e,t){return+t?vW(e,t):wW(e)}function wW(e){return Xu({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function vW(e,t){function n(r,i,o,s,a,c,l,u,f,d,h,p,m,g){var y=l-r,b=u-i,x=y*y+b*b;if(x>4*t&&m--){var _=s+d,v=a+h,w=c+p,T=he(_*_+v*v+w*w),M=ve(w/=T),R=Bt(Bt(w)-1)<J||Bt(o-f)<J?(o+f)/2:We(v,_),I=e(R,M),A=I[0],O=I[1],F=A-r,S=O-i,E=b*F-y*S;(E*E/x>t||Bt((y*F+b*S)/x-.5)>.3||s*d+a*h+c*p<_W)&&(n(r,i,o,s,a,c,A,O,R,_/=T,v/=T,w,m,g),g.point(A,O),n(A,O,R,_,v,w,l,u,f,d,h,p,m,g))}}return function(r){var i,o,s,a,c,l,u,f,d,h,p,m,g={point:y,lineStart:b,lineEnd:_,polygonStart:function(){r.polygonStart(),g.lineStart=v},polygonEnd:function(){r.polygonEnd(),g.lineStart=b}};function y(M,R){M=e(M,R),r.point(M[0],M[1])}function b(){f=NaN,g.point=x,r.lineStart()}function x(M,R){var I=_o([M,R]),A=e(M,R);n(f,d,u,h,p,m,f=A[0],d=A[1],u=M,h=I[0],p=I[1],m=I[2],pL,r),r.point(f,d)}function _(){g.point=y,r.lineEnd()}function v(){b(),g.point=w,g.lineEnd=T}function w(M,R){x(i=M,R),o=f,s=d,a=h,c=p,l=m,g.point=x}function T(){n(f,d,u,h,p,m,o,s,i,a,c,l,pL,r),g.lineEnd=_,_()}return g}}var SW=Xu({point:function(e,t){this.stream.point(e*jt,t*jt)}});function IW(e){return Xu({point:function(t,n){var r=e(t,n);return this.stream.point(r[0],r[1])}})}function TW(e,t,n,r,i){function o(s,a){return s*=r,a*=i,[t+e*s,n-e*a]}return o.invert=function(s,a){return[(s-t)/e*r,(n-a)/e*i]},o}function mL(e,t,n,r,i,o){if(!o)return TW(e,t,n,r,i);var s=K(o),a=Q(o),c=s*e,l=a*e,u=s/e,f=a/e,d=(a*n-s*t)/e,h=(a*t+s*n)/e;function p(m,g){return m*=r,g*=i,[c*m-l*g+t,n-l*m-c*g]}return p.invert=function(m,g){return[r*(u*m-f*g+d),i*(h-f*m-u*g)]},p}function Nn(e){return fI(function(){return e})()}function fI(e){var t,n=150,r=480,i=250,o=0,s=0,a=0,c=0,l=0,u,f=0,d=1,h=1,p=null,m=GS,g=null,y,b,x,_=bp,v=.5,w,T,M,R,I;function A(E){return M(E[0]*jt,E[1]*jt)}function O(E){return E=M.invert(E[0],E[1]),E&&[E[0]*Ce,E[1]*Ce]}A.stream=function(E){return R&&I===E?R:R=SW(IW(u)(m(w(_(I=E)))))},A.preclip=function(E){return arguments.length?(m=E,p=void 0,S()):m},A.postclip=function(E){return arguments.length?(_=E,g=y=b=x=null,S()):_},A.clipAngle=function(E){return arguments.length?(m=+E?HF(p=E*jt):(p=null,GS),S()):p*Ce},A.clipExtent=function(E){return arguments.length?(_=E==null?(g=y=b=x=null,bp):ju(g=+E[0][0],y=+E[0][1],b=+E[1][0],x=+E[1][1]),S()):g==null?null:[[g,y],[b,x]]},A.scale=function(E){return arguments.length?(n=+E,F()):n},A.translate=function(E){return arguments.length?(r=+E[0],i=+E[1],F()):[r,i]},A.center=function(E){return arguments.length?(o=E[0]%360*jt,s=E[1]%360*jt,F()):[o*Ce,s*Ce]},A.rotate=function(E){return arguments.length?(a=E[0]%360*jt,c=E[1]%360*jt,l=E.length>2?E[2]%360*jt:0,F()):[a*Ce,c*Ce,l*Ce]},A.angle=function(E){return arguments.length?(f=E%360*jt,F()):f*Ce},A.reflectX=function(E){return arguments.length?(d=E?-1:1,F()):d<0},A.reflectY=function(E){return arguments.length?(h=E?-1:1,F()):h<0},A.precision=function(E){return arguments.length?(w=uI(T,v=E*E),S()):he(v)},A.fitExtent=function(E,N){return Ip(A,E,N)},A.fitSize=function(E,N){return Ub(A,E,N)},A.fitWidth=function(E,N){return zb(A,E,N)},A.fitHeight=function(E,N){return qb(A,E,N)};function F(){var E=mL(n,0,0,d,h,f).apply(null,t(o,s)),N=mL(n,r-E[0],i-E[1],d,h,f);return u=VS(a,c,l),T=yp(t,N),M=yp(u,T),w=uI(T,v),S()}function S(){return R=I=null,A}return function(){return t=e.apply(this,arguments),A.invert=t.invert&&O,F()}}function Hu(e){var t=0,n=Mt/3,r=fI(e),i=r(t,n);return i.parallels=function(o){return arguments.length?r(t=o[0]*jt,n=o[1]*jt):[t*Ce,n*Ce]},i}function yL(e){var t=K(e);function n(r,i){return[r*t,Q(i)/t]}return n.invert=function(r,i){return[r/t,ve(i*t)]},n}function gL(e,t){var n=Q(e),r=(n+Q(t))/2;if(Bt(r)<J)return yL(e);var i=1+n*(2*r-n),o=he(i)/r;function s(a,c){var l=he(i-2*r*Q(c))/r;return[l*Q(a*=r),o-l*K(a)]}return s.invert=function(a,c){var l=o-c,u=We(a,Bt(l))*$n(l);return l*r<0&&(u-=Mt*$n(a)*$n(l)),[u/r,ve((i-(a*a+l*l)*r*r)/(2*r))]},s}function $a(){return Hu(gL).scale(155.424).center([0,33.6442])}function Tp(){return $a().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function EW(e){var t=e.length;return{point:function(n,r){for(var i=-1;++i<t;)e[i].point(n,r)},sphere:function(){for(var n=-1;++n<t;)e[n].sphere()},lineStart:function(){for(var n=-1;++n<t;)e[n].lineStart()},lineEnd:function(){for(var n=-1;++n<t;)e[n].lineEnd()},polygonStart:function(){for(var n=-1;++n<t;)e[n].polygonStart()},polygonEnd:function(){for(var n=-1;++n<t;)e[n].polygonEnd()}}}function dI(){var e,t,n=Tp(),r,i=$a().rotate([154,0]).center([-2,58.5]).parallels([55,65]),o,s=$a().rotate([157,0]).center([-3,19.9]).parallels([8,18]),a,c,l={point:function(d,h){c=[d,h]}};function u(d){var h=d[0],p=d[1];return c=null,r.point(h,p),c||(o.point(h,p),c)||(a.point(h,p),c)}u.invert=function(d){var h=n.scale(),p=n.translate(),m=(d[0]-p[0])/h,g=(d[1]-p[1])/h;return(g>=.12&&g<.234&&m>=-.425&&m<-.214?i:g>=.166&&g<.234&&m>=-.214&&m<-.115?s:n).invert(d)},u.stream=function(d){return e&&t===d?e:e=EW([n.stream(t=d),i.stream(d),s.stream(d)])},u.precision=function(d){return arguments.length?(n.precision(d),i.precision(d),s.precision(d),f()):n.precision()},u.scale=function(d){return arguments.length?(n.scale(d),i.scale(d*.35),s.scale(d),u.translate(n.translate())):n.scale()},u.translate=function(d){if(!arguments.length)return n.translate();var h=n.scale(),p=+d[0],m=+d[1];return r=n.translate(d).clipExtent([[p-.455*h,m-.238*h],[p+.455*h,m+.238*h]]).stream(l),o=i.translate([p-.307*h,m+.201*h]).clipExtent([[p-.425*h+J,m+.12*h+J],[p-.214*h-J,m+.234*h-J]]).stream(l),a=s.translate([p-.205*h,m+.212*h]).clipExtent([[p-.214*h+J,m+.166*h+J],[p-.115*h-J,m+.234*h-J]]).stream(l),f()},u.fitExtent=function(d,h){return Ip(u,d,h)},u.fitSize=function(d,h){return Ub(u,d,h)},u.fitWidth=function(d,h){return zb(u,d,h)},u.fitHeight=function(d,h){return qb(u,d,h)};function f(){return e=t=null,u}return u.scale(1070)}function jb(e){return function(t,n){var r=K(t),i=K(n),o=e(r*i);return o===1/0?[2,0]:[o*i*Q(t),o*Q(n)]}}function So(e){return function(t,n){var r=he(t*t+n*n),i=e(r),o=Q(i),s=K(i);return[We(t*o,r*s),ve(r&&n*o/r)]}}var hI=jb(function(e){return he(2/(1+e))});hI.invert=So(function(e){return 2*ve(e/2)});function pI(){return Nn(hI).scale(124.75).clipAngle(180-.001)}var mI=jb(function(e){return(e=bb(e))&&e/Q(e)});mI.invert=So(function(e){return e});function yI(){return Nn(mI).scale(79.4188).clipAngle(180-.001)}function Zu(e,t){return[e,ol(Uu((de+t)/2))]}Zu.invert=function(e,t){return[e,2*li(mb(t))-de]};function gI(){return bI(Zu).scale(961/cn)}function bI(e){var t=Nn(e),n=t.center,r=t.scale,i=t.translate,o=t.clipExtent,s=null,a,c,l;t.scale=function(f){return arguments.length?(r(f),u()):r()},t.translate=function(f){return arguments.length?(i(f),u()):i()},t.center=function(f){return arguments.length?(n(f),u()):n()},t.clipExtent=function(f){return arguments.length?(f==null?s=a=c=l=null:(s=+f[0][0],a=+f[0][1],c=+f[1][0],l=+f[1][1]),u()):s==null?null:[[s,a],[c,l]]};function u(){var f=Mt*r(),d=t(VF(t.rotate()).invert([0,0]));return o(s==null?[[d[0]-f,d[1]-f],[d[0]+f,d[1]+f]]:e===Zu?[[Math.max(d[0]-f,s),a],[Math.min(d[0]+f,c),l]]:[[s,Math.max(d[1]-f,a)],[c,Math.min(d[1]+f,l)]])}return u()}function Vb(e){return Uu((de+e)/2)}function bL(e,t){var n=K(e),r=e===t?Q(e):ol(n/K(t))/ol(Vb(t)/Vb(e)),i=n*gb(Vb(e),r)/r;if(!r)return Zu;function o(s,a){i>0?a<-de+J&&(a=-de+J):a>de-J&&(a=de-J);var c=i/gb(Vb(a),r);return[c*Q(r*s),i-c*K(r*s)]}return o.invert=function(s,a){var c=i-a,l=$n(r)*he(s*s+c*c),u=We(s,Bt(c))*$n(c);return c*r<0&&(u-=Mt*$n(s)*$n(c)),[u/r,2*li(gb(i/l,1/r))-de]},o}function xI(){return Hu(bL).scale(109.5).parallels([30,30])}function Qu(e,t){return[e,t]}Qu.invert=Qu;function _I(){return Nn(Qu).scale(152.63)}function xL(e,t){var n=K(e),r=e===t?Q(e):(n-K(t))/(t-e),i=n/r+e;if(Bt(r)<J)return Qu;function o(s,a){var c=i-a,l=r*s;return[c*Q(l),i-c*K(l)]}return o.invert=function(s,a){var c=i-a,l=We(s,Bt(c))*$n(c);return c*r<0&&(l-=Mt*$n(s)*$n(c)),[l/r,i-$n(r)*he(s*s+c*c)]},o}function wI(){return Hu(xL).scale(131.154).center([0,13.9389])}var Ep=1.340264,Ap=-.081106,Mp=893e-6,Np=.003796,Yb=he(3)/2,AW=12;function vI(e,t){var n=ve(Yb*Q(t)),r=n*n,i=r*r*r;return[e*K(n)/(Yb*(Ep+3*Ap*r+i*(7*Mp+9*Np*r))),n*(Ep+Ap*r+i*(Mp+Np*r))]}vI.invert=function(e,t){for(var n=t,r=n*n,i=r*r*r,o=0,s,a,c;o<AW&&(a=n*(Ep+Ap*r+i*(Mp+Np*r))-t,c=Ep+3*Ap*r+i*(7*Mp+9*Np*r),n-=s=a/c,r=n*n,i=r*r*r,!(Bt(s)<il));++o);return[Yb*e*(Ep+3*Ap*r+i*(7*Mp+9*Np*r))/K(n),ve(Q(n)/Yb)]};function SI(){return Nn(vI).scale(177.158)}function II(e,t){var n=K(t),r=K(e)*n;return[n*Q(e)/r,Q(t)/r]}II.invert=So(li);function TI(){return Nn(II).scale(144.049).clipAngle(60)}function EI(e,t){return[K(t)*Q(e),Q(t)]}EI.invert=So(ve);function AI(){return Nn(EI).scale(249.5).clipAngle(90+J)}function MI(e,t){var n=K(t),r=1+K(e)*n;return[n*Q(e)/r,Q(t)/r]}MI.invert=So(function(e){return 2*li(e)});function NI(){return Nn(MI).scale(250).clipAngle(142)}function RI(e,t){return[ol(Uu((de+t)/2)),-e]}RI.invert=function(e,t){return[-t,2*li(mb(e))-de]};function OI(){var e=bI(RI),t=e.center,n=e.rotate;return e.center=function(r){return arguments.length?t([-r[1],r[0]]):(r=t(),[r[1],-r[0]])},e.rotate=function(r){return arguments.length?n([r[0],r[1],r.length>2?r[2]+90:90]):(r=n(),[r[0],r[1],r[2]-90])},n([0,0,90]).scale(159.155)}function MW(e,t){return e.parent===t.parent?1:2}function NW(e){return e.reduce(RW,0)/e.length}function RW(e,t){return e+t.x}function OW(e){return 1+e.reduce(DW,0)}function DW(e,t){return Math.max(e,t.y)}function kW(e){for(var t;t=e.children;)e=t[0];return e}function FW(e){for(var t;t=e.children;)e=t[t.length-1];return e}function Gb(){var e=MW,t=1,n=1,r=!1;function i(o){var s,a=0;o.eachAfter(function(d){var h=d.children;h?(d.x=NW(h),d.y=OW(h)):(d.x=s?a+=e(d,s):0,d.y=0,s=d)});var c=kW(o),l=FW(o),u=c.x-e(c,l)/2,f=l.x+e(l,c)/2;return o.eachAfter(r?function(d){d.x=(d.x-o.x)*t,d.y=(o.y-d.y)*n}:function(d){d.x=(d.x-u)/(f-u)*t,d.y=(1-(o.y?d.y/o.y:1))*n})}return i.separation=function(o){return arguments.length?(e=o,i):e},i.size=function(o){return arguments.length?(r=!1,t=+o[0],n=+o[1],i):r?null:[t,n]},i.nodeSize=function(o){return arguments.length?(r=!0,t=+o[0],n=+o[1],i):r?[t,n]:null},i}function LW(e){var t=0,n=e.children,r=n&&n.length;if(!r)t=1;else for(;--r>=0;)t+=n[r].value;e.value=t}function _L(){return this.eachAfter(LW)}function wL(e,t){let n=-1;for(let r of this)e.call(t,r,++n,this);return this}function vL(e,t){for(var n=this,r=[n],i,o,s=-1;n=r.pop();)if(e.call(t,n,++s,this),i=n.children)for(o=i.length-1;o>=0;--o)r.push(i[o]);return this}function SL(e,t){for(var n=this,r=[n],i=[],o,s,a,c=-1;n=r.pop();)if(i.push(n),o=n.children)for(s=0,a=o.length;s<a;++s)r.push(o[s]);for(;n=i.pop();)e.call(t,n,++c,this);return this}function IL(e,t){let n=-1;for(let r of this)if(e.call(t,r,++n,this))return r}function TL(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,r=t.children,i=r&&r.length;--i>=0;)n+=r[i].value;t.value=n})}function EL(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function AL(e){for(var t=this,n=CW(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var i=r.length;e!==n;)r.splice(i,0,e),e=e.parent;return r}function CW(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),i=null;for(e=n.pop(),t=r.pop();e===t;)i=e,e=n.pop(),t=r.pop();return i}function ML(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function NL(){return Array.from(this)}function RL(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function OL(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*DL(){var e=this,t,n=[e],r,i,o;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,r=e.children)for(i=0,o=r.length;i<o;++i)n.push(r[i]);while(n.length)}function DI(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=$W)):t===void 0&&(t=PW);for(var n=new Ua(e),r,i=[n],o,s,a,c;r=i.pop();)if((s=t(r.data))&&(c=(s=Array.from(s)).length))for(r.children=s,a=c-1;a>=0;--a)i.push(o=s[a]=new Ua(s[a])),o.parent=r,o.depth=r.depth+1;return n.eachBefore(kI)}function BW(){return DI(this).eachBefore(UW)}function PW(e){return e.children}function $W(e){return Array.isArray(e)?e[1]:null}function UW(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function kI(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function Ua(e){this.data=e,this.depth=this.height=0,this.parent=null}Ua.prototype=DI.prototype={constructor:Ua,count:_L,each:wL,eachAfter:SL,eachBefore:vL,find:IL,sum:TL,sort:EL,path:AL,ancestors:ML,descendants:NL,leaves:RL,links:OL,copy:BW,[Symbol.iterator]:DL};function Wb(e){return e==null?null:zW(e)}function zW(e){if(typeof e!="function")throw new Error;return e}var qW={depth:-1},kL={},FI={};function jW(e){return e.id}function VW(e){return e.parentId}function Xb(){var e=jW,t=VW,n;function r(i){var o=Array.from(i),s=e,a=t,c,l,u,f,d,h,p,m,g=new Map;if(n!=null){let y=o.map((_,v)=>YW(n(_,v,i))),b=y.map(FL),x=new Set(y).add("");for(let _ of b)x.has(_)||(x.add(_),y.push(_),b.push(FL(_)),o.push(FI));s=(_,v)=>y[v],a=(_,v)=>b[v]}for(u=0,c=o.length;u<c;++u)l=o[u],h=o[u]=new Ua(l),(p=s(l,u,i))!=null&&(p+="")&&(m=h.id=p,g.set(m,g.has(m)?kL:h)),(p=a(l,u,i))!=null&&(p+="")&&(h.parent=p);for(u=0;u<c;++u)if(h=o[u],p=h.parent){if(d=g.get(p),!d)throw new Error("missing: "+p);if(d===kL)throw new Error("ambiguous: "+p);d.children?d.children.push(h):d.children=[h],h.parent=d}else{if(f)throw new Error("multiple roots");f=h}if(!f)throw new Error("no root");if(n!=null){for(;f.data===FI&&f.children.length===1;)f=f.children[0],--c;for(let y=o.length-1;y>=0&&(h=o[y],h.data===FI);--y)h.data=null}if(f.parent=qW,f.eachBefore(function(y){y.depth=y.parent.depth+1,--c}).eachBefore(kI),f.parent=null,c>0)throw new Error("cycle");return f}return r.id=function(i){return arguments.length?(e=Wb(i),r):e},r.parentId=function(i){return arguments.length?(t=Wb(i),r):t},r.path=function(i){return arguments.length?(n=Wb(i),r):n},r}function YW(e){e=`${e}`;let t=e.length;return LI(e,t-1)&&!LI(e,t-2)&&(e=e.slice(0,-1)),e[0]==="/"?e:`/${e}`}function FL(e){let t=e.length;if(t<2)return"";for(;--t>1&&!LI(e,t););return e.slice(0,t)}function LI(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if(!(n&1))return!0}return!1}function GW(e,t){return e.parent===t.parent?1:2}function CI(e){var t=e.children;return t?t[0]:e.t}function BI(e){var t=e.children;return t?t[t.length-1]:e.t}function WW(e,t,n){var r=n/(t.i-e.i);t.c-=r,t.s+=n,e.c+=r,t.z+=n,t.m+=n}function XW(e){for(var t=0,n=0,r=e.children,i=r.length,o;--i>=0;)o=r[i],o.z+=t,o.m+=t,t+=o.s+(n+=o.c)}function HW(e,t,n){return e.a.parent===t.parent?e.a:n}function Hb(e,t){this._=e,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}Hb.prototype=Object.create(Ua.prototype);function ZW(e){for(var t=new Hb(e,0),n,r=[t],i,o,s,a;n=r.pop();)if(o=n._.children)for(n.children=new Array(a=o.length),s=a-1;s>=0;--s)r.push(i=n.children[s]=new Hb(o[s],s)),i.parent=n;return(t.parent=new Hb(null,0)).children=[t],t}function cl(){var e=GW,t=1,n=1,r=null;function i(l){var u=ZW(l);if(u.eachAfter(o),u.parent.m=-u.z,u.eachBefore(s),r)l.eachBefore(c);else{var f=l,d=l,h=l;l.eachBefore(function(b){b.x<f.x&&(f=b),b.x>d.x&&(d=b),b.depth>h.depth&&(h=b)});var p=f===d?1:e(f,d)/2,m=p-f.x,g=t/(d.x+p+m),y=n/(h.depth||1);l.eachBefore(function(b){b.x=(b.x+m)*g,b.y=b.depth*y})}return l}function o(l){var u=l.children,f=l.parent.children,d=l.i?f[l.i-1]:null;if(u){XW(l);var h=(u[0].z+u[u.length-1].z)/2;d?(l.z=d.z+e(l._,d._),l.m=l.z-h):l.z=h}else d&&(l.z=d.z+e(l._,d._));l.parent.A=a(l,d,l.parent.A||f[0])}function s(l){l._.x=l.z+l.parent.m,l.m+=l.parent.m}function a(l,u,f){if(u){for(var d=l,h=l,p=u,m=d.parent.children[0],g=d.m,y=h.m,b=p.m,x=m.m,_;p=BI(p),d=CI(d),p&&d;)m=CI(m),h=BI(h),h.a=l,_=p.z+b-d.z-g+e(p._,d._),_>0&&(WW(HW(p,l,f),l,_),g+=_,y+=_),b+=p.m,g+=d.m,x+=m.m,y+=h.m;p&&!BI(h)&&(h.t=p,h.m+=b-y),d&&!CI(m)&&(m.t=d,m.m+=g-x,f=l)}return f}function c(l){l.x*=t,l.y=l.depth*n}return i.separation=function(l){return arguments.length?(e=l,i):e},i.size=function(l){return arguments.length?(r=!1,t=+l[0],n=+l[1],i):r?null:[t,n]},i.nodeSize=function(l){return arguments.length?(r=!0,t=+l[0],n=+l[1],i):r?[t,n]:null},i}var LL=23283064365386963e-26;function ll(e=Math.random()){let t=(0<=e&&e<1?e/LL:Math.abs(e))|0;return()=>(t=1664525*t+1013904223|0,LL*(t>>>0))}function He(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function Rp(e,t){switch(arguments.length){case 0:break;case 1:{typeof e=="function"?this.interpolator(e):this.range(e);break}default:{this.domain(e),typeof t=="function"?this.interpolator(t):this.range(t);break}}return this}var Op=Symbol("implicit");function ul(){var e=new Zn,t=[],n=[],r=Op;function i(o){let s=e.get(o);if(s===void 0){if(r!==Op)return r;e.set(o,s=t.push(o)-1)}return n[s%n.length]}return i.domain=function(o){if(!arguments.length)return t.slice();t=[],e=new Zn;for(let s of o)e.has(s)||e.set(s,t.push(s)-1);return i},i.range=function(o){return arguments.length?(n=Array.from(o),i):n.slice()},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return ul(t,n).unknown(r)},He.apply(i,arguments),i}function za(){var e=ul().unknown(void 0),t=e.domain,n=e.range,r=0,i=1,o,s,a=!1,c=0,l=0,u=.5;delete e.unknown;function f(){var d=t().length,h=i<r,p=h?i:r,m=h?r:i;o=(m-p)/Math.max(1,d-c+l*2),a&&(o=Math.floor(o)),p+=(m-p-o*(d-c))*u,s=o*(1-c),a&&(p=Math.round(p),s=Math.round(s));var g=$e(d).map(function(y){return p+o*y});return n(h?g.reverse():g)}return e.domain=function(d){return arguments.length?(t(d),f()):t()},e.range=function(d){return arguments.length?([r,i]=d,r=+r,i=+i,f()):[r,i]},e.rangeRound=function(d){return[r,i]=d,r=+r,i=+i,a=!0,f()},e.bandwidth=function(){return s},e.step=function(){return o},e.round=function(d){return arguments.length?(a=!!d,f()):a},e.padding=function(d){return arguments.length?(c=Math.min(1,l=+d),f()):c},e.paddingInner=function(d){return arguments.length?(c=Math.min(1,d),f()):c},e.paddingOuter=function(d){return arguments.length?(l=+d,f()):l},e.align=function(d){return arguments.length?(u=Math.max(0,Math.min(1,d)),f()):u},e.copy=function(){return za(t(),[r,i]).round(a).paddingInner(c).paddingOuter(l).align(u)},He.apply(f(),arguments)}function CL(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return CL(t())},e}function PI(){return CL(za.apply(null,arguments).paddingInner(1))}function $I(e){return function(){return e}}function Ku(e){return+e}var BL=[0,1];function xr(e){return e}function UI(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:$I(isNaN(t)?NaN:.5)}function QW(e,t){var n;return e>t&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function KW(e,t,n){var r=e[0],i=e[1],o=t[0],s=t[1];return i<r?(r=UI(i,r),o=n(s,o)):(r=UI(r,i),o=n(o,s)),function(a){return o(r(a))}}function JW(e,t,n){var r=Math.min(e.length,t.length)-1,i=new Array(r),o=new Array(r),s=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++s<r;)i[s]=UI(e[s],e[s+1]),o[s]=n(t[s],t[s+1]);return function(a){var c=ws(e,a,1,r)-1;return o[c](i[c](a))}}function Io(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function fl(){var e=BL,t=BL,n=Cr,r,i,o,s=xr,a,c,l;function u(){var d=Math.min(e.length,t.length);return s!==xr&&(s=QW(e[0],e[d-1])),a=d>2?JW:KW,c=l=null,f}function f(d){return d==null||isNaN(d=+d)?o:(c||(c=a(e.map(r),t,n)))(r(s(d)))}return f.invert=function(d){return s(i((l||(l=a(t,e.map(r),we)))(d)))},f.domain=function(d){return arguments.length?(e=Array.from(d,Ku),u()):e.slice()},f.range=function(d){return arguments.length?(t=Array.from(d),u()):t.slice()},f.rangeRound=function(d){return t=Array.from(d),n=Kc,u()},f.clamp=function(d){return arguments.length?(s=d?!0:xr,u()):s!==xr},f.interpolate=function(d){return arguments.length?(n=d,u()):n},f.unknown=function(d){return arguments.length?(o=d,f):o},function(d,h){return r=d,i=h,u()}}function Dp(){return fl()(xr,xr)}function zI(e,t,n,r){var i=wu(e,t,n),o;switch(r=xo(r??",f"),r.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(o=FS(i,s))&&(r.precision=o),pb(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=LS(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=kS(i))&&(r.precision=o-(r.type==="%")*2);break}}return ci(r)}function Ds(e){var t=e.domain;return e.ticks=function(n){var r=t();return Tn(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return zI(i[0],i[i.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),i=0,o=r.length-1,s=r[i],a=r[o],c,l,u=10;for(a<s&&(l=s,s=a,a=l,l=i,i=o,o=l);u-- >0;){if(l=vs(s,a,n),l===c)return r[i]=s,r[o]=a,t(r);if(l>0)s=Math.floor(s/l)*l,a=Math.ceil(a/l)*l;else if(l<0)s=Math.ceil(s*l)/l,a=Math.floor(a*l)/l;else break;c=l}return e},e}function ks(){var e=Dp();return e.copy=function(){return Io(e,ks())},He.apply(e,arguments),Ds(e)}function kp(e){var t;function n(r){return r==null||isNaN(r=+r)?t:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(e=Array.from(r,Ku),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return kp(e).unknown(t)},e=arguments.length?Array.from(e,Ku):[0,1],Ds(n)}function Fp(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],o=e[r],s;return o<i&&(s=n,n=r,r=s,s=i,i=o,o=s),e[n]=t.floor(i),e[r]=t.ceil(o),e}function PL(e){return Math.log(e)}function $L(e){return Math.exp(e)}function tX(e){return-Math.log(-e)}function eX(e){return-Math.exp(-e)}function nX(e){return isFinite(e)?+("1e"+e):e<0?0:e}function rX(e){return e===10?nX:e===Math.E?Math.exp:t=>Math.pow(e,t)}function iX(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function UL(e){return(t,n)=>-e(-t,n)}function qI(e){let t=e(PL,$L),n=t.domain,r=10,i,o;function s(){return i=iX(r),o=rX(r),n()[0]<0?(i=UL(i),o=UL(o),e(tX,eX)):e(PL,$L),t}return t.base=function(a){return arguments.length?(r=+a,s()):r},t.domain=function(a){return arguments.length?(n(a),s()):n()},t.ticks=a=>{let c=n(),l=c[0],u=c[c.length-1],f=u<l;f&&([l,u]=[u,l]);let d=i(l),h=i(u),p,m,g=a==null?10:+a,y=[];if(!(r%1)&&h-d<g){if(d=Math.floor(d),h=Math.ceil(h),l>0){for(;d<=h;++d)for(p=1;p<r;++p)if(m=d<0?p/o(-d):p*o(d),!(m<l)){if(m>u)break;y.push(m)}}else for(;d<=h;++d)for(p=r-1;p>=1;--p)if(m=d>0?p/o(-d):p*o(d),!(m<l)){if(m>u)break;y.push(m)}y.length*2<g&&(y=Tn(l,u,g))}else y=Tn(d,h,Math.min(h-d,g)).map(o);return f?y.reverse():y},t.tickFormat=(a,c)=>{if(a==null&&(a=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=xo(c)).precision==null&&(c.trim=!0),c=ci(c)),a===1/0)return c;let l=Math.max(1,r*a/t.ticks().length);return u=>{let f=u/o(Math.round(i(u)));return f*r<r-.5&&(f*=r),f<=l?c(u):""}},t.nice=()=>n(Fp(n(),{floor:a=>o(Math.floor(i(a))),ceil:a=>o(Math.ceil(i(a)))})),t}function Lp(){let e=qI(fl()).domain([1,10]);return e.copy=()=>Io(e,Lp()).base(e.base()),He.apply(e,arguments),e}function zL(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function qL(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function jI(e){var t=1,n=e(zL(t),qL(t));return n.constant=function(r){return arguments.length?e(zL(t=+r),qL(t)):t},Ds(n)}function Cp(){var e=jI(fl());return e.copy=function(){return Io(e,Cp()).constant(e.constant())},He.apply(e,arguments)}function jL(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function oX(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function sX(e){return e<0?-e*e:e*e}function VI(e){var t=e(xr,xr),n=1;function r(){return n===1?e(xr,xr):n===.5?e(oX,sX):e(jL(n),jL(1/n))}return t.exponent=function(i){return arguments.length?(n=+i,r()):n},Ds(t)}function Bp(){var e=VI(fl());return e.copy=function(){return Io(e,Bp()).exponent(e.exponent())},He.apply(e,arguments),e}function Pp(){var e=[],t=[],n=[],r;function i(){var s=0,a=Math.max(1,t.length);for(n=new Array(a-1);++s<a;)n[s-1]=j2(e,s/a);return o}function o(s){return s==null||isNaN(s=+s)?r:t[ws(n,s)]}return o.invertExtent=function(s){var a=t.indexOf(s);return a<0?[NaN,NaN]:[a>0?n[a-1]:e[0],a<n.length?n[a]:e[e.length-1]]},o.domain=function(s){if(!arguments.length)return e.slice();e=[];for(let a of s)a!=null&&!isNaN(a=+a)&&e.push(a);return e.sort(Ut),i()},o.range=function(s){return arguments.length?(t=Array.from(s),i()):t.slice()},o.unknown=function(s){return arguments.length?(r=s,o):r},o.quantiles=function(){return n.slice()},o.copy=function(){return Pp().domain(e).range(t).unknown(r)},He.apply(o,arguments)}function $p(){var e=[.5],t=[0,1],n,r=1;function i(o){return o!=null&&o<=o?t[ws(e,o,0,r)]:n}return i.domain=function(o){return arguments.length?(e=Array.from(o),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(o){return arguments.length?(t=Array.from(o),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(o){var s=t.indexOf(o);return[e[s-1],e[s]]},i.unknown=function(o){return arguments.length?(n=o,i):n},i.copy=function(){return $p().domain(e).range(t).unknown(n)},He.apply(i,arguments)}var YI=new Date,GI=new Date;function pe(e,t,n,r){function i(o){return e(o=arguments.length===0?new Date:new Date(+o)),o}return i.floor=o=>(e(o=new Date(+o)),o),i.ceil=o=>(e(o=new Date(o-1)),t(o,1),e(o),o),i.round=o=>{let s=i(o),a=i.ceil(o);return o-s<a-o?s:a},i.offset=(o,s)=>(t(o=new Date(+o),s==null?1:Math.floor(s)),o),i.range=(o,s,a)=>{let c=[];if(o=i.ceil(o),a=a==null?1:Math.floor(a),!(o<s)||!(a>0))return c;let l;do c.push(l=new Date(+o)),t(o,a),e(o);while(l<o&&o<s);return c},i.filter=o=>pe(s=>{if(s>=s)for(;e(s),!o(s);)s.setTime(s-1)},(s,a)=>{if(s>=s)if(a<0)for(;++a<=0;)for(;t(s,-1),!o(s););else for(;--a>=0;)for(;t(s,1),!o(s););}),n&&(i.count=(o,s)=>(YI.setTime(+o),GI.setTime(+s),e(YI),e(GI),Math.floor(n(YI,GI))),i.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?i.filter(r?s=>r(s)%o===0:s=>i.count(0,s)%o===0):i)),i}var Up=pe(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Up.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?pe(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):Up);var qAt=Up.range;var ln=pe(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*1e3)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds()),VL=ln.range;var Fs=pe(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getMinutes()),aX=Fs.range,Ls=pe(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes()),cX=Ls.range;var Cs=pe(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3-e.getMinutes()*6e4)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getHours()),lX=Cs.range,Bs=pe(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours()),uX=Bs.range;var ui=pe(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/864e5,e=>e.getDate()-1),fX=ui.range,pl=pe(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1),dX=pl.range,ml=pe(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>Math.floor(e/864e5)),hX=ml.range;function yl(e){return pe(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/6048e5)}var Pr=yl(0),qa=yl(1),Zb=yl(2),Qb=yl(3),Eo=yl(4),Kb=yl(5),Jb=yl(6),GL=Pr.range,pX=qa.range,mX=Zb.range,yX=Qb.range,gX=Eo.range,bX=Kb.range,xX=Jb.range;function gl(e){return pe(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/6048e5)}var $r=gl(0),ja=gl(1),tx=gl(2),ex=gl(3),Ao=gl(4),nx=gl(5),rx=gl(6),WL=$r.range,_X=ja.range,wX=tx.range,vX=ex.range,SX=Ao.range,IX=nx.range,TX=rx.range;var Ps=pe(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth()),EX=Ps.range,$s=pe(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth()),AX=$s.range;var Un=pe(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Un.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:pe(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});var MX=Un.range,zn=pe(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());zn.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:pe(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});var NX=zn.range;function HL(e,t,n,r,i,o){let s=[[ln,1,1e3],[ln,5,5*1e3],[ln,15,15*1e3],[ln,30,30*1e3],[o,1,6e4],[o,5,5*6e4],[o,15,15*6e4],[o,30,30*6e4],[i,1,36e5],[i,3,3*36e5],[i,6,6*36e5],[i,12,12*36e5],[r,1,864e5],[r,2,2*864e5],[n,1,6048e5],[t,1,2592e6],[t,3,3*2592e6],[e,1,31536e6]];function a(l,u,f){let d=u<l;d&&([l,u]=[u,l]);let h=f&&typeof f.range=="function"?f:c(l,u,f),p=h?h.range(l,+u+1):[];return d?p.reverse():p}function c(l,u,f){let d=Math.abs(u-l)/f,h=_s(([,,g])=>g).right(s,d);if(h===s.length)return e.every(wu(l/31536e6,u/31536e6,f));if(h===0)return Up.every(Math.max(wu(l,u,f),1));let[p,m]=s[d/s[h-1][2]<s[h][2]/d?h-1:h];return p.every(m)}return[a,c]}var[WI,qp]=HL(zn,$s,$r,ml,Bs,Ls),[XI,HI]=HL(Un,Ps,Pr,ui,Cs,Fs);function ZI(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function QI(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function jp(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function KI(e){var t=e.dateTime,n=e.date,r=e.time,i=e.periods,o=e.days,s=e.shortDays,a=e.months,c=e.shortMonths,l=Vp(i),u=Yp(i),f=Vp(o),d=Yp(o),h=Vp(s),p=Yp(s),m=Vp(a),g=Yp(a),y=Vp(c),b=Yp(c),x={a:L,A:B,b:C,B:P,c:null,d:eC,e:eC,f:JX,g:lH,G:fH,H:ZX,I:QX,j:KX,L:sC,m:tH,M:eH,p:$,q:U,Q:iC,s:oC,S:nH,u:rH,U:iH,V:oH,w:sH,W:aH,x:null,X:null,y:cH,Y:uH,Z:dH,"%":rC},_={a:X,A:tt,b:nt,B:st,c:null,d:nC,e:nC,f:yH,g:EH,G:MH,H:hH,I:pH,j:mH,L:cC,m:gH,M:bH,p:Y,q:rt,Q:iC,s:oC,S:xH,u:_H,U:wH,V:vH,w:SH,W:IH,x:null,X:null,y:TH,Y:AH,Z:NH,"%":rC},v={a:I,A,b:O,B:F,c:S,d:JL,e:JL,f:GX,g:KL,G:QL,H:tC,I:tC,j:qX,L:YX,m:zX,M:jX,p:R,q:UX,Q:XX,s:HX,S:VX,u:LX,U:CX,V:BX,w:FX,W:PX,x:E,X:N,y:KL,Y:QL,Z:$X,"%":WX};x.x=w(n,x),x.X=w(r,x),x.c=w(t,x),_.x=w(n,_),_.X=w(r,_),_.c=w(t,_);function w(q,H){return function(ot){var z=[],Lt=-1,dt=0,Wt=q.length,Xt,et,oe;for(ot instanceof Date||(ot=new Date(+ot));++Lt<Wt;)q.charCodeAt(Lt)===37&&(z.push(q.slice(dt,Lt)),(et=ZL[Xt=q.charAt(++Lt)])!=null?Xt=q.charAt(++Lt):et=Xt==="e"?" ":"0",(oe=H[Xt])&&(Xt=oe(ot,et)),z.push(Xt),dt=Lt+1);return z.push(q.slice(dt,Lt)),z.join("")}}function T(q,H){return function(ot){var z=jp(1900,void 0,1),Lt=M(z,q,ot+="",0),dt,Wt;if(Lt!=ot.length)return null;if("Q"in z)return new Date(z.Q);if("s"in z)return new Date(z.s*1e3+("L"in z?z.L:0));if(H&&!("Z"in z)&&(z.Z=0),"p"in z&&(z.H=z.H%12+z.p*12),z.m===void 0&&(z.m="q"in z?z.q:0),"V"in z){if(z.V<1||z.V>53)return null;"w"in z||(z.w=1),"Z"in z?(dt=QI(jp(z.y,0,1)),Wt=dt.getUTCDay(),dt=Wt>4||Wt===0?ja.ceil(dt):ja(dt),dt=pl.offset(dt,(z.V-1)*7),z.y=dt.getUTCFullYear(),z.m=dt.getUTCMonth(),z.d=dt.getUTCDate()+(z.w+6)%7):(dt=ZI(jp(z.y,0,1)),Wt=dt.getDay(),dt=Wt>4||Wt===0?qa.ceil(dt):qa(dt),dt=ui.offset(dt,(z.V-1)*7),z.y=dt.getFullYear(),z.m=dt.getMonth(),z.d=dt.getDate()+(z.w+6)%7)}else("W"in z||"U"in z)&&("w"in z||(z.w="u"in z?z.u%7:"W"in z?1:0),Wt="Z"in z?QI(jp(z.y,0,1)).getUTCDay():ZI(jp(z.y,0,1)).getDay(),z.m=0,z.d="W"in z?(z.w+6)%7+z.W*7-(Wt+5)%7:z.w+z.U*7-(Wt+6)%7);return"Z"in z?(z.H+=z.Z/100|0,z.M+=z.Z%100,QI(z)):ZI(z)}}function M(q,H,ot,z){for(var Lt=0,dt=H.length,Wt=ot.length,Xt,et;Lt<dt;){if(z>=Wt)return-1;if(Xt=H.charCodeAt(Lt++),Xt===37){if(Xt=H.charAt(Lt++),et=v[Xt in ZL?H.charAt(Lt++):Xt],!et||(z=et(q,ot,z))<0)return-1}else if(Xt!=ot.charCodeAt(z++))return-1}return z}function R(q,H,ot){var z=l.exec(H.slice(ot));return z?(q.p=u.get(z[0].toLowerCase()),ot+z[0].length):-1}function I(q,H,ot){var z=h.exec(H.slice(ot));return z?(q.w=p.get(z[0].toLowerCase()),ot+z[0].length):-1}function A(q,H,ot){var z=f.exec(H.slice(ot));return z?(q.w=d.get(z[0].toLowerCase()),ot+z[0].length):-1}function O(q,H,ot){var z=y.exec(H.slice(ot));return z?(q.m=b.get(z[0].toLowerCase()),ot+z[0].length):-1}function F(q,H,ot){var z=m.exec(H.slice(ot));return z?(q.m=g.get(z[0].toLowerCase()),ot+z[0].length):-1}function S(q,H,ot){return M(q,t,H,ot)}function E(q,H,ot){return M(q,n,H,ot)}function N(q,H,ot){return M(q,r,H,ot)}function L(q){return s[q.getDay()]}function B(q){return o[q.getDay()]}function C(q){return c[q.getMonth()]}function P(q){return a[q.getMonth()]}function $(q){return i[+(q.getHours()>=12)]}function U(q){return 1+~~(q.getMonth()/3)}function X(q){return s[q.getUTCDay()]}function tt(q){return o[q.getUTCDay()]}function nt(q){return c[q.getUTCMonth()]}function st(q){return a[q.getUTCMonth()]}function Y(q){return i[+(q.getUTCHours()>=12)]}function rt(q){return 1+~~(q.getUTCMonth()/3)}return{format:function(q){var H=w(q+="",x);return H.toString=function(){return q},H},parse:function(q){var H=T(q+="",!1);return H.toString=function(){return q},H},utcFormat:function(q){var H=w(q+="",_);return H.toString=function(){return q},H},utcParse:function(q){var H=T(q+="",!0);return H.toString=function(){return q},H}}}var ZL={"-":"",_:" ",0:"0"},un=/^\s*\d+/,OX=/^%/,DX=/[\\^$*+?|[\]().{}]/g;function te(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",o=i.length;return r+(o<n?new Array(n-o+1).join(t)+i:i)}function kX(e){return e.replace(DX,"\\$&")}function Vp(e){return new RegExp("^(?:"+e.map(kX).join("|")+")","i")}function Yp(e){return new Map(e.map((t,n)=>[t.toLowerCase(),n]))}function FX(e,t,n){var r=un.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function LX(e,t,n){var r=un.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function CX(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function BX(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function PX(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function QL(e,t,n){var r=un.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function KL(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function $X(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function UX(e,t,n){var r=un.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function zX(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function JL(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function qX(e,t,n){var r=un.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function tC(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function jX(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function VX(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function YX(e,t,n){var r=un.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function GX(e,t,n){var r=un.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function WX(e,t,n){var r=OX.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function XX(e,t,n){var r=un.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function HX(e,t,n){var r=un.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function eC(e,t){return te(e.getDate(),t,2)}function ZX(e,t){return te(e.getHours(),t,2)}function QX(e,t){return te(e.getHours()%12||12,t,2)}function KX(e,t){return te(1+ui.count(Un(e),e),t,3)}function sC(e,t){return te(e.getMilliseconds(),t,3)}function JX(e,t){return sC(e,t)+"000"}function tH(e,t){return te(e.getMonth()+1,t,2)}function eH(e,t){return te(e.getMinutes(),t,2)}function nH(e,t){return te(e.getSeconds(),t,2)}function rH(e){var t=e.getDay();return t===0?7:t}function iH(e,t){return te(Pr.count(Un(e)-1,e),t,2)}function aC(e){var t=e.getDay();return t>=4||t===0?Eo(e):Eo.ceil(e)}function oH(e,t){return e=aC(e),te(Eo.count(Un(e),e)+(Un(e).getDay()===4),t,2)}function sH(e){return e.getDay()}function aH(e,t){return te(qa.count(Un(e)-1,e),t,2)}function cH(e,t){return te(e.getFullYear()%100,t,2)}function lH(e,t){return e=aC(e),te(e.getFullYear()%100,t,2)}function uH(e,t){return te(e.getFullYear()%1e4,t,4)}function fH(e,t){var n=e.getDay();return e=n>=4||n===0?Eo(e):Eo.ceil(e),te(e.getFullYear()%1e4,t,4)}function dH(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+te(t/60|0,"0",2)+te(t%60,"0",2)}function nC(e,t){return te(e.getUTCDate(),t,2)}function hH(e,t){return te(e.getUTCHours(),t,2)}function pH(e,t){return te(e.getUTCHours()%12||12,t,2)}function mH(e,t){return te(1+pl.count(zn(e),e),t,3)}function cC(e,t){return te(e.getUTCMilliseconds(),t,3)}function yH(e,t){return cC(e,t)+"000"}function gH(e,t){return te(e.getUTCMonth()+1,t,2)}function bH(e,t){return te(e.getUTCMinutes(),t,2)}function xH(e,t){return te(e.getUTCSeconds(),t,2)}function _H(e){var t=e.getUTCDay();return t===0?7:t}function wH(e,t){return te($r.count(zn(e)-1,e),t,2)}function lC(e){var t=e.getUTCDay();return t>=4||t===0?Ao(e):Ao.ceil(e)}function vH(e,t){return e=lC(e),te(Ao.count(zn(e),e)+(zn(e).getUTCDay()===4),t,2)}function SH(e){return e.getUTCDay()}function IH(e,t){return te(ja.count(zn(e)-1,e),t,2)}function TH(e,t){return te(e.getUTCFullYear()%100,t,2)}function EH(e,t){return e=lC(e),te(e.getUTCFullYear()%100,t,2)}function AH(e,t){return te(e.getUTCFullYear()%1e4,t,4)}function MH(e,t){var n=e.getUTCDay();return e=n>=4||n===0?Ao(e):Ao.ceil(e),te(e.getUTCFullYear()%1e4,t,4)}function NH(){return"+0000"}function rC(){return"%"}function iC(e){return+e}function oC(e){return Math.floor(+e/1e3)}var Ju,tf,uC,Mo,fC;JI({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function JI(e){return Ju=KI(e),tf=Ju.format,uC=Ju.parse,Mo=Ju.utcFormat,fC=Ju.utcParse,Ju}function RH(e){return new Date(e)}function OH(e){return e instanceof Date?+e:+new Date(+e)}function ix(e,t,n,r,i,o,s,a,c,l){var u=Dp(),f=u.invert,d=u.domain,h=l(".%L"),p=l(":%S"),m=l("%I:%M"),g=l("%I %p"),y=l("%a %d"),b=l("%b %d"),x=l("%B"),_=l("%Y");function v(w){return(c(w)<w?h:a(w)<w?p:s(w)<w?m:o(w)<w?g:r(w)<w?i(w)<w?y:b:n(w)<w?x:_)(w)}return u.invert=function(w){return new Date(f(w))},u.domain=function(w){return arguments.length?d(Array.from(w,OH)):d().map(RH)},u.ticks=function(w){var T=d();return e(T[0],T[T.length-1],w??10)},u.tickFormat=function(w,T){return T==null?v:l(T)},u.nice=function(w){var T=d();return(!w||typeof w.range!="function")&&(w=t(T[0],T[T.length-1],w??10)),w?d(Fp(T,w)):u},u.copy=function(){return Io(u,ix(e,t,n,r,i,o,s,a,c,l))},u}function ox(){return He.apply(ix(XI,HI,Un,Ps,Pr,ui,Cs,Fs,ln,tf).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function sx(){return He.apply(ix(WI,qp,zn,$s,$r,pl,Bs,Ls,ln,Mo).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function Gp(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function ax(){var e=0,t=.5,n=1,r=1,i,o,s,a,c,l=xr,u,f=!1,d;function h(m){return isNaN(m=+m)?d:(m=.5+((m=+u(m))-o)*(r*m<r*o?a:c),l(f?Math.max(0,Math.min(1,m)):m))}h.domain=function(m){return arguments.length?([e,t,n]=m,i=u(e=+e),o=u(t=+t),s=u(n=+n),a=i===o?0:.5/(o-i),c=o===s?0:.5/(s-o),r=o<i?-1:1,h):[e,t,n]},h.clamp=function(m){return arguments.length?(f=!!m,h):f},h.interpolator=function(m){return arguments.length?(l=m,h):l};function p(m){return function(g){var y,b,x;return arguments.length?([y,b,x]=g,l=mo(m,[y,b,x]),h):[l(0),l(.5),l(1)]}}return h.range=p(Cr),h.rangeRound=p(Kc),h.unknown=function(m){return arguments.length?(d=m,h):d},function(m){return u=m,i=m(e),o=m(t),s=m(n),a=i===o?0:.5/(o-i),c=o===s?0:.5/(s-o),r=o<i?-1:1,h}}function Wp(){var e=Ds(ax()(xr));return e.copy=function(){return Gp(e,Wp())},Rp.apply(e,arguments)}function cx(){var e=qI(ax()).domain([.1,1,10]);return e.copy=function(){return Gp(e,cx()).base(e.base())},Rp.apply(e,arguments)}function lx(){var e=jI(ax());return e.copy=function(){return Gp(e,lx()).constant(e.constant())},Rp.apply(e,arguments)}function ux(){var e=VI(ax());return e.copy=function(){return Gp(e,ux()).exponent(e.exponent())},Rp.apply(e,arguments)}function G(e){for(var t=e.length/6|0,n=new Array(t),r=0;r<t;)n[r]="#"+e.slice(r*6,++r*6);return n}var tT=G("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");var eT=G("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666");var nT=G("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666");var rT=G("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");var iT=G("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2");var oT=G("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc");var sT=G("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999");var aT=G("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3");var cT=G("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");var lT=G("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");var ht=e=>oS(e[e.length-1]);var fx=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(G),dx=ht(fx);var hx=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(G),px=ht(hx);var mx=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(G),yx=ht(mx);var gx=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(G),bx=ht(gx);var Xp=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(G),ef=ht(Xp);var xx=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(G),_x=ht(xx);var Hp=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(G),nf=ht(Hp);var wx=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(G),vx=ht(wx);var Sx=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(G),Ix=ht(Sx);var Tx=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(G),Ex=ht(Tx);var Ax=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(G),Mx=ht(Ax);var Nx=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(G),Rx=ht(Nx);var Ox=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(G),Dx=ht(Ox);var kx=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(G),Fx=ht(kx);var Lx=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(G),Cx=ht(Lx);var Bx=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(G),Px=ht(Bx);var $x=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(G),Ux=ht($x);var zx=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(G),qx=ht(zx);var jx=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(G),Vx=ht(jx);var Yx=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(G),Gx=ht(Yx);var Wx=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(G),Xx=ht(Wx);var Hx=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(G),Zx=ht(Hx);var Qx=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(G),Kx=ht(Qx);var Jx=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(G),t1=ht(Jx);var e1=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(G),n1=ht(e1);var r1=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(G),i1=ht(r1);var o1=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(G),s1=ht(o1);function a1(e){return e=Math.max(0,Math.min(1,e)),"rgb("+Math.max(0,Math.min(255,Math.round(-4.54-e*(35.34-e*(2381.73-e*(6402.7-e*(7024.72-e*2710.57)))))))+", "+Math.max(0,Math.min(255,Math.round(32.49+e*(170.73+e*(52.82-e*(131.46-e*(176.58-e*67.37)))))))+", "+Math.max(0,Math.min(255,Math.round(81.24+e*(442.36-e*(2482.43-e*(6167.24-e*(6614.94-e*2475.67)))))))+")"}var c1=Ru(Jn(300,.5,0),Jn(-240,.5,1));var u1=Ru(Jn(-100,.75,.35),Jn(80,1.5,.8)),f1=Ru(Jn(260,.75,.35),Jn(80,1.5,.8)),l1=Jn();function d1(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return l1.h=360*e-100,l1.s=1.5-1.5*t,l1.l=.8-.9*t,l1+""}var h1=rn(),DH=Math.PI/3,kH=Math.PI*2/3;function p1(e){var t;return e=(.5-e)*Math.PI,h1.r=255*(t=Math.sin(e))*t,h1.g=255*(t=Math.sin(e+DH))*t,h1.b=255*(t=Math.sin(e+kH))*t,h1+""}function m1(e){return e=Math.max(0,Math.min(1,e)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+e*(1172.33-e*(10793.56-e*(33300.12-e*(38394.49-e*14825.05)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+e*(557.33+e*(1225.33-e*(3574.96-e*(1073.77+e*707.56)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+e*(3211.1-e*(15327.97-e*(27814-e*(22569.18-e*6838.66)))))))+")"}function y1(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}var g1=y1(G("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),b1=y1(G("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),x1=y1(G("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),_1=y1(G("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function Ze(e){return function(){return e}}var uT=Math.cos;var rf=Math.min,Zp=Math.sin,ee=Math.sqrt,fT=1e-12,bl=Math.PI,u4t=bl/2,of=2*bl;function w1(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new La(t)}var p4t=Array.prototype.slice;function v1(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function dC(e){this._context=e}dC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Us(e){return new dC(e)}function S1(e){return e[0]}function I1(e){return e[1]}function Qp(e,t){var n=Ze(!0),r=null,i=Us,o=null,s=w1(a);e=typeof e=="function"?e:e===void 0?S1:Ze(e),t=typeof t=="function"?t:t===void 0?I1:Ze(t);function a(c){var l,u=(c=v1(c)).length,f,d=!1,h;for(r==null&&(o=i(h=s())),l=0;l<=u;++l)!(l<u&&n(f=c[l],l,c))===d&&((d=!d)?o.lineStart():o.lineEnd()),d&&o.point(+e(f,l,c),+t(f,l,c));if(h)return o=null,h+""||null}return a.x=function(c){return arguments.length?(e=typeof c=="function"?c:Ze(+c),a):e},a.y=function(c){return arguments.length?(t=typeof c=="function"?c:Ze(+c),a):t},a.defined=function(c){return arguments.length?(n=typeof c=="function"?c:Ze(!!c),a):n},a.curve=function(c){return arguments.length?(i=c,r!=null&&(o=i(r)),a):i},a.context=function(c){return arguments.length?(c==null?r=o=null:o=i(r=c),a):r},a}function sf(e,t,n){var r=null,i=Ze(!0),o=null,s=Us,a=null,c=w1(l);e=typeof e=="function"?e:e===void 0?S1:Ze(+e),t=typeof t=="function"?t:t===void 0?Ze(0):Ze(+t),n=typeof n=="function"?n:n===void 0?I1:Ze(+n);function l(f){var d,h,p,m=(f=v1(f)).length,g,y=!1,b,x=new Array(m),_=new Array(m);for(o==null&&(a=s(b=c())),d=0;d<=m;++d){if(!(d<m&&i(g=f[d],d,f))===y)if(y=!y)h=d,a.areaStart(),a.lineStart();else{for(a.lineEnd(),a.lineStart(),p=d-1;p>=h;--p)a.point(x[p],_[p]);a.lineEnd(),a.areaEnd()}y&&(x[d]=+e(g,d,f),_[d]=+t(g,d,f),a.point(r?+r(g,d,f):x[d],n?+n(g,d,f):_[d]))}if(b)return a=null,b+""||null}function u(){return Qp().defined(i).curve(s).context(o)}return l.x=function(f){return arguments.length?(e=typeof f=="function"?f:Ze(+f),r=null,l):e},l.x0=function(f){return arguments.length?(e=typeof f=="function"?f:Ze(+f),l):e},l.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Ze(+f),l):r},l.y=function(f){return arguments.length?(t=typeof f=="function"?f:Ze(+f),n=null,l):t},l.y0=function(f){return arguments.length?(t=typeof f=="function"?f:Ze(+f),l):t},l.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Ze(+f),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(f){return arguments.length?(i=typeof f=="function"?f:Ze(!!f),l):i},l.curve=function(f){return arguments.length?(s=f,o!=null&&(a=s(o)),l):s},l.context=function(f){return arguments.length?(f==null?o=a=null:a=s(o=f),l):o},l}var T1=class{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}};function dT(e){return new T1(e,!0)}function hT(e){return new T1(e,!1)}var FH=ee(3),Kp={draw(e,t){let n=ee(t+rf(t/28,.75))*.59436,r=n/2,i=r*FH;e.moveTo(0,n),e.lineTo(0,-n),e.moveTo(-i,-r),e.lineTo(i,r),e.moveTo(-i,r),e.lineTo(i,-r)}};var zs={draw(e,t){let n=ee(t/bl);e.moveTo(n,0),e.arc(0,0,n,0,of)}};var Jp={draw(e,t){let n=ee(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}};var hC=ee(1/3),LH=hC*2,tm={draw(e,t){let n=ee(t/LH),r=n*hC;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}};var em={draw(e,t){let n=ee(t)*.62625;e.moveTo(0,-n),e.lineTo(n,0),e.lineTo(0,n),e.lineTo(-n,0),e.closePath()}};var nm={draw(e,t){let n=ee(t-rf(t/7,2))*.87559;e.moveTo(-n,0),e.lineTo(n,0),e.moveTo(0,n),e.lineTo(0,-n)}};var rm={draw(e,t){let n=ee(t),r=-n/2;e.rect(r,r,n,n)}};var im={draw(e,t){let n=ee(t)*.4431;e.moveTo(n,n),e.lineTo(n,-n),e.lineTo(-n,-n),e.lineTo(-n,n),e.closePath()}};var CH=.8908130915292852,pC=Zp(bl/10)/Zp(7*bl/10),BH=Zp(of/10)*pC,PH=-uT(of/10)*pC,om={draw(e,t){let n=ee(t*CH),r=BH*n,i=PH*n;e.moveTo(0,-n),e.lineTo(r,i);for(let o=1;o<5;++o){let s=of*o/5,a=uT(s),c=Zp(s);e.lineTo(c*n,-a*n),e.lineTo(a*r-c*i,c*r+a*i)}e.closePath()}};var pT=ee(3),sm={draw(e,t){let n=-ee(t/(pT*3));e.moveTo(0,n*2),e.lineTo(-pT*n,-n),e.lineTo(pT*n,-n),e.closePath()}};var $H=ee(3),am={draw(e,t){let n=ee(t)*.6824,r=n/2,i=n*$H/2;e.moveTo(0,-n),e.lineTo(i,r),e.lineTo(-i,r),e.closePath()}};var fi=-.5,di=ee(3)/2,mT=1/ee(12),UH=(mT/2+1)*3,cm={draw(e,t){let n=ee(t/UH),r=n/2,i=n*mT,o=r,s=n*mT+n,a=-o,c=s;e.moveTo(r,i),e.lineTo(o,s),e.lineTo(a,c),e.lineTo(fi*r-di*i,di*r+fi*i),e.lineTo(fi*o-di*s,di*o+fi*s),e.lineTo(fi*a-di*c,di*a+fi*c),e.lineTo(fi*r+di*i,fi*i-di*r),e.lineTo(fi*o+di*s,fi*s-di*o),e.lineTo(fi*a+di*c,fi*c-di*a),e.closePath()}};var af={draw(e,t){let n=ee(t-rf(t/6,1.7))*.6189;e.moveTo(-n,-n),e.lineTo(n,n),e.moveTo(-n,n),e.lineTo(n,-n)}};var E1=[zs,Jp,tm,rm,om,sm,cm],yT=[zs,nm,af,am,Kp,im,em];function hi(){}function cf(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function lm(e){this._context=e}lm.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:cf(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:cf(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function gT(e){return new lm(e)}function mC(e){this._context=e}mC.prototype={areaStart:hi,areaEnd:hi,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:cf(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function bT(e){return new mC(e)}function yC(e){this._context=e}yC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:cf(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function xT(e){return new yC(e)}function gC(e,t){this._basis=new lm(e),this._beta=t}gC.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,n=e.length-1;if(n>0)for(var r=e[0],i=t[0],o=e[n]-r,s=t[n]-i,a=-1,c;++a<=n;)c=a/n,this._basis.point(this._beta*e[a]+(1-this._beta)*(r+c*o),this._beta*t[a]+(1-this._beta)*(i+c*s));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};var _T=function e(t){function n(r){return t===1?new lm(r):new gC(r,t)}return n.beta=function(r){return e(+r)},n}(.85);function lf(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function A1(e,t){this._context=e,this._k=(1-t)/6}A1.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:lf(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:lf(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var wT=function e(t){function n(r){return new A1(r,t)}return n.tension=function(r){return e(+r)},n}(0);function M1(e,t){this._context=e,this._k=(1-t)/6}M1.prototype={areaStart:hi,areaEnd:hi,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:lf(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var vT=function e(t){function n(r){return new M1(r,t)}return n.tension=function(r){return e(+r)},n}(0);function N1(e,t){this._context=e,this._k=(1-t)/6}N1.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:lf(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var ST=function e(t){function n(r){return new N1(r,t)}return n.tension=function(r){return e(+r)},n}(0);function um(e,t,n){var r=e._x1,i=e._y1,o=e._x2,s=e._y2;if(e._l01_a>fT){var a=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,c=3*e._l01_a*(e._l01_a+e._l12_a);r=(r*a-e._x0*e._l12_2a+e._x2*e._l01_2a)/c,i=(i*a-e._y0*e._l12_2a+e._y2*e._l01_2a)/c}if(e._l23_a>fT){var l=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,u=3*e._l23_a*(e._l23_a+e._l12_a);o=(o*l+e._x1*e._l23_2a-t*e._l12_2a)/u,s=(s*l+e._y1*e._l23_2a-n*e._l12_2a)/u}e._context.bezierCurveTo(r,i,o,s,e._x2,e._y2)}function bC(e,t){this._context=e,this._alpha=t}bC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:um(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var IT=function e(t){function n(r){return t?new bC(r,t):new A1(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function xC(e,t){this._context=e,this._alpha=t}xC.prototype={areaStart:hi,areaEnd:hi,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:um(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var TT=function e(t){function n(r){return t?new xC(r,t):new M1(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function _C(e,t){this._context=e,this._alpha=t}_C.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:um(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var ET=function e(t){function n(r){return t?new _C(r,t):new N1(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function wC(e){this._context=e}wC.prototype={areaStart:hi,areaEnd:hi,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function AT(e){return new wC(e)}function vC(e){return e<0?-1:1}function SC(e,t,n){var r=e._x1-e._x0,i=t-e._x1,o=(e._y1-e._y0)/(r||i<0&&-0),s=(n-e._y1)/(i||r<0&&-0),a=(o*i+s*r)/(r+i);return(vC(o)+vC(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(a))||0}function IC(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function MT(e,t,n){var r=e._x0,i=e._y0,o=e._x1,s=e._y1,a=(o-r)/3;e._context.bezierCurveTo(r+a,i+a*t,o-a,s-a*n,o,s)}function R1(e){this._context=e}R1.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:MT(this,this._t0,IC(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,MT(this,IC(this,n=SC(this,e,t)),n);break;default:MT(this,this._t0,n=SC(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function TC(e){this._context=new EC(e)}(TC.prototype=Object.create(R1.prototype)).point=function(e,t){R1.prototype.point.call(this,t,e)};function EC(e){this._context=e}EC.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,o){this._context.bezierCurveTo(t,e,r,n,o,i)}};function NT(e){return new R1(e)}function RT(e){return new TC(e)}function MC(e){this._context=e}MC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=AC(e),i=AC(t),o=0,s=1;s<n;++o,++s)this._context.bezierCurveTo(r[0][o],i[0][o],r[1][o],i[1][o],e[s],t[s]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function AC(e){var t,n=e.length-1,r,i=new Array(n),o=new Array(n),s=new Array(n);for(i[0]=0,o[0]=2,s[0]=e[0]+2*e[1],t=1;t<n-1;++t)i[t]=1,o[t]=4,s[t]=4*e[t]+2*e[t+1];for(i[n-1]=2,o[n-1]=7,s[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=i[t]/o[t-1],o[t]-=r,s[t]-=r*s[t-1];for(i[n-1]=s[n-1]/o[n-1],t=n-2;t>=0;--t)i[t]=(s[t]-i[t+1])/o[t];for(o[n-1]=(e[n]+i[n-1])/2,t=0;t<n-1;++t)o[t]=2*e[t+1]-i[t+1];return[i,o]}function OT(e){return new MC(e)}function O1(e,t){this._context=e,this._t=t}O1.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function DT(e){return new O1(e,.5)}function kT(e){return new O1(e,0)}function FT(e){return new O1(e,1)}var fm=e=>()=>e;function LT(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Ur(e,t,n){this.k=e,this.x=t,this.y=n}Ur.prototype={constructor:Ur,scale:function(e){return e===1?this:new Ur(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ur(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var dm=new Ur(1,0,0);CT.prototype=Ur.prototype;function CT(e){for(;!e.__zoom;)if(!(e=e.parentNode))return dm;return e.__zoom}function D1(e){e.stopImmediatePropagation()}function uf(e){e.preventDefault(),e.stopImmediatePropagation()}function zH(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function qH(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function NC(){return this.__zoom||dm}function jH(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function VH(){return navigator.maxTouchPoints||"ontouchstart"in this}function YH(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s))}function BT(){var e=zH,t=qH,n=YH,r=jH,i=VH,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=fS,l=Gc("start","zoom","end"),u,f,d,h=500,p=150,m=0,g=10;function y(S){S.property("__zoom",NC).on("wheel.zoom",M,{passive:!1}).on("mousedown.zoom",R).on("dblclick.zoom",I).filter(i).on("touchstart.zoom",A).on("touchmove.zoom",O).on("touchend.zoom touchcancel.zoom",F).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(S,E,N,L){var B=S.selection?S.selection():S;B.property("__zoom",NC),S!==B?v(S,E,N,L):B.interrupt().each(function(){w(this,arguments).event(L).start().zoom(null,typeof E=="function"?E.apply(this,arguments):E).end()})},y.scaleBy=function(S,E,N,L){y.scaleTo(S,function(){var B=this.__zoom.k,C=typeof E=="function"?E.apply(this,arguments):E;return B*C},N,L)},y.scaleTo=function(S,E,N,L){y.transform(S,function(){var B=t.apply(this,arguments),C=this.__zoom,P=N==null?_(B):typeof N=="function"?N.apply(this,arguments):N,$=C.invert(P),U=typeof E=="function"?E.apply(this,arguments):E;return n(x(b(C,U),P,$),B,s)},N,L)},y.translateBy=function(S,E,N,L){y.transform(S,function(){return n(this.__zoom.translate(typeof E=="function"?E.apply(this,arguments):E,typeof N=="function"?N.apply(this,arguments):N),t.apply(this,arguments),s)},null,L)},y.translateTo=function(S,E,N,L,B){y.transform(S,function(){var C=t.apply(this,arguments),P=this.__zoom,$=L==null?_(C):typeof L=="function"?L.apply(this,arguments):L;return n(dm.translate($[0],$[1]).scale(P.k).translate(typeof E=="function"?-E.apply(this,arguments):-E,typeof N=="function"?-N.apply(this,arguments):-N),C,s)},L,B)};function b(S,E){return E=Math.max(o[0],Math.min(o[1],E)),E===S.k?S:new Ur(E,S.x,S.y)}function x(S,E,N){var L=E[0]-N[0]*S.k,B=E[1]-N[1]*S.k;return L===S.x&&B===S.y?S:new Ur(S.k,L,B)}function _(S){return[(+S[0][0]+ +S[1][0])/2,(+S[0][1]+ +S[1][1])/2]}function v(S,E,N,L){S.on("start.zoom",function(){w(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).event(L).end()}).tween("zoom",function(){var B=this,C=arguments,P=w(B,C).event(L),$=t.apply(B,C),U=N==null?_($):typeof N=="function"?N.apply(B,C):N,X=Math.max($[1][0]-$[0][0],$[1][1]-$[0][1]),tt=B.__zoom,nt=typeof E=="function"?E.apply(B,C):E,st=c(tt.invert(U).concat(X/tt.k),nt.invert(U).concat(X/nt.k));return function(Y){if(Y===1)Y=nt;else{var rt=st(Y),q=X/rt[2];Y=new Ur(q,U[0]-rt[0]*q,U[1]-rt[1]*q)}P.zoom(null,Y)}})}function w(S,E,N){return!N&&S.__zooming||new T(S,E)}function T(S,E){this.that=S,this.args=E,this.active=0,this.sourceEvent=null,this.extent=t.apply(S,E),this.taps=0}T.prototype={event:function(S){return S&&(this.sourceEvent=S),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(S,E){return this.mouse&&S!=="mouse"&&(this.mouse[1]=E.invert(this.mouse[0])),this.touch0&&S!=="touch"&&(this.touch0[1]=E.invert(this.touch0[0])),this.touch1&&S!=="touch"&&(this.touch1[1]=E.invert(this.touch1[0])),this.that.__zoom=E,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(S){var E=qt(this.that).datum();l.call(S,this.that,new LT(S,{sourceEvent:this.sourceEvent,target:y,type:S,transform:this.that.__zoom,dispatch:l}),E)}};function M(S,...E){if(!e.apply(this,arguments))return;var N=w(this,E).event(S),L=this.__zoom,B=Math.max(o[0],Math.min(o[1],L.k*Math.pow(2,r.apply(this,arguments)))),C=Ln(S);if(N.wheel)(N.mouse[0][0]!==C[0]||N.mouse[0][1]!==C[1])&&(N.mouse[1]=L.invert(N.mouse[0]=C)),clearTimeout(N.wheel);else{if(L.k===B)return;N.mouse=[C,L.invert(C)],yo(this),N.start()}uf(S),N.wheel=setTimeout(P,p),N.zoom("mouse",n(x(b(L,B),N.mouse[0],N.mouse[1]),N.extent,s));function P(){N.wheel=null,N.end()}}function R(S,...E){if(d||!e.apply(this,arguments))return;var N=S.currentTarget,L=w(this,E,!0).event(S),B=qt(S.view).on("mousemove.zoom",U,!0).on("mouseup.zoom",X,!0),C=Ln(S,N),P=S.clientX,$=S.clientY;qh(S.view),D1(S),L.mouse=[C,this.__zoom.invert(C)],yo(this),L.start();function U(tt){if(uf(tt),!L.moved){var nt=tt.clientX-P,st=tt.clientY-$;L.moved=nt*nt+st*st>m}L.event(tt).zoom("mouse",n(x(L.that.__zoom,L.mouse[0]=Ln(tt,N),L.mouse[1]),L.extent,s))}function X(tt){B.on("mousemove.zoom mouseup.zoom",null),jh(tt.view,L.moved),uf(tt),L.event(tt).end()}}function I(S,...E){if(e.apply(this,arguments)){var N=this.__zoom,L=Ln(S.changedTouches?S.changedTouches[0]:S,this),B=N.invert(L),C=N.k*(S.shiftKey?.5:2),P=n(x(b(N,C),L,B),t.apply(this,E),s);uf(S),a>0?qt(this).transition().duration(a).call(v,P,L,S):qt(this).call(y.transform,P,L,S)}}function A(S,...E){if(e.apply(this,arguments)){var N=S.touches,L=N.length,B=w(this,E,S.changedTouches.length===L).event(S),C,P,$,U;for(D1(S),P=0;P<L;++P)$=N[P],U=Ln($,this),U=[U,this.__zoom.invert(U),$.identifier],B.touch0?!B.touch1&&B.touch0[2]!==U[2]&&(B.touch1=U,B.taps=0):(B.touch0=U,C=!0,B.taps=1+!!u);u&&(u=clearTimeout(u)),C&&(B.taps<2&&(f=U[0],u=setTimeout(function(){u=null},h)),yo(this),B.start())}}function O(S,...E){if(this.__zooming){var N=w(this,E).event(S),L=S.changedTouches,B=L.length,C,P,$,U;for(uf(S),C=0;C<B;++C)P=L[C],$=Ln(P,this),N.touch0&&N.touch0[2]===P.identifier?N.touch0[0]=$:N.touch1&&N.touch1[2]===P.identifier&&(N.touch1[0]=$);if(P=N.that.__zoom,N.touch1){var X=N.touch0[0],tt=N.touch0[1],nt=N.touch1[0],st=N.touch1[1],Y=(Y=nt[0]-X[0])*Y+(Y=nt[1]-X[1])*Y,rt=(rt=st[0]-tt[0])*rt+(rt=st[1]-tt[1])*rt;P=b(P,Math.sqrt(Y/rt)),$=[(X[0]+nt[0])/2,(X[1]+nt[1])/2],U=[(tt[0]+st[0])/2,(tt[1]+st[1])/2]}else if(N.touch0)$=N.touch0[0],U=N.touch0[1];else return;N.zoom("touch",n(x(P,$,U),N.extent,s))}}function F(S,...E){if(this.__zooming){var N=w(this,E).event(S),L=S.changedTouches,B=L.length,C,P;for(D1(S),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),C=0;C<B;++C)P=L[C],N.touch0&&N.touch0[2]===P.identifier?delete N.touch0:N.touch1&&N.touch1[2]===P.identifier&&delete N.touch1;if(N.touch1&&!N.touch0&&(N.touch0=N.touch1,delete N.touch1),N.touch0)N.touch0[1]=this.__zoom.invert(N.touch0[0]);else if(N.end(),N.taps===2&&(P=Ln(P,this),Math.hypot(f[0]-P[0],f[1]-P[1])<g)){var $=qt(this).on("dblclick.zoom");$&&$.apply(this,arguments)}}}return y.wheelDelta=function(S){return arguments.length?(r=typeof S=="function"?S:fm(+S),y):r},y.filter=function(S){return arguments.length?(e=typeof S=="function"?S:fm(!!S),y):e},y.touchable=function(S){return arguments.length?(i=typeof S=="function"?S:fm(!!S),y):i},y.extent=function(S){return arguments.length?(t=typeof S=="function"?S:fm([[+S[0][0],+S[0][1]],[+S[1][0],+S[1][1]]]),y):t},y.scaleExtent=function(S){return arguments.length?(o[0]=+S[0],o[1]=+S[1],y):[o[0],o[1]]},y.translateExtent=function(S){return arguments.length?(s[0][0]=+S[0][0],s[1][0]=+S[1][0],s[0][1]=+S[0][1],s[1][1]=+S[1][1],y):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},y.constrain=function(S){return arguments.length?(n=S,y):n},y.duration=function(S){return arguments.length?(a=+S,y):a},y.interpolate=function(S){return arguments.length?(c=S,y):c},y.on=function(){var S=l.on.apply(l,arguments);return S===l?y:S},y.clickDistance=function(S){return arguments.length?(m=(S=+S)*S,y):Math.sqrt(m)},y.tapDistance=function(S){return arguments.length?(g=+S,y):g},y}function Ue(e){return e!=null&&!Number.isNaN(e)}function fn(e,t){return+Ue(t)-+Ue(e)||Ut(e,t)}function xl(e,t){return+Ue(t)-+Ue(e)||Hn(e,t)}function hm(e){return e!=null&&`${e}`!=""}function ff(e){return isFinite(e)?e:NaN}function sr(e){return e>0&&isFinite(e)?e:NaN}function Va(e){return e<0&&isFinite(e)?e:NaN}function df(e,t){if(e instanceof Date||(e=new Date(+e)),isNaN(e))return typeof t=="function"?t(e):t;let n=e.getUTCHours(),r=e.getUTCMinutes(),i=e.getUTCSeconds(),o=e.getUTCMilliseconds();return`${GH(e.getUTCFullYear(),4)}-${qs(e.getUTCMonth()+1,2)}-${qs(e.getUTCDate(),2)}${n||r||i||o?`T${qs(n,2)}:${qs(r,2)}${i||o?`:${qs(i,2)}${o?`.${qs(o,3)}`:""}`:""}Z`:""}`}function GH(e){return e<0?`-${qs(-e,6)}`:e>9999?`+${qs(e,6)}`:qs(e,4)}function qs(e,t){return`${e}`.padStart(t,"0")}var WH=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function pm(e,t){return WH.test(e+="")?new Date(e):typeof t=="function"?t(e):t}var pf=1e3,Ga=pf*60,Wa=Ga*60,Ro=Wa*24,No=Ro*7,_l=Ro*30,Ya=Ro*365,PT=[["millisecond",1],["2 milliseconds",2],["5 milliseconds",5],["10 milliseconds",10],["20 milliseconds",20],["50 milliseconds",50],["100 milliseconds",100],["200 milliseconds",200],["500 milliseconds",500],["second",pf],["5 seconds",5*pf],["15 seconds",15*pf],["30 seconds",30*pf],["minute",Ga],["5 minutes",5*Ga],["15 minutes",15*Ga],["30 minutes",30*Ga],["hour",Wa],["3 hours",3*Wa],["6 hours",6*Wa],["12 hours",12*Wa],["day",Ro],["2 days",2*Ro],["week",No],["2 weeks",2*No],["month",_l],["3 months",3*_l],["6 months",6*_l],["year",Ya],["2 years",2*Ya],["5 years",5*Ya],["10 years",10*Ya],["20 years",20*Ya],["50 years",50*Ya],["100 years",100*Ya]],$T=new Map([["second",pf],["minute",Ga],["hour",Wa],["day",Ro],["monday",No],["tuesday",No],["wednesday",No],["thursday",No],["friday",No],["saturday",No],["sunday",No],["week",No],["month",_l],["year",Ya]]),OC=new Map([["second",ln],["minute",Fs],["hour",Cs],["day",ui],["monday",qa],["tuesday",Zb],["wednesday",Qb],["thursday",Eo],["friday",Kb],["saturday",Jb],["sunday",Pr],["week",Pr],["month",Ps],["year",Un]]),UT=new Map([["second",ln],["minute",Ls],["hour",Bs],["day",ml],["monday",ja],["tuesday",tx],["wednesday",ex],["thursday",Ao],["friday",nx],["saturday",rx],["sunday",$r],["week",$r],["month",$s],["year",zn]]),mf=Symbol("intervalDuration"),F1=Symbol("intervalType");for(let[e,t]of OC)t[mf]=$T.get(e),t[F1]="time";for(let[e,t]of UT)t[mf]=$T.get(e),t[F1]="utc";var mm=[["year",zn,"utc"],["month",$s,"utc"],["day",ml,"utc",6*_l],["hour",Bs,"utc",3*Ro],["minute",Ls,"utc",6*Wa],["second",ln,"utc",30*Ga]],k1=[["year",Un,"time"],["month",Ps,"time"],["day",ui,"time",6*_l],["hour",Cs,"time",3*Ro],["minute",Fs,"time",6*Wa],["second",ln,"time",30*Ga]],XH=[mm[0],k1[0],mm[1],k1[1],mm[2],k1[2],...mm.slice(3)];function L1(e){let t=`${e}`.toLowerCase();t.endsWith("s")&&(t=t.slice(0,-1));let n=1,r=/^(?:(\d+)\s+)/.exec(t);switch(r&&(t=t.slice(r[0].length),n=+r[1]),t){case"quarter":t="month",n*=3;break;case"half":t="month",n*=6;break}let i=UT.get(t);if(!i)throw new Error(`unknown interval: ${e}`);if(n>1&&!i.every)throw new Error(`non-periodic interval: ${t}`);return[t,n]}function zT(e){return DC(L1(e),"time")}function ym(e){return DC(L1(e),"utc")}function DC([e,t],n){let r=(n==="time"?OC:UT).get(e);return t>1&&(r=r.every(t),r[mf]=$T.get(e)*t,r[F1]=n),r}function qT(e,t){if(!(t>1))return;let n=e[mf];if(!PT.some(([,i])=>i===n)||n%Ro===0&&Ro<n&&n<_l)return;let[r]=PT[_s(([,i])=>Math.log(i)).center(PT,Math.log(n*t))];return(e[F1]==="time"?zT:ym)(r)}function RC(e,t,n){let r=t==="time"?tf:Mo;if(n==null)return r(e==="year"?"%Y":e==="month"?"%Y-%m":e==="day"?"%Y-%m-%d":e==="hour"||e==="minute"?"%Y-%m-%dT%H:%M":e==="second"?"%Y-%m-%dT%H:%M:%S":"%Y-%m-%dT%H:%M:%S.%L");let i=HH(n);switch(e){case"millisecond":return hf(r(".%L"),r(":%M:%S"),i);case"second":return hf(r(":%S"),r("%-I:%M"),i);case"minute":return hf(r("%-I:%M"),r("%p"),i);case"hour":return hf(r("%-I %p"),r("%b %-d"),i);case"day":return hf(r("%-d"),r("%b"),i);case"month":return hf(r("%b"),r("%Y"),i);case"year":return r("%Y")}throw new Error("unable to format time ticks")}function HH(e){return e==="left"||e==="right"?(t,n)=>`
11
12
  ${t}
12
13
  ${n}`:e==="top"?(t,n)=>`${n}
13
14
  ${t}`:(t,n)=>`${t}
14
- ${n}`}function OH(e){return e==="time"?z1:e==="utc"?am:NH}function bk(e,t,n){let r=Ut(B0(t,(i,o)=>Math.abs(o-i)));if(r<1e3)return mk("millisecond","utc",n);for(let[i,o,s,a]of OH(e)){if(r>a||i==="hour"&&!r)break;if(t.every(c=>o.floor(c)>=c))return mk(i,s,n)}}function ff(e,t,n){return(r,i,o)=>{let s=e(r,i),a=t(r,i),c=i-zs(o);return i!==c&&o[c]!==void 0&&a===t(o[c],c)?s:n(s,a)}}var xl=Object.getPrototypeOf(Uint8Array),kH=Object.prototype.toString,ST=Symbol("reindex");function dt(e,t,n){let r=typeof t;return r==="string"?xk(e,IT(t),n):r==="function"?xk(e,t,n):r==="number"||t instanceof Date||r==="boolean"?Yt(e,pn(t),n):typeof t?.transform=="function"?_k(t.transform(e),n):FH(_k(t,n),e?.[ST])}function FH(e,t){return t?um(e,t):e}function xk(e,t,n){return Yt(e,n?.prototype instanceof xl?DH(t):t,n)}function _k(e,t){return t===void 0?je(e):e instanceof t?e:t.prototype instanceof xl&&!(e instanceof xl)?t.from(e,TT):t.from(e)}function DH(e){return(t,n)=>TT(e(t,n))}var Wa=[null],IT=e=>t=>t[e],Ie={transform:ir},W={transform:e=>e};var lm=()=>1,wk=()=>!0,ze=e=>e==null?e:`${e}`,It=e=>e==null?e:+e;var js=e=>e?e[0]:void 0,Xa=e=>e?e[1]:void 0,vk=e=>e?e[2]:void 0,pn=e=>()=>e;function pf(e){let t=+`${e}`.slice(1)/100;return(n,r)=>Hn(n,t,r)}function Qe(e){return e instanceof xl?e:Yt(e,TT,Float64Array)}function TT(e){return e==null?NaN:Number(e)}function Sk(e){return Yt(e,ET)}function ET(e){return e instanceof Date&&!isNaN(e)?e:typeof e=="string"?Uc(e):e==null||isNaN(e=+e)?void 0:new Date(e)}function Ne(e,t){return e===void 0&&(e=t),e===null?[void 0,"none"]:Za(e)?[void 0,e]:[e,void 0]}function ie(e,t){return e===void 0&&(e=t),e===null||typeof e=="number"?[void 0,e]:[e,void 0]}function AT(e,t,n){if(e!=null)return Ze(e,t,n)}function Ze(e,t,n){let r=`${e}`.toLowerCase();if(!n.includes(r))throw new Error(`invalid ${t}: ${e}`);return r}function je(e){return e==null||e instanceof Array||e instanceof xl?e:Array.from(e)}function Yt(e,t,n=Array){return e==null?e:e instanceof n?e.map(t):n.from(e,t)}function Ha(e,t=Array){return e instanceof t?e.slice():t.from(e)}function MT({x:e,x1:t,x2:n}){return e!==void 0||t!==void 0||n!==void 0}function NT({y:e,y1:t,y2:n}){return e!==void 0||t!==void 0||n!==void 0}function mf(e){return MT(e)||NT(e)||e.interval!==void 0}function mn(e){return e?.toString===kH}function Lo(e){return mn(e)&&(e.type!==void 0||e.domain!==void 0)}function qr(e){return mn(e)&&typeof e.transform!="function"}function Co(e){return qr(e)&&e.value===void 0&&e.channel===void 0}function RT(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?[js,Xa]:[e,t]}function jn({z:e,fill:t,stroke:n}={}){return e===void 0&&([e]=Ne(t)),e===void 0&&([e]=Ne(n)),e}function ir(e){let t=e.length,n=new Uint32Array(t);for(let r=0;r<t;++r)n[r]=r;return n}function um(e,t){return Yt(t,n=>e[n],e.constructor)}function yf(e){return e.length===1?(t,n)=>e(um(n,t)):e}function qs(e,t,n){return e.subarray?e.subarray(t,n):e.slice(t,n)}function Vs(e){return e!==null&&typeof e=="object"?e.valueOf():e}function V1(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 yn(e){let t;return[{transform:()=>t,label:Fn(e)},n=>t=n]}function kn(e){return e==null?[e]:yn(e)}function Fn(e,t){return typeof e=="string"?e:e&&e.label!==void 0?e.label:t}function gf(e,t){return{transform(n){let r=e.transform(n),i=t.transform(n);return Re(r)||Re(i)?Yt(r,(o,s)=>new Date((+r[s]+ +i[s])/2)):Yt(r,(o,s)=>(+r[s]+ +i[s])/2,Float64Array)},label:e.label}}function _l(e,t){let n=OT(t?.interval,t?.type);return n?Yt(e,n):e}function OT(e,t){let n=bf(e,t);return n&&(r=>Ue(r)?n.floor(r):r)}function bf(e,t){if(e!=null){if(typeof e=="number"){0<e&&e<1&&Number.isInteger(1/e)&&(e=-1/e);let n=Math.abs(e);return e<0?{floor:r=>Math.floor(r*n)/n,offset:r=>(r*n+1)/n,range:(r,i)=>$e(Math.ceil(r*n),i*n).map(o=>o/n)}:{floor:r=>Math.floor(r/n)*n,offset:r=>r+n,range:(r,i)=>$e(Math.ceil(r/n),i/n).map(o=>o*n)}}if(typeof e=="string")return(t==="time"?wT:cm)(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 Bo(e,t){if(e=bf(e,t),e&&typeof e.range!="function")throw new Error("invalid interval: missing range method");return e}function Ik(e,t){if(e=Bo(e,t),e&&typeof e.ceil!="function")throw new Error("invalid interval: missing ceil method");return e}function Tk(e){return Qa(e)&&typeof e?.floor=="function"&&e.floor()instanceof Date}function Qa(e){return typeof e?.range=="function"}function mi(e){return e===void 0||qr(e)?e:{value:e}}function Ek(e){return e==null?null:{transform:t=>dt(t,e,Float64Array),label:Fn(e)}}function Ak(e){if(!or(e))return!1;for(let t of e)if(t!=null)return typeof t=="object"&&"0"in t&&"1"in t}function or(e){return e&&typeof e[Symbol.iterator]=="function"}function Y1(e){for(let t of e)if(t!=null)return typeof t!="object"||t instanceof Date}function Te(e){for(let t of e){if(t==null)continue;let n=typeof t;return n==="string"||n==="boolean"}}function Re(e){for(let t of e)if(t!=null)return t instanceof Date}function Mk(e){for(let t of e)if(t!=null)return typeof t=="string"&&isNaN(t)&&Uc(t)}function Nk(e){for(let t of e)if(t!=null){if(typeof t!="string")return!1;if(t.trim())return!isNaN(t)}}function Ys(e){for(let t of e)if(t!=null)return typeof t=="number"}function G1(e,t){let n;for(let r of e)if(r!=null){if(!t(r))return!1;n=!0}return n}var LH=new Set("none,currentcolor,transparent,aliceblue,antiquewhite,aqua,aquamarine,azure,beige,bisque,black,blanchedalmond,blue,blueviolet,brown,burlywood,cadetblue,chartreuse,chocolate,coral,cornflowerblue,cornsilk,crimson,cyan,darkblue,darkcyan,darkgoldenrod,darkgray,darkgreen,darkgrey,darkkhaki,darkmagenta,darkolivegreen,darkorange,darkorchid,darkred,darksalmon,darkseagreen,darkslateblue,darkslategray,darkslategrey,darkturquoise,darkviolet,deeppink,deepskyblue,dimgray,dimgrey,dodgerblue,firebrick,floralwhite,forestgreen,fuchsia,gainsboro,ghostwhite,gold,goldenrod,gray,green,greenyellow,grey,honeydew,hotpink,indianred,indigo,ivory,khaki,lavender,lavenderblush,lawngreen,lemonchiffon,lightblue,lightcoral,lightcyan,lightgoldenrodyellow,lightgray,lightgreen,lightgrey,lightpink,lightsalmon,lightseagreen,lightskyblue,lightslategray,lightslategrey,lightsteelblue,lightyellow,lime,limegreen,linen,magenta,maroon,mediumaquamarine,mediumblue,mediumorchid,mediumpurple,mediumseagreen,mediumslateblue,mediumspringgreen,mediumturquoise,mediumvioletred,midnightblue,mintcream,mistyrose,moccasin,navajowhite,navy,oldlace,olive,olivedrab,orange,orangered,orchid,palegoldenrod,palegreen,paleturquoise,palevioletred,papayawhip,peachpuff,peru,pink,plum,powderblue,purple,rebeccapurple,red,rosybrown,royalblue,saddlebrown,salmon,sandybrown,seagreen,seashell,sienna,silver,skyblue,slateblue,slategray,slategrey,snow,springgreen,steelblue,tan,teal,thistle,tomato,turquoise,violet,wheat,white,whitesmoke,yellow".split(","));function Za(e){return typeof e!="string"?!1:(e=e.toLowerCase().trim(),/^#[0-9a-f]{3,8}$/.test(e)||/^(?:url|var|rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix)\(.*\)$/.test(e)||LH.has(e))}function Rk(e){return typeof e=="number"&&(0<=e&&e<=1||isNaN(e))}function ne(e){return e==null||Gs(e)}function Gs(e){return/^\s*none\s*$/i.test(e)}function Ok(e){return/^\s*round\s*$/i.test(e)}function W1(e,t){return AT(e,t,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function Po(e="middle"){return W1(e,"frameAnchor")}function zs(e){if(e==null)return;let t=e[0],n=e[e.length-1];return Wn(t,n)}function kk(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 CH(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 fm(e){return or(e)?CH(e):e}var yi=Symbol("position"),Vr=Symbol("color"),wl=Symbol("radius"),vl=Symbol("length"),Sl=Symbol("opacity"),xf=Symbol("symbol"),Fk=Symbol("projection"),ue=new Map([["x",yi],["y",yi],["fx",yi],["fy",yi],["r",wl],["color",Vr],["opacity",Sl],["symbol",xf],["length",vl],["projection",Fk]]);function Dk(e){return e===yi||e===Fk}function Lk(e){return e===yi||e===wl||e===vl||e===Sl}var kT=Math.sqrt(3),FT=2/kT,BH={draw(e,t){let n=Math.sqrt(t/Math.PI),r=n*FT,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()}},DT=new Map([["asterisk",Yp],["circle",Us],["cross",Gp],["diamond",Wp],["diamond2",Xp],["hexagon",BH],["plus",Hp],["square",Qp],["square2",Zp],["star",Kp],["times",sf],["triangle",Jp],["triangle2",tm],["wye",em]]);function LT(e){return e&&typeof e.draw=="function"}function Ck(e){return LT(e)?!0:typeof e!="string"?!1:DT.has(e.toLowerCase())}function _f(e){if(e==null||LT(e))return e;let t=DT.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid symbol: ${e}`)}function Bk(e){if(e==null||LT(e))return[void 0,e];if(typeof e=="string"){let t=DT.get(`${e}`.toLowerCase());if(t)return[void 0,t]}return[e,void 0]}function gn({filter:e,sort:t,reverse:n,transform:r,initializer:i,...o}={},s){if(r===void 0&&(e!=null&&(r=PT(e)),t!=null&&!Co(t)&&(r=CT(r,UT(t))),n&&(r=CT(r,$T))),s!=null&&i!=null)throw new Error("transforms cannot be applied after initializers");return{...o,...(t===null||Co(t))&&{sort:t},transform:CT(r,s)}}function ve({filter:e,sort:t,reverse:n,initializer:r,...i}={},o){return r===void 0&&(e!=null&&(r=PT(e)),t!=null&&!Co(t)&&(r=BT(r,UT(t))),n&&(r=BT(r,$T))),{...i,...(t===null||Co(t))&&{sort:t},initializer:BT(r,o)}}function CT(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,je(n),r,i)}}function BT(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 X1(e,t){return(e.initializer!=null?ve:gn)(e,t)}function Pk(e,t){return X1(t,PT(e))}function PT(e){return(t,n)=>{let r=dt(t,e);return{data:t,facets:n.map(i=>i.filter(o=>r[o]))}}}function $k({sort:e,...t}={}){return{...X1(t,$T),sort:Co(e)?e:null}}function $T(e,t){return{data:e,facets:t.map(n=>n.slice().reverse())}}function Uk({seed:e,sort:t,...n}={}){return{...X1(n,zk(e==null?Math.random:al(e))),sort:Co(t)?t:null}}function H1(e,{sort:t,...n}={}){return{...(qr(e)&&e.channel!==void 0?ve:X1)(n,UT(e)),sort:Co(t)?t:null}}function UT(e){return(typeof e=="function"&&e.length!==1?PH:zk)(e)}function PH(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 zk(e){let t,n;({channel:t,value:e,order:n}={...mi(e)});let r=t?.startsWith("-");if(r&&(t=t.slice(1)),n===void 0&&(n=r?gl:hn),typeof n!="function")switch(`${n}`.toLowerCase()){case"ascending":n=hn;break;case"descending":n=gl;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 hm(e,t){return Q1(null,null,e,t)}function Ja(e={y:"count"},t={}){let{x:n=W}=t;if(n==null)throw new Error("missing channel: x");return Q1(n,null,e,t)}function tc(e={x:"count"},t={}){let{y:n=W}=t;if(n==null)throw new Error("missing channel: y");return Q1(null,n,e,t)}function pm(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 Q1(n,r,e,t)}function Q1(e,t,{data:n=J1,filter:r,sort:i,reverse:o,...s}={},a={}){s=jT(s,a),n=Gk(n,W),i=i==null?void 0:Vk("sort",i,a),r=r==null?void 0:Yk("filter",r,a);let[c,l]=kn(e),[u,f]=kn(t),{z:d,fill:h,stroke:p,x1:y,x2:g,y1:m,y2:b,...x}=a,[_,v]=kn(d),[w]=Ne(h),[T]=Ne(p),[M,R]=kn(w),[I,E]=kn(T);return{..."z"in a&&{z:_||d},..."fill"in a&&{fill:M||h},..."stroke"in a&&{stroke:I||p},...gn(x,(O,F,S)=>{let A=_l(dt(O,e),S?.x),N=_l(dt(O,t),S?.y),D=dt(O,d),B=dt(O,w),C=dt(O,T),P=mm(s,{z:D,fill:B,stroke:C}),$=[],U=[],X=A&&l([]),tt=N&&f([]),nt=D&&v([]),st=B&&R([]),Y=C&&E([]),rt=0;for(let j of s)j.initialize(O);i&&i.initialize(O),r&&r.initialize(O);for(let j of F){let H=[];for(let ot of s)ot.scope("facet",j);i&&i.scope("facet",j),r&&r.scope("facet",j);for(let[ot,z]of Ka(j,P))for(let[Nt,lt]of Ka(z,N))for(let[Wt,Xt]of Ka(lt,A)){let et={data:O};if(A&&(et.x=Wt),N&&(et.y=Nt),!(r&&!r.reduce(Xt,et))){H.push(rt++),U.push(n.reduceIndex(Xt,O,et)),A&&X.push(Wt),N&&tt.push(Nt),D&&nt.push(P===D?ot:D[Xt[0]]),B&&st.push(P===B?ot:B[Xt[0]]),C&&Y.push(P===C?ot:C[Xt[0]]);for(let oe of s)oe.reduce(Xt,et);i&&i.reduce(Xt,et)}}$.push(H)}return qT($,i,o),{data:U,facets:$}}),...!$o(s,"x")&&(c?{x:c}:{x1:y,x2:g}),...!$o(s,"y")&&(u?{y:u}:{y1:m,y2:b}),...Object.fromEntries(s.map(({name:O,output:F})=>[O,F]))}}function $o(e,...t){for(let{name:n}of e)if(t.includes(n))return!0;return!1}function zT(e,t,n=Z1){let r=Object.entries(e);return t.title!=null&&e.title===void 0&&r.push(["title",VH]),t.href!=null&&e.href===void 0&&r.push(["href",t_]),r.filter(([,i])=>i!==void 0).map(([i,o])=>o===null?$H(i):n(i,o,t))}function Z1(e,t,n,r=K1){let i;mn(t)&&"reduce"in t&&(i=t.scale,t=t.reduce);let o=r(e,t,n),[s,a]=yn(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 $H(e){return{name:e,initialize(){},scope(){},reduce(){}}}function K1(e,t,n,r=wf){let i=V1(e,n),o=r(t,i),s,a;return{label:Fn(o===dm?null:i,o.label),initialize(c){s=i===void 0?c:dt(c,i),o.scope==="data"&&(a=o.reduceIndex(ir(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 Ka(e,t){return t?mo(cn(e,n=>t[n]),js):[[,e]]}function wf(e,t,n=UH){if(e==null)return n(e);if(typeof e.reduceIndex=="function")return e;if(typeof e.reduce=="function"&&mn(e))return jH(e);if(typeof e=="function")return qH(e);if(/^p\d{2}$/i.test(e))return Ws(pf(e));switch(`${e}`.toLowerCase()){case"first":return t_;case"last":return YH;case"identity":return J1;case"count":return dm;case"distinct":return GH;case"sum":return t==null?dm:WH;case"proportion":return qk(t,"data");case"proportion-facet":return qk(t,"facet");case"deviation":return Ws(ii);case"min":return Ws(ae);case"min-index":return Ws(D0);case"max":return Ws(Ut);case"max-index":return Ws(F0);case"mean":return jk(vs);case"median":return jk(zi);case"variance":return Ws(Aa);case"mode":return Ws(Su)}return n(e)}function UH(e){throw new Error(`invalid reduce: ${e}`)}function jT(e,t){return zT(e,t,Vk)}function Vk(e,t,n){return Z1(e,t,n,Yk)}function Yk(e,t,n){return K1(e,t,n,Gk)}function Gk(e,t){return wf(e,t,zH)}function zH(e){switch(`${e}`.toLowerCase()){case"x":return XH;case"y":return HH}throw new Error(`invalid group reduce: ${e}`)}function mm(e,t){for(let n in t){let r=t[n];if(r!==void 0&&!e.some(i=>i.name===n))return r}}function qT(e,t,n){if(t){let r=t.output.transform(),i=(o,s)=>hn(r[o],r[s]);e.forEach(o=>o.sort(i))}n&&e.forEach(r=>r.reverse())}function jH(e){return console.warn("deprecated reduce interface; implement reduceIndex instead."),{...e,reduceIndex:e.reduce.bind(e)}}function qH(e){return{reduceIndex(t,n,r){return e(um(n,t),r)}}}function Ws(e){return{reduceIndex(t,n){return e(t,r=>n[r])}}}function jk(e){return{reduceIndex(t,n){let r=e(t,i=>n[i]);return Re(n)?new Date(r):r}}}var J1={reduceIndex(e,t){return um(t,e)}},t_={reduceIndex(e,t){return t[e[0]]}},VH={reduceIndex(e,t){let r=mo(Ui(e,o=>o.length,o=>t[o]),Xa),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`,Mn(o,Xa)]}return i.map(([o,s])=>`${o} (${s.toLocaleString("en-US")})`).join(`
15
- `)}},YH={reduceIndex(e,t){return t[e[e.length-1]]}},dm={label:"Frequency",reduceIndex(e){return e.length}},GH={label:"Distinct",reduceIndex(e,t){let n=new Cr;for(let r of e)n.add(t[r]);return n.size}},WH=Ws(Mn);function qk(e,t){return e==null?{scope:t,label:"Frequency",reduceIndex:(n,r,i=1)=>n.length/i}:{scope:t,reduceIndex:(n,r,i=1)=>Mn(n,o=>r[o])/i}}var XH={reduceIndex(e,t,{x:n}){return n}},HH={reduceIndex(e,t,{y:n}){return n}};function Wk(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 vf(e,{scale:t,type:n,value:r,filter:i,hint:o,label:s=Fn(r)},a){return o===void 0&&typeof r?.transform=="function"&&(o=r.hint),YT(a,{scale:t,type:n,value:dt(e,r),label:s,filter:i,hint:o})}function e_(e,t){return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,vf(t,r,n)]))}function Sf(e,t){let n=Object.fromEntries(Object.entries(e).map(([r,{scale:i,value:o}])=>{let s=i==null?null:t[i];return[r,s==null?o:Yt(o,s)]}));return n.channels=e,n}function YT(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&&G1(r,Za)?null:"color";break;case"fillOpacity":case"strokeOpacity":case"opacity":t.scale=n!==!0&&G1(r,Rk)?null:"opacity";break;case"symbol":n!==!0&&G1(r,Ck)?(t.scale=null,t.value=Yt(r,_f)):t.scale="symbol";break;default:t.scale=ue.has(e)?e:null;break}else if(n===!1)t.scale=null;else if(n!=null&&!ue.has(n))throw new Error(`unknown scale: ${n}`);return t}function Hk(e,t,n,r,i){let{order:o,reverse:s,reduce:a=!0,limit:c}=i;for(let l in i){if(!ue.has(l))continue;let{value:u,order:f=o,reverse:d=s,reduce:h=a,limit:p=c}=mi(i[l]),y=u?.startsWith("-");if(y&&(u=u.slice(1)),f=f===void 0?y!==(u==="width"||u==="height")?Zk:Qk:KH(f),h==null||h===!1)continue;let g=l==="fx"||l==="fy"?ZH(t,r[l]):QH(n,l);if(!g)throw new Error(`missing channel for scale: ${l}`);let m=g.value,[b=0,x=1/0]=or(p)?p:p<0?[p]:[0,p];if(u==null)g.domain=()=>{let _=Array.from(new Cr(m));return d&&(_=_.reverse()),(b!==0||x!==1/0)&&(_=_.slice(b,x)),_};else{let _=u==="data"?e:u==="height"?Xk(n,"y1","y2"):u==="width"?Xk(n,"x1","x2"):VT(n,u,u==="y"?"y2":u==="x"?"x2":void 0),v=wf(h===!0?"max":h,_);g.domain=()=>{let w=_2(ir(m),T=>v.reduceIndex(T,_),T=>m[T]);return f&&w.sort(f),d&&w.reverse(),(b!==0||x!==1/0)&&(w=w.slice(b,x)),w.map(js)}}}}function QH(e,t){for(let n in e){let r=e[n];if(r.scale===t)return r}}function ZH(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 Xk(e,t,n){let r=VT(e,t),i=VT(e,n);return Yt(i,(o,s)=>Math.abs(o-r[s]),Float64Array)}function VT(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 KH(e){if(e==null||typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"ascending":return Qk;case"descending":return Zk}throw new Error(`invalid order: ${e}`)}function Qk([e,t],[n,r]){return hn(t,r)||hn(e,n)}function Zk([e,t],[n,r]){return gl(t,r)||hn(e,n)}function ym(e,t){let n=e[t];if(n){for(;n.source;)n=n.source;return n.source===null?null:n}}function n_(e){let t,n;return(...r)=>((n?.length!==r.length||n.some((i,o)=>i!==r[o]))&&(n=r,t=e(...r)),t)}var JH=n_(e=>new Intl.NumberFormat(e)),tQ=n_((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{month:t}})),eQ=n_((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{weekday:t}}));function nQ(e="en-US"){let t=JH(e);return n=>n!=null&&!isNaN(n)?t.format(n):void 0}function Kk(e="en-US",t="short"){let n=tQ(e,t);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2e3,+r)))?n.format(r):void 0}function Jk(e="en-US",t="short"){let n=eQ(e,t);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2001,0,+r)))?n.format(r):void 0}function GT(e){return yu(e,"Invalid Date")}function rQ(e="en-US"){let t=nQ(e);return n=>(n instanceof Date?GT:typeof n=="number"?t:ze)(n)}var Yi=rQ();var WT=0,XT;function t8(){let e=WT;return WT=0,XT=void 0,e}function qn(e){e!==XT&&(XT=e,console.warn(e),++WT)}var Oe=(typeof window<"u"?window.devicePixelRatio>1:typeof it>"u")?0:.5,iQ=0;function r_(){return`plot-clip-${++iQ}`}function i_(e,{title:t,href:n,ariaLabel:r,ariaDescription:i,ariaHidden:o,target:s,fill:a,fillOpacity:c,stroke:l,strokeWidth:u,strokeOpacity:f,strokeLinejoin:d,strokeLinecap:h,strokeMiterlimit:p,strokeDasharray:y,strokeDashoffset:g,opacity:m,mixBlendMode:b,imageFilter:x,paintOrder:_,pointerEvents:v,shapeRendering:w,channels:T},{ariaLabel:M,fill:R="currentColor",fillOpacity:I,stroke:E="none",strokeOpacity:O,strokeWidth:F,strokeLinecap:S,strokeLinejoin:A,strokeMiterlimit:N,paintOrder:D}){R===null&&(a=null,c=null),E===null&&(l=null,f=null),ne(R)?!ne(E)&&(!ne(a)||T?.fill)&&(E="none"):ne(E)&&(!ne(l)||T?.stroke)&&(R="none");let[B,C]=Ne(a,R),[P,$]=ie(c,I),[U,X]=Ne(l,E),[tt,nt]=ie(f,O),[st,Y]=ie(m);Gs(X)||(u===void 0&&(u=F),h===void 0&&(h=S),d===void 0&&(d=A),p===void 0&&!Ok(d)&&(p=N),!Gs(C)&&_===void 0&&(_=D));let[rt,j]=ie(u);return R!==null&&(e.fill=ce(C,"currentColor"),e.fillOpacity=gm($,1)),E!==null&&(e.stroke=ce(X,"none"),e.strokeWidth=gm(j,1),e.strokeOpacity=gm(nt,1),e.strokeLinejoin=ce(d,"miter"),e.strokeLinecap=ce(h,"butt"),e.strokeMiterlimit=gm(p,4),e.strokeDasharray=ce(y,"none"),e.strokeDashoffset=ce(g,"0")),e.target=ze(s),e.ariaLabel=ze(M),e.ariaDescription=ze(i),e.ariaHidden=ze(o),e.opacity=gm(Y,1),e.mixBlendMode=ce(b,"normal"),e.imageFilter=ce(x,"none"),e.paintOrder=ce(_,"normal"),e.pointerEvents=ce(v,"auto"),e.shapeRendering=ce(w,"auto"),{title:{value:t,optional:!0,filter:null},href:{value:n,optional:!0,filter:null},ariaLabel:{value:r,optional:!0,filter:null},fill:{value:B,scale:"auto",optional:!0},fillOpacity:{value:P,scale:"auto",optional:!0},stroke:{value:U,scale:"auto",optional:!0},strokeOpacity:{value:tt,scale:"auto",optional:!0},strokeWidth:{value:rt,optional:!0},opacity:{value:st,scale:"auto",optional:!0}}}function oQ(e,t){t&&e.filter(n=>sm(t[n])).append("title").call(aQ,t)}function sQ(e,t){t&&e.filter(([n])=>sm(t[n])).append("title").call(cQ,t)}function aQ(e,t){t&&e.text(n=>Yi(t[n]))}function cQ(e,t){t&&e.text(([n])=>Yi(t[n]))}function Qt(e,{target:t,tip:n},{ariaLabel:r,title:i,fill:o,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:l,opacity:u,href:f}){r&&ct(e,"aria-label",d=>r[d]),o&&ct(e,"fill",d=>o[d]),s&&ct(e,"fill-opacity",d=>s[d]),a&&ct(e,"stroke",d=>a[d]),c&&ct(e,"stroke-opacity",d=>c[d]),l&&ct(e,"stroke-width",d=>l[d]),u&&ct(e,"opacity",d=>u[d]),f&&e8(e,d=>f[d],t),n||oQ(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&&ct(e,"aria-label",([d])=>r[d]),o&&ct(e,"fill",([d])=>o[d]),s&&ct(e,"fill-opacity",([d])=>s[d]),a&&ct(e,"stroke",([d])=>a[d]),c&&ct(e,"stroke-opacity",([d])=>c[d]),l&&ct(e,"stroke-width",([d])=>l[d]),u&&ct(e,"opacity",([d])=>u[d]),f&&e8(e,([d])=>f[d],t),n||sQ(e,i)}function lQ({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 bm(e,t,n){let r=cn(e,i=>t[i]);return n===void 0&&r.size>1+e.length>>1&&qn("Warning: the implicit z channel has high cardinality. This may occur when the fill or stroke channel is associated with quantitative data rather than ordinal or categorical data. You can suppress this warning by setting the z option explicitly; if this data represents a single series, set z to null."),r.values()}function*o_(e,t,n,r){let{z:i}=n,{z:o}=r,s=lQ(r,n),a=[...t,...s];for(let c of o?bm(e,o,i):[e]){let l,u;t:for(let f of c){for(let d of a)if(!Ue(d[f])){u&&u.push(-1);continue t}if(l===void 0){u&&(yield u),l=s.map(d=>Vs(d[f])),u=[f];continue}u.push(f);for(let d=0;d<s.length;++d)if(Vs(s[d][f])!==l[d]){yield u,l=s.map(p=>Vs(p[f])),u=[f];continue t}}u&&(yield u)}}function s_(e){return e===!0?e="frame":e===!1?e=null:e!=null&&(e=Ze(e,"clip",["frame","sphere"])),e}function uQ(e,t,n,r){let i,{clip:o=r.clip}=t;switch(o){case"frame":{let{width:s,height:a,marginLeft:c,marginRight:l,marginTop:u,marginBottom:f}=n,d=r_();i=`url(#${d})`,e=at("svg:g",r).call(h=>h.append("svg:clipPath").attr("id",d).append("rect").attr("x",c).attr("y",u).attr("width",s-l-c).attr("height",a-u-f)).each(function(){this.appendChild(e.node()),e.node=()=>this});break}case"sphere":{let{projection:s}=r;if(!s)throw new Error('the "sphere" clip option requires a projection');let a=r_();i=`url(#${a})`,e.append("clipPath").attr("id",a).append("path").attr("d",Rn(s)({type:"Sphere"}));break}}ct(e,"aria-label",t.ariaLabel),ct(e,"aria-description",t.ariaDescription),ct(e,"aria-hidden",t.ariaHidden),ct(e,"clip-path",i)}function Mt(e,t,n,r){uQ(e,t,n,r),ct(e,"fill",t.fill),ct(e,"fill-opacity",t.fillOpacity),ct(e,"stroke",t.stroke),ct(e,"stroke-width",t.strokeWidth),ct(e,"stroke-opacity",t.strokeOpacity),ct(e,"stroke-linejoin",t.strokeLinejoin),ct(e,"stroke-linecap",t.strokeLinecap),ct(e,"stroke-miterlimit",t.strokeMiterlimit),ct(e,"stroke-dasharray",t.strokeDasharray),ct(e,"stroke-dashoffset",t.strokeDashoffset),ct(e,"shape-rendering",t.shapeRendering),ct(e,"filter",t.imageFilter),ct(e,"paint-order",t.paintOrder);let{pointerEvents:i=r.pointerSticky===!1?"none":void 0}=t;ct(e,"pointer-events",i)}function Tt(e,t){fQ(e,"mix-blend-mode",t.mixBlendMode),ct(e,"opacity",t.opacity)}function e8(e,t,n){e.each(function(r){let i=t(r);if(i!=null){let o=this.ownerDocument.createElementNS(oi.svg,"a");o.setAttribute("fill","inherit"),o.setAttributeNS(oi.xlink,"href",i),n!=null&&o.setAttribute("target",n),this.parentNode.insertBefore(o,this).appendChild(this)}})}function ct(e,t,n){n!=null&&e.attr(t,n)}function fQ(e,t,n){n!=null&&e.style(t,n)}function bt(e,t,{x:n,y:r},i=Oe,o=Oe){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 ce(e,t){if((e=ze(e))!==t)return e}function gm(e,t){if((e=It(e))!==t)return e}var dQ=/^-?([_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 If(e){if(e===void 0)return"plot-d6a7b5";if(e=`${e}`,!dQ.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 bn({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 ec(e={}){let{document:t=typeof window<"u"?window.document:void 0,clip:n}=e;return{document:t,clip:s_(n)}}function at(e,{document:t}){return zt(Is(e).call(t.documentElement))}var r8=Math.PI,Xs=2*r8,n8=.618;function i8({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(mn(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}=o8(e));let{width:u,height:f,marginLeft:d,marginRight:h,marginTop:p,marginBottom:y}=s,g=u-d-h-o-r,m=f-p-y-n-i;if(e=e?.({width:g,height:m,clip:l,...a}),e==null)return;l=hQ(l,d,p,u-h,f-y);let b=d+o,x=p+n,_;if(c!=null){let[[v,w],[T,M]]=Rn(e).bounds(c),R=Math.min(g/(T-v),m/(M-w));R>0?(b-=(R*(v+T)-g)/2,x-=(R*(w+M)-m)/2,_=ol({point(I,E){this.stream.point(I*R+b,E*R+x)}})):qn("Warning: the projection could not be fit to the specified domain; using the default scale.")}return _??=b===0&&x===0?s8():ol({point(v,w){this.stream.point(v+b,w+x)}}),{stream:v=>e.stream(_.stream(l(v)))}}function o8(e){switch(`${e}`.toLowerCase()){case"albers-usa":return Gi(GS,.7463,.4673);case"albers":return a_(bp,.7463,.4673);case"azimuthal-equal-area":return Gi(XS,4,4);case"azimuthal-equidistant":return Gi(QS,Xs,Xs);case"conic-conformal":return a_(JS,Xs,Xs);case"conic-equal-area":return a_(Pa,6.1702,2.9781);case"conic-equidistant":return a_(eI,7.312,3.6282);case"equal-earth":return Gi(rI,5.4133,2.6347);case"equirectangular":return Gi(tI,Xs,r8);case"gnomonic":return Gi(oI,3.4641,3.4641);case"identity":return{type:s8};case"reflect-y":return{type:pQ};case"mercator":return Gi(ZS,Xs,Xs);case"orthographic":return Gi(aI,2,2);case"stereographic":return Gi(lI,2,2);case"transverse-mercator":return Gi(fI,Xs,Xs);default:throw new Error(`unknown projection type: ${e}`)}}function hQ(e,t,n,r,i){if(e===!1||e==null||typeof e=="number")return o=>o;switch(e===!0&&(e="frame"),`${e}`.toLowerCase()){case"frame":return ju(t,n,r,i);default:throw new Error(`unknown projection clip type: ${e}`)}}function Gi(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 a_(e,t,n){let{type:r,aspectRatio:i}=Gi(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 s8=pn({stream:e=>e}),pQ=pn(ol({point(e,t){this.stream.point(e,-t)}}));function HT(e,t,n,r){let i=n[e],o=n[t],s=i.length,a=n[e]=new Float64Array(s).fill(NaN),c=n[t]=new Float64Array(s).fill(NaN),l,u=r.stream({point(f,d){a[l]=f,c[l]=d}});for(l=0;l<s;++l)u.point(i[l],o[l])}function a8({projection:e}={}){return e==null?!1:typeof e.stream=="function"?!0:(mn(e)&&(e=e.type),e!=null)}function c8(e){if(typeof e?.stream=="function")return n8;if(mn(e)&&(e=e.type),e!=null){if(typeof e!="function"){let{aspectRatio:t}=o8(e);if(t)return t}return n8}}function nc(e,t,{projection:n}){let{x:r,y:i}=e,o={};return r&&(o.x=r),i&&(o.y=i),o=Sf(o,t),n&&r?.scale==="x"&&i?.scale==="y"&&HT("x","y",o,n),r&&(o.x=Qe(o.x)),i&&(o.y=Qe(o.y)),o}function l8(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)$r(s,o);return[r,i]}var mQ=["#4269d0","#efb118","#ff725c","#6cc5b0","#3ca951","#ff8ab7","#a463f2","#97bbf5","#9c6b4e","#9498a0"],p8=new Map([["accent",LI],["category10",DI],["dark2",CI],["observable10",mQ],["paired",BI],["pastel1",PI],["pastel2",$I],["set1",UI],["set2",zI],["set3",jI],["tableau10",qI]]);function m8(e){return e!=null&&p8.has(`${e}`.toLowerCase())}var u8=new Map([...p8,["brbg",Hs(xx,_x)],["prgn",Hs(wx,vx)],["piyg",Hs(Sx,Ix)],["puor",Hs(Tx,Ex)],["rdbu",Hs(zp,tf)],["rdgy",Hs(Ax,Mx)],["rdylbu",Hs(jp,ef)],["rdylgn",Hs(Nx,Rx)],["spectral",Hs(Ox,kx)],["burd",f8(zp,tf)],["buylrd",f8(jp,ef)],["blues",xn(r1,i1)],["greens",xn(o1,s1)],["greys",xn(a1,c1)],["oranges",xn(h1,p1)],["purples",xn(l1,u1)],["reds",xn(f1,d1)],["turbo",Qs(S1)],["viridis",Qs(T1)],["magma",Qs(E1)],["inferno",Qs(A1)],["plasma",Qs(M1)],["cividis",Qs(m1)],["cubehelix",Qs(y1)],["warm",Qs(b1)],["cool",Qs(x1)],["bugn",xn(Fx,Dx)],["bupu",xn(Lx,Cx)],["gnbu",xn(Bx,Px)],["orrd",xn($x,Ux)],["pubu",xn(qx,Vx)],["pubugn",xn(zx,jx)],["purd",xn(Yx,Gx)],["rdpu",xn(Wx,Xx)],["ylgn",xn(Zx,Kx)],["ylgnbu",xn(Hx,Qx)],["ylorbr",xn(Jx,t1)],["ylorrd",xn(e1,n1)],["rainbow",d8(_1)],["sinebow",d8(v1)]]);function xn(e,t){return({length:n})=>n===1?[e[3][1]]:n===2?[e[3][1],e[3][2]]:(n=Math.max(3,Math.floor(n)),n>9?Cn(t,n):e[n])}function Hs(e,t){return({length:n})=>n===2?[e[3][0],e[3][2]]:(n=Math.max(3,Math.floor(n)),n>11?Cn(t,n):e[n])}function f8(e,t){return({length:n})=>n===2?[e[3][2],e[3][0]]:(n=Math.max(3,Math.floor(n)),n>11?Cn(r=>t(1-r),n):e[n].slice().reverse())}function Qs(e){return({length:t})=>Cn(e,Math.max(2,Math.floor(t)))}function d8(e){return({length:t})=>Cn(e,Math.floor(t)+1).slice(0,-1)}function QT(e){let t=`${e}`.toLowerCase();if(!u8.has(t))throw new Error(`unknown ordinal scheme: ${t}`);return u8.get(t)}function xm(e,t){let n=QT(e),r=typeof n=="function"?n({length:t}):n;return r.length!==t?r.slice(0,t):r}function y8(e,t="greys"){let n=new Set,[r,i]=xm(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 h8=new Map([["brbg",_x],["prgn",vx],["piyg",Ix],["puor",Ex],["rdbu",tf],["rdgy",Mx],["rdylbu",ef],["rdylgn",Rx],["spectral",kx],["burd",e=>tf(1-e)],["buylrd",e=>ef(1-e)],["blues",i1],["greens",s1],["greys",c1],["purples",u1],["reds",d1],["oranges",p1],["turbo",S1],["viridis",T1],["magma",E1],["inferno",A1],["plasma",M1],["cividis",m1],["cubehelix",y1],["warm",b1],["cool",x1],["bugn",Dx],["bupu",Cx],["gnbu",Px],["orrd",Ux],["pubugn",jx],["pubu",Vx],["purd",Gx],["rdpu",Xx],["ylgnbu",Qx],["ylgn",Kx],["ylorbr",t1],["ylorrd",n1],["rainbow",_1],["sinebow",v1]]);function Ef(e){let t=`${e}`.toLowerCase();if(!h8.has(t))throw new Error(`unknown quantitative scheme: ${t}`);return h8.get(t)}var yQ=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function g8(e){return e!=null&&yQ.has(`${e}`.toLowerCase())}var KT=e=>t=>e(1-t),ZT=[0,1],b8=new Map([["number",_e],["rgb",si],["hsl",G2],["hcl",W2],["lab",nb]]);function JT(e){let t=`${e}`.toLowerCase();if(!b8.has(t))throw new Error(`unknown interpolator: ${t}`);return b8.get(t)}function Mf(e,t,n,{type:r,nice:i,clamp:o,zero:s,domain:a=E8(e,n),unknown:c,round:l,scheme:u,interval:f,range:d=ue.get(e)===wl?_Q(n,a):ue.get(e)===vl?wQ(n,a):ue.get(e)===Sl?ZT:void 0,interpolate:h=ue.get(e)===Vr?u==null&&d!==void 0?si:Ef(u!==void 0?u:r==="cyclical"?"rainbow":"turbo"):l?Qc:_e,reverse:p}){if(f=Bo(f,r),(r==="cyclical"||r==="sequential")&&(r="linear"),typeof h!="function"&&(h=JT(h)),p=!!p,d!==void 0){let y=(a=je(a)).length,g=(d=je(d)).length;if(y!==g){if(h.length===1)throw new Error("invalid piecewise interpolator");h=xo(h,d),d=void 0}}if(h.length===1?(p&&(h=KT(h),p=!1),d===void 0&&(d=Float64Array.from(a,(y,g)=>g/(a.length-1)),d.length===2&&(d=ZT)),t.interpolate((d===ZT?pn:_m)(h))):t.interpolate(h),s){let[y,g]=se(a);(y>0||g<0)&&(a=Ha(a),zs(a)!==Math.sign(y)?a[a.length-1]=0:a[0]=0)}return p&&(a=Na(a)),t.domain(a).unknown(c),i&&(t.nice(gQ(i,r)),a=t.domain()),d!==void 0&&t.range(d),o&&t.clamp(o),{type:r,domain:a,range:d,scale:t,interpolate:h,interval:f}}function gQ(e,t){return e===!0?void 0:typeof e=="number"?e:Ik(e,t)}function x8(e,t,n){return Mf(e,ks(),t,n)}function _8(e,t,n){return tE(e,t,{...n,exponent:.5})}function tE(e,t,{exponent:n=1,...r}){return Mf(e,Rp().exponent(n),t,{...r,type:"pow"})}function w8(e,t,{base:n=10,domain:r=vQ(t),...i}){return Mf(e,Mp().base(n),t,{...i,domain:r})}function v8(e,t,{constant:n=1,...r}){return Mf(e,Np().constant(n),t,r)}function S8(e,t,{range:n,quantiles:r=n===void 0?5:(n=[...n]).length,n:i=r,scheme:o="rdylbu",domain:s=SQ(t),unknown:a,interpolate:c,reverse:l}){return n===void 0&&(n=c!==void 0?Cn(c,i):ue.get(e)===Vr?xm(o,i):void 0),s.length>0&&(s=Op(s,n===void 0?{length:i}:n).quantiles()),c_(e,t,{domain:s,range:n,reverse:l,unknown:a})}function I8(e,t,{range:n,n:r=n===void 0?5:(n=[...n]).length,scheme:i="rdylbu",domain:o=E8(e,t),unknown:s,interpolate:a,reverse:c}){let[l,u]=se(o),f;return n===void 0?(f=An(l,u,r),f[0]<=l&&f.splice(0,1),f[f.length-1]>=u&&f.pop(),r=f.length+1,n=a!==void 0?Cn(a,r):ue.get(e)===Vr?xm(i,r):void 0):(f=Cn(_e(l,u),r+1).slice(1,-1),l instanceof Date&&(f=f.map(d=>new Date(d)))),zs(je(o))<0&&f.reverse(),c_(e,t,{domain:f,range:n,reverse:c,unknown:s})}function c_(e,t,{domain:n=[0],unknown:r,scheme:i="rdylbu",interpolate:o,range:s=o!==void 0?Cn(o,n.length+1):ue.get(e)===Vr?xm(i,n.length+1):void 0,reverse:a}){n=je(n);let c=zs(n);if(!isNaN(c)&&!bQ(n,c))throw new Error(`the ${e} scale has a non-monotonic domain`);return a&&(s=Na(s)),{type:"threshold",scale:kp(c<0?Na(n):n,s===void 0?[]:s).unknown(r),domain:n,range:s}}function bQ(e,t){for(let n=1,r=e.length,i=e[0];n<r;++n){let o=Wn(i,i=e[n]);if(o!==0&&o!==t)return!1}return!0}function T8(e){return{type:"identity",scale:Lk(ue.get(e))?Ep():t=>t}}function Af(e,t=uf){return e.length?[ae(e,({value:n})=>n===void 0?n:ae(n,t)),Ut(e,({value:n})=>n===void 0?n:Ut(n,t))]:[0,1]}function E8(e,t){let n=ue.get(e);return(n===wl||n===Sl||n===vl?xQ:Af)(t)}function xQ(e){return[0,e.length?Ut(e,({value:t})=>t===void 0?t:Ut(t,uf)):1]}function _Q(e,t){let n=e.find(({radius:s})=>s!==void 0);if(n!==void 0)return[0,n.radius];let r=Hn(e,.5,({value:s})=>s===void 0?NaN:Hn(s,.25,rr)),i=t.map(s=>3*Math.sqrt(s/r)),o=30/Ut(i);return o<1?i.map(s=>s*o):i}function wQ(e,t){let n=zi(e,({value:o})=>o===void 0?NaN:zi(o,Math.abs)),r=t.map(o=>12*o/n),i=60/Ut(r);return i<1?r.map(o=>o*i):r}function vQ(e){for(let{value:t}of e)if(t!==void 0)for(let n of t){if(n>0)return Af(e,rr);if(n<0)return Af(e,qa)}return[1,10]}function SQ(e){let t=[];for(let{value:n}of e)if(n!==void 0)for(let r of n)t.push(r);return t}function _m(e){return(t,n)=>r=>e(t+r*(n-t))}function l_(e,t,n,r,{type:i,nice:o,clamp:s,domain:a=Af(r),unknown:c,pivot:l=0,scheme:u,range:f,symmetric:d=!0,interpolate:h=ue.get(e)===Vr?u==null&&f!==void 0?si:Ef(u!==void 0?u:"rdbu"):_e,reverse:p}){l=+l,a=je(a);let[y,g]=a;if(a.length>2&&qn(`Warning: the diverging ${e} scale domain contains extra elements.`),Wn(y,g)<0&&([y,g]=[g,y],p=!p),y=Math.min(y,l),g=Math.max(g,l),typeof h!="function"&&(h=JT(h)),f!==void 0&&(h=h.length===1?_m(h)(...f):xo(h,f)),p&&(h=KT(h)),d){let m=n.apply(l),b=m-n.apply(y),x=n.apply(g)-m;b<x?y=n.invert(m-x):b>x&&(g=n.invert(m+b))}return t.domain([y,l,g]).unknown(c).interpolator(h),s&&t.clamp(s),o&&t.nice(o),{type:i,domain:[y,g],pivot:l,interpolate:h,scale:t}}function A8(e,t,n){return l_(e,Up(),IQ,t,n)}function M8(e,t,n){return eE(e,t,{...n,exponent:.5})}function eE(e,t,{exponent:n=1,...r}){return l_(e,bx().exponent(n=+n),AQ(n),t,{...r,type:"diverging-pow"})}function N8(e,t,{base:n=10,pivot:r=1,domain:i=Af(t,r<0?qa:rr),...o}){return l_(e,yx().base(n=+n),TQ,t,{domain:i,pivot:r,...o})}function R8(e,t,{constant:n=1,...r}){return l_(e,gx().constant(n=+n),MQ(n),t,r)}var IQ={apply(e){return e},invert(e){return e}},TQ={apply:Math.log,invert:Math.exp},EQ={apply(e){return Math.sign(e)*Math.sqrt(Math.abs(e))},invert(e){return Math.sign(e)*(e*e)}};function AQ(e){return e===.5?EQ:{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 MQ(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 O8(e,t,n,r){return Mf(e,t,n,r)}function k8(e,t,n){return O8(e,hx(),t,n)}function F8(e,t,n){return O8(e,px(),t,n)}var Nf=Symbol("ordinal");function L8(e,t,n,{type:r,interval:i,domain:o,range:s,reverse:a,hint:c}){return i=Bo(i,r),o===void 0&&(o=U8(n,i,e)),(r==="categorical"||r===Nf)&&(r="ordinal"),a&&(o=Na(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 C8(e,t,{type:n,interval:r,domain:i,range:o,scheme:s,unknown:a,...c}){r=Bo(r,n),i===void 0&&(i=U8(t,r,e));let l;if(ue.get(e)===xf)l=NQ(t),o=o===void 0?RQ(l):Yt(o,_f);else if(ue.get(e)===Vr&&(o===void 0&&(n==="ordinal"||n===Nf)&&(o=y8(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],d=o[1]-o[0];o=({length:h})=>Cn(p=>u(f+d*p),h)}else o=QT(s);if(a===Ip)throw new Error(`implicit unknown on ${e} scale is not supported`);return L8(e,cl().unknown(a),t,{...c,type:n,domain:i,range:o,hint:l})}function B8(e,t,{align:n=.5,padding:r=.5,...i}){return $8(bI().align(n).padding(r),t,i,e)}function P8(e,t,{align:n=.5,padding:r=.1,paddingInner:i=r,paddingOuter:o=e==="fx"||e==="fy"?0:r,...s}){return $8(Ua().align(n).paddingInner(i).paddingOuter(o),t,s,e)}function $8(e,t,n,r){let{round:i}=n;return i!==void 0&&e.round(i=!!i),e=L8(r,e,t,n),e.round=i,e}function U8(e,t,n){let r=new Cr;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]=se(r).map(t.floor,t);return t.range(i,t.offset(o))}if(r.size>1e4&&ue.get(n)===yi)throw new Error(`implicit ordinal domain of ${n} scale has more than 10,000 values`);return mo(r,hn)}function D8(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 NQ(e){return{fill:D8(e,"fill"),stroke:D8(e,"stroke")}}function RQ(e){return ne(e.fill)?QI:D1}function wm(e,{label:t,inset:n=0,insetTop:r=n,insetRight:i=n,insetBottom:o=n,insetLeft:s=n,round:a,nice:c,clamp:l,zero:u,align:f,padding:d,projection:h,facet:{label:p=t}={},...y}={}){let g={};for(let[m,b]of e){let x=y[m],_=X8(m,b,{round:ue.get(m)===yi?a:void 0,nice:c,clamp:l,zero:u,align:f,padding:d,projection:h,...x});if(_){let{label:v=m==="fx"||m==="fy"?p:t,percent:w,transform:T,inset:M,insetTop:R=M!==void 0?M:m==="y"?r:0,insetRight:I=M!==void 0?M:m==="x"?i:0,insetBottom:E=M!==void 0?M:m==="y"?o:0,insetLeft:O=M!==void 0?M:m==="x"?s:0}=x||{};if(T==null)T=void 0;else if(typeof T!="function")throw new Error("invalid scale transform; not a function");_.percent=!!w,_.label=v===void 0?OQ(b,_):v,_.transform=T,m==="x"||m==="fx"?(_.insetLeft=+O,_.insetRight=+I):(m==="y"||m==="fy")&&(_.insetTop=+R,_.insetBottom=+E),g[m]=_}}return g}function rE(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]=Q8(i),n[r]=o,o.type=s,a!=null&&(o.interval=a),c!=null&&(o.label=c)}return n}function Y8(e,t){let{x:n,y:r,fx:i,fy:o}=e,s=i||o?d_(t):t;i&&z8(i,s),o&&j8(o,s);let a=i||o?iE(e,t):t;n&&z8(n,a),r&&j8(r,a)}function OQ(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!Uo(t)&&t.percent&&(n=`${n} (%)`),{inferred:!0,toString:()=>n}}function f_(e){return Math.sign(zs(e.domain()))*Math.sign(zs(e.range()))}function d_(e){let{marginTop:t,marginRight:n,marginBottom:r,marginLeft:i,width:o,height:s,facet:{marginTop:a,marginRight:c,marginBottom:l,marginLeft:u}}=e;return{marginTop:Math.max(t,a),marginRight:Math.max(n,c),marginBottom:Math.max(r,l),marginLeft:Math.max(i,u),width:o,height:s}}function iE({fx:e,fy:t},n){let{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=d_(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 z8(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)],Uo(e)||(e.range=W8(e)),e.scale.range(e.range)}G8(e)}function j8(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],Uo(e)?e.range.reverse():e.range=W8(e),e.scale.range(e.range)}G8(e)}function G8(e){e.round===void 0&&DQ(e)&&kQ(e)<=30&&e.scale.round(!0)}function kQ({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 W8(e){let t=e.scale.domain().length+oE(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 h_(e,t,n){return X8(e,n===void 0?void 0:[{hint:n}],{...t})}function X8(e,t=[],n={}){let r=FQ(e,t,n);if(n.type===void 0&&n.domain===void 0&&n.range===void 0&&n.interval==null&&e!=="fx"&&e!=="fy"&&Uo({type:r})){let i=t.map(({value:o})=>o).filter(o=>o!==void 0);i.some(Re)?qn(`Warning: some data associated with the ${e} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${Rf(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 "${Rf(r)}".`):i.some(Mk)?qn(`Warning: some data associated with the ${e} scale are strings that appear to be dates (e.g., YYYY-MM-DD). If these strings represent dates, you should parse them to Date objects. Dates are typically associated with a "utc" or "time" scale rather than a "${Rf(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 "${Rf(r)}".`):i.some(Nk)&&qn(`Warning: some data associated with the ${e} scale are strings that appear to be numbers. If these strings represent numbers, you should parse or coerce them to numbers. Numbers are typically associated with a "linear" scale rather than a "${Rf(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 "${Rf(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=u_(t,n,Qe);break;case"identity":switch(ue.get(e)){case yi:n=u_(t,n,Qe);break;case xf:n=u_(t,n,LQ);break}break;case"utc":case"time":n=u_(t,n,Sk);break}switch(r){case"diverging":return A8(e,t,n);case"diverging-sqrt":return M8(e,t,n);case"diverging-pow":return eE(e,t,n);case"diverging-log":return N8(e,t,n);case"diverging-symlog":return R8(e,t,n);case"categorical":case"ordinal":case Nf:return C8(e,t,n);case"cyclical":case"sequential":case"linear":return x8(e,t,n);case"sqrt":return _8(e,t,n);case"threshold":return c_(e,t,n);case"quantile":return S8(e,t,n);case"quantize":return I8(e,t,n);case"pow":return tE(e,t,n);case"log":return w8(e,t,n);case"symlog":return v8(e,t,n);case"utc":return F8(e,t,n);case"time":return k8(e,t,n);case"point":return B8(e,t,n);case"band":return P8(e,t,n);case"identity":return T8(e);case void 0:return;default:throw new Error(`unknown scale type: ${r}`)}}function Rf(e){return typeof e=="symbol"?e.description:e}function q8(e){return typeof e=="string"?`${e}`.toLowerCase():e}var V8={toString:()=>"projection"};function FQ(e,t,{type:n,domain:r,range:i,scheme:o,pivot:s,projection:a}){if(n=q8(n),e==="fx"||e==="fy")return"band";(e==="x"||e==="y")&&a!=null&&(n=V8);for(let l of t){let u=q8(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===V8)return;if(n!==void 0)return n;if(r===void 0&&!t.some(({value:l})=>l!==void 0))return;let c=ue.get(e);if(c===wl)return"sqrt";if(c===Sl||c===vl)return"linear";if(c===xf)return"ordinal";if((r||i||[]).length>2)return nE(c);if(r!==void 0){if(Te(r))return nE(c);if(Re(r))return"utc"}else{let l=t.map(({value:u})=>u).filter(u=>u!==void 0);if(l.some(Te))return nE(c);if(l.some(Re))return"utc"}if(c===Vr){if(s!=null||g8(o))return"diverging";if(m8(o))return"categorical"}return"linear"}function nE(e){switch(e){case yi:return"point";case Vr:return Nf;default:return"ordinal"}}function Uo({type:e}){return e==="ordinal"||e==="point"||e==="band"||e===Nf}function oE({type:e}){return e==="threshold"}function DQ({type:e}){return e==="point"||e==="band"}function sr(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 u_(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 LQ(e){return Yt(e,_f)}function zo(e={}){let t;for(let n in e)if(ue.has(n)&&Lo(e[n])){if(t!==void 0)throw new Error("ambiguous scale definition; multiple scales found");t=Q8(h_(n,e[n]))}if(t===void 0)throw new Error("invalid scale definition; no scale found");return t}function H8(e){return t=>{if(!ue.has(t=`${t}`))throw new Error(`unknown scale: ${t}`);return e[t]}}function Q8({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:Ha(n),...r!==void 0&&{range:Ha(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 K8(e,t,n={}){let r=.5-Oe,i=.5+Oe,o=.5+Oe,s=.5-Oe;for(let{marginTop:y,marginRight:g,marginBottom:m,marginLeft:b}of t)y>r&&(r=y),g>i&&(i=g),m>o&&(o=m),b>s&&(s=b);let{margin:a,marginTop:c=a!==void 0?a:r,marginRight:l=a!==void 0?a:i,marginBottom:u=a!==void 0?a:o,marginLeft:f=a!==void 0?a:s}=n;c=+c,l=+l,u=+u,f=+f;let{width:d=640,height:h=CQ(e,n,{width:d,marginTopDefault:r,marginRightDefault:i,marginBottomDefault:o,marginLeftDefault:s})+Math.max(0,c-r+u-o)}=n;d=+d,h=+h;let p={width:d,height:h,marginTop:c,marginRight:l,marginBottom:u,marginLeft:f};if(e.fx||e.fy){let{margin:y,marginTop:g=y!==void 0?y:c,marginRight:m=y!==void 0?y:l,marginBottom:b=y!==void 0?y:u,marginLeft:x=y!==void 0?y:f}=n.facet??{};g=+g,m=+m,b=+b,x=+x,p.facet={marginTop:g,marginRight:m,marginBottom:b,marginLeft:x}}return p}function CQ({x:e,y:t,fy:n,fx:r},{projection:i,aspectRatio:o},{width:s,marginTopDefault:a,marginRightDefault:c,marginBottomDefault:l,marginLeftDefault:u}){let f=n?n.scale.domain().length:1,d=c8(i);if(d){let p=r?r.scale.domain().length:1,y=(1.1*f-.1)/(1.1*p-.1)*d,g=Math.max(.1,Math.min(10,y));return Math.round((s-u-c)*g+a+l)}let h=t?Uo(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=Z8("y",t)/(Z8("x",e)*o),y=r?r.scale.bandwidth():1,g=n?n.scale.bandwidth():1,m=y*(s-u-c)-e.insetLeft-e.insetRight;return(p*m+t.insetTop+t.insetBottom)/g+a+l}return!!(t||n)*Math.max(1,Math.min(60,h*f))*20+!!r*30+60}function Z8(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]=se(r);return Math.abs(i(s)-i(o))}function tF(e,t){let{fx:n,fy:r}=wm(e,t),i=n?.scale.domain(),o=r?.scale.domain();return i&&o?R0(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 eF(e,{x:t,y:n}){return t&&=uE(t),n&&=uE(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 m_(e,{fx:t,fy:n}){let r=ir(e),i=t?.value,o=n?.value;return t&&n?Ui(r,s=>(s.fx=i[s[0]],s.fy=o[s[0]],s),s=>i[s],s=>o[s]):t?Ui(r,s=>(s.fx=i[s[0]],s),s=>i[s]):Ui(r,s=>(s.fy=o[s[0]],s),s=>o[s])}function nF(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 rF(e){let t=[],n=new Uint32Array(Mn(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 BQ=new Map([["top",sE],["right",lE],["bottom",aE],["left",cE],["top-left",p_(sE,cE)],["top-right",p_(sE,lE)],["bottom-left",p_(aE,cE)],["bottom-right",p_(aE,lE)],["top-empty",$Q],["right-empty",jQ],["bottom-empty",UQ],["left-empty",zQ],["empty",qQ]]);function iF(e){if(e==null)return null;let t=BQ.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid facet anchor: ${e}`)}var J8=new WeakMap;function uE(e){let t=J8.get(e);return t||J8.set(e,t=new Xn(Yt(e,(n,r)=>[n,r]))),t}function rc(e,t){return uE(e).get(t)}function PQ(e,t,n){return t=Vs(t),n=Vs(n),e.find(r=>Object.is(Vs(r.x),t)&&Object.is(Vs(r.y),n))}function y_(e,t,n){return PQ(e,t,n)?.empty}function sE(e,{y:t},{y:n}){return t?rc(t,n)===0:!0}function aE(e,{y:t},{y:n}){return t?rc(t,n)===t.length-1:!0}function cE(e,{x:t},{x:n}){return t?rc(t,n)===0:!0}function lE(e,{x:t},{x:n}){return t?rc(t,n)===t.length-1:!0}function $Q(e,{y:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=rc(t,r);if(o>0)return y_(e,n,t[o-1])}function UQ(e,{y:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=rc(t,r);if(o<t.length-1)return y_(e,n,t[o+1])}function zQ(e,{x:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=rc(t,n);if(o>0)return y_(e,t[o-1],r)}function jQ(e,{x:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=rc(t,n);if(o<t.length-1)return y_(e,t[o+1],r)}function qQ(e,t,{empty:n}){return n}function p_(e,t){return function(){return e.apply(null,arguments)&&t.apply(null,arguments)}}function g_(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 mt=class{constructor(t,n={},r={},i){let{facet:o="auto",facetAnchor:s,fx:a,fy:c,sort:l,dx:u=0,dy:f=0,margin:d=0,marginTop:h=d,marginRight:p=d,marginBottom:y=d,marginLeft:g=d,clip:m=i?.clip,channels:b,tip:x,render:_}=r;if(this.data=t,this.sort=Co(l)?l:null,this.initializer=ve(r).initializer,this.transform=this.initializer?r.transform:gn(r).transform,o===null||o===!1?this.facet=null:(this.facet=Ze(o===!0?"include":o,"facet",["auto","include","exclude","super"]),this.fx=t===Wa&&typeof a=="string"?[a]:a,this.fy=t===Wa&&typeof c=="string"?[c]:c),this.facetAnchor=iF(s),n=fm(n),b!==void 0&&(n={...VQ(b),...n}),i!==void 0&&(n={...i_(this,r,i),...n}),this.channels=Object.fromEntries(Object.entries(n).map(([v,w])=>{if(qr(w.value)){let{value:T,label:M=w.label,scale:R=w.scale}=w.value;w={...w,label:M,scale:R,value:T}}if(t===Wa&&typeof w.value=="string"){let{value:T}=w;w={...w,value:[T]}}return[v,w]}).filter(([v,{value:w,optional:T}])=>{if(w!=null)return!0;if(T)return!1;throw new Error(`missing channel value: ${v}`)})),this.dx=+u,this.dy=+f,this.marginTop=+h,this.marginRight=+p,this.marginBottom=+y,this.marginLeft=+g,this.clip=s_(m),this.tip=YQ(x),this.facet==="super"){if(a||c)throw new Error("super-faceting cannot use fx or fy");for(let v in this.channels){let{scale:w}=n[v];if(!(w!=="x"&&w!=="y"))throw new Error("super-faceting cannot use x or y")}}_!=null&&(this.render=Of(_,this.render))}initialize(t,n,r){let i=je(this.data);t===void 0&&i!=null&&(t=[ir(i)]);let o=t;this.transform!=null&&({facets:t,data:i}=this.transform(i,t,r),i=je(i)),t!==void 0&&(t.original=o);let s=e_(this.channels,i);return this.sort!=null&&Hk(i,t,s,n,this.sort),{data:i,facets:t,channels:s}}filter(t,n,r){for(let i in n){let{filter:o=Ue}=n[i];if(o!==null){let s=r[i];t=t.filter(a=>o(s[a]))}}return t}project(t,n,r){for(let i in t)if(t[i].scale==="x"&&/^x|x$/.test(i)){let o=i.replace(/^x|x$/,"y");o in t&&t[o].scale==="y"&&HT(i,o,n,r.projection)}}scale(t,n,r){let i=Sf(t,n);return r.projection&&this.project(t,i,r),i}};function Ke(...e){return e.plot=mt.prototype.plot,e}function Of(e,t){if(e==null)return t===null?void 0:t;if(t==null)return e===null?void 0:e;if(typeof e!="function")throw new TypeError(`invalid render transform: ${e}`);if(typeof t!="function")throw new TypeError(`invalid render transform: ${t}`);return function(n,r,i,o,s,a){return e.call(this,n,r,i,o,s,(c,l,u,f,d)=>t.call(this,c,l,u,f,d,a))}}function VQ(e){return Object.fromEntries(Object.entries(fm(e)).map(([t,n])=>(n=typeof n=="string"?{value:n,label:t}:mi(n),n.filter===void 0&&n.scale==null&&(n={...n,filter:null}),[t,n])))}function YQ(e){return e===!0?"xy":e===!1||e==null?null:typeof e=="string"?Ze(e,"tip",["x","y","xy"]):e}function Wi(e,t){return e?.tip===!0?{...e,tip:t}:mn(e?.tip)&&e.tip.pointer===void 0?{...e,tip:{...e.tip,pointer:t}}:e}var oF=new WeakMap;function fE(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:Of(function(u,f,d,h,p,y){p={...p,pointerSticky:!1};let g=p.ownerSVGElement,{data:m}=p.getMarkState(this),b=oF.get(g);b||oF.set(g,b={sticky:!1,roots:[],renders:[]});let x=b.renders.push(X)-1,{x:_,y:v,fx:w,fy:T}=f,M=w?w(u.fx)-h.marginLeft:0,R=T?T(u.fy)-h.marginTop:0;_?.bandwidth&&(M+=_.bandwidth()/2),v?.bandwidth&&(R+=v.bandwidth()/2);let I=u.fi!=null,E;if(I){let Y=b.facetStates;Y||(b.facetStates=Y=new Map),E=Y.get(this),E||Y.set(this,E=new Map)}let[O,F]=bn(this,h),{px:S,py:A}=d,N=S?Y=>S[Y]:dE(d,O),D=A?Y=>A[Y]:hE(d,F),B,C,P,$;function U(Y,rt){if(I)if($&&($=cancelAnimationFrame($)),Y==null)E.delete(u.fi);else{E.set(u.fi,rt),$=requestAnimationFrame(()=>{$=null;for(let[j,H]of E)if(H<rt||H===rt&&j<u.fi){Y=null;break}X(Y)});return}X(Y)}function X(Y){if(B===Y&&P===b.sticky)return;B=Y,P=p.pointerSticky=b.sticky;let rt=B==null?[]:[B];I&&(rt.fx=u.fx,rt.fy=u.fy,rt.fi=u.fi);let j=y(rt,f,d,h,p);if(C){if(I){let H=C.parentNode,ot=C.getAttribute("transform"),z=j.getAttribute("transform");ot?j.setAttribute("transform",ot):j.removeAttribute("transform"),z?H.setAttribute("transform",z):H.removeAttribute("transform"),j.removeAttribute("aria-label"),j.removeAttribute("aria-description"),j.removeAttribute("aria-hidden")}C.replaceWith(j)}return b.roots[x]=C=j,B==null&&E?.size>1||p.dispatchValue(B==null?null:m[B]),j}function tt(Y){if(b.sticky||Y.pointerType==="mouse"&&Y.buttons===1)return;let[rt,j]=Ln(Y);rt-=M,j-=R;let H=rt<h.marginLeft||rt>h.width-h.marginRight?1:e,ot=j<h.marginTop||j>h.height-h.marginBottom?1:t,z=null,Nt=s*s;for(let lt of u){let Wt=H*(N(lt)-rt),Xt=ot*(D(lt)-j),et=Wt*Wt+Xt*Xt;et<=Nt&&(z=lt,Nt=et)}if(z!=null&&(e!==1||t!==1)){let lt=N(z)-rt,Wt=D(z)-j;Nt=lt*lt+Wt*Wt}U(z,Nt)}function nt(Y){Y.pointerType==="mouse"&&B!=null&&(b.sticky&&b.roots.some(rt=>rt?.contains(Y.target))||(b.sticky?(b.sticky=!1,b.renders.forEach(rt=>rt(null))):(b.sticky=!0,X(B)),Y.stopImmediatePropagation()))}function st(Y){Y.pointerType==="mouse"&&(b.sticky||U(null))}return g.addEventListener("pointerenter",tt),g.addEventListener("pointermove",tt),g.addEventListener("pointerdown",nt),g.addEventListener("pointerleave",st),X(null)},c)}}function kf(e){return fE(1,1,e)}function Ff(e){return fE(1,.01,e)}function Tl(e){return fE(.01,1,e)}function dE({x1:e,x2:t,x:n=e},r){return e&&t?i=>(e[i]+t[i])/2:n?i=>n[i]:()=>r}function hE({y1:e,y2:t,y:n=e},r){return e&&t?i=>(e[i]+t[i])/2:n?i=>n[i]:()=>r}function b_(e){return Uo(e)&&e.interval===void 0?void 0:"tabular-nums"}function sF(e,t){let{label:n=e.label,tickSize:r=6,width:i=240,height:o=44+r,marginTop:s=18,marginRight:a=0,marginBottom:c=16+r,marginLeft:l=0,style:u,ticks:f=(i-l-a)/64,tickFormat:d,fontVariant:h=b_(e),round:p=!0,opacity:y,className:g}=t,m=ec(t);g=If(g),y=ie(y)[1],d===null&&(d=()=>null);let b=at("svg",m).attr("class",`${g}-ramp`).attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("width",i).attr("height",o).attr("viewBox",`0 0 ${i} ${o}`).call(O=>O.append("style").text(`:where(.${g}-ramp) {
15
+ ${n}`}function ZH(e){return e==="time"?k1:e==="utc"?mm:XH}function kC(e,t,n){let r=Gt(N0(t,(i,o)=>Math.abs(o-i)));if(r<1e3)return RC("millisecond","utc",n);for(let[i,o,s,a]of ZH(e)){if(r>a||i==="hour"&&!r)break;if(t.every(c=>o.floor(c)>=c))return RC(i,s,n)}}function hf(e,t,n){return(r,i,o)=>{let s=e(r,i),a=t(r,i),c=i-js(o);return i!==c&&o[c]!==void 0&&a===t(o[c],c)?s:n(s,a)}}var wl=Object.getPrototypeOf(Uint8Array),QH=Object.prototype.toString,jT=Symbol("reindex");function mt(e,t,n){let r=typeof t;return r==="string"?FC(e,VT(t),n):r==="function"?FC(e,t,n):r==="number"||t instanceof Date||r==="boolean"?Yt(e,dn(t),n):typeof t?.transform=="function"?LC(t.transform(e),n):KH(LC(t,n),e?.[jT])}function KH(e,t){return t?bm(e,t):e}function FC(e,t,n){return Yt(e,n?.prototype instanceof wl?JH(t):t,n)}function LC(e,t){return t===void 0?qe(e):e instanceof t?e:t.prototype instanceof wl&&!(e instanceof wl)?t.from(e,YT):t.from(e)}function JH(e){return(t,n)=>YT(e(t,n))}var Xa=[null],VT=e=>t=>t[e],Ae={transform:ar},W={transform:e=>e};var gm=()=>1,CC=()=>!0,ze=e=>e==null?e:`${e}`,Nt=e=>e==null?e:+e;var Vs=e=>e?e[0]:void 0,Ha=e=>e?e[1]:void 0,BC=e=>e?e[2]:void 0,dn=e=>()=>e;function yf(e){let t=+`${e}`.slice(1)/100;return(n,r)=>Kn(n,t,r)}function Qe(e){return e instanceof wl?e:Yt(e,YT,Float64Array)}function YT(e){return e==null?NaN:Number(e)}function PC(e){return Yt(e,GT)}function GT(e){return e instanceof Date&&!isNaN(e)?e:typeof e=="string"?pm(e):e==null||isNaN(e=+e)?void 0:new Date(e)}function Re(e,t){return e===void 0&&(e=t),e===null?[void 0,"none"]:Ka(e)?[void 0,e]:[e,void 0]}function ie(e,t){return e===void 0&&(e=t),e===null||typeof e=="number"?[void 0,e]:[e,void 0]}function WT(e,t,n){if(e!=null)return Ke(e,t,n)}function Ke(e,t,n){let r=`${e}`.toLowerCase();if(!n.includes(r))throw new Error(`invalid ${t}: ${e}`);return r}function qe(e){return e==null||e instanceof Array||e instanceof wl?e:Array.from(e)}function Yt(e,t,n=Array){return e==null?e:e instanceof n?e.map(t):n.from(e,t)}function Za(e,t=Array){return e instanceof t?e.slice():t.from(e)}function XT({x:e,x1:t,x2:n}){return e!==void 0||t!==void 0||n!==void 0}function HT({y:e,y1:t,y2:n}){return e!==void 0||t!==void 0||n!==void 0}function gf(e){return XT(e)||HT(e)||e.interval!==void 0}function hn(e){return e?.toString===QH}function Oo(e){return hn(e)&&(e.type!==void 0||e.domain!==void 0)}function zr(e){return hn(e)&&typeof e.transform!="function"}function Do(e){return zr(e)&&e.value===void 0&&e.channel===void 0}function ZT(e,t,n,r=W){return t===void 0&&n===void 0?(t=0,n=e===void 0?r:e):t===void 0?t=e===void 0?0:e:n===void 0&&(n=e===void 0?0:e),[t,n]}function Be(e,t){return e===void 0&&t===void 0?[Vs,Ha]:[e,t]}function qn({z:e,fill:t,stroke:n}={}){return e===void 0&&([e]=Re(t)),e===void 0&&([e]=Re(n)),e}function ar(e){let t=e.length,n=new Uint32Array(t);for(let r=0;r<t;++r)n[r]=r;return n}function bm(e,t){return Yt(t,n=>e[n],e.constructor)}function bf(e){return e.length===1?(t,n)=>e(bm(n,t)):e}function Ys(e,t,n){return e.subarray?e.subarray(t,n):e.slice(t,n)}function Gs(e){return e!==null&&typeof e=="object"?e.valueOf():e}function C1(e,t){if(t[e]!==void 0)return t[e];switch(e){case"x1":case"x2":e="x";break;case"y1":case"y2":e="y";break}return t[e]}function pn(e){let t;return[{transform:()=>t,label:On(e)},n=>t=n]}function Rn(e){return e==null?[e]:pn(e)}function On(e,t){return typeof e=="string"?e:e&&e.label!==void 0?e.label:t}function xf(e,t){return{transform(n){let r=e.transform(n),i=t.transform(n);return Oe(r)||Oe(i)?Yt(r,(o,s)=>new Date((+r[s]+ +i[s])/2)):Yt(r,(o,s)=>(+r[s]+ +i[s])/2,Float64Array)},label:e.label}}function vl(e,t){let n=QT(t?.interval,t?.type);return n?Yt(e,n):e}function QT(e,t){let n=_f(e,t);return n&&(r=>Ue(r)?n.floor(r):r)}function _f(e,t){if(e!=null){if(typeof e=="number"){0<e&&e<1&&Number.isInteger(1/e)&&(e=-1/e);let n=Math.abs(e);return e<0?{floor:r=>Math.floor(r*n)/n,offset:r=>(r*n+1)/n,range:(r,i)=>$e(Math.ceil(r*n),i*n).map(o=>o/n)}:{floor:r=>Math.floor(r/n)*n,offset:r=>r+n,range:(r,i)=>$e(Math.ceil(r/n),i/n).map(o=>o*n)}}if(typeof e=="string")return(t==="time"?zT:ym)(e);if(typeof e.floor!="function")throw new Error("invalid interval; missing floor method");if(typeof e.offset!="function")throw new Error("invalid interval; missing offset method");return e}}function ko(e,t){if(e=_f(e,t),e&&typeof e.range!="function")throw new Error("invalid interval: missing range method");return e}function $C(e,t){if(e=ko(e,t),e&&typeof e.ceil!="function")throw new Error("invalid interval: missing ceil method");return e}function UC(e){return Qa(e)&&typeof e?.floor=="function"&&e.floor()instanceof Date}function Qa(e){return typeof e?.range=="function"}function pi(e){return e===void 0||zr(e)?e:{value:e}}function zC(e){return e==null?null:{transform:t=>mt(t,e,Float64Array),label:On(e)}}function qC(e){if(!cr(e))return!1;for(let t of e)if(t!=null)return typeof t=="object"&&"0"in t&&"1"in t}function cr(e){return e&&typeof e[Symbol.iterator]=="function"}function B1(e){for(let t of e)if(t!=null)return typeof t!="object"||t instanceof Date}function Me(e){for(let t of e){if(t==null)continue;let n=typeof t;return n==="string"||n==="boolean"}}function Oe(e){for(let t of e)if(t!=null)return t instanceof Date}function jC(e){for(let t of e)if(t!=null)return typeof t=="string"&&isNaN(t)&&pm(t)}function VC(e){for(let t of e)if(t!=null){if(typeof t!="string")return!1;if(t.trim())return!isNaN(t)}}function Ws(e){for(let t of e)if(t!=null)return typeof t=="number"}function P1(e,t){let n;for(let r of e)if(r!=null){if(!t(r))return!1;n=!0}return n}var tZ=new Set("none,currentcolor,transparent,aliceblue,antiquewhite,aqua,aquamarine,azure,beige,bisque,black,blanchedalmond,blue,blueviolet,brown,burlywood,cadetblue,chartreuse,chocolate,coral,cornflowerblue,cornsilk,crimson,cyan,darkblue,darkcyan,darkgoldenrod,darkgray,darkgreen,darkgrey,darkkhaki,darkmagenta,darkolivegreen,darkorange,darkorchid,darkred,darksalmon,darkseagreen,darkslateblue,darkslategray,darkslategrey,darkturquoise,darkviolet,deeppink,deepskyblue,dimgray,dimgrey,dodgerblue,firebrick,floralwhite,forestgreen,fuchsia,gainsboro,ghostwhite,gold,goldenrod,gray,green,greenyellow,grey,honeydew,hotpink,indianred,indigo,ivory,khaki,lavender,lavenderblush,lawngreen,lemonchiffon,lightblue,lightcoral,lightcyan,lightgoldenrodyellow,lightgray,lightgreen,lightgrey,lightpink,lightsalmon,lightseagreen,lightskyblue,lightslategray,lightslategrey,lightsteelblue,lightyellow,lime,limegreen,linen,magenta,maroon,mediumaquamarine,mediumblue,mediumorchid,mediumpurple,mediumseagreen,mediumslateblue,mediumspringgreen,mediumturquoise,mediumvioletred,midnightblue,mintcream,mistyrose,moccasin,navajowhite,navy,oldlace,olive,olivedrab,orange,orangered,orchid,palegoldenrod,palegreen,paleturquoise,palevioletred,papayawhip,peachpuff,peru,pink,plum,powderblue,purple,rebeccapurple,red,rosybrown,royalblue,saddlebrown,salmon,sandybrown,seagreen,seashell,sienna,silver,skyblue,slateblue,slategray,slategrey,snow,springgreen,steelblue,tan,teal,thistle,tomato,turquoise,violet,wheat,white,whitesmoke,yellow".split(","));function Ka(e){return typeof e!="string"?!1:(e=e.toLowerCase().trim(),/^#[0-9a-f]{3,8}$/.test(e)||/^(?:url|var|rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix)\(.*\)$/.test(e)||tZ.has(e))}function YC(e){return typeof e=="number"&&(0<=e&&e<=1||isNaN(e))}function ne(e){return e==null||Xs(e)}function Xs(e){return/^\s*none\s*$/i.test(e)}function GC(e){return/^\s*round\s*$/i.test(e)}function $1(e,t){return WT(e,t,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function Fo(e="middle"){return $1(e,"frameAnchor")}function js(e){if(e==null)return;let t=e[0],n=e[e.length-1];return Hn(t,n)}function WC(e={},...t){let n=e;for(let r of t)for(let i in r)if(n[i]===void 0){let o=r[i];n===e?n={...n,[i]:o}:n[i]=o}return n}function eZ(e){console.warn("named iterables are deprecated; please use an object instead");let t=new Set;return Object.fromEntries(Array.from(e,n=>{let{name:r}=n;if(r==null)throw new Error("missing name");let i=`${r}`;if(i==="__proto__")throw new Error(`illegal name: ${i}`);if(t.has(i))throw new Error(`duplicate name: ${i}`);return t.add(i),[r,n]}))}function xm(e){return cr(e)?eZ(e):e}var mi=Symbol("position"),qr=Symbol("color"),Sl=Symbol("radius"),Il=Symbol("length"),Tl=Symbol("opacity"),wf=Symbol("symbol"),XC=Symbol("projection"),fe=new Map([["x",mi],["y",mi],["fx",mi],["fy",mi],["r",Sl],["color",qr],["opacity",Tl],["symbol",wf],["length",Il],["projection",XC]]);function HC(e){return e===mi||e===XC}function ZC(e){return e===mi||e===Sl||e===Il||e===Tl}var KT=Math.sqrt(3),JT=2/KT,nZ={draw(e,t){let n=Math.sqrt(t/Math.PI),r=n*JT,i=r/2;e.moveTo(0,r),e.lineTo(n,i),e.lineTo(n,-i),e.lineTo(0,-r),e.lineTo(-n,-i),e.lineTo(-n,i),e.closePath()}},tE=new Map([["asterisk",Kp],["circle",zs],["cross",Jp],["diamond",tm],["diamond2",em],["hexagon",nZ],["plus",nm],["square",rm],["square2",im],["star",om],["times",af],["triangle",sm],["triangle2",am],["wye",cm]]);function eE(e){return e&&typeof e.draw=="function"}function QC(e){return eE(e)?!0:typeof e!="string"?!1:tE.has(e.toLowerCase())}function vf(e){if(e==null||eE(e))return e;let t=tE.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid symbol: ${e}`)}function KC(e){if(e==null||eE(e))return[void 0,e];if(typeof e=="string"){let t=tE.get(`${e}`.toLowerCase());if(t)return[void 0,t]}return[e,void 0]}function mn({filter:e,sort:t,reverse:n,transform:r,initializer:i,...o}={},s){if(r===void 0&&(e!=null&&(r=iE(e)),t!=null&&!Do(t)&&(r=nE(r,sE(t))),n&&(r=nE(r,oE))),s!=null&&i!=null)throw new Error("transforms cannot be applied after initializers");return{...o,...(t===null||Do(t))&&{sort:t},transform:nE(r,s)}}function Se({filter:e,sort:t,reverse:n,initializer:r,...i}={},o){return r===void 0&&(e!=null&&(r=iE(e)),t!=null&&!Do(t)&&(r=rE(r,sE(t))),n&&(r=rE(r,oE))),{...i,...(t===null||Do(t))&&{sort:t},initializer:rE(r,o)}}function nE(e,t){return e==null?t===null?void 0:t:t==null?e===null?void 0:e:function(n,r,i){return{data:n,facets:r}=e.call(this,n,r,i),t.call(this,qe(n),r,i)}}function rE(e,t){return e==null?t===null?void 0:t:t==null?e===null?void 0:e:function(n,r,i,...o){let s,a,c,l,u,f;return{data:a=n,facets:c=r,channels:s}=e.call(this,n,r,i,...o),{data:u=a,facets:f=c,channels:l}=t.call(this,a,c,{...i,...s},...o),{data:u,facets:f,channels:{...s,...l}}}}function U1(e,t){return(e.initializer!=null?Se:mn)(e,t)}function JC(e,t){return U1(t,iE(e))}function iE(e){return(t,n)=>{let r=mt(t,e);return{data:t,facets:n.map(i=>i.filter(o=>r[o]))}}}function t5({sort:e,...t}={}){return{...U1(t,oE),sort:Do(e)?e:null}}function oE(e,t){return{data:e,facets:t.map(n=>n.slice().reverse())}}function e5({seed:e,sort:t,...n}={}){return{...U1(n,n5(e==null?Math.random:ll(e))),sort:Do(t)?t:null}}function z1(e,{sort:t,...n}={}){return{...(zr(e)&&e.channel!==void 0?Se:U1)(n,sE(e)),sort:Do(t)?t:null}}function sE(e){return(typeof e=="function"&&e.length!==1?rZ:n5)(e)}function rZ(e){return(t,n)=>{let r=(i,o)=>e(t[i],t[o]);return{data:t,facets:n.map(i=>i.slice().sort(r))}}}function n5(e){let t,n;({channel:t,value:e,order:n}={...pi(e)});let r=t?.startsWith("-");if(r&&(t=t.slice(1)),n===void 0&&(n=r?xl:fn),typeof n!="function")switch(`${n}`.toLowerCase()){case"ascending":n=fn;break;case"descending":n=xl;break;default:throw new Error(`invalid order: ${n}`)}return(i,o,s)=>{let a;if(t===void 0)a=mt(i,e);else{if(s===void 0)throw new Error("channel sort requires an initializer");if(a=s[t],!a)return{};a=a.value}let c=(l,u)=>n(a[l],a[u]);return{data:i,facets:o.map(l=>l.slice().sort(c))}}}function wm(e,t){return q1(null,null,e,t)}function tc(e={y:"count"},t={}){let{x:n=W}=t;if(n==null)throw new Error("missing channel: x");return q1(n,null,e,t)}function ec(e={x:"count"},t={}){let{y:n=W}=t;if(n==null)throw new Error("missing channel: y");return q1(null,n,e,t)}function vm(e={fill:"count"},t={}){let{x:n,y:r}=t;if([n,r]=Be(n,r),n==null)throw new Error("missing channel: x");if(r==null)throw new Error("missing channel: y");return q1(n,r,e,t)}function q1(e,t,{data:n=Y1,filter:r,sort:i,reverse:o,...s}={},a={}){s=cE(s,a),n=a5(n,W),i=i==null?void 0:o5("sort",i,a),r=r==null?void 0:s5("filter",r,a);let[c,l]=Rn(e),[u,f]=Rn(t),{z:d,fill:h,stroke:p,x1:m,x2:g,y1:y,y2:b,...x}=a,[_,v]=Rn(d),[w]=Re(h),[T]=Re(p),[M,R]=Rn(w),[I,A]=Rn(T);return{..."z"in a&&{z:_||d},..."fill"in a&&{fill:M||h},..."stroke"in a&&{stroke:I||p},...mn(x,(O,F,S)=>{let E=vl(mt(O,e),S?.x),N=vl(mt(O,t),S?.y),L=mt(O,d),B=mt(O,w),C=mt(O,T),P=Sm(s,{z:L,fill:B,stroke:C}),$=[],U=[],X=E&&l([]),tt=N&&f([]),nt=L&&v([]),st=B&&R([]),Y=C&&A([]),rt=0;for(let q of s)q.initialize(O);i&&i.initialize(O),r&&r.initialize(O);for(let q of F){let H=[];for(let ot of s)ot.scope("facet",q);i&&i.scope("facet",q),r&&r.scope("facet",q);for(let[ot,z]of Ja(q,P))for(let[Lt,dt]of Ja(z,N))for(let[Wt,Xt]of Ja(dt,E)){let et={data:O};if(E&&(et.x=Wt),N&&(et.y=Lt),!(r&&!r.reduce(Xt,et))){H.push(rt++),U.push(n.reduceIndex(Xt,O,et)),E&&X.push(Wt),N&&tt.push(Lt),L&&nt.push(P===L?ot:L[Xt[0]]),B&&st.push(P===B?ot:B[Xt[0]]),C&&Y.push(P===C?ot:C[Xt[0]]);for(let oe of s)oe.reduce(Xt,et);i&&i.reduce(Xt,et)}}$.push(H)}return lE($,i,o),{data:U,facets:$}}),...!Lo(s,"x")&&(c?{x:c}:{x1:m,x2:g}),...!Lo(s,"y")&&(u?{y:u}:{y1:y,y2:b}),...Object.fromEntries(s.map(({name:O,output:F})=>[O,F]))}}function Lo(e,...t){for(let{name:n}of e)if(t.includes(n))return!0;return!1}function aE(e,t,n=j1){let r=Object.entries(e);return t.title!=null&&e.title===void 0&&r.push(["title",lZ]),t.href!=null&&e.href===void 0&&r.push(["href",G1]),r.filter(([,i])=>i!==void 0).map(([i,o])=>o===null?iZ(i):n(i,o,t))}function j1(e,t,n,r=V1){let i;hn(t)&&"reduce"in t&&(i=t.scale,t=t.reduce);let o=r(e,t,n),[s,a]=pn(o.label),c;return{name:e,output:i===void 0?s:{value:s,scale:i},initialize(l){o.initialize(l),c=a([])},scope(l,u){o.scope(l,u)},reduce(l,u){c.push(o.reduce(l,u))}}}function iZ(e){return{name:e,initialize(){},scope(){},reduce(){}}}function V1(e,t,n,r=Sf){let i=C1(e,n),o=r(t,i),s,a;return{label:On(o===_m?null:i,o.label),initialize(c){s=i===void 0?c:mt(c,i),o.scope==="data"&&(a=o.reduceIndex(ar(c),s))},scope(c,l){o.scope===c&&(a=o.reduceIndex(l,s))},reduce(c,l){return o.scope==null?o.reduceIndex(c,s,l):o.reduceIndex(c,s,a,l)}}}function Ja(e,t){return t?uo(an(e,n=>t[n]),Vs):[[,e]]}function Sf(e,t,n=oZ){if(e==null)return n(e);if(typeof e.reduceIndex=="function")return e;if(typeof e.reduce=="function"&&hn(e))return aZ(e);if(typeof e=="function")return cZ(e);if(/^p\d{2}$/i.test(e))return Hs(yf(e));switch(`${e}`.toLowerCase()){case"first":return G1;case"last":return uZ;case"identity":return Y1;case"count":return _m;case"distinct":return fZ;case"sum":return t==null?_m:dZ;case"proportion":return i5(t,"data");case"proportion-facet":return i5(t,"facet");case"deviation":return Hs(ri);case"min":return Hs(ce);case"min-index":return Hs(E0);case"max":return Hs(Gt);case"max-index":return Hs(T0);case"mean":return r5(Ss);case"median":return r5(Bi);case"variance":return Hs(Ma);case"mode":return Hs(Iu)}return n(e)}function oZ(e){throw new Error(`invalid reduce: ${e}`)}function cE(e,t){return aE(e,t,o5)}function o5(e,t,n){return j1(e,t,n,s5)}function s5(e,t,n){return V1(e,t,n,a5)}function a5(e,t){return Sf(e,t,sZ)}function sZ(e){switch(`${e}`.toLowerCase()){case"x":return hZ;case"y":return pZ}throw new Error(`invalid group reduce: ${e}`)}function Sm(e,t){for(let n in t){let r=t[n];if(r!==void 0&&!e.some(i=>i.name===n))return r}}function lE(e,t,n){if(t){let r=t.output.transform(),i=(o,s)=>fn(r[o],r[s]);e.forEach(o=>o.sort(i))}n&&e.forEach(r=>r.reverse())}function aZ(e){return console.warn("deprecated reduce interface; implement reduceIndex instead."),{...e,reduceIndex:e.reduce.bind(e)}}function cZ(e){return{reduceIndex(t,n,r){return e(bm(n,t),r)}}}function Hs(e){return{reduceIndex(t,n){return e(t,r=>n[r])}}}function r5(e){return{reduceIndex(t,n){let r=e(t,i=>n[i]);return Oe(n)?new Date(r):r}}}var Y1={reduceIndex(e,t){return bm(t,e)}},G1={reduceIndex(e,t){return t[e[0]]}},lZ={reduceIndex(e,t){let r=uo(Ci(e,o=>o.length,o=>t[o]),Ha),i=r.slice(-5).reverse();if(i.length<r.length){let o=r.slice(0,-4);i[4]=[`\u2026 ${o.length.toLocaleString("en-US")} more`,En(o,Ha)]}return i.map(([o,s])=>`${o} (${s.toLocaleString("en-US")})`).join(`
16
+ `)}},uZ={reduceIndex(e,t){return t[e[e.length-1]]}},_m={label:"Frequency",reduceIndex(e){return e.length}},fZ={label:"Distinct",reduceIndex(e,t){let n=new Qn;for(let r of e)n.add(t[r]);return n.size}},dZ=Hs(En);function i5(e,t){return e==null?{scope:t,label:"Frequency",reduceIndex:(n,r,i=1)=>n.length/i}:{scope:t,reduceIndex:(n,r,i=1)=>En(n,o=>r[o])/i}}var hZ={reduceIndex(e,t,{x:n}){return n}},pZ={reduceIndex(e,t,{y:n}){return n}};function c5(e){if(typeof e!="function")throw new Error(`invalid test function: ${e}`);return{reduceIndex(t,n,{data:r}){return n[t.find(i=>e(r[i],i,r))]}}}function If(e,{scale:t,type:n,value:r,filter:i,hint:o,label:s=On(r)},a){return o===void 0&&typeof r?.transform=="function"&&(o=r.hint),fE(a,{scale:t,type:n,value:mt(e,r),label:s,filter:i,hint:o})}function W1(e,t){return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,If(t,r,n)]))}function Tf(e,t){let n=Object.fromEntries(Object.entries(e).map(([r,{scale:i,value:o}])=>{let s=i==null?null:t[i];return[r,s==null?o:Yt(o,s)]}));return n.channels=e,n}function fE(e,t){let{scale:n,value:r}=t;if(n===!0||n==="auto")switch(e){case"fill":case"stroke":case"color":t.scale=n!==!0&&P1(r,Ka)?null:"color";break;case"fillOpacity":case"strokeOpacity":case"opacity":t.scale=n!==!0&&P1(r,YC)?null:"opacity";break;case"symbol":n!==!0&&P1(r,QC)?(t.scale=null,t.value=Yt(r,vf)):t.scale="symbol";break;default:t.scale=fe.has(e)?e:null;break}else if(n===!1)t.scale=null;else if(n!=null&&!fe.has(n))throw new Error(`unknown scale: ${n}`);return t}function u5(e,t,n,r,i){let{order:o,reverse:s,reduce:a=!0,limit:c}=i;for(let l in i){if(!fe.has(l))continue;let{value:u,order:f=o,reverse:d=s,reduce:h=a,limit:p=c}=pi(i[l]),m=u?.startsWith("-");if(m&&(u=u.slice(1)),f=f===void 0?m!==(u==="width"||u==="height")?d5:f5:gZ(f),h==null||h===!1)continue;let g=l==="fx"||l==="fy"?yZ(t,r[l]):mZ(n,l);if(!g)throw new Error(`missing channel for scale: ${l}`);let y=g.value,[b=0,x=1/0]=cr(p)?p:p<0?[p]:[0,p];if(u==null)g.domain=()=>{let _=Array.from(new Qn(y));return d&&(_=_.reverse()),(b!==0||x!==1/0)&&(_=_.slice(b,x)),_};else{let _=u==="data"?e:u==="height"?l5(n,"y1","y2"):u==="width"?l5(n,"x1","x2"):uE(n,u,u==="y"?"y2":u==="x"?"x2":void 0),v=Sf(h===!0?"max":h,_);g.domain=()=>{let w=U2(ar(y),T=>v.reduceIndex(T,_),T=>y[T]);return f&&w.sort(f),d&&w.reverse(),(b!==0||x!==1/0)&&(w=w.slice(b,x)),w.map(Vs)}}}}function mZ(e,t){for(let n in e){let r=e[n];if(r.scale===t)return r}}function yZ(e,t){let n=e.original;if(n===e)return t;let r=t.value,i=t.value=[];for(let o=0;o<n.length;++o){let s=r[n[o][0]];for(let a of e[o])i[a]=s}return t}function l5(e,t,n){let r=uE(e,t),i=uE(e,n);return Yt(i,(o,s)=>Math.abs(o-r[s]),Float64Array)}function uE(e,t,n){let r=e[t];if(!r&&n!==void 0&&(r=e[n]),r)return r.value;throw new Error(`missing channel: ${t}`)}function gZ(e){if(e==null||typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"ascending":return f5;case"descending":return d5}throw new Error(`invalid order: ${e}`)}function f5([e,t],[n,r]){return fn(t,r)||fn(e,n)}function d5([e,t],[n,r]){return xl(t,r)||fn(e,n)}function Im(e,t){let n=e[t];if(n){for(;n.source;)n=n.source;return n.source===null?null:n}}function X1(e){let t,n;return(...r)=>((n?.length!==r.length||n.some((i,o)=>i!==r[o]))&&(n=r,t=e(...r)),t)}var bZ=X1(e=>new Intl.NumberFormat(e)),xZ=X1((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{month:t}})),_Z=X1((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{weekday:t}}));function wZ(e="en-US"){let t=bZ(e);return n=>n!=null&&!isNaN(n)?t.format(n):void 0}function h5(e="en-US",t="short"){let n=xZ(e,t);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2e3,+r)))?n.format(r):void 0}function p5(e="en-US",t="short"){let n=_Z(e,t);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2001,0,+r)))?n.format(r):void 0}function dE(e){return df(e,"Invalid Date")}function vZ(e="en-US"){let t=wZ(e);return n=>(n instanceof Date?dE:typeof n=="number"?t:ze)(n)}var zi=vZ();var hE=0,pE;function m5(){let e=hE;return hE=0,pE=void 0,e}function jn(e){e!==pE&&(pE=e,console.warn(e),++hE)}var De=(typeof window<"u"?window.devicePixelRatio>1:typeof it>"u")?0:.5,SZ=0;function H1(){return`plot-clip-${++SZ}`}function Z1(e,{title:t,href:n,ariaLabel:r,ariaDescription:i,ariaHidden:o,target:s,fill:a,fillOpacity:c,stroke:l,strokeWidth:u,strokeOpacity:f,strokeLinejoin:d,strokeLinecap:h,strokeMiterlimit:p,strokeDasharray:m,strokeDashoffset:g,opacity:y,mixBlendMode:b,imageFilter:x,paintOrder:_,pointerEvents:v,shapeRendering:w,channels:T},{ariaLabel:M,fill:R="currentColor",fillOpacity:I,stroke:A="none",strokeOpacity:O,strokeWidth:F,strokeLinecap:S,strokeLinejoin:E,strokeMiterlimit:N,paintOrder:L}){R===null&&(a=null,c=null),A===null&&(l=null,f=null),ne(R)?!ne(A)&&(!ne(a)||T?.fill)&&(A="none"):ne(A)&&(!ne(l)||T?.stroke)&&(R="none");let[B,C]=Re(a,R),[P,$]=ie(c,I),[U,X]=Re(l,A),[tt,nt]=ie(f,O),[st,Y]=ie(y);Xs(X)||(u===void 0&&(u=F),h===void 0&&(h=S),d===void 0&&(d=E),p===void 0&&!GC(d)&&(p=N),!Xs(C)&&_===void 0&&(_=L));let[rt,q]=ie(u);return R!==null&&(e.fill=le(C,"currentColor"),e.fillOpacity=Tm($,1)),A!==null&&(e.stroke=le(X,"none"),e.strokeWidth=Tm(q,1),e.strokeOpacity=Tm(nt,1),e.strokeLinejoin=le(d,"miter"),e.strokeLinecap=le(h,"butt"),e.strokeMiterlimit=Tm(p,4),e.strokeDasharray=le(m,"none"),e.strokeDashoffset=le(g,"0")),e.target=ze(s),e.ariaLabel=ze(M),e.ariaDescription=ze(i),e.ariaHidden=ze(o),e.opacity=Tm(Y,1),e.mixBlendMode=le(b,"normal"),e.imageFilter=le(x,"none"),e.paintOrder=le(_,"normal"),e.pointerEvents=le(v,"auto"),e.shapeRendering=le(w,"auto"),{title:{value:t,optional:!0,filter:null},href:{value:n,optional:!0,filter:null},ariaLabel:{value:r,optional:!0,filter:null},fill:{value:B,scale:"auto",optional:!0},fillOpacity:{value:P,scale:"auto",optional:!0},stroke:{value:U,scale:"auto",optional:!0},strokeOpacity:{value:tt,scale:"auto",optional:!0},strokeWidth:{value:rt,optional:!0},opacity:{value:st,scale:"auto",optional:!0}}}function IZ(e,t){t&&e.filter(n=>hm(t[n])).append("title").call(EZ,t)}function TZ(e,t){t&&e.filter(([n])=>hm(t[n])).append("title").call(AZ,t)}function EZ(e,t){t&&e.text(n=>zi(t[n]))}function AZ(e,t){t&&e.text(([n])=>zi(t[n]))}function Zt(e,{target:t,tip:n},{ariaLabel:r,title:i,fill:o,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:l,opacity:u,href:f}){r&&ft(e,"aria-label",d=>r[d]),o&&ft(e,"fill",d=>o[d]),s&&ft(e,"fill-opacity",d=>s[d]),a&&ft(e,"stroke",d=>a[d]),c&&ft(e,"stroke-opacity",d=>c[d]),l&&ft(e,"stroke-width",d=>l[d]),u&&ft(e,"opacity",d=>u[d]),f&&y5(e,d=>f[d],t),n||IZ(e,i)}function El(e,{target:t,tip:n},{ariaLabel:r,title:i,fill:o,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:l,opacity:u,href:f}){r&&ft(e,"aria-label",([d])=>r[d]),o&&ft(e,"fill",([d])=>o[d]),s&&ft(e,"fill-opacity",([d])=>s[d]),a&&ft(e,"stroke",([d])=>a[d]),c&&ft(e,"stroke-opacity",([d])=>c[d]),l&&ft(e,"stroke-width",([d])=>l[d]),u&&ft(e,"opacity",([d])=>u[d]),f&&y5(e,([d])=>f[d],t),n||TZ(e,i)}function MZ({ariaLabel:e,title:t,fill:n,fillOpacity:r,stroke:i,strokeOpacity:o,strokeWidth:s,opacity:a,href:c},{tip:l}){return[e,l?void 0:t,n,r,i,o,s,a,c].filter(u=>u!==void 0)}function Em(e,t,n){let r=an(e,i=>t[i]);return n===void 0&&r.size>1+e.length>>1&&jn("Warning: the implicit z channel has high cardinality. This may occur when the fill or stroke channel is associated with quantitative data rather than ordinal or categorical data. You can suppress this warning by setting the z option explicitly; if this data represents a single series, set z to null."),r.values()}function*Q1(e,t,n,r){let{z:i}=n,{z:o}=r,s=MZ(r,n),a=[...t,...s];for(let c of o?Em(e,o,i):[e]){let l,u;t:for(let f of c){for(let d of a)if(!Ue(d[f])){u&&u.push(-1);continue t}if(l===void 0){u&&(yield u),l=s.map(d=>Gs(d[f])),u=[f];continue}u.push(f);for(let d=0;d<s.length;++d)if(Gs(s[d][f])!==l[d]){yield u,l=s.map(p=>Gs(p[f])),u=[f];continue t}}u&&(yield u)}}function K1(e){return e===!0?e="frame":e===!1?e=null:e!=null&&(e=Ke(e,"clip",["frame","sphere"])),e}function NZ(e,t,n,r){let i,{clip:o=r.clip}=t;switch(o){case"frame":{let{width:s,height:a,marginLeft:c,marginRight:l,marginTop:u,marginBottom:f}=n,d=H1();i=`url(#${d})`,e=ct("svg:g",r).call(h=>h.append("svg:clipPath").attr("id",d).append("rect").attr("x",c).attr("y",u).attr("width",s-l-c).attr("height",a-u-f)).each(function(){this.appendChild(e.node()),e.node=()=>this});break}case"sphere":{let{projection:s}=r;if(!s)throw new Error('the "sphere" clip option requires a projection');let a=H1();i=`url(#${a})`,e.append("clipPath").attr("id",a).append("path").attr("d",Mn(s)({type:"Sphere"}));break}}ft(e,"aria-label",t.ariaLabel),ft(e,"aria-description",t.ariaDescription),ft(e,"aria-hidden",t.ariaHidden),ft(e,"clip-path",i)}function Ft(e,t,n,r){NZ(e,t,n,r),ft(e,"fill",t.fill),ft(e,"fill-opacity",t.fillOpacity),ft(e,"stroke",t.stroke),ft(e,"stroke-width",t.strokeWidth),ft(e,"stroke-opacity",t.strokeOpacity),ft(e,"stroke-linejoin",t.strokeLinejoin),ft(e,"stroke-linecap",t.strokeLinecap),ft(e,"stroke-miterlimit",t.strokeMiterlimit),ft(e,"stroke-dasharray",t.strokeDasharray),ft(e,"stroke-dashoffset",t.strokeDashoffset),ft(e,"shape-rendering",t.shapeRendering),ft(e,"filter",t.imageFilter),ft(e,"paint-order",t.paintOrder);let{pointerEvents:i=r.pointerSticky===!1?"none":void 0}=t;ft(e,"pointer-events",i)}function Rt(e,t){RZ(e,"mix-blend-mode",t.mixBlendMode),ft(e,"opacity",t.opacity)}function y5(e,t,n){e.each(function(r){let i=t(r);if(i!=null){let o=this.ownerDocument.createElementNS(ii.svg,"a");o.setAttribute("fill","inherit"),o.setAttributeNS(ii.xlink,"href",i),n!=null&&o.setAttribute("target",n),this.parentNode.insertBefore(o,this).appendChild(this)}})}function ft(e,t,n){n!=null&&e.attr(t,n)}function RZ(e,t,n){n!=null&&e.style(t,n)}function It(e,t,{x:n,y:r},i=De,o=De){i+=t.dx,o+=t.dy,n?.bandwidth&&(i+=n.bandwidth()/2),r?.bandwidth&&(o+=r.bandwidth()/2),(i||o)&&e.attr("transform",`translate(${i},${o})`)}function le(e,t){if((e=ze(e))!==t)return e}function Tm(e,t){if((e=Nt(e))!==t)return e}var OZ=/^-?([_a-z]|[\240-\377]|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])([_a-z0-9-]|[\240-\377]|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])*$/i;function Ef(e){if(e===void 0)return"plot-d6a7b5";if(e=`${e}`,!OZ.test(e))throw new Error(`invalid class name: ${e}`);return e}function Af(e,t){if(typeof t=="string")e.property("style",t);else if(t!=null)for(let n of e)Object.assign(n.style,t)}function yn({frameAnchor:e},{width:t,height:n,marginTop:r,marginRight:i,marginBottom:o,marginLeft:s}){return[/left$/.test(e)?s:/right$/.test(e)?t-i:(s+t-i)/2,/^top/.test(e)?r:/^bottom/.test(e)?n-o:(r+n-o)/2]}function nc(e={}){let{document:t=typeof window<"u"?window.document:void 0,clip:n}=e;return{document:t,clip:K1(n)}}function ct(e,{document:t}){return qt(Ts(e).call(t.documentElement))}var b5=Math.PI,Zs=2*b5,g5=.618;function x5({projection:e,inset:t=0,insetTop:n=t,insetRight:r=t,insetBottom:i=t,insetLeft:o=t}={},s){if(e==null)return;if(typeof e.stream=="function")return e;let a,c,l="frame";if(hn(e)){let v;if({type:e,domain:c,inset:v,insetTop:n=v!==void 0?v:n,insetRight:r=v!==void 0?v:r,insetBottom:i=v!==void 0?v:i,insetLeft:o=v!==void 0?v:o,clip:l=l,...a}=e,e==null)return}typeof e!="function"&&({type:e}=_5(e));let{width:u,height:f,marginLeft:d,marginRight:h,marginTop:p,marginBottom:m}=s,g=u-d-h-o-r,y=f-p-m-n-i;if(e=e?.({width:g,height:y,clip:l,...a}),e==null)return;l=DZ(l,d,p,u-h,f-m);let b=d+o,x=p+n,_;if(c!=null){let[[v,w],[T,M]]=Mn(e).bounds(c),R=Math.min(g/(T-v),y/(M-w));R>0?(b-=(R*(v+T)-g)/2,x-=(R*(w+M)-y)/2,_=Object.assign(al({point(I,A){this.stream.point(I*R+b,A*R+x)}}),{invert:([I,A])=>[(I-b)/R,(A-x)/R]})):jn("Warning: the projection could not be fit to the specified domain; using the default scale.")}return _??=b===0&&x===0?w5():Object.assign(al({point(v,w){this.stream.point(v+b,w+x)}}),{invert:([v,w])=>[v-b,w-x]}),{stream:v=>e.stream(_.stream(l(v))),invert:v=>e.invert(_.invert(v))}}function _5(e){switch(`${e}`.toLowerCase()){case"albers-usa":return qi(dI,.7463,.4673);case"albers":return J1(Tp,.7463,.4673);case"azimuthal-equal-area":return qi(pI,4,4);case"azimuthal-equidistant":return qi(yI,Zs,Zs);case"conic-conformal":return J1(xI,Zs,Zs);case"conic-equal-area":return J1($a,6.1702,2.9781);case"conic-equidistant":return J1(wI,7.312,3.6282);case"equal-earth":return qi(SI,5.4133,2.6347);case"equirectangular":return qi(_I,Zs,b5);case"gnomonic":return qi(TI,3.4641,3.4641);case"identity":return{type:w5};case"reflect-y":return{type:kZ};case"mercator":return qi(gI,Zs,Zs);case"orthographic":return qi(AI,2,2);case"stereographic":return qi(NI,2,2);case"transverse-mercator":return qi(OI,Zs,Zs);default:throw new Error(`unknown projection type: ${e}`)}}function DZ(e,t,n,r,i){if(e===!1||e==null||typeof e=="number")return o=>o;switch(e===!0&&(e="frame"),`${e}`.toLowerCase()){case"frame":return ju(t,n,r,i);default:throw new Error(`unknown projection clip type: ${e}`)}}function qi(e,t,n){return{type:({width:r,height:i,rotate:o,precision:s=.15,clip:a})=>{let c=e();return s!=null&&c.precision?.(s),o!=null&&c.rotate?.(o),typeof a=="number"&&c.clipAngle?.(a),c.scale(Math.min(r/t,i/n)),c.translate([r/2,i/2]),c},aspectRatio:n/t}}function J1(e,t,n){let{type:r,aspectRatio:i}=qi(e,t,n);return{type:o=>{let{parallels:s,domain:a,width:c,height:l}=o,u=r(o);return s!=null&&(u.parallels(s),a===void 0&&u.fitSize([c,l],{type:"Sphere"})),u},aspectRatio:i}}var w5=dn({stream:e=>e,invert:e=>e}),kZ=dn(Object.assign(al({point(e,t){this.stream.point(e,-t)}}),{invert:([e,t])=>[e,-t]}));function mE(e,t,n,r){let i=n[e],o=n[t],s=i.length,a=n[e]=new Float64Array(s).fill(NaN),c=n[t]=new Float64Array(s).fill(NaN),l,u=r.stream({point(f,d){a[l]=f,c[l]=d}});for(l=0;l<s;++l)u.point(i[l],o[l])}function v5({projection:e}={}){return e==null?!1:typeof e.stream=="function"?!0:(hn(e)&&(e=e.type),e!=null)}function S5(e){if(typeof e?.stream=="function")return g5;if(hn(e)&&(e=e.type),e!=null){if(typeof e!="function"){let{aspectRatio:t}=_5(e);if(t)return t}return g5}}function rc(e,t,{projection:n}){let{x:r,y:i}=e,o={};return r&&(o.x=r),i&&(o.y=i),o=Tf(o,t),n&&r?.scale==="x"&&i?.scale==="y"&&mE("x","y",o,n),r&&(o.x=Qe(o.x)),i&&(o.y=Qe(o.y)),o}function I5(e){let t=[],n=[],r={scale:"x",value:t},i={scale:"y",value:n},o={point(s,a){t.push(s),n.push(a)},lineStart(){},lineEnd(){},polygonStart(){},polygonEnd(){},sphere(){}};for(let s of e.value)Br(s,o);return[r,i]}var FZ=["#4269d0","#efb118","#ff725c","#6cc5b0","#3ca951","#ff8ab7","#a463f2","#97bbf5","#9c6b4e","#9498a0"],N5=new Map([["accent",eT],["category10",tT],["dark2",nT],["observable10",FZ],["paired",rT],["pastel1",iT],["pastel2",oT],["set1",sT],["set2",aT],["set3",cT],["tableau10",lT]]);function R5(e){return e!=null&&N5.has(`${e}`.toLowerCase())}var T5=new Map([...N5,["brbg",Qs(fx,dx)],["prgn",Qs(hx,px)],["piyg",Qs(mx,yx)],["puor",Qs(gx,bx)],["rdbu",Qs(Xp,ef)],["rdgy",Qs(xx,_x)],["rdylbu",Qs(Hp,nf)],["rdylgn",Qs(wx,vx)],["spectral",Qs(Sx,Ix)],["burd",E5(Xp,ef)],["buylrd",E5(Hp,nf)],["blues",gn(Hx,Zx)],["greens",gn(Qx,Kx)],["greys",gn(Jx,t1)],["oranges",gn(o1,s1)],["purples",gn(e1,n1)],["reds",gn(r1,i1)],["turbo",Ks(m1)],["viridis",Ks(g1)],["magma",Ks(b1)],["inferno",Ks(x1)],["plasma",Ks(_1)],["cividis",Ks(a1)],["cubehelix",Ks(c1)],["warm",Ks(u1)],["cool",Ks(f1)],["bugn",gn(Tx,Ex)],["bupu",gn(Ax,Mx)],["gnbu",gn(Nx,Rx)],["orrd",gn(Ox,Dx)],["pubu",gn(Lx,Cx)],["pubugn",gn(kx,Fx)],["purd",gn(Bx,Px)],["rdpu",gn($x,Ux)],["ylgn",gn(jx,Vx)],["ylgnbu",gn(zx,qx)],["ylorbr",gn(Yx,Gx)],["ylorrd",gn(Wx,Xx)],["rainbow",A5(d1)],["sinebow",A5(p1)]]);function gn(e,t){return({length:n})=>n===1?[e[3][1]]:n===2?[e[3][1],e[3][2]]:(n=Math.max(3,Math.floor(n)),n>9?Cn(t,n):e[n])}function Qs(e,t){return({length:n})=>n===2?[e[3][0],e[3][2]]:(n=Math.max(3,Math.floor(n)),n>11?Cn(t,n):e[n])}function E5(e,t){return({length:n})=>n===2?[e[3][2],e[3][0]]:(n=Math.max(3,Math.floor(n)),n>11?Cn(r=>t(1-r),n):e[n].slice().reverse())}function Ks(e){return({length:t})=>Cn(e,Math.max(2,Math.floor(t)))}function A5(e){return({length:t})=>Cn(e,Math.floor(t)+1).slice(0,-1)}function yE(e){let t=`${e}`.toLowerCase();if(!T5.has(t))throw new Error(`unknown ordinal scheme: ${t}`);return T5.get(t)}function Am(e,t){let n=yE(e),r=typeof n=="function"?n({length:t}):n;return r.length!==t?r.slice(0,t):r}function O5(e,t="greys"){let n=new Set,[r,i]=Am(t,2);for(let o of e)if(o!=null)if(o===!0)n.add(i);else if(o===!1)n.add(r);else return;return[...n]}var M5=new Map([["brbg",dx],["prgn",px],["piyg",yx],["puor",bx],["rdbu",ef],["rdgy",_x],["rdylbu",nf],["rdylgn",vx],["spectral",Ix],["burd",e=>ef(1-e)],["buylrd",e=>nf(1-e)],["blues",Zx],["greens",Kx],["greys",t1],["purples",n1],["reds",i1],["oranges",s1],["turbo",m1],["viridis",g1],["magma",b1],["inferno",x1],["plasma",_1],["cividis",a1],["cubehelix",c1],["warm",u1],["cool",f1],["bugn",Ex],["bupu",Mx],["gnbu",Rx],["orrd",Dx],["pubugn",Fx],["pubu",Cx],["purd",Px],["rdpu",Ux],["ylgnbu",qx],["ylgn",Vx],["ylorbr",Gx],["ylorrd",Xx],["rainbow",d1],["sinebow",p1]]);function Mf(e){let t=`${e}`.toLowerCase();if(!M5.has(t))throw new Error(`unknown quantitative scheme: ${t}`);return M5.get(t)}var LZ=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function D5(e){return e!=null&&LZ.has(`${e}`.toLowerCase())}var bE=e=>t=>e(1-t),gE=[0,1],k5=new Map([["number",we],["rgb",oi],["hsl",dS],["hcl",hS],["lab",X0]]);function xE(e){let t=`${e}`.toLowerCase();if(!k5.has(t))throw new Error(`unknown interpolator: ${t}`);return k5.get(t)}function Rf(e,t,n,{type:r,nice:i,clamp:o,zero:s,domain:a=z5(e,n),unknown:c,round:l,scheme:u,interval:f,range:d=fe.get(e)===Sl?$Z(n,a):fe.get(e)===Il?UZ(n,a):fe.get(e)===Tl?gE:void 0,interpolate:h=fe.get(e)===qr?u==null&&d!==void 0?oi:Mf(u!==void 0?u:r==="cyclical"?"rainbow":"turbo"):l?Kc:we,reverse:p}){if(f=ko(f,r),(r==="cyclical"||r==="sequential")&&(r="linear"),typeof h!="function"&&(h=xE(h)),p=!!p,d!==void 0){let m=(a=qe(a)).length,g=(d=qe(d)).length;if(m!==g){if(h.length===1)throw new Error("invalid piecewise interpolator");h=mo(h,d),d=void 0}}if(h.length===1?(p&&(h=bE(h),p=!1),d===void 0&&(d=Float64Array.from(a,(m,g)=>g/(a.length-1)),d.length===2&&(d=gE)),t.interpolate((d===gE?dn:Mm)(h))):t.interpolate(h),s){let[m,g]=ae(a);(m>0||g<0)&&(a=Za(a),js(a)!==Math.sign(m)?a[a.length-1]=0:a[0]=0)}return p&&(a=Ra(a)),t.domain(a).unknown(c),i&&(t.nice(CZ(i,r)),a=t.domain()),d!==void 0&&t.range(d),o&&t.clamp(o),{type:r,domain:a,range:d,scale:t,interpolate:h,interval:f}}function CZ(e,t){return e===!0?void 0:typeof e=="number"?e:$C(e,t)}function F5(e,t,n){return Rf(e,ks(),t,n)}function L5(e,t,n){return _E(e,t,{...n,exponent:.5})}function _E(e,t,{exponent:n=1,...r}){return Rf(e,Bp().exponent(n),t,{...r,type:"pow"})}function C5(e,t,{base:n=10,domain:r=zZ(t),...i}){return Rf(e,Lp().base(n),t,{...i,domain:r})}function B5(e,t,{constant:n=1,...r}){return Rf(e,Cp().constant(n),t,r)}function P5(e,t,{range:n,quantiles:r=n===void 0?5:(n=[...n]).length,n:i=r,scheme:o="rdylbu",domain:s=qZ(t),unknown:a,interpolate:c,reverse:l}){return n===void 0&&(n=c!==void 0?Cn(c,i):fe.get(e)===qr?Am(o,i):void 0),s.length>0&&(s=Pp(s,n===void 0?{length:i}:n).quantiles()),t_(e,t,{domain:s,range:n,reverse:l,unknown:a})}function $5(e,t,{range:n,n:r=n===void 0?5:(n=[...n]).length,scheme:i="rdylbu",domain:o=z5(e,t),unknown:s,interpolate:a,reverse:c}){let[l,u]=ae(o),f;return n===void 0?(f=Tn(l,u,r),f[0]<=l&&f.splice(0,1),f[f.length-1]>=u&&f.pop(),r=f.length+1,n=a!==void 0?Cn(a,r):fe.get(e)===qr?Am(i,r):void 0):(f=Cn(we(l,u),r+1).slice(1,-1),l instanceof Date&&(f=f.map(d=>new Date(d)))),js(qe(o))<0&&f.reverse(),t_(e,t,{domain:f,range:n,reverse:c,unknown:s})}function t_(e,t,{domain:n=[0],unknown:r,scheme:i="rdylbu",interpolate:o,range:s=o!==void 0?Cn(o,n.length+1):fe.get(e)===qr?Am(i,n.length+1):void 0,reverse:a}){n=qe(n);let c=js(n);if(!isNaN(c)&&!BZ(n,c))throw new Error(`the ${e} scale has a non-monotonic domain`);return a&&(s=Ra(s)),{type:"threshold",scale:$p(c<0?Ra(n):n,s===void 0?[]:s).unknown(r),domain:n,range:s}}function BZ(e,t){for(let n=1,r=e.length,i=e[0];n<r;++n){let o=Hn(i,i=e[n]);if(o!==0&&o!==t)return!1}return!0}function U5(e){return{type:"identity",scale:ZC(fe.get(e))?kp():t=>t}}function Nf(e,t=ff){return e.length?[ce(e,({value:n})=>n===void 0?n:ce(n,t)),Gt(e,({value:n})=>n===void 0?n:Gt(n,t))]:[0,1]}function z5(e,t){let n=fe.get(e);return(n===Sl||n===Tl||n===Il?PZ:Nf)(t)}function PZ(e){return[0,e.length?Gt(e,({value:t})=>t===void 0?t:Gt(t,ff)):1]}function $Z(e,t){let n=e.find(({radius:s})=>s!==void 0);if(n!==void 0)return[0,n.radius];let r=Kn(e,.5,({value:s})=>s===void 0?NaN:Kn(s,.25,sr)),i=t.map(s=>3*Math.sqrt(s/r)),o=30/Gt(i);return o<1?i.map(s=>s*o):i}function UZ(e,t){let n=Bi(e,({value:o})=>o===void 0?NaN:Bi(o,Math.abs)),r=t.map(o=>12*o/n),i=60/Gt(r);return i<1?r.map(o=>o*i):r}function zZ(e){for(let{value:t}of e)if(t!==void 0)for(let n of t){if(n>0)return Nf(e,sr);if(n<0)return Nf(e,Va)}return[1,10]}function qZ(e){let t=[];for(let{value:n}of e)if(n!==void 0)for(let r of n)t.push(r);return t}function Mm(e){return(t,n)=>r=>e(t+r*(n-t))}function e_(e,t,n,r,{type:i,nice:o,clamp:s,domain:a=Nf(r),unknown:c,pivot:l=0,scheme:u,range:f,symmetric:d=!0,interpolate:h=fe.get(e)===qr?u==null&&f!==void 0?oi:Mf(u!==void 0?u:"rdbu"):we,reverse:p}){l=+l,a=qe(a);let[m,g]=a;if(a.length>2&&jn(`Warning: the diverging ${e} scale domain contains extra elements.`),Hn(m,g)<0&&([m,g]=[g,m],p=!p),m=Math.min(m,l),g=Math.max(g,l),typeof h!="function"&&(h=xE(h)),f!==void 0&&(h=h.length===1?Mm(h)(...f):mo(h,f)),p&&(h=bE(h)),d){let y=n.apply(l),b=y-n.apply(m),x=n.apply(g)-y;b<x?m=n.invert(y-x):b>x&&(g=n.invert(y+b))}return t.domain([m,l,g]).unknown(c).interpolator(h),s&&t.clamp(s),o&&t.nice(o),{type:i,domain:[m,g],pivot:l,interpolate:h,scale:t}}function q5(e,t,n){return e_(e,Wp(),jZ,t,n)}function j5(e,t,n){return wE(e,t,{...n,exponent:.5})}function wE(e,t,{exponent:n=1,...r}){return e_(e,ux().exponent(n=+n),GZ(n),t,{...r,type:"diverging-pow"})}function V5(e,t,{base:n=10,pivot:r=1,domain:i=Nf(t,r<0?Va:sr),...o}){return e_(e,cx().base(n=+n),VZ,t,{domain:i,pivot:r,...o})}function Y5(e,t,{constant:n=1,...r}){return e_(e,lx().constant(n=+n),WZ(n),t,r)}var jZ={apply(e){return e},invert(e){return e}},VZ={apply:Math.log,invert:Math.exp},YZ={apply(e){return Math.sign(e)*Math.sqrt(Math.abs(e))},invert(e){return Math.sign(e)*(e*e)}};function GZ(e){return e===.5?YZ:{apply(t){return Math.sign(t)*Math.pow(Math.abs(t),e)},invert(t){return Math.sign(t)*Math.pow(Math.abs(t),1/e)}}}function WZ(e){return{apply(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))},invert(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}}function G5(e,t,n,r){return Rf(e,t,n,r)}function W5(e,t,n){return G5(e,ox(),t,n)}function X5(e,t,n){return G5(e,sx(),t,n)}var Of=Symbol("ordinal");function Z5(e,t,n,{type:r,interval:i,domain:o,range:s,reverse:a,hint:c}){return i=ko(i,r),o===void 0&&(o=eB(n,i,e)),(r==="categorical"||r===Of)&&(r="ordinal"),a&&(o=Ra(o)),o=t.domain(o).domain(),s!==void 0&&(typeof s=="function"&&(s=s(o)),t.range(s)),{type:r,domain:o,range:s,scale:t,hint:c,interval:i}}function Q5(e,t,{type:n,interval:r,domain:i,range:o,scheme:s,unknown:a,...c}){r=ko(r,n),i===void 0&&(i=eB(t,r,e));let l;if(fe.get(e)===wf)l=XZ(t),o=o===void 0?HZ(l):Yt(o,vf);else if(fe.get(e)===qr&&(o===void 0&&(n==="ordinal"||n===Of)&&(o=O5(i,s),o!==void 0&&(s=void 0)),s===void 0&&o===void 0&&(s=n==="ordinal"?"turbo":"observable10"),s!==void 0))if(o!==void 0){let u=Mf(s),f=o[0],d=o[1]-o[0];o=({length:h})=>Cn(p=>u(f+d*p),h)}else o=yE(s);if(a===Op)throw new Error(`implicit unknown on ${e} scale is not supported`);return Z5(e,ul().unknown(a),t,{...c,type:n,domain:i,range:o,hint:l})}function K5(e,t,{align:n=.5,padding:r=.5,...i}){return tB(PI().align(n).padding(r),t,i,e)}function J5(e,t,{align:n=.5,padding:r=.1,paddingInner:i=r,paddingOuter:o=e==="fx"||e==="fy"?0:r,...s}){return tB(za().align(n).paddingInner(i).paddingOuter(o),t,s,e)}function tB(e,t,n,r){let{round:i}=n;return i!==void 0&&e.round(i=!!i),e=Z5(r,e,t,n),e.round=i,e}function eB(e,t,n){let r=new Qn;for(let{value:i,domain:o}of e){if(o!==void 0)return o();if(i!==void 0)for(let s of i)r.add(s)}if(t!==void 0){let[i,o]=ae(r).map(t.floor,t);return t.range(i,t.offset(o))}if(r.size>1e4&&fe.get(n)===mi)throw new Error(`implicit ordinal domain of ${n} scale has more than 10,000 values`);return uo(r,fn)}function H5(e,t){let n;for(let{hint:r}of e){let i=r?.[t];if(i!==void 0){if(n===void 0)n=i;else if(n!==i)return}}return n}function XZ(e){return{fill:H5(e,"fill"),stroke:H5(e,"stroke")}}function HZ(e){return ne(e.fill)?yT:E1}function Nm(e,{label:t,inset:n=0,insetTop:r=n,insetRight:i=n,insetBottom:o=n,insetLeft:s=n,round:a,nice:c,clamp:l,zero:u,align:f,padding:d,projection:h,facet:{label:p=t}={},...m}={}){let g={};for(let[y,b]of e){let x=m[y],_=lB(y,b,{round:fe.get(y)===mi?a:void 0,nice:c,clamp:l,zero:u,align:f,padding:d,projection:h,...x});if(_){let{label:v=y==="fx"||y==="fy"?p:t,percent:w,transform:T,inset:M,insetTop:R=M!==void 0?M:y==="y"?r:0,insetRight:I=M!==void 0?M:y==="x"?i:0,insetBottom:A=M!==void 0?M:y==="y"?o:0,insetLeft:O=M!==void 0?M:y==="x"?s:0}=x||{};if(T==null)T=void 0;else if(typeof T!="function")throw new Error("invalid scale transform; not a function");_.percent=!!w,_.label=v===void 0?ZZ(b,_):v,_.transform=T,y==="x"||y==="fx"?(_.insetLeft=+O,_.insetRight=+I):(y==="y"||y==="fy")&&(_.insetTop=+R,_.insetBottom=+A),g[y]=_}}return g}function SE(e){let t={},n={scales:t};for(let[r,i]of Object.entries(e)){let{scale:o,type:s,interval:a,label:c}=i;t[r]=fB(i),n[r]=o,o.type=s,a!=null&&(o.interval=a),c!=null&&(o.label=c)}return n}function sB(e,t){let{x:n,y:r,fx:i,fy:o}=e,s=i||o?i_(t):t;i&&nB(i,s),o&&rB(o,s);let a=i||o?IE(e,t):t;n&&nB(n,a),r&&rB(r,a)}function ZZ(e=[],t){let n;for(let{label:r}of e)if(r!==void 0){if(n===void 0)n=r;else if(n!==r)return}if(n!==void 0)return!Co(t)&&t.percent&&(n=`${n} (%)`),{inferred:!0,toString:()=>n}}function r_(e){return Math.sign(js(e.domain()))*Math.sign(js(e.range()))}function i_(e){let{marginTop:t,marginRight:n,marginBottom:r,marginLeft:i,width:o,height:s,facet:{marginTop:a,marginRight:c,marginBottom:l,marginLeft:u}}=e;return{marginTop:Math.max(t,a),marginRight:Math.max(n,c),marginBottom:Math.max(r,l),marginLeft:Math.max(i,u),width:o,height:s}}function IE({fx:e,fy:t},n){let{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=i_(n);return{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:e?e.scale.bandwidth()+s+i:a,height:t?t.scale.bandwidth()+r+o:c,facet:{width:a,height:c}}}function nB(e,t){if(e.range===void 0){let{insetLeft:n,insetRight:r}=e,{width:i,marginLeft:o=0,marginRight:s=0}=t,a=o+n,c=i-s-r;e.range=[a,Math.max(a,c)],Co(e)||(e.range=cB(e)),e.scale.range(e.range)}aB(e)}function rB(e,t){if(e.range===void 0){let{insetTop:n,insetBottom:r}=e,{height:i,marginTop:o=0,marginBottom:s=0}=t,a=o+n,c=i-s-r;e.range=[Math.max(a,c),a],Co(e)?e.range.reverse():e.range=cB(e),e.scale.range(e.range)}aB(e)}function aB(e){e.round===void 0&&JZ(e)&&QZ(e)<=30&&e.scale.round(!0)}function QZ({scale:e}){let t=e.domain().length,[n,r]=e.range(),i=e.paddingInner?e.paddingInner():1,o=e.paddingOuter?e.paddingOuter():e.padding(),s=t-i,a=Math.abs(r-n)/Math.max(1,s+o*2);return(a-Math.floor(a))*s}function cB(e){let t=e.scale.domain().length+TE(e);if(!(t>2))return e.range;let[n,r]=e.range;return Array.from({length:t},(i,o)=>n+o/(t-1)*(r-n))}function o_(e,t,n){return lB(e,n===void 0?void 0:[{hint:n}],{...t})}function lB(e,t=[],n={}){let r=KZ(e,t,n);if(n.type===void 0&&n.domain===void 0&&n.range===void 0&&n.interval==null&&e!=="fx"&&e!=="fy"&&Co({type:r})){let i=t.map(({value:o})=>o).filter(o=>o!==void 0);i.some(Oe)?jn(`Warning: some data associated with the ${e} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${Df(r)}" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can specify the interval of the ${e} scale (e.g., d3.utcDay), or you can suppress this warning by setting the type of the ${e} scale to "${Df(r)}".`):i.some(jC)?jn(`Warning: some data associated with the ${e} scale are strings that appear to be dates (e.g., YYYY-MM-DD). If these strings represent dates, you should parse them to Date objects. Dates are typically associated with a "utc" or "time" scale rather than a "${Df(r)}" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can suppress this warning by setting the type of the ${e} scale to "${Df(r)}".`):i.some(VC)&&jn(`Warning: some data associated with the ${e} scale are strings that appear to be numbers. If these strings represent numbers, you should parse or coerce them to numbers. Numbers are typically associated with a "linear" scale rather than a "${Df(r)}" scale. If you want to treat this data as ordinal, you can specify the interval of the ${e} scale (e.g., 1 for integers), or you can suppress this warning by setting the type of the ${e} scale to "${Df(r)}".`)}switch(n.type=r,r){case"diverging":case"diverging-sqrt":case"diverging-pow":case"diverging-log":case"diverging-symlog":case"cyclical":case"sequential":case"linear":case"sqrt":case"threshold":case"quantile":case"pow":case"log":case"symlog":n=n_(t,n,Qe);break;case"identity":switch(fe.get(e)){case mi:n=n_(t,n,Qe);break;case wf:n=n_(t,n,tQ);break}break;case"utc":case"time":n=n_(t,n,PC);break}switch(r){case"diverging":return q5(e,t,n);case"diverging-sqrt":return j5(e,t,n);case"diverging-pow":return wE(e,t,n);case"diverging-log":return V5(e,t,n);case"diverging-symlog":return Y5(e,t,n);case"categorical":case"ordinal":case Of:return Q5(e,t,n);case"cyclical":case"sequential":case"linear":return F5(e,t,n);case"sqrt":return L5(e,t,n);case"threshold":return t_(e,t,n);case"quantile":return P5(e,t,n);case"quantize":return $5(e,t,n);case"pow":return _E(e,t,n);case"log":return C5(e,t,n);case"symlog":return B5(e,t,n);case"utc":return X5(e,t,n);case"time":return W5(e,t,n);case"point":return K5(e,t,n);case"band":return J5(e,t,n);case"identity":return U5(e);case void 0:return;default:throw new Error(`unknown scale type: ${r}`)}}function Df(e){return typeof e=="symbol"?e.description:e}function iB(e){return typeof e=="string"?`${e}`.toLowerCase():e}var oB={toString:()=>"projection"};function KZ(e,t,{type:n,domain:r,range:i,scheme:o,pivot:s,projection:a}){if(n=iB(n),e==="fx"||e==="fy")return"band";(e==="x"||e==="y")&&a!=null&&(n=oB);for(let l of t){let u=iB(l.type);if(u!==void 0){if(n===void 0)n=u;else if(n!==u)throw new Error(`scale incompatible with channel: ${n} !== ${u}`)}}if(n===oB)return;if(n!==void 0)return n;if(r===void 0&&!t.some(({value:l})=>l!==void 0))return;let c=fe.get(e);if(c===Sl)return"sqrt";if(c===Tl||c===Il)return"linear";if(c===wf)return"ordinal";if((r||i||[]).length>2)return vE(c);if(r!==void 0){if(Me(r))return vE(c);if(Oe(r))return"utc"}else{let l=t.map(({value:u})=>u).filter(u=>u!==void 0);if(l.some(Me))return vE(c);if(l.some(Oe))return"utc"}if(c===qr){if(s!=null||D5(o))return"diverging";if(R5(o))return"categorical"}return"linear"}function vE(e){switch(e){case mi:return"point";case qr:return Of;default:return"ordinal"}}function Co({type:e}){return e==="ordinal"||e==="point"||e==="band"||e===Of}function TE({type:e}){return e==="threshold"}function JZ({type:e}){return e==="point"||e==="band"}function lr(e){if(e===void 0)return!0;let t=e.domain(),n=e(t[0]);for(let r=1,i=t.length;r<i;++r)if(e(t[r])-n)return!1;return!0}function n_(e,{domain:t,...n},r){for(let i of e)i.value!==void 0&&(t===void 0&&(t=i.value?.domain),i.value=r(i.value));return{domain:t===void 0?t:r(t),...n}}function tQ(e){return Yt(e,vf)}function kf(e={}){let t;for(let n in e)if(fe.has(n)&&Oo(e[n])){if(t!==void 0)throw new Error("ambiguous scale definition; multiple scales found");t=fB(o_(n,e[n]))}if(t===void 0)throw new Error("invalid scale definition; no scale found");return t}function uB(e){return t=>{if(!fe.has(t=`${t}`))throw new Error(`unknown scale: ${t}`);return e[t]}}function fB({scale:e,type:t,domain:n,range:r,interpolate:i,interval:o,transform:s,percent:a,pivot:c}){if(t==="identity")return{type:"identity",apply:u=>u,invert:u=>u};let l=e.unknown?e.unknown():void 0;return{type:t,domain:Za(n),...r!==void 0&&{range:Za(r)},...s!==void 0&&{transform:s},...a&&{percent:a},...l!==void 0&&{unknown:l},...o!==void 0&&{interval:o},...i!==void 0&&{interpolate:i},...e.clamp&&{clamp:e.clamp()},...c!==void 0&&{pivot:c,symmetric:!1},...e.base&&{base:e.base()},...e.exponent&&{exponent:e.exponent()},...e.constant&&{constant:e.constant()},...e.align&&{align:e.align(),round:e.round()},...e.padding&&(e.paddingInner?{paddingInner:e.paddingInner(),paddingOuter:e.paddingOuter()}:{padding:e.padding()}),...e.bandwidth&&{bandwidth:e.bandwidth(),step:e.step()},apply:u=>e(u),...e.invert&&{invert:u=>e.invert(u)}}}function hB(e,t,n={}){let r=.5-De,i=.5+De,o=.5+De,s=.5-De;for(let{marginTop:m,marginRight:g,marginBottom:y,marginLeft:b}of t)m>r&&(r=m),g>i&&(i=g),y>o&&(o=y),b>s&&(s=b);let{margin:a,marginTop:c=a!==void 0?a:r,marginRight:l=a!==void 0?a:i,marginBottom:u=a!==void 0?a:o,marginLeft:f=a!==void 0?a:s}=n;c=+c,l=+l,u=+u,f=+f;let{width:d=640,height:h=eQ(e,n,{width:d,marginTopDefault:r,marginRightDefault:i,marginBottomDefault:o,marginLeftDefault:s})+Math.max(0,c-r+u-o)}=n;d=+d,h=+h;let p={width:d,height:h,marginTop:c,marginRight:l,marginBottom:u,marginLeft:f};if(e.fx||e.fy){let{margin:m,marginTop:g=m!==void 0?m:c,marginRight:y=m!==void 0?m:l,marginBottom:b=m!==void 0?m:u,marginLeft:x=m!==void 0?m:f}=n.facet??{};g=+g,y=+y,b=+b,x=+x,p.facet={marginTop:g,marginRight:y,marginBottom:b,marginLeft:x}}return p}function eQ({x:e,y:t,fy:n,fx:r},{projection:i,aspectRatio:o},{width:s,marginTopDefault:a,marginRightDefault:c,marginBottomDefault:l,marginLeftDefault:u}){let f=n?n.scale.domain().length:1,d=S5(i);if(d){let p=r?r.scale.domain().length:1,m=(1.1*f-.1)/(1.1*p-.1)*d,g=Math.max(.1,Math.min(10,m));return Math.round((s-u-c)*g+a+l)}let h=t?Co(t)?t.scale.domain().length:Math.max(7,17/f):1;if(o!=null){if(o=+o,!(isFinite(o)&&o>0))throw new Error(`invalid aspectRatio: ${o}`);let p=dB("y",t)/(dB("x",e)*o),m=r?r.scale.bandwidth():1,g=n?n.scale.bandwidth():1,y=m*(s-u-c)-e.insetLeft-e.insetRight;return(p*y+t.insetTop+t.insetBottom)/g+a+l}return!!(t||n)*Math.max(1,Math.min(60,h*f))*20+!!r*30+60}function dB(e,t){if(!t)throw new Error(`aspectRatio requires ${e} scale`);let{type:n,domain:r}=t,i;switch(n){case"linear":case"utc":case"time":i=Number;break;case"pow":{let a=t.scale.exponent();i=c=>Math.pow(c,a);break}case"log":i=Math.log;break;case"point":case"band":return r.length;default:throw new Error(`unsupported ${e} scale for aspectRatio: ${n}`)}let[o,s]=ae(r);return Math.abs(i(s)-i(o))}function mB(e,t){let{fx:n,fy:r}=Nm(e,t),i=n?.scale.domain(),o=r?.scale.domain();return i&&o?v0(i,o).map(([s,a],c)=>({x:s,y:a,i:c})):i?i.map((s,a)=>({x:s,i:a})):o?o.map((s,a)=>({y:s,i:a})):void 0}function yB(e,{x:t,y:n}){return t&&=RE(t),n&&=RE(n),e.filter(t&&n?r=>t.has(r.x)&&n.has(r.y):t?r=>t.has(r.x):r=>n.has(r.y)).sort(t&&n?(r,i)=>t.get(r.x)-t.get(i.x)||n.get(r.y)-n.get(i.y):t?(r,i)=>t.get(r.x)-t.get(i.x):(r,i)=>n.get(r.y)-n.get(i.y))}function a_(e,{fx:t,fy:n}){let r=ar(e),i=t?.value,o=n?.value;return t&&n?Ci(r,s=>(s.fx=i[s[0]],s.fy=o[s[0]],s),s=>i[s],s=>o[s]):t?Ci(r,s=>(s.fx=i[s[0]],s),s=>i[s]):Ci(r,s=>(s.fy=o[s[0]],s),s=>o[s])}function gB(e,t,{marginTop:n,marginLeft:r}){return e&&t?({x:i,y:o})=>`translate(${e(i)-r},${t(o)-n})`:e?({x:i})=>`translate(${e(i)-r},0)`:({y:i})=>`translate(0,${t(i)-n})`}function bB(e){let t=[],n=new Uint32Array(En(e,r=>r.length));for(let r of e){let i=0;for(let o of e)r!==o&&(n.set(o,i),i+=o.length);t.push(n.slice(0,i))}return t}var nQ=new Map([["top",EE],["right",NE],["bottom",AE],["left",ME],["top-left",s_(EE,ME)],["top-right",s_(EE,NE)],["bottom-left",s_(AE,ME)],["bottom-right",s_(AE,NE)],["top-empty",iQ],["right-empty",aQ],["bottom-empty",oQ],["left-empty",sQ],["empty",cQ]]);function xB(e){if(e==null)return null;let t=nQ.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid facet anchor: ${e}`)}var pB=new WeakMap;function RE(e){let t=pB.get(e);return t||pB.set(e,t=new Zn(Yt(e,(n,r)=>[n,r]))),t}function ic(e,t){return RE(e).get(t)}function rQ(e,t,n){return t=Gs(t),n=Gs(n),e.find(r=>Object.is(Gs(r.x),t)&&Object.is(Gs(r.y),n))}function c_(e,t,n){return rQ(e,t,n)?.empty}function EE(e,{y:t},{y:n}){return t?ic(t,n)===0:!0}function AE(e,{y:t},{y:n}){return t?ic(t,n)===t.length-1:!0}function ME(e,{x:t},{x:n}){return t?ic(t,n)===0:!0}function NE(e,{x:t},{x:n}){return t?ic(t,n)===t.length-1:!0}function iQ(e,{y:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=ic(t,r);if(o>0)return c_(e,n,t[o-1])}function oQ(e,{y:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=ic(t,r);if(o<t.length-1)return c_(e,n,t[o+1])}function sQ(e,{x:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=ic(t,n);if(o>0)return c_(e,t[o-1],r)}function aQ(e,{x:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=ic(t,n);if(o<t.length-1)return c_(e,t[o+1],r)}function cQ(e,t,{empty:n}){return n}function s_(e,t){return function(){return e.apply(null,arguments)&&t.apply(null,arguments)}}function l_(e,{channels:{fx:t,fy:n},groups:r}){return t&&n?e.map(({x:i,y:o})=>r.get(i)?.get(o)??[]):t?e.map(({x:i})=>r.get(i)??[]):e.map(({y:i})=>r.get(i)??[])}var wt=class{constructor(t,n={},r={},i){let{facet:o="auto",facetAnchor:s,fx:a,fy:c,sort:l,dx:u=0,dy:f=0,margin:d=0,marginTop:h=d,marginRight:p=d,marginBottom:m=d,marginLeft:g=d,clip:y=i?.clip,channels:b,tip:x,render:_}=r;if(this.data=t,this.sort=Do(l)?l:null,this.initializer=Se(r).initializer,this.transform=this.initializer?r.transform:mn(r).transform,o===null||o===!1?this.facet=null:(this.facet=Ke(o===!0?"include":o,"facet",["auto","include","exclude","super"]),this.fx=t===Xa&&typeof a=="string"?[a]:a,this.fy=t===Xa&&typeof c=="string"?[c]:c),this.facetAnchor=xB(s),n=xm(n),b!==void 0&&(n={...lQ(b),...n}),i!==void 0&&(n={...Z1(this,r,i),...n}),this.channels=Object.fromEntries(Object.entries(n).map(([v,w])=>{if(zr(w.value)){let{value:T,label:M=w.label,scale:R=w.scale}=w.value;w={...w,label:M,scale:R,value:T}}if(t===Xa&&typeof w.value=="string"){let{value:T}=w;w={...w,value:[T]}}return[v,w]}).filter(([v,{value:w,optional:T}])=>{if(w!=null)return!0;if(T)return!1;throw new Error(`missing channel value: ${v}`)})),this.dx=+u,this.dy=+f,this.marginTop=+h,this.marginRight=+p,this.marginBottom=+m,this.marginLeft=+g,this.clip=K1(y),this.tip=uQ(x),this.facet==="super"){if(a||c)throw new Error("super-faceting cannot use fx or fy");for(let v in this.channels){let{scale:w}=n[v];if(!(w!=="x"&&w!=="y"))throw new Error("super-faceting cannot use x or y")}}_!=null&&(this.render=Ff(_,this.render))}initialize(t,n,r){let i=qe(this.data);t===void 0&&i!=null&&(t=[ar(i)]);let o=t;this.transform!=null&&({facets:t,data:i}=this.transform(i,t,r),i=qe(i)),t!==void 0&&(t.original=o);let s=W1(this.channels,i);return this.sort!=null&&u5(i,t,s,n,this.sort),{data:i,facets:t,channels:s}}filter(t,n,r){for(let i in n){let{filter:o=Ue}=n[i];if(o!==null){let s=r[i];t=t.filter(a=>o(s[a]))}}return t}project(t,n,r){for(let i in t)if(t[i].scale==="x"&&/^x|x$/.test(i)){let o=i.replace(/^x|x$/,"y");o in t&&t[o].scale==="y"&&mE(i,o,n,r.projection)}}scale(t,n,r){let i=Tf(t,n);return r.projection&&this.project(t,i,r),i}};function Je(...e){return e.plot=wt.prototype.plot,e}function Ff(e,t){if(e==null)return t===null?void 0:t;if(t==null)return e===null?void 0:e;if(typeof e!="function")throw new TypeError(`invalid render transform: ${e}`);if(typeof t!="function")throw new TypeError(`invalid render transform: ${t}`);return function(n,r,i,o,s,a){return e.call(this,n,r,i,o,s,(c,l,u,f,d)=>t.call(this,c,l,u,f,d,a))}}function lQ(e){return Object.fromEntries(Object.entries(xm(e)).map(([t,n])=>(n=typeof n=="string"?{value:n,label:t}:pi(n),n.filter===void 0&&n.scale==null&&(n={...n,filter:null}),[t,n])))}function uQ(e){return e===!0?"xy":e===!1||e==null?null:typeof e=="string"?Ke(e,"tip",["x","y","xy"]):e}function ji(e,t){return e?.tip===!0?{...e,tip:t}:hn(e?.tip)&&e.tip.pointer===void 0?{...e,tip:{...e.tip,pointer:t}}:e}var _B=new WeakMap;function OE(e,t,{x:n,y:r,px:i,py:o,maxRadius:s=40,channels:a,render:c,...l}={}){return s=+s,i!=null&&(n??=null,a={...a,px:{value:i,scale:"x"}}),o!=null&&(r??=null,a={...a,py:{value:o,scale:"y"}}),{x:n,y:r,channels:a,...l,render:Ff(function(u,f,d,h,p,m){p={...p,pointerSticky:!1};let g=p.ownerSVGElement,{data:y}=p.getMarkState(this),b=_B.get(g);b||_B.set(g,b={sticky:!1,roots:[],renders:[]});let x=b.renders.push(X)-1,{x:_,y:v,fx:w,fy:T}=f,M=w?w(u.fx)-h.marginLeft:0,R=T?T(u.fy)-h.marginTop:0;_?.bandwidth&&(M+=_.bandwidth()/2),v?.bandwidth&&(R+=v.bandwidth()/2);let I=u.fi!=null,A;if(I){let Y=b.facetStates;Y||(b.facetStates=Y=new Map),A=Y.get(this),A||Y.set(this,A=new Map)}let[O,F]=yn(this,h),{px:S,py:E}=d,N=S?Y=>S[Y]:DE(d,O),L=E?Y=>E[Y]:kE(d,F),B,C,P,$;function U(Y,rt){if(I)if($&&($=cancelAnimationFrame($)),Y==null)A.delete(u.fi);else{A.set(u.fi,rt),$=requestAnimationFrame(()=>{$=null;for(let[q,H]of A)if(H<rt||H===rt&&q<u.fi){Y=null;break}X(Y)});return}X(Y)}function X(Y){if(B===Y&&P===b.sticky)return;B=Y,P=p.pointerSticky=b.sticky;let rt=B==null?[]:[B];I&&(rt.fx=u.fx,rt.fy=u.fy,rt.fi=u.fi);let q=m(rt,f,d,h,p);if(C){if(I){let H=C.parentNode,ot=C.getAttribute("transform"),z=q.getAttribute("transform");ot?q.setAttribute("transform",ot):q.removeAttribute("transform"),z?H.setAttribute("transform",z):H.removeAttribute("transform"),q.removeAttribute("aria-label"),q.removeAttribute("aria-description"),q.removeAttribute("aria-hidden")}C.replaceWith(q)}return b.roots[x]=C=q,B==null&&A?.size>1||p.dispatchValue(B==null?null:y[B]),q}function tt(Y){if(b.sticky||Y.pointerType==="mouse"&&Y.buttons===1)return;let[rt,q]=Ln(Y);rt-=M,q-=R;let H=rt<h.marginLeft||rt>h.width-h.marginRight?1:e,ot=q<h.marginTop||q>h.height-h.marginBottom?1:t,z=null,Lt=s*s;for(let dt of u){let Wt=H*(N(dt)-rt),Xt=ot*(L(dt)-q),et=Wt*Wt+Xt*Xt;et<=Lt&&(z=dt,Lt=et)}if(z!=null&&(e!==1||t!==1)){let dt=N(z)-rt,Wt=L(z)-q;Lt=dt*dt+Wt*Wt}U(z,Lt)}function nt(Y){Y.pointerType==="mouse"&&B!=null&&(b.sticky&&b.roots.some(rt=>rt?.contains(Y.target))||(b.sticky?(b.sticky=!1,b.renders.forEach(rt=>rt(null))):(b.sticky=!0,X(B)),Y.stopImmediatePropagation()))}function st(Y){Y.pointerType==="mouse"&&(b.sticky||U(null))}return g.addEventListener("pointerenter",tt),g.addEventListener("pointermove",tt),g.addEventListener("pointerdown",nt),g.addEventListener("pointerleave",st),X(null)},c)}}function Lf(e){return OE(1,1,e)}function Cf(e){return OE(1,.01,e)}function Al(e){return OE(.01,1,e)}function DE({x1:e,x2:t,x:n=e},r){return e&&t?i=>(e[i]+t[i])/2:n?i=>n[i]:()=>r}function kE({y1:e,y2:t,y:n=e},r){return e&&t?i=>(e[i]+t[i])/2:n?i=>n[i]:()=>r}function u_(e){return Co(e)&&e.interval===void 0?void 0:"tabular-nums"}function wB(e,t){let{label:n=e.label,tickSize:r=6,width:i=240,height:o=44+r,marginTop:s=18,marginRight:a=0,marginBottom:c=16+r,marginLeft:l=0,style:u,ticks:f=(i-l-a)/64,tickFormat:d,fontVariant:h=u_(e),round:p=!0,opacity:m,className:g}=t,y=nc(t);g=Ef(g),m=ie(m)[1],d===null&&(d=()=>null);let b=ct("svg",y).attr("class",`${g}-ramp`).attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("width",i).attr("height",o).attr("viewBox",`0 0 ${i} ${o}`).call(O=>O.append("style").text(`:where(.${g}-ramp) {
16
17
  display: block;
17
18
  height: auto;
18
19
  height: intrinsic;
@@ -21,9 +22,9 @@ ${n}`}function OH(e){return e==="time"?z1:e==="utc"?am:NH}function bk(e,t,n){let
21
22
  }
22
23
  :where(.${g}-ramp text) {
23
24
  white-space: pre;
24
- }`)).call(Tf,u),x=O=>O.selectAll(".tick line").attr("y1",s+c-o),_,v=p?(O,F)=>O.rangeRound(F):(O,F)=>O.range(F),{type:w,domain:T,range:M,interpolate:R,scale:I,pivot:E}=e;if(R){let O=M===void 0?R:xo(R.length===1?_m(R):R,M);_=v(I.copy(),Cn(_e(l,i-a),Math.min(T.length+(E!==void 0),M===void 0?1/0:M.length)));let F=256,S=m.document.createElement("canvas");S.width=F,S.height=1;let A=S.getContext("2d");for(let N=0,D=F-1;N<F;++N)A.fillStyle=O(N/D),A.fillRect(N,0,1,1);b.append("image").attr("opacity",y).attr("x",l).attr("y",s).attr("width",i-l-a).attr("height",o-s-c).attr("preserveAspectRatio","none").attr("xlink:href",S.toDataURL())}else if(w==="threshold"){let O=T,F=d===void 0?S=>S:typeof d=="string"?li(d):d;_=v(ks().domain([-1,M.length-1]),[l,i-a]),b.append("g").attr("fill-opacity",y).selectAll().data(M).enter().append("rect").attr("x",(S,A)=>_(A-1)).attr("y",s).attr("width",(S,A)=>_(A)-_(A-1)).attr("height",o-s-c).attr("fill",S=>S),f=Yt(O,(S,A)=>A),d=S=>F(O[S],S)}else _=v(Ua().domain(T),[l,i-a]),b.append("g").attr("fill-opacity",y).selectAll().data(T).enter().append("rect").attr("x",_).attr("y",s).attr("width",Math.max(0,_.bandwidth()-1)).attr("height",o-s-c).attr("fill",I),x=()=>{};return b.append("g").attr("transform",`translate(0,${o-c})`).call(A2(_).ticks(Array.isArray(f)?null:f,typeof d=="string"?d:void 0).tickFormat(typeof d=="function"?d:void 0).tickSize(r).tickValues(Array.isArray(f)?f:null)).attr("font-size",null).attr("font-family",null).attr("font-variant",ce(h,"normal")).call(x).call(O=>O.select(".domain").remove()),n!==void 0&&b.append("text").attr("x",l).attr("y",s-6).attr("fill","currentColor").attr("font-weight","bold").text(n),b.node()}var Df=Math.PI/180;function Xi(e,{marker:t,markerStart:n=t,markerMid:r=t,markerEnd:i=t}={}){e.markerStart=pE(n),e.markerMid=pE(r),e.markerEnd=pE(i)}function pE(e){if(e==null||e===!1)return null;if(e===!0)return cF;if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"none":return null;case"arrow":return aF("auto");case"arrow-reverse":return aF("auto-start-reverse");case"dot":return GQ;case"circle":case"circle-fill":return cF;case"circle-stroke":return WQ;case"tick":return mE("auto");case"tick-x":return mE(90);case"tick-y":return mE(0)}throw new Error(`invalid marker: ${e}`)}function aF(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 GQ(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 cF(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 WQ(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 mE(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 XQ=0;function Zs(e,t,{stroke:n},r){return uF(e,t,n&&(i=>n[i]),r)}function lF(e,t,{stroke:n},r){return uF(e,t,n&&(([i])=>n[i]),r)}function uF(e,{markerStart:t,markerMid:n,markerEnd:r,stroke:i},o=()=>i,s){let a=new Map;function c(l){return function(u){let f=o(u),d=a.get(l);d||a.set(l,d=new Map);let h=d.get(f);if(!h){let p=this.parentNode.insertBefore(l(f,s),this),y=`plot-marker-${++XQ}`;p.setAttribute("id",y),d.set(f,h=`url(#${y})`)}return h}}t&&e.attr("marker-start",c(t)),n&&e.attr("marker-mid",c(n)),r&&e.attr("marker-end",c(r))}function El({inset:e,insetLeft:t,insetRight:n,...r}={}){return[t,n]=fF(e,t,n),{inset:e,insetLeft:t,insetRight:n,...r}}function Al({inset:e,insetTop:t,insetBottom:n,...r}={}){return[t,n]=fF(e,t,n),{inset:e,insetTop:t,insetBottom:n,...r}}function fF(e,t,n){return e===void 0&&t===void 0&&n===void 0?Oe?[1,0]:[.5,.5]:[t,n]}function dF(e,{interval:t}){return e={...mi(e)},e.interval=bf(e.interval===void 0?t:e.interval),e}function x_(e,t,n,r){let{[e]:i,[`${e}1`]:o,[`${e}2`]:s}=n,{value:a,interval:c}=dF(i,n);if(a==null||c==null&&!r)return n;let l=Fn(i);if(c==null){let h,p={transform:y=>h||(h=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 d(h){return f!==void 0&&h===u?f:f=Yt(dt(u=h,a),p=>c.floor(p))}return t({...n,[e]:void 0,[`${e}1`]:o===void 0?{transform:d,label:l}:o,[`${e}2`]:s===void 0?{transform:h=>d(h).map(p=>c.offset(p)),label:l}:s})}function hF(e,t,n){let{[e]:r}=n,{value:i,interval:o}=dF(r,n);return i==null||o==null?n:t({...n,[e]:{label:Fn(r),transform:s=>{let a=Yt(dt(s,i),l=>o.floor(l)),c=a.map(l=>o.offset(l));return a.map(Re(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 yE(e={}){return x_("x",El,e,!0)}function gE(e={}){return x_("y",Al,e,!0)}function __(e={}){return x_("x",El,e)}function w_(e={}){return x_("y",Al,e)}function v_(e={}){return hF("x",El,e)}function S_(e={}){return hF("y",Al,e)}var pF={ariaLabel:"rule",fill:null,stroke:"currentColor"},vm=class extends mt{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}},Wi(n,"x"),pF),this.insetTop=It(a),this.insetBottom=It(c),Xi(this,n)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y1:l,y2:u}=r,{width:f,height:d,marginTop:h,marginRight:p,marginLeft:y,marginBottom:g}=i,{insetTop:m,insetBottom:b}=this;return at("svg:g",o).call(Mt,this,i,o).call(bt,this,{x:c&&s},Oe,0).call(x=>x.selectAll().data(t).enter().append("line").call(Tt,this).attr("x1",c?_=>c[_]:(y+f-p)/2).attr("x2",c?_=>c[_]:(y+f-p)/2).attr("y1",l&&!sr(a)?_=>l[_]+m:h+m).attr("y2",u&&!sr(a)?a.bandwidth?_=>u[_]+a.bandwidth()-b:_=>u[_]-b:d-g-b).call(Qt,this,r).call(Zs,this,r,o)).node()}},Sm=class extends mt{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}},Wi(n,"y"),pF),this.insetRight=It(a),this.insetLeft=It(c),Xi(this,n)}render(t,n,r,i,o){let{x:s,y:a}=n,{y:c,x1:l,x2:u}=r,{width:f,height:d,marginTop:h,marginRight:p,marginLeft:y,marginBottom:g}=i,{insetLeft:m,insetRight:b}=this;return at("svg:g",o).call(Mt,this,i,o).call(bt,this,{y:c&&a},0,Oe).call(x=>x.selectAll().data(t).enter().append("line").call(Tt,this).attr("x1",l&&!sr(s)?_=>l[_]+m:y+m).attr("x2",u&&!sr(s)?s.bandwidth?_=>u[_]+s.bandwidth()-b:_=>u[_]-b:f-p-b).attr("y1",c?_=>c[_]:(h+d-g)/2).attr("y2",c?_=>c[_]:(h+d-g)/2).call(Qt,this,r).call(Zs,this,r,o)).node()}};function Yr(e,t){let{x:n=W,y:r,y1:i,y2:o,...s}=w_(t);return[i,o]=mF(r,i,o),new vm(e,{...s,x:n,y1:i,y2:o})}function Gr(e,t){let{y:n=W,x:r,x1:i,x2:o,...s}=__(t);return[i,o]=mF(r,i,o),new Sm(e,{...s,y:n,x1:i,x2:o})}function mF(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 ic(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 HQ={ariaLabel:"text",strokeLinejoin:"round",strokeWidth:3,paintOrder:"stroke"},_F="\xAD",Nl=class extends mt{constructor(t,n={}){let{x:r,y:i,text:o=or(t)&&Y1(t)?W:Ie,frameAnchor:s,textAnchor:a=/right$/i.test(s)?"end":/left$/i.test(s)?"start":"middle",lineAnchor:c=/^top/i.test(s)?"top":/^bottom/i.test(s)?"bottom":"middle",lineHeight:l=1,lineWidth:u=1/0,textOverflow:f,monospace:d,fontFamily:h=d?"ui-monospace, monospace":void 0,fontSize:p,fontStyle:y,fontVariant:g,fontWeight:m,rotate:b}=n,[x,_]=ie(b,0),[v,w]=JQ(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:Ek(x),optional:!0},text:{value:o,filter:sm,optional:!0}},n,HQ),this.rotate=_,this.textAnchor=ce(a,"middle"),this.lineAnchor=Ze(c,"lineAnchor",["top","middle","bottom"]),this.lineHeight=+l,this.lineWidth=+u,this.textOverflow=xE(f),this.monospace=!!d,this.fontFamily=ze(h),this.fontSize=w,this.fontStyle=ze(y),this.fontVariant=ze(g),this.fontWeight=ze(m),this.frameAnchor=Po(s),!(this.lineWidth>=0))throw new Error(`invalid lineWidth: ${u}`);this.splitLines=wE(this),this.clipLine=vE(this)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,rotate:u,text:f,title:d,fontSize:h}=r,{rotate:p}=this,[y,g]=bn(this,i);return at("svg:g",o).call(Mt,this,i,o).call(_E,this,f,i).call(bt,this,{x:c&&s,y:l&&a}).call(m=>m.selectAll().data(t).enter().append("text").call(Tt,this).call(QQ,this,f,d).attr("transform",ic`translate(${c?b=>c[b]:y},${l?b=>l[b]:g})${u?b=>` rotate(${u[b]})`:p?` rotate(${p})`:""}`).call(ct,"font-size",h&&(b=>h[b])).call(Qt,this,r)).node()}};function xE(e){return e==null?null:Ze(e,"textOverflow",["clip","ellipsis","clip-start","clip-end","ellipsis-start","ellipsis-middle","ellipsis-end"]).replace(/^(clip|ellipsis)$/,"$1-end")}function QQ(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(Yi(n[l])??"").map(c),f=u.length,d=i==="top"?.71:i==="bottom"?1-f:(164-f*100)/200;if(f>1){let h=0;for(let p=0;p<f;++p){if(++h,!u[p])continue;let y=this.ownerDocument.createElementNS(oi.svg,"tspan");y.setAttribute("x",0),p===h-1?y.setAttribute("y",`${(d+p)*o}em`):y.setAttribute("dy",`${h*o}em`),y.textContent=u[p],this.appendChild(y),h=0}}else d&&this.setAttribute("y",`${d*o}em`),this.textContent=u[0];if(s&&!r&&u[0]!==n[l]){let h=this.ownerDocument.createElementNS(oi.svg,"title");h.textContent=n[l],this.appendChild(h)}})}function jo(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Le(t,n)),new Nl(e,{...r,x:t,y:n})}function I_(e,{x:t=W,...n}={}){return new Nl(e,S_({...n,x:t}))}function T_(e,{y:t=W,...n}={}){return new Nl(e,v_({...n,y:t}))}function _E(e,t,n){ct(e,"text-anchor",t.textAnchor),ct(e,"font-family",t.fontFamily),ct(e,"font-size",t.fontSize),ct(e,"font-style",t.fontStyle),ct(e,"font-variant",t.fontVariant===void 0?ZQ(n):t.fontVariant),ct(e,"font-weight",t.fontWeight)}function ZQ(e){return e&&(Ys(e)||Re(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 JQ(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 tZ(e,t,n){let r=[],i,o=0;for(let[s,a,c]of eZ(e)){if(i===void 0&&(i=s),o>i&&n(e,i,a)>t&&(r.push(e.slice(i,o)+(e[o-1]===_F?"-":"")),i=s),c){r.push(e.slice(i,a)),i=void 0;continue}o=a}return r}function*eZ(e){let t=0,n=0,r=e.length;for(;n<r;){let i=1;switch(e[n]){case _F:case"-":++n,yield[t,n,!1],t=n;break;case" ":for(yield[t,n,!1];e[++n]===" ";);t=n;break;case"\r":e[n+1]===`
25
+ }`)).call(Af,u),x=O=>O.selectAll(".tick line").attr("y1",s+c-o),_,v=p?(O,F)=>O.rangeRound(F):(O,F)=>O.range(F),{type:w,domain:T,range:M,interpolate:R,scale:I,pivot:A}=e;if(R){let O=M===void 0?R:mo(R.length===1?Mm(R):R,M);_=v(I.copy(),Cn(we(l,i-a),Math.min(T.length+(A!==void 0),M===void 0?1/0:M.length)));let F=256,S=y.document.createElement("canvas");S.width=F,S.height=1;let E=S.getContext("2d");for(let N=0,L=F-1;N<F;++N)E.fillStyle=O(N/L),E.fillRect(N,0,1,1);b.append("image").attr("opacity",m).attr("x",l).attr("y",s).attr("width",i-l-a).attr("height",o-s-c).attr("preserveAspectRatio","none").attr("xlink:href",S.toDataURL())}else if(w==="threshold"){let O=T,F=d===void 0?S=>S:typeof d=="string"?ci(d):d;_=v(ks().domain([-1,M.length-1]),[l,i-a]),b.append("g").attr("fill-opacity",m).selectAll().data(M).enter().append("rect").attr("x",(S,E)=>_(E-1)).attr("y",s).attr("width",(S,E)=>_(E)-_(E-1)).attr("height",o-s-c).attr("fill",S=>S),f=Yt(O,(S,E)=>E),d=S=>F(O[S],S)}else _=v(za().domain(T),[l,i-a]),b.append("g").attr("fill-opacity",m).selectAll().data(T).enter().append("rect").attr("x",_).attr("y",s).attr("width",Math.max(0,_.bandwidth()-1)).attr("height",o-s-c).attr("fill",I),x=()=>{};return b.append("g").attr("transform",`translate(0,${o-c})`).call(W2(_).ticks(Array.isArray(f)?null:f,typeof d=="string"?d:void 0).tickFormat(typeof d=="function"?d:void 0).tickSize(r).tickValues(Array.isArray(f)?f:null)).attr("font-size",null).attr("font-family",null).attr("font-variant",le(h,"normal")).call(x).call(O=>O.select(".domain").remove()),n!==void 0&&b.append("text").attr("x",l).attr("y",s-6).attr("fill","currentColor").attr("font-weight","bold").text(n),b.node()}var Bf=Math.PI/180;function Vi(e,{marker:t,markerStart:n=t,markerMid:r=t,markerEnd:i=t}={}){e.markerStart=FE(n),e.markerMid=FE(r),e.markerEnd=FE(i)}function FE(e){if(e==null||e===!1)return null;if(e===!0)return SB;if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"none":return null;case"arrow":return vB("auto");case"arrow-reverse":return vB("auto-start-reverse");case"dot":return fQ;case"circle":case"circle-fill":return SB;case"circle-stroke":return dQ;case"tick":return LE("auto");case"tick-x":return LE(90);case"tick-y":return LE(0)}throw new Error(`invalid marker: ${e}`)}function vB(e){return(t,n)=>ct("svg:marker",n).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("orient",e).attr("fill","none").attr("stroke",t).attr("stroke-width",1.5).attr("stroke-linecap","round").attr("stroke-linejoin","round").call(r=>r.append("path").attr("d","M-1.5,-3l3,3l-3,3")).node()}function fQ(e,t){return ct("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",e).attr("stroke","none").call(n=>n.append("circle").attr("r",2.5)).node()}function SB(e,t){return ct("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",e).attr("stroke","var(--plot-background)").attr("stroke-width",1.5).call(n=>n.append("circle").attr("r",3)).node()}function dQ(e,t){return ct("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill","var(--plot-background)").attr("stroke",e).attr("stroke-width",1.5).call(n=>n.append("circle").attr("r",3)).node()}function LE(e){return(t,n)=>ct("svg:marker",n).attr("viewBox","-3 -3 6 6").attr("markerWidth",6).attr("markerHeight",6).attr("orient",e).attr("stroke",t).call(r=>r.append("path").attr("d","M0,-3v6")).node()}var hQ=0;function Js(e,t,{stroke:n},r){return TB(e,t,n&&(i=>n[i]),r)}function IB(e,t,{stroke:n},r){return TB(e,t,n&&(([i])=>n[i]),r)}function TB(e,{markerStart:t,markerMid:n,markerEnd:r,stroke:i},o=()=>i,s){let a=new Map;function c(l){return function(u){let f=o(u),d=a.get(l);d||a.set(l,d=new Map);let h=d.get(f);if(!h){let p=this.parentNode.insertBefore(l(f,s),this),m=`plot-marker-${++hQ}`;p.setAttribute("id",m),d.set(f,h=`url(#${m})`)}return h}}t&&e.attr("marker-start",c(t)),n&&e.attr("marker-mid",c(n)),r&&e.attr("marker-end",c(r))}function Ml({inset:e,insetLeft:t,insetRight:n,...r}={}){return[t,n]=EB(e,t,n),{inset:e,insetLeft:t,insetRight:n,...r}}function Nl({inset:e,insetTop:t,insetBottom:n,...r}={}){return[t,n]=EB(e,t,n),{inset:e,insetTop:t,insetBottom:n,...r}}function EB(e,t,n){return e===void 0&&t===void 0&&n===void 0?De?[1,0]:[.5,.5]:[t,n]}function AB(e,{interval:t}){return e={...pi(e)},e.interval=_f(e.interval===void 0?t:e.interval),e}function f_(e,t,n,r){let{[e]:i,[`${e}1`]:o,[`${e}2`]:s}=n,{value:a,interval:c}=AB(i,n);if(a==null||c==null&&!r)return n;let l=On(i);if(c==null){let h,p={transform:m=>h||(h=mt(m,a)),label:l};return{...n,[e]:void 0,[`${e}1`]:o===void 0?p:o,[`${e}2`]:s===void 0&&!(o===s&&r)?p:s}}let u,f;function d(h){return f!==void 0&&h===u?f:f=Yt(mt(u=h,a),p=>c.floor(p))}return t({...n,[e]:void 0,[`${e}1`]:o===void 0?{transform:d,label:l}:o,[`${e}2`]:s===void 0?{transform:h=>d(h).map(p=>c.offset(p)),label:l}:s})}function MB(e,t,n){let{[e]:r}=n,{value:i,interval:o}=AB(r,n);return i==null||o==null?n:t({...n,[e]:{label:On(r),transform:s=>{let a=Yt(mt(s,i),l=>o.floor(l)),c=a.map(l=>o.offset(l));return a.map(Oe(a)?(l,u)=>l==null||isNaN(l=+l)||(u=c[u],u==null)||isNaN(u=+u)?void 0:new Date((l+u)/2):(l,u)=>l==null||(u=c[u],u==null)?NaN:(+l+ +u)/2)}}})}function CE(e={}){return f_("x",Ml,e,!0)}function BE(e={}){return f_("y",Nl,e,!0)}function d_(e={}){return f_("x",Ml,e)}function h_(e={}){return f_("y",Nl,e)}function p_(e={}){return MB("x",Ml,e)}function m_(e={}){return MB("y",Nl,e)}var NB={ariaLabel:"rule",fill:null,stroke:"currentColor"},Rm=class extends wt{constructor(t,n={}){let{x:r,y1:i,y2:o,inset:s=0,insetTop:a=s,insetBottom:c=s}=n;super(t,{x:{value:r,scale:"x",optional:!0},y1:{value:i,scale:"y",optional:!0},y2:{value:o,scale:"y",optional:!0}},ji(n,"x"),NB),this.insetTop=Nt(a),this.insetBottom=Nt(c),Vi(this,n)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y1:l,y2:u}=r,{width:f,height:d,marginTop:h,marginRight:p,marginLeft:m,marginBottom:g}=i,{insetTop:y,insetBottom:b}=this;return ct("svg:g",o).call(Ft,this,i,o).call(It,this,{x:c&&s},De,0).call(x=>x.selectAll().data(t).enter().append("line").call(Rt,this).attr("x1",c?_=>c[_]:(m+f-p)/2).attr("x2",c?_=>c[_]:(m+f-p)/2).attr("y1",l&&!lr(a)?_=>l[_]+y:h+y).attr("y2",u&&!lr(a)?a.bandwidth?_=>u[_]+a.bandwidth()-b:_=>u[_]-b:d-g-b).call(Zt,this,r).call(Js,this,r,o)).node()}},Om=class extends wt{constructor(t,n={}){let{x1:r,x2:i,y:o,inset:s=0,insetRight:a=s,insetLeft:c=s}=n;super(t,{y:{value:o,scale:"y",optional:!0},x1:{value:r,scale:"x",optional:!0},x2:{value:i,scale:"x",optional:!0}},ji(n,"y"),NB),this.insetRight=Nt(a),this.insetLeft=Nt(c),Vi(this,n)}render(t,n,r,i,o){let{x:s,y:a}=n,{y:c,x1:l,x2:u}=r,{width:f,height:d,marginTop:h,marginRight:p,marginLeft:m,marginBottom:g}=i,{insetLeft:y,insetRight:b}=this;return ct("svg:g",o).call(Ft,this,i,o).call(It,this,{y:c&&a},0,De).call(x=>x.selectAll().data(t).enter().append("line").call(Rt,this).attr("x1",l&&!lr(s)?_=>l[_]+y:m+y).attr("x2",u&&!lr(s)?s.bandwidth?_=>u[_]+s.bandwidth()-b:_=>u[_]-b:f-p-b).attr("y1",c?_=>c[_]:(h+d-g)/2).attr("y2",c?_=>c[_]:(h+d-g)/2).call(Zt,this,r).call(Js,this,r,o)).node()}};function jr(e,t){let{x:n=W,y:r,y1:i,y2:o,...s}=h_(t);return[i,o]=RB(r,i,o),new Rm(e,{...s,x:n,y1:i,y2:o})}function Vr(e,t){let{y:n=W,x:r,x1:i,x2:o,...s}=d_(t);return[i,o]=RB(r,i,o),new Om(e,{...s,y:n,x1:i,x2:o})}function RB(e,t,n){if(e==null){if(t===void 0){if(n!==void 0)return[0,n]}else if(n===void 0)return[0,t]}else{if(t===void 0)return n===void 0?[0,e]:[e,n];if(n===void 0)return[e,t]}return[t,n]}function oc(e,...t){let n=t.length;for(let r=0,i=!0;r<n;++r)typeof t[r]!="function"&&(i&&(e=e.slice(),i=!1),e.splice(r,2,e[r]+t[r]+e[r+1]),t.splice(r,1),--r,--n);return r=>{let i=e[0];for(let o=0;o<n;++o)i+=t[o](r)+e[o+1];return i}}var pQ={ariaLabel:"text",strokeLinejoin:"round",strokeWidth:3,paintOrder:"stroke"},LB="\xAD",Ol=class extends wt{constructor(t,n={}){let{x:r,y:i,text:o=cr(t)&&B1(t)?W:Ae,frameAnchor:s,textAnchor:a=/right$/i.test(s)?"end":/left$/i.test(s)?"start":"middle",lineAnchor:c=/^top/i.test(s)?"top":/^bottom/i.test(s)?"bottom":"middle",lineHeight:l=1,lineWidth:u=1/0,textOverflow:f,monospace:d,fontFamily:h=d?"ui-monospace, monospace":void 0,fontSize:p,fontStyle:m,fontVariant:g,fontWeight:y,rotate:b}=n,[x,_]=ie(b,0),[v,w]=bQ(p);if(super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},fontSize:{value:v,optional:!0},rotate:{value:zC(x),optional:!0},text:{value:o,filter:hm,optional:!0}},n,pQ),this.rotate=_,this.textAnchor=le(a,"middle"),this.lineAnchor=Ke(c,"lineAnchor",["top","middle","bottom"]),this.lineHeight=+l,this.lineWidth=+u,this.textOverflow=$E(f),this.monospace=!!d,this.fontFamily=ze(h),this.fontSize=w,this.fontStyle=ze(m),this.fontVariant=ze(g),this.fontWeight=ze(y),this.frameAnchor=Fo(s),!(this.lineWidth>=0))throw new Error(`invalid lineWidth: ${u}`);this.splitLines=zE(this),this.clipLine=qE(this)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,rotate:u,text:f,title:d,fontSize:h}=r,{rotate:p}=this,[m,g]=yn(this,i);return ct("svg:g",o).call(Ft,this,i,o).call(UE,this,f,i).call(It,this,{x:c&&s,y:l&&a}).call(y=>y.selectAll().data(t).enter().append("text").call(Rt,this).call(mQ,this,f,d).attr("transform",oc`translate(${c?b=>c[b]:m},${l?b=>l[b]:g})${u?b=>` rotate(${u[b]})`:p?` rotate(${p})`:""}`).call(ft,"font-size",h&&(b=>h[b])).call(Zt,this,r)).node()}};function $E(e){return e==null?null:Ke(e,"textOverflow",["clip","ellipsis","clip-start","clip-end","ellipsis-start","ellipsis-middle","ellipsis-end"]).replace(/^(clip|ellipsis)$/,"$1-end")}function mQ(e,t,n,r){if(!n)return;let{lineAnchor:i,lineHeight:o,textOverflow:s,splitLines:a,clipLine:c}=t;e.each(function(l){let u=a(zi(n[l])??"").map(c),f=u.length,d=i==="top"?.71:i==="bottom"?1-f:(164-f*100)/200;if(f>1){let h=0;for(let p=0;p<f;++p){if(++h,!u[p])continue;let m=this.ownerDocument.createElementNS(ii.svg,"tspan");m.setAttribute("x",0),p===h-1?m.setAttribute("y",`${(d+p)*o}em`):m.setAttribute("dy",`${h*o}em`),m.textContent=u[p],this.appendChild(m),h=0}}else d&&this.setAttribute("y",`${d*o}em`),this.textContent=u[0];if(s&&!r&&u[0]!==n[l]){let h=this.ownerDocument.createElementNS(ii.svg,"title");h.textContent=n[l],this.appendChild(h)}})}function Bo(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Be(t,n)),new Ol(e,{...r,x:t,y:n})}function y_(e,{x:t=W,...n}={}){return new Ol(e,m_({...n,x:t}))}function g_(e,{y:t=W,...n}={}){return new Ol(e,p_({...n,y:t}))}function UE(e,t,n){ft(e,"text-anchor",t.textAnchor),ft(e,"font-family",t.fontFamily),ft(e,"font-size",t.fontSize),ft(e,"font-style",t.fontStyle),ft(e,"font-variant",t.fontVariant===void 0?yQ(n):t.fontVariant),ft(e,"font-weight",t.fontWeight)}function yQ(e){return e&&(Ws(e)||Oe(e))?"tabular-nums":void 0}var gQ=new Set(["inherit","initial","revert","unset","xx-small","x-small","small","medium","large","x-large","xx-large","xxx-large","larger","smaller"]);function bQ(e){return e==null||typeof e=="number"?[void 0,e]:typeof e!="string"?[e,void 0]:(e=e.trim().toLowerCase(),gQ.has(e)||/^[+-]?\d*\.?\d+(e[+-]?\d+)?(\w*|%)$/.test(e)?[void 0,e]:[e,void 0])}function xQ(e,t,n){let r=[],i,o=0;for(let[s,a,c]of _Q(e)){if(i===void 0&&(i=s),o>i&&n(e,i,a)>t&&(r.push(e.slice(i,o)+(e[o-1]===LB?"-":"")),i=s),c){r.push(e.slice(i,a)),i=void 0;continue}o=a}return r}function*_Q(e){let t=0,n=0,r=e.length;for(;n<r;){let i=1;switch(e[n]){case LB:case"-":++n,yield[t,n,!1],t=n;break;case" ":for(yield[t,n,!1];e[++n]===" ";);t=n;break;case"\r":e[n+1]===`
25
26
  `&&++i;case`
26
- `:yield[t,n,!0],n+=i,t=n;break;default:++n;break}}yield[t,n,!0]}var yF={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 E_(e,t=0,n=e.length){let r=0;for(let i=t;i<n;i=Lf(e,i))r+=yF[e[i]]??(vF(e,i)?120:yF.e);return r}function A_(e,t=0,n=e.length){let r=0;for(let i=t;i<n;i=Lf(e,i))r+=vF(e,i)?126:63;return r}function wE({monospace:e,lineWidth:t,textOverflow:n}){if(n!=null||t==1/0)return o=>o.split(/\r\n?|\n/g);let r=e?A_:E_,i=t*100;return o=>tZ(o,i,r)}function vE({monospace:e,lineWidth:t,textOverflow:n}){if(n==null||t==1/0)return o=>o;let r=e?A_:E_,i=t*100;switch(n){case"clip-start":return o=>bF(o,i,r,"");case"clip-end":return o=>gF(o,i,r,"");case"ellipsis-start":return o=>bF(o,i,r,Ml);case"ellipsis-middle":return o=>nZ(o,i,r,Ml);case"ellipsis-end":return o=>gF(o,i,r,Ml)}}var Ml="\u2026";function Rl(e,t,n,r){let i=[],o=0;for(let s=0,a=0,c=e.length;s<c;s=a){a=Lf(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 gF(e,t,n,r){e=e.trim();let i=n(r),[o]=Rl(e,t,n,i);return o<0?e:e.slice(0,o).trimEnd()+r}function nZ(e,t,n,r){e=e.trim();let i=n(e);if(i<=t)return e;let o=n(r)/2,[s,a]=Rl(e,t/2,n,o),[c]=Rl(e,i-t/2-a+o,n,-o);return c<0?r:e.slice(0,s).trimEnd()+r+e.slice(Lf(e,c)).trimStart()}function bF(e,t,n,r){e=e.trim();let i=n(e);if(i<=t)return e;let o=n(r),[s]=Rl(e,i-t+o,n,-o);return s<0?r:r+e.slice(Lf(e,s)).trimStart()}var bE=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,xF=/\p{Extended_Pictographic}/uy;function Lf(e,t){return t+=rZ(e,t)?2:1,oZ(e,t)&&(t=bE.lastIndex),iZ(e,t)?Lf(e,t+1):t}function wF(e,t){return e.charCodeAt(t)<128}function rZ(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 iZ(e,t){return e.charCodeAt(t)===8205}function oZ(e,t){return wF(e,t)?!1:(bE.lastIndex=t,bE.test(e))}function vF(e,t){return wF(e,t)?!1:(xF.lastIndex=t,xF.test(e))}var SF={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},IF=3.5,sZ=IF*5,TF={draw(e,t,n){let r=t*n/sZ;e.moveTo(0,0),e.lineTo(0,-t),e.moveTo(-r,r-t),e.lineTo(0,-t),e.lineTo(r,r-t)}},EF={draw(e,t,n){e.moveTo(-n,0),e.lineTo(0,-t),e.lineTo(n,0)}},aZ=new Map([["arrow",TF],["spike",EF]]);function cZ(e){return e&&typeof e.draw=="function"}function lZ(e){if(cZ(e))return e;let t=aZ.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid shape: ${e}`)}var Ol=class extends mt{constructor(t,n={}){let{x:r,y:i,r:o=IF,length:s,rotate:a,shape:c=TF,anchor:l="middle",frameAnchor:u}=n,[f,d]=ie(s,12),[h,p]=ie(a,0);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},length:{value:f,scale:"length",optional:!0},rotate:{value:h,optional:!0}},n,SF),this.r=+o,this.length=d,this.rotate=p,this.shape=lZ(c),this.anchor=Ze(l,"anchor",["start","middle","end"]),this.frameAnchor=Po(u)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,length:u,rotate:f}=r,{length:d,rotate:h,anchor:p,shape:y,r:g}=this,[m,b]=bn(this,i);return at("svg:g",o).call(Mt,this,i,o).call(bt,this,{x:c&&s,y:l&&a}).call(x=>x.selectAll().data(t).enter().append("path").call(Tt,this).attr("transform",ic`translate(${c?_=>c[_]:m},${l?_=>l[_]:b})${f?_=>` rotate(${f[_]})`:h?` rotate(${h})`:""}${p==="start"?"":p==="end"?u?_=>` translate(0,${u[_]})`:` translate(0,${d})`:u?_=>` translate(0,${u[_]/2})`:` translate(0,${d/2})`}`).attr("d",u?_=>{let v=Kn();return y.draw(v,u[_],g),v}:(()=>{let _=Kn();return y.draw(_,d,g),_})()).call(Qt,this,r)).node()}};function SE(e,t={}){let{x:n,y:r,...i}=t;return t.frameAnchor===void 0&&([n,r]=Le(n,r)),new Ol(e,{...i,x:n,y:r})}function M_(e,t={}){let{x:n=W,...r}=t;return new Ol(e,{...r,x:n})}function N_(e,t={}){let{y:n=W,...r}=t;return new Ol(e,{...r,y:n})}function AF(e,t={}){let{shape:n=EF,stroke:r=SF.stroke,strokeWidth:i=1,fill:o=r,fillOpacity:s=.3,anchor:a="start",...c}=t;return SE(e,{...c,shape:n,stroke:r,strokeWidth:i,fill:o,fillOpacity:s,anchor:a})}function oc(e,t){return arguments.length<2&&!or(e)&&(t=e,e=null),t===void 0&&(t={}),[e,t]}function R_({anchor:e}={},t){return e===void 0?t[0]:Ze(e,"anchor",t)}function MF(e){return R_(e,["left","right"])}function NF(e){return R_(e,["right","left"])}function RF(e){return R_(e,["bottom","top"])}function OF(e){return R_(e,["top","bottom"])}function Im(){let[e,t]=oc(...arguments);return kF("y",MF(t),e,t)}function O_(){let[e,t]=oc(...arguments);return kF("fy",NF(t),e,t)}function Tm(){let[e,t]=oc(...arguments);return FF("x",RF(t),e,t)}function k_(){let[e,t]=oc(...arguments);return FF("fx",OF(t),e,t)}function kF(e,t,n,{color:r="currentColor",opacity:i=1,stroke:o=r,strokeOpacity:s=i,strokeWidth:a=1,fill:c=r,fillOpacity:l=i,textAnchor:u,textStroke:f,textStrokeOpacity:d,textStrokeWidth:h,tickSize:p=e==="y"?6:0,tickPadding:y,tickRotate:g,x:m,margin:b,marginTop:x=b===void 0?20:b,marginRight:_=b===void 0?t==="right"?40:0:b,marginBottom:v=b===void 0?20:b,marginLeft:w=b===void 0?t==="left"?40:0:b,label:T,labelAnchor:M,labelArrow:R,labelOffset:I,...E}){return p=It(p),y=It(y),g=It(g),M!==void 0&&(M=Ze(M,"labelAnchor",["center","top","bottom"])),R=zF(R),Ke(p&&!ne(o)?uZ(e,t,n,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:y,tickRotate:g,x:m,...E}):null,ne(c)?null:dZ(e,t,n,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:d,strokeWidth:h,textAnchor:u,tickSize:p,tickPadding:y,tickRotate:g,x:m,marginTop:x,marginRight:_,marginBottom:v,marginLeft:w,...E}),!ne(c)&&T!==null?jo([],BF({fill:c,fillOpacity:l,...E},function(O,F,S,A,N){let D=A[e],{marginTop:B,marginRight:C,marginBottom:P,marginLeft:$}=e==="y"&&N.inset||N,U=M??(D.bandwidth?"center":"top"),X=I??(t==="right"?C:$)-3;return U==="center"?(this.textAnchor=void 0,this.lineAnchor=t==="right"?"bottom":"top",this.frameAnchor=t,this.rotate=-90):(this.textAnchor=t==="right"?"end":"start",this.lineAnchor=U,this.frameAnchor=`${U}-${t}`,this.rotate=0),this.dy=U==="top"?3-B:U==="bottom"?P-3:0,this.dx=t==="right"?X:-X,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[UF(e,D,{anchor:t,label:T,labelAnchor:U,labelArrow:R})]}}}})):null)}function FF(e,t,n,{color:r="currentColor",opacity:i=1,stroke:o=r,strokeOpacity:s=i,strokeWidth:a=1,fill:c=r,fillOpacity:l=i,textAnchor:u,textStroke:f,textStrokeOpacity:d,textStrokeWidth:h,tickSize:p=e==="x"?6:0,tickPadding:y,tickRotate:g,y:m,margin:b,marginTop:x=b===void 0?t==="top"?30:0:b,marginRight:_=b===void 0?20:b,marginBottom:v=b===void 0?t==="bottom"?30:0:b,marginLeft:w=b===void 0?20:b,label:T,labelAnchor:M,labelArrow:R,labelOffset:I,...E}){return p=It(p),y=It(y),g=It(g),M!==void 0&&(M=Ze(M,"labelAnchor",["center","left","right"])),R=zF(R),Ke(p&&!ne(o)?fZ(e,t,n,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:y,tickRotate:g,y:m,...E}):null,ne(c)?null:hZ(e,t,n,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:d,strokeWidth:h,textAnchor:u,tickSize:p,tickPadding:y,tickRotate:g,y:m,marginTop:x,marginRight:_,marginBottom:v,marginLeft:w,...E}),!ne(c)&&T!==null?jo([],BF({fill:c,fillOpacity:l,...E},function(O,F,S,A,N){let D=A[e],{marginTop:B,marginRight:C,marginBottom:P,marginLeft:$}=e==="x"&&N.inset||N,U=M??(D.bandwidth?"center":"right"),X=I??(t==="top"?B:P)-3;return U==="center"?(this.frameAnchor=t,this.textAnchor=void 0):(this.frameAnchor=`${t}-${U}`,this.textAnchor=U==="right"?"end":"start"),this.lineAnchor=t,this.dy=t==="top"?-X:X,this.dx=U==="right"?C-3:U==="left"?3-$:0,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[UF(e,D,{anchor:t,label:T,labelAnchor:U,labelArrow:R})]}}}})):null)}function uZ(e,t,n,{strokeWidth:r=1,strokeLinecap:i=null,strokeLinejoin:o=null,facetAnchor:s=t+(e==="y"?"-empty":""),frameAnchor:a=t,tickSize:c,inset:l=0,insetLeft:u=l,insetRight:f=l,dx:d=0,y:h=e==="y"?void 0:null,...p}){return Cf(N_,e,t,`${e}-axis tick`,n,{strokeWidth:r,strokeLinecap:i,strokeLinejoin:o,facetAnchor:s,frameAnchor:a,y:h,...p,dx:t==="left"?+d-Oe+ +u:+d+Oe-f,anchor:"start",length:c,shape:t==="left"?gZ:bZ})}function fZ(e,t,n,{strokeWidth:r=1,strokeLinecap:i=null,strokeLinejoin:o=null,facetAnchor:s=t+(e==="x"?"-empty":""),frameAnchor:a=t,tickSize:c,inset:l=0,insetTop:u=l,insetBottom:f=l,dy:d=0,x:h=e==="x"?void 0:null,...p}){return Cf(M_,e,t,`${e}-axis tick`,n,{strokeWidth:r,strokeLinejoin:o,strokeLinecap:i,facetAnchor:s,frameAnchor:a,x:h,...p,dy:t==="bottom"?+d-Oe-f:+d+Oe+ +u,anchor:"start",length:c,shape:t==="bottom"?mZ:yZ})}function dZ(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*Df):0),text:c,textAnchor:l=Math.abs(s)>60?"middle":t==="left"?"end":"start",lineAnchor:u=s>60?"top":s<-60?"bottom":"middle",fontVariant:f,inset:d=0,insetLeft:h=d,insetRight:p=d,dx:y=0,y:g=e==="y"?void 0:null,...m}){return Cf(T_,e,t,`${e}-axis tick label`,n,{facetAnchor:r,frameAnchor:i,text:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,y:g,...m,dx:t==="left"?+y-o-a+ +h:+y+ +o+ +a-p},function(b,x,_,v,w){f===void 0&&(this.fontVariant=$F(b)),c===void 0&&(w.text=PF(b,x,_,v,t))})}function hZ(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*Df):0),text:c,textAnchor:l=Math.abs(s)>=10?s<0^t==="bottom"?"start":"end":"middle",lineAnchor:u=Math.abs(s)>=10?"middle":t==="bottom"?"top":"bottom",fontVariant:f,inset:d=0,insetTop:h=d,insetBottom:p=d,dy:y=0,x:g=e==="x"?void 0:null,...m}){return Cf(I_,e,t,`${e}-axis tick label`,n,{facetAnchor:r,frameAnchor:i,text:c===void 0?null:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,x:g,...m,dy:t==="bottom"?+y+ +o+ +a-p:+y-o-a+ +h},function(b,x,_,v,w){f===void 0&&(this.fontVariant=$F(b)),c===void 0&&(w.text=PF(b,x,_,v,t))})}function F_(){let[e,t]=oc(...arguments);return DF("y",MF(t),e,t)}function D_(){let[e,t]=oc(...arguments);return DF("fy",NF(t),e,t)}function L_(){let[e,t]=oc(...arguments);return LF("x",RF(t),e,t)}function C_(){let[e,t]=oc(...arguments);return LF("fx",OF(t),e,t)}function DF(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 Cf(Gr,e,t,`${e}-grid`,n,{y:r,x1:o,x2:s,...CF(a)})}function LF(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 Cf(Yr,e,t,`${e}-grid`,n,{x:r,y1:o,y2:s,...CF(a)})}function CF({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 BF({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]=Ne(e),[,t]=ie(t),{facet:"super",x:null,y:null,fill:e,fillOpacity:t,fontFamily:n,fontSize:r,fontStyle:i,fontVariant:o,fontWeight:s,monospace:a,pointerEvents:c,shapeRendering:l,clip:u,initializer:f}}function Cf(e,t,n,r,i,o,s){let a;function c(f,d,h,p,y,g){let m=f==null&&(t==="fx"||t==="fy"),{[t]:b}=p;if(!b)throw new Error(`missing scale: ${t}`);let x=b.domain(),{interval:_,ticks:v,tickFormat:w,tickSpacing:T=t==="x"?80:35}=o;if(typeof v=="string"&&jF(b)&&(_=v,v=void 0),v===void 0&&(v=Bo(_,b.type)??pZ(b,T)),f==null){if(or(v))f=je(v);else if(Qa(v))f=IE(v,...se(x));else if(b.interval){let R=b.interval;if(b.ticks){let[I,E]=se(x),O=(E-I)/R[hf];R=vT(R,O/v)??R,f=IE(R,I,E)}else{f=x;let I=f.length;R=vT(R,I/v)??R,R!==b.interval&&(f=IE(R,...se(f)))}if(R===b.interval){let I=Math.round(f.length/v);I>1&&(f=f.filter((E,O)=>O%I===0))}}else b.ticks?f=b.ticks(v):f=x;if(!b.ticks&&f.length&&f!==x){let R=new Cr(x);f=f.filter(I=>R.has(I)),f.length||qn(`Warning: the ${t}-axis ticks appear to not align with the scale domain, resulting in no ticks. Try different ticks?`)}t==="y"||t==="x"?d=[ir(f)]:a[t]={scale:t,value:W}}s?.call(this,b,f,v,w,a);let M=Object.fromEntries(Object.entries(a).map(([R,I])=>[R,{...I,value:dt(f,I.value)}]));return m&&(d=g.filterFacets(f,M)),{data:f,facets:d,channels:M}}let l=ve(o).initializer,u=e(i,ve({...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 pZ(e,t){let[n,r]=se(e.range());return(r-n)/t}function PF(e,t,n,r,i){return{value:Em(e,t,n,r,i)}}function Em(e,t,n,r,i){return typeof r=="function"?r:r===void 0&&t&&Re(t)?bk(e.type,t,i)??Yi:e.tickFormat?e.tickFormat(typeof n=="number"?n:null,r):r===void 0?Yi:typeof r=="string"?(Re(e.domain())?ko:li)(r):pn(r)}function IE(e,t,n){return e.range(t,e.offset(e.floor(n)))}var mZ={draw(e,t){e.moveTo(0,0),e.lineTo(0,t)}},yZ={draw(e,t){e.moveTo(0,0),e.lineTo(0,-t)}},gZ={draw(e,t){e.moveTo(0,0),e.lineTo(-t,0)}},bZ={draw(e,t){e.moveTo(0,0),e.lineTo(t,0)}};function $F(e){return e.bandwidth&&!e.interval?void 0:"tabular-nums"}function UF(e,t,{anchor:n,label:r=t.label,labelAnchor:i,labelArrow:o}={}){if(!(r==null||r.inferred&&jF(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=f_(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 zF(e="auto"){return ne(e)?!1:typeof e=="boolean"?e:Ze(e,"labelArrow",["auto","up","right","down","left"])}function jF(e){return Re(e.domain())}function qF(e,t){if(t==null)return t;let n=e(t);if(!n)throw new Error(`scale not found: ${t}`);return n}function VF(e,{opacity:t,...n}={}){if(!Uo(e)&&!oE(e))throw new Error(`swatches legend requires ordinal or threshold color scale (not ${e.type})`);return GF(e,n,(r,i,o,s)=>r.append("svg").attr("width",o).attr("height",s).attr("fill",i.scale).attr("fill-opacity",ie(t)[1]).append("rect").attr("width","100%").attr("height","100%"))}function YF(e,{fill:t=e.hint?.fill!==void 0?e.hint.fill:"none",fillOpacity:n=1,stroke:r=e.hint?.stroke!==void 0?e.hint.stroke:ne(t)?"currentColor":"none",strokeOpacity:i=1,strokeWidth:o=1.5,r:s=4.5,...a}={},c){let[l,u]=Ne(t),[f,d]=Ne(r),h=qF(c,l),p=qF(c,f),y=s*s*Math.PI;return n=ie(n)[1],i=ie(i)[1],o=ie(o)[1],GF(e,a,(g,m,b,x)=>g.append("svg").attr("viewBox","-8 -8 16 16").attr("width",b).attr("height",x).attr("fill",l==="color"?_=>h.scale(_):u).attr("fill-opacity",n).attr("stroke",f==="color"?_=>p.scale(_):d).attr("stroke-opacity",i).attr("stroke-width",o).append("path").attr("d",_=>{let v=Kn();return e.scale(_).draw(v,y),v}))}function GF(e,t={},n){let{columns:r,tickFormat:i,fontVariant:o=b_(e),swatchSize:s=15,swatchWidth:a=s,swatchHeight:c=s,marginLeft:l=0,className:u,style:f,width:d}=t,h=ec(t);u=If(u),i=Em(e.scale,e.domain,void 0,i);let p=at("div",h).attr("class",`${u}-swatches ${u}-swatches-${r!=null?"columns":"wrap"}`),y;return r!=null?(y=`:where(.${u}-swatches-columns .${u}-swatch) {
27
+ `:yield[t,n,!0],n+=i,t=n;break;default:++n;break}}yield[t,n,!0]}var OB={a:56,b:63,c:57,d:63,e:58,f:37,g:62,h:60,i:26,j:26,k:55,l:26,m:88,n:60,o:60,p:62,q:62,r:39,s:54,t:38,u:60,v:55,w:79,x:54,y:55,z:55,A:69,B:67,C:73,D:74,E:61,F:58,G:76,H:75,I:28,J:55,K:67,L:58,M:89,N:75,O:78,P:65,Q:78,R:67,S:65,T:65,U:75,V:69,W:98,X:69,Y:67,Z:67,0:64,1:48,2:62,3:64,4:66,5:63,6:65,7:58,8:65,9:65," ":29,"!":32,'"':49,"'":31,"(":39,")":39,",":31,"-":48,".":31,"/":32,":":31,";":31,"?":52,"\u2018":31,"\u2019":31,"\u201C":47,"\u201D":47,"\u2026":82};function b_(e,t=0,n=e.length){let r=0;for(let i=t;i<n;i=Pf(e,i))r+=OB[e[i]]??(BB(e,i)?120:OB.e);return r}function x_(e,t=0,n=e.length){let r=0;for(let i=t;i<n;i=Pf(e,i))r+=BB(e,i)?126:63;return r}function zE({monospace:e,lineWidth:t,textOverflow:n}){if(n!=null||t==1/0)return o=>o.split(/\r\n?|\n/g);let r=e?x_:b_,i=t*100;return o=>xQ(o,i,r)}function qE({monospace:e,lineWidth:t,textOverflow:n}){if(n==null||t==1/0)return o=>o;let r=e?x_:b_,i=t*100;switch(n){case"clip-start":return o=>kB(o,i,r,"");case"clip-end":return o=>DB(o,i,r,"");case"ellipsis-start":return o=>kB(o,i,r,Rl);case"ellipsis-middle":return o=>wQ(o,i,r,Rl);case"ellipsis-end":return o=>DB(o,i,r,Rl)}}var Rl="\u2026";function Dl(e,t,n,r){let i=[],o=0;for(let s=0,a=0,c=e.length;s<c;s=a){a=Pf(e,s);let l=n(e,s,a);if(o+l>t){for(o+=r;o>t&&s>0;)a=s,s=i.pop(),o-=n(e,s,a);return[s,t-o]}o+=l,i.push(s)}return[-1,0]}function DB(e,t,n,r){e=e.trim();let i=n(r),[o]=Dl(e,t,n,i);return o<0?e:e.slice(0,o).trimEnd()+r}function wQ(e,t,n,r){e=e.trim();let i=n(e);if(i<=t)return e;let o=n(r)/2,[s,a]=Dl(e,t/2,n,o),[c]=Dl(e,i-t/2-a+o,n,-o);return c<0?r:e.slice(0,s).trimEnd()+r+e.slice(Pf(e,c)).trimStart()}function kB(e,t,n,r){e=e.trim();let i=n(e);if(i<=t)return e;let o=n(r),[s]=Dl(e,i-t+o,n,-o);return s<0?r:r+e.slice(Pf(e,s)).trimStart()}var PE=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,FB=/\p{Extended_Pictographic}/uy;function Pf(e,t){return t+=vQ(e,t)?2:1,IQ(e,t)&&(t=PE.lastIndex),SQ(e,t)?Pf(e,t+1):t}function CB(e,t){return e.charCodeAt(t)<128}function vQ(e,t){let n=e.charCodeAt(t);if(n>=55296&&n<56320){let r=e.charCodeAt(t+1);return r>=56320&&r<57344}return!1}function SQ(e,t){return e.charCodeAt(t)===8205}function IQ(e,t){return CB(e,t)?!1:(PE.lastIndex=t,PE.test(e))}function BB(e,t){return CB(e,t)?!1:(FB.lastIndex=t,FB.test(e))}var PB={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},$B=3.5,TQ=$B*5,UB={draw(e,t,n){let r=t*n/TQ;e.moveTo(0,0),e.lineTo(0,-t),e.moveTo(-r,r-t),e.lineTo(0,-t),e.lineTo(r,r-t)}},zB={draw(e,t,n){e.moveTo(-n,0),e.lineTo(0,-t),e.lineTo(n,0)}},EQ=new Map([["arrow",UB],["spike",zB]]);function AQ(e){return e&&typeof e.draw=="function"}function MQ(e){if(AQ(e))return e;let t=EQ.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid shape: ${e}`)}var kl=class extends wt{constructor(t,n={}){let{x:r,y:i,r:o=$B,length:s,rotate:a,shape:c=UB,anchor:l="middle",frameAnchor:u}=n,[f,d]=ie(s,12),[h,p]=ie(a,0);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},length:{value:f,scale:"length",optional:!0},rotate:{value:h,optional:!0}},n,PB),this.r=+o,this.length=d,this.rotate=p,this.shape=MQ(c),this.anchor=Ke(l,"anchor",["start","middle","end"]),this.frameAnchor=Fo(u)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,length:u,rotate:f}=r,{length:d,rotate:h,anchor:p,shape:m,r:g}=this,[y,b]=yn(this,i);return ct("svg:g",o).call(Ft,this,i,o).call(It,this,{x:c&&s,y:l&&a}).call(x=>x.selectAll().data(t).enter().append("path").call(Rt,this).attr("transform",oc`translate(${c?_=>c[_]:y},${l?_=>l[_]:b})${f?_=>` rotate(${f[_]})`:h?` rotate(${h})`:""}${p==="start"?"":p==="end"?u?_=>` translate(0,${u[_]})`:` translate(0,${d})`:u?_=>` translate(0,${u[_]/2})`:` translate(0,${d/2})`}`).attr("d",u?_=>{let v=er();return m.draw(v,u[_],g),v}:(()=>{let _=er();return m.draw(_,d,g),_})()).call(Zt,this,r)).node()}};function jE(e,t={}){let{x:n,y:r,...i}=t;return t.frameAnchor===void 0&&([n,r]=Be(n,r)),new kl(e,{...i,x:n,y:r})}function __(e,t={}){let{x:n=W,...r}=t;return new kl(e,{...r,x:n})}function w_(e,t={}){let{y:n=W,...r}=t;return new kl(e,{...r,y:n})}function qB(e,t={}){let{shape:n=zB,stroke:r=PB.stroke,strokeWidth:i=1,fill:o=r,fillOpacity:s=.3,anchor:a="start",...c}=t;return jE(e,{...c,shape:n,stroke:r,strokeWidth:i,fill:o,fillOpacity:s,anchor:a})}function sc(e,t){return arguments.length<2&&!cr(e)&&(t=e,e=null),t===void 0&&(t={}),[e,t]}function v_({anchor:e}={},t){return e===void 0?t[0]:Ke(e,"anchor",t)}function jB(e){return v_(e,["left","right"])}function VB(e){return v_(e,["right","left"])}function YB(e){return v_(e,["bottom","top"])}function GB(e){return v_(e,["top","bottom"])}function Dm(){let[e,t]=sc(...arguments);return WB("y",jB(t),e,t)}function S_(){let[e,t]=sc(...arguments);return WB("fy",VB(t),e,t)}function km(){let[e,t]=sc(...arguments);return XB("x",YB(t),e,t)}function I_(){let[e,t]=sc(...arguments);return XB("fx",GB(t),e,t)}function WB(e,t,n,{color:r="currentColor",opacity:i=1,stroke:o=r,strokeOpacity:s=i,strokeWidth:a=1,fill:c=r,fillOpacity:l=i,textAnchor:u,textStroke:f,textStrokeOpacity:d,textStrokeWidth:h,tickSize:p=e==="y"?6:0,tickPadding:m,tickRotate:g,x:y,margin:b,marginTop:x=b===void 0?20:b,marginRight:_=b===void 0?t==="right"?40:0:b,marginBottom:v=b===void 0?20:b,marginLeft:w=b===void 0?t==="left"?40:0:b,label:T,labelAnchor:M,labelArrow:R,labelOffset:I,...A}){return p=Nt(p),m=Nt(m),g=Nt(g),M!==void 0&&(M=Ke(M,"labelAnchor",["center","top","bottom"])),R=n7(R),Je(p&&!ne(o)?NQ(e,t,n,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:m,tickRotate:g,x:y,...A}):null,ne(c)?null:OQ(e,t,n,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:d,strokeWidth:h,textAnchor:u,tickSize:p,tickPadding:m,tickRotate:g,x:y,marginTop:x,marginRight:_,marginBottom:v,marginLeft:w,...A}),!ne(c)&&T!==null?Bo([],KB({fill:c,fillOpacity:l,...A},function(O,F,S,E,N){let L=E[e],{marginTop:B,marginRight:C,marginBottom:P,marginLeft:$}=e==="y"&&N.inset||N,U=M??(L.bandwidth?"center":"top"),X=I??(t==="right"?C:$)-3;return U==="center"?(this.textAnchor=void 0,this.lineAnchor=t==="right"?"bottom":"top",this.frameAnchor=t,this.rotate=-90):(this.textAnchor=t==="right"?"end":"start",this.lineAnchor=U,this.frameAnchor=`${U}-${t}`,this.rotate=0),this.dy=U==="top"?3-B:U==="bottom"?P-3:0,this.dx=t==="right"?X:-X,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[e7(e,L,{anchor:t,label:T,labelAnchor:U,labelArrow:R})]}}}})):null)}function XB(e,t,n,{color:r="currentColor",opacity:i=1,stroke:o=r,strokeOpacity:s=i,strokeWidth:a=1,fill:c=r,fillOpacity:l=i,textAnchor:u,textStroke:f,textStrokeOpacity:d,textStrokeWidth:h,tickSize:p=e==="x"?6:0,tickPadding:m,tickRotate:g,y,margin:b,marginTop:x=b===void 0?t==="top"?30:0:b,marginRight:_=b===void 0?20:b,marginBottom:v=b===void 0?t==="bottom"?30:0:b,marginLeft:w=b===void 0?20:b,label:T,labelAnchor:M,labelArrow:R,labelOffset:I,...A}){return p=Nt(p),m=Nt(m),g=Nt(g),M!==void 0&&(M=Ke(M,"labelAnchor",["center","left","right"])),R=n7(R),Je(p&&!ne(o)?RQ(e,t,n,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:m,tickRotate:g,y,...A}):null,ne(c)?null:DQ(e,t,n,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:d,strokeWidth:h,textAnchor:u,tickSize:p,tickPadding:m,tickRotate:g,y,marginTop:x,marginRight:_,marginBottom:v,marginLeft:w,...A}),!ne(c)&&T!==null?Bo([],KB({fill:c,fillOpacity:l,...A},function(O,F,S,E,N){let L=E[e],{marginTop:B,marginRight:C,marginBottom:P,marginLeft:$}=e==="x"&&N.inset||N,U=M??(L.bandwidth?"center":"right"),X=I??(t==="top"?B:P)-3;return U==="center"?(this.frameAnchor=t,this.textAnchor=void 0):(this.frameAnchor=`${t}-${U}`,this.textAnchor=U==="right"?"end":"start"),this.lineAnchor=t,this.dy=t==="top"?-X:X,this.dx=U==="right"?C-3:U==="left"?3-$:0,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[e7(e,L,{anchor:t,label:T,labelAnchor:U,labelArrow:R})]}}}})):null)}function NQ(e,t,n,{strokeWidth:r=1,strokeLinecap:i=null,strokeLinejoin:o=null,facetAnchor:s=t+(e==="y"?"-empty":""),frameAnchor:a=t,tickSize:c,inset:l=0,insetLeft:u=l,insetRight:f=l,dx:d=0,y:h=e==="y"?void 0:null,...p}){return $f(w_,e,t,`${e}-axis tick`,n,{strokeWidth:r,strokeLinecap:i,strokeLinejoin:o,facetAnchor:s,frameAnchor:a,y:h,...p,dx:t==="left"?+d-De+ +u:+d+De-f,anchor:"start",length:c,shape:t==="left"?CQ:BQ})}function RQ(e,t,n,{strokeWidth:r=1,strokeLinecap:i=null,strokeLinejoin:o=null,facetAnchor:s=t+(e==="x"?"-empty":""),frameAnchor:a=t,tickSize:c,inset:l=0,insetTop:u=l,insetBottom:f=l,dy:d=0,x:h=e==="x"?void 0:null,...p}){return $f(__,e,t,`${e}-axis tick`,n,{strokeWidth:r,strokeLinejoin:o,strokeLinecap:i,facetAnchor:s,frameAnchor:a,x:h,...p,dy:t==="bottom"?+d-De-f:+d+De+ +u,anchor:"start",length:c,shape:t==="bottom"?FQ:LQ})}function OQ(e,t,n,{facetAnchor:r=t+(e==="y"?"-empty":""),frameAnchor:i=t,tickSize:o,tickRotate:s=0,tickPadding:a=Math.max(3,9-o)+(Math.abs(s)>60?4*Math.cos(s*Bf):0),text:c,textAnchor:l=Math.abs(s)>60?"middle":t==="left"?"end":"start",lineAnchor:u=s>60?"top":s<-60?"bottom":"middle",fontVariant:f,inset:d=0,insetLeft:h=d,insetRight:p=d,dx:m=0,y:g=e==="y"?void 0:null,...y}){return $f(g_,e,t,`${e}-axis tick label`,n,{facetAnchor:r,frameAnchor:i,text:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,y:g,...y,dx:t==="left"?+m-o-a+ +h:+m+ +o+ +a-p},function(b,x,_,v,w){f===void 0&&(this.fontVariant=t7(b)),c===void 0&&(w.text=JB(b,x,_,v,t))})}function DQ(e,t,n,{facetAnchor:r=t+(e==="x"?"-empty":""),frameAnchor:i=t,tickSize:o,tickRotate:s=0,tickPadding:a=Math.max(3,9-o)+(Math.abs(s)>=10?4*Math.cos(s*Bf):0),text:c,textAnchor:l=Math.abs(s)>=10?s<0^t==="bottom"?"start":"end":"middle",lineAnchor:u=Math.abs(s)>=10?"middle":t==="bottom"?"top":"bottom",fontVariant:f,inset:d=0,insetTop:h=d,insetBottom:p=d,dy:m=0,x:g=e==="x"?void 0:null,...y}){return $f(y_,e,t,`${e}-axis tick label`,n,{facetAnchor:r,frameAnchor:i,text:c===void 0?null:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,x:g,...y,dy:t==="bottom"?+m+ +o+ +a-p:+m-o-a+ +h},function(b,x,_,v,w){f===void 0&&(this.fontVariant=t7(b)),c===void 0&&(w.text=JB(b,x,_,v,t))})}function T_(){let[e,t]=sc(...arguments);return HB("y",jB(t),e,t)}function E_(){let[e,t]=sc(...arguments);return HB("fy",VB(t),e,t)}function A_(){let[e,t]=sc(...arguments);return ZB("x",YB(t),e,t)}function M_(){let[e,t]=sc(...arguments);return ZB("fx",GB(t),e,t)}function HB(e,t,n,{y:r=e==="y"?void 0:null,x:i=null,x1:o=t==="left"?i:null,x2:s=t==="right"?i:null,...a}){return $f(Vr,e,t,`${e}-grid`,n,{y:r,x1:o,x2:s,...QB(a)})}function ZB(e,t,n,{x:r=e==="x"?void 0:null,y:i=null,y1:o=t==="top"?i:null,y2:s=t==="bottom"?i:null,...a}){return $f(jr,e,t,`${e}-grid`,n,{x:r,y1:o,y2:s,...QB(a)})}function QB({color:e="currentColor",opacity:t=.1,stroke:n=e,strokeOpacity:r=t,strokeWidth:i=1,...o}){return{stroke:n,strokeOpacity:r,strokeWidth:i,...o}}function KB({fill:e,fillOpacity:t,fontFamily:n,fontSize:r,fontStyle:i,fontVariant:o,fontWeight:s,monospace:a,pointerEvents:c,shapeRendering:l,clip:u=!1},f){return[,e]=Re(e),[,t]=ie(t),{facet:"super",x:null,y:null,fill:e,fillOpacity:t,fontFamily:n,fontSize:r,fontStyle:i,fontVariant:o,fontWeight:s,monospace:a,pointerEvents:c,shapeRendering:l,clip:u,initializer:f}}function $f(e,t,n,r,i,o,s){let a;function c(f,d,h,p,m,g){let y=f==null&&(t==="fx"||t==="fy"),{[t]:b}=p;if(!b)throw new Error(`missing scale: ${t}`);let x=b.domain(),{interval:_,ticks:v,tickFormat:w,tickSpacing:T=t==="x"?80:35}=o;if(typeof v=="string"&&r7(b)&&(_=v,v=void 0),v===void 0&&(v=ko(_,b.type)??kQ(b,T)),f==null){if(cr(v))f=qe(v);else if(Qa(v))f=VE(v,...ae(x));else if(b.interval){let R=b.interval;if(b.ticks){let[I,A]=ae(x),O=(A-I)/R[mf];R=qT(R,O/v)??R,f=VE(R,I,A)}else{f=x;let I=f.length;R=qT(R,I/v)??R,R!==b.interval&&(f=VE(R,...ae(f)))}if(R===b.interval){let I=Math.round(f.length/v);I>1&&(f=f.filter((A,O)=>O%I===0))}}else b.ticks?f=b.ticks(v):f=x;if(!b.ticks&&f.length&&f!==x){let R=new Qn(x);f=f.filter(I=>R.has(I)),f.length||jn(`Warning: the ${t}-axis ticks appear to not align with the scale domain, resulting in no ticks. Try different ticks?`)}t==="y"||t==="x"?d=[ar(f)]:a[t]={scale:t,value:W}}s?.call(this,b,f,v,w,a);let M=Object.fromEntries(Object.entries(a).map(([R,I])=>[R,{...I,value:mt(f,I.value)}]));return y&&(d=g.filterFacets(f,M)),{data:f,facets:d,channels:M}}let l=Se(o).initializer,u=e(i,Se({...o,initializer:c},l));return i==null?(a=u.channels,u.channels={}):a={},u.ariaLabel=r,u.clip===void 0&&(u.clip=!1),u}function kQ(e,t){let[n,r]=ae(e.range());return(r-n)/t}function JB(e,t,n,r,i){return{value:Fm(e,t,n,r,i)}}function Fm(e,t,n,r,i){return typeof r=="function"?r:r===void 0&&t&&Oe(t)?kC(e.type,t,i)??zi:e.tickFormat?e.tickFormat(typeof n=="number"?n:null,r):r===void 0?zi:typeof r=="string"?(Oe(e.domain())?Mo:ci)(r):dn(r)}function VE(e,t,n){return e.range(t,e.offset(e.floor(n)))}var FQ={draw(e,t){e.moveTo(0,0),e.lineTo(0,t)}},LQ={draw(e,t){e.moveTo(0,0),e.lineTo(0,-t)}},CQ={draw(e,t){e.moveTo(0,0),e.lineTo(-t,0)}},BQ={draw(e,t){e.moveTo(0,0),e.lineTo(t,0)}};function t7(e){return e.bandwidth&&!e.interval?void 0:"tabular-nums"}function e7(e,t,{anchor:n,label:r=t.label,labelAnchor:i,labelArrow:o}={}){if(!(r==null||r.inferred&&r7(t)&&/^(date|time|year)$/i.test(r))){if(r=String(r),o==="auto"&&(o=(!t.bandwidth||t.interval)&&!/[↑↓→←]/.test(r)),!o)return r;if(o===!0){let s=r_(t);s&&(o=/x$/.test(e)||i==="center"?/x$/.test(e)===s<0?"left":"right":s<0?"up":"down")}switch(o){case"left":return`\u2190 ${r}`;case"right":return`${r} \u2192`;case"up":return n==="right"?`${r} \u2191`:`\u2191 ${r}`;case"down":return n==="right"?`${r} \u2193`:`\u2193 ${r}`}return r}}function n7(e="auto"){return ne(e)?!1:typeof e=="boolean"?e:Ke(e,"labelArrow",["auto","up","right","down","left"])}function r7(e){return Oe(e.domain())}function i7(e,t){if(t==null)return t;let n=e(t);if(!n)throw new Error(`scale not found: ${t}`);return n}function o7(e,{opacity:t,...n}={}){if(!Co(e)&&!TE(e))throw new Error(`swatches legend requires ordinal or threshold color scale (not ${e.type})`);return a7(e,n,(r,i,o,s)=>r.append("svg").attr("width",o).attr("height",s).attr("fill",i.scale).attr("fill-opacity",ie(t)[1]).append("rect").attr("width","100%").attr("height","100%"))}function s7(e,{fill:t=e.hint?.fill!==void 0?e.hint.fill:"none",fillOpacity:n=1,stroke:r=e.hint?.stroke!==void 0?e.hint.stroke:ne(t)?"currentColor":"none",strokeOpacity:i=1,strokeWidth:o=1.5,r:s=4.5,...a}={},c){let[l,u]=Re(t),[f,d]=Re(r),h=i7(c,l),p=i7(c,f),m=s*s*Math.PI;return n=ie(n)[1],i=ie(i)[1],o=ie(o)[1],a7(e,a,(g,y,b,x)=>g.append("svg").attr("viewBox","-8 -8 16 16").attr("width",b).attr("height",x).attr("fill",l==="color"?_=>h.scale(_):u).attr("fill-opacity",n).attr("stroke",f==="color"?_=>p.scale(_):d).attr("stroke-opacity",i).attr("stroke-width",o).append("path").attr("d",_=>{let v=er();return e.scale(_).draw(v,m),v}))}function a7(e,t={},n){let{columns:r,tickFormat:i,fontVariant:o=u_(e),swatchSize:s=15,swatchWidth:a=s,swatchHeight:c=s,marginLeft:l=0,className:u,style:f,width:d}=t,h=nc(t);u=Ef(u),i=Fm(e.scale,e.domain,void 0,i);let p=ct("div",h).attr("class",`${u}-swatches ${u}-swatches-${r!=null?"columns":"wrap"}`),m;return r!=null?(m=`:where(.${u}-swatches-columns .${u}-swatch) {
27
28
  display: flex;
28
29
  align-items: center;
29
30
  break-inside: avoid;
@@ -36,7 +37,7 @@ ${n}`}function OH(e){return e==="time"?z1:e==="utc"?am:NH}function bk(e,t,n){let
36
37
  white-space: nowrap;
37
38
  overflow: hidden;
38
39
  text-overflow: ellipsis;
39
- }`,p.style("columns",r).selectAll().data(e.domain).enter().append("div").attr("class",`${u}-swatch`).call(n,e,a,c).call(g=>g.append("div").attr("class",`${u}-swatch-label`).attr("title",i).text(i))):(y=`:where(.${u}-swatches-wrap) {
40
+ }`,p.style("columns",r).selectAll().data(e.domain).enter().append("div").attr("class",`${u}-swatch`).call(n,e,a,c).call(g=>g.append("div").attr("class",`${u}-swatch-label`).attr("title",i).text(i))):(m=`:where(.${u}-swatches-wrap) {
40
41
  display: flex;
41
42
  align-items: center;
42
43
  min-height: 33px;
@@ -55,7 +56,7 @@ ${n}`}function OH(e){return e==="time"?z1:e==="utc"?am:NH}function bk(e,t,n){let
55
56
  margin-right: 0.5em;
56
57
  overflow: visible;
57
58
  }
58
- ${y}`)).style("margin-left",l?`${+l}px`:null).style("width",d===void 0?null:`${+d}px`).style("font-variant",ce(o,"normal")).call(Tf,f).node()}var B_=new Map([["symbol",YF],["color",HF],["opacity",xZ]]);function WF(e={}){for(let[t,n]of B_){let r=e[t];if(Lo(r)){let i=ec(e),o;if(t==="symbol"){let{fill:s,stroke:a=s===void 0&&Lo(e.color)?"color":void 0}=e;o={fill:s,stroke:a}}return n(h_(t,r,o),TE(i,r,e),s=>Lo(e[s])?h_(s,e[s]):null)}}throw new Error("unknown legend type; no scale found")}function XF(e,t,n={}){return(r,i)=>{if(!B_.has(r))throw new Error(`unknown legend type: ${r}`);if(r in e)return B_.get(r)(e[r],TE(t,n[r],i),o=>e[o])}}function TE({className:e,...t},{label:n,ticks:r,tickFormat:i}={},o){return kk(o,{className:e,...t},{label:n,ticks:r,tickFormat:i})}function HF(e,{legend:t=!0,...n}){if(t===!0&&(t=e.type==="ordinal"?"swatches":"ramp"),e.domain!==void 0)switch(`${t}`.toLowerCase()){case"swatches":return VF(e,n);case"ramp":return sF(e,n);default:throw new Error(`unknown legend type: ${t}`)}}function xZ({type:e,interpolate:t,...n},{legend:r=!0,color:i=ln(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 HF({type:e,...n,interpolate:_Z(i)},{legend:r,...o})}function _Z(e){let{r:t,g:n,b:r}=ln(e)||ln(0,0,0);return i=>`rgba(${t},${n},${r},${i})`}function QF(e,t,n){let r=[];for(let[i,o]of B_){let s=n[i];if(s?.legend&&i in e){let a=o(e[i],TE(t,e[i],s),c=>e[c]);a!=null&&r.push(a)}}return r}var wZ={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},vZ={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1},Am=class extends mt{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(Wa,void 0,t,n==null?wZ:vZ),this.anchor=AT(n,"anchor",["top","right","bottom","left"]),this.insetTop=It(i),this.insetRight=It(o),this.insetBottom=It(s),this.insetLeft=It(a),this.rx=It(c),this.ry=It(l)}render(t,n,r,i,o){let{marginTop:s,marginRight:a,marginBottom:c,marginLeft:l,width:u,height:f}=i,{anchor:d,insetTop:h,insetRight:p,insetBottom:y,insetLeft:g,rx:m,ry:b}=this,x=l+g,_=u-a-p,v=s+h,w=f-c-y;return at(d?"svg:line":"svg:rect",o).datum(0).call(Mt,this,i,o).call(Tt,this).call(Qt,this,r).call(bt,this,{}).call(d==="left"?T=>T.attr("x1",x).attr("x2",x).attr("y1",v).attr("y2",w):d==="right"?T=>T.attr("x1",_).attr("x2",_).attr("y1",v).attr("y2",w):d==="top"?T=>T.attr("x1",x).attr("x2",_).attr("y1",v).attr("y2",v):d==="bottom"?T=>T.attr("x1",x).attr("x2",_).attr("y1",w).attr("y2",w):T=>T.attr("x",x).attr("y",v).attr("width",_-x).attr("height",w-v).attr("rx",m).attr("ry",b)).node()}};function Bf(e){return new Am(e)}var EE={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},SZ=new Set(["geometry","href","src","ariaLabel","scales"]),Mm=class extends mt{constructor(t,n={}){n.tip&&(n={...n,tip:!1}),n.title===void 0&&or(t)&&Y1(t)&&(n={...n,title:W});let{x:r,y:i,x1:o,x2:s,y1:a,y2:c,anchor:l,preferredAnchor:u="bottom",monospace:f,fontFamily:d=f?"ui-monospace, monospace":void 0,fontSize:h,fontStyle:p,fontVariant:y,fontWeight:g,lineHeight:m=1,lineWidth:b=20,frameAnchor:x,format:_,textAnchor:v="start",textOverflow:w,textPadding:T=8,title:M,pointerSize:R=12,pathFilter:I="drop-shadow(0 3px 4px rgba(0,0,0,0.2))"}=n;super(t,{x:{value:o!=null&&s!=null?null:r,scale:"x",optional:!0},y:{value:a!=null&&c!=null?null:i,scale:"y",optional:!0},x1:{value:o,scale:"x",optional:s==null},y1:{value:a,scale:"y",optional:c==null},x2:{value:s,scale:"x",optional:o==null},y2:{value:c,scale:"y",optional:a==null},title:{value:M,optional:!0}},n,EE),this.anchor=W1(l,"anchor"),this.preferredAnchor=W1(u,"preferredAnchor"),this.frameAnchor=Po(x),this.textAnchor=ce(v,"middle"),this.textPadding=+T,this.pointerSize=+R,this.pathFilter=ze(I),this.lineHeight=+m,this.lineWidth=+b,this.textOverflow=xE(w),this.monospace=!!f,this.fontFamily=ze(d),this.fontSize=It(h),this.fontStyle=ze(p),this.fontVariant=ze(y),this.fontWeight=ze(g);for(let E in EE)E in this.channels&&(this[E]=EE[E]);this.splitLines=wE(this),this.clipLine=vE(this),this.format={..._}}render(t,n,r,i,o){let s=this,{x:a,y:c,fx:l,fy:u}=n,{ownerSVGElement:f,document:d}=o,{anchor:h,monospace:p,lineHeight:y,lineWidth:g}=this,{textPadding:m,pointerSize:b,pathFilter:x}=this,{marginTop:_,marginLeft:v}=i,{x1:w,y1:T,x2:M,y2:R,x:I=w??M,y:E=T??R}=r,O=l?l(t.fx)-v:0,F=u?u(t.fy)-_:0,[S,A]=bn(this,i),N=dE(r,S),D=hE(r,A),B=p?A_:E_,C=B(Ml),P,$;"title"in r?(P=r.channels,$=MZ):(P=AZ.call(this,r,n),$=NZ);let U=at("svg:g",o).call(Mt,this,i,o).call(_E,this).call(bt,this,{x:I&&a,y:E&&c}).call(nt=>nt.selectAll().data(t).enter().append("g").attr("transform",st=>`translate(${Math.round(N(st))},${Math.round(D(st))})`).call(Tt,this).call(st=>st.append("path").attr("filter",x)).call(st=>st.append("text").each(function(Y){let rt=zt(this);this.setAttribute("fill","currentColor"),this.setAttribute("fill-opacity",1),this.setAttribute("stroke","none");let j=$.call(s,Y,t,P,n,r);if(typeof j=="string")for(let H of s.splitLines(j))X(rt,{value:s.clipLine(H)});else{let H=new Set;for(let ot of j){let{label:z=""}=ot;z&&H.has(z)||(H.add(z),X(rt,ot))}}})));function X(nt,{label:st,value:Y,color:rt,opacity:j}){st??="",Y??="";let H=rt!=null||j!=null,ot,z=g*100,[Nt]=Rl(st,z,B,C);if(Nt>=0)st=st.slice(0,Nt).trimEnd()+Ml,ot=Y.trim(),Y="";else{(st||!Y&&!H)&&(Y=" "+Y);let[Wt]=Rl(Y,z-B(st),B,C);Wt>=0&&(ot=Y.trim(),Y=Y.slice(0,Wt).trimEnd()+Ml)}let lt=nt.append("tspan").attr("x",0).attr("dy",`${y}em`).text("\u200B");st&&lt.append("tspan").attr("font-weight","bold").text(st),Y&&lt.append(()=>d.createTextNode(Y)),H&&lt.append("tspan").text(" \u25A0").attr("fill",rt).attr("fill-opacity",j).style("user-select","none"),ot&&lt.append("title").text(ot)}function tt(){let{width:nt,height:st}=i.facet??i;U.selectChildren().each(function(Y){let{x:rt,width:j,height:H}=this.getBBox();j=Math.round(j),H=Math.round(H);let ot=h;if(ot===void 0){let lt=N(Y)+O,Wt=D(Y)+F,Xt=lt+j+b+m*2<nt,et=lt-j-b-m*2>0,oe=Wt+H+b+m*2<st,Ir=Wt-H-b-m*2>0;ot=Xt&&et?oe&&Ir?s.preferredAnchor:Ir?"bottom":"top":oe&&Ir?Xt?"left":"right":(Xt||et)&&(oe||Ir)?`${Ir?"bottom":"top"}-${Xt?"left":"right"}`:s.preferredAnchor}let z=this.firstChild,Nt=this.lastChild;if(z.setAttribute("d",EZ(ot,b,m,j,H)),rt)for(let lt of Nt.childNodes)lt.setAttribute("x",-rt);Nt.setAttribute("y",`${+IZ(ot,Nt.childNodes.length,y).toFixed(6)}em`),Nt.setAttribute("transform",`translate(${TZ(ot,b,m,j,H)})`)}),U.attr("visibility",null)}return t.length&&(U.attr("visibility","hidden"),f.isConnected?Promise.resolve().then(tt):typeof requestAnimationFrame<"u"&&requestAnimationFrame(tt)),U.node()}};function $_(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Le(t,n)),new Mm(e,{...r,x:t,y:n})}function IZ(e,t,n){return/^top(?:-|$)/.test(e)?.94-n:-.29-t*n}function TZ(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 EZ(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 AZ({channels:e},t){let n={},r=this.format;r=ZF(r,e,"x"),r=ZF(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=ym(e,i);s&&(n[i]=s)}}for(let i in e){if(i in n||i in r||SZ.has(i))continue;let o=ym(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]=(Re(s)?ko:li)(o)}else if(o===void 0||o===!0){let s=t[i];this.format[i]=s?.bandwidth?Em(s,s.domain()):Yi}}return n}function ZF(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 MZ(e,t,{title:n}){return Yi(n.value[e],e)}function*NZ(e,t,n,r,i){for(let o in n){if(o==="fx"||o==="fy"){yield{label:P_(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:JF(r,n,"x"),value:KF(this.format.x2,n.x1,s,e)};else if(o==="y2"&&"y1"in n)yield{label:JF(r,n,"y"),value:KF(this.format.y2,n.y1,s,e)};else{let a=s.value[e],c=s.scale;if(!Ue(a)&&c==null)continue;yield{label:P_(r,n,o),value:this.format[o](a,e),color:c==="color"?i[o][e]:null,opacity:c==="opacity"?i[o][e]:null}}}}function KF(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 JF(e,t,n){let r=P_(e,t,`${n}1`,n),i=P_(e,t,`${n}2`,n);return r===i?r:`${r}\u2013${i}`}function P_(e,t,n,r=n){let i=t[n],o=e[i?.scale??n];return String(o?.label??i?.label??r)}function Rm(e={}){let{facet:t,style:n,title:r,subtitle:i,caption:o,ariaLabel:s,ariaDescription:a}=e,c=If(e.className),l=e.marks===void 0?[]:eD(e.marks);l.push(...CZ(l));let u=DZ(t,e),f=new Map;for(let C of l){let P=nD(C,u,e);P&&f.set(C,P)}let d=new Map;u&&Nm(d,[u],e),Nm(d,f,e);let h=eD(BZ(l,d,e));for(let C of h){let P=nD(C,u,e);P&&f.set(C,P)}l.unshift(...h);let p=tF(d,e);if(p!==void 0){let C=u?g_(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?g_(p,U):C)}let P=new Set;for(let{facetsIndex:$}of f.values())$?.forEach((U,X)=>{U?.length>0&&P.add(X)});p.forEach(0<P.size&&P.size<p.length?($,U)=>$.empty=!P.has(U):$=>$.empty=!1);for(let $ of l)if($.facet==="exclude"){let U=f.get($);U!==void 0&&(U.facetsIndex=rF(U.facetsIndex))}}for(let C of ue.keys())Lo(e[C])&&C!=="fx"&&C!=="fy"&&d.set(C,[]);let y=new Map;for(let C of l){if(y.has(C))throw new Error("duplicate mark; each mark must be unique");let{facetsIndex:P,channels:$}=f.get(C)??{},{data:U,facets:X,channels:tt}=C.initialize(P,$,e);NE(tt,e),y.set(C,{data:U,facets:X,channels:tt})}let g=wm(Nm(d,y,e),e),m=K8(g,l,e);Y8(g,m);let b=rE(g),{fx:x,fy:_}=b,v=x||_?iE(g,m):m,w=x||_?VZ(b,m):m,T=ec(e),M=T.document,R=Is("svg").call(M.documentElement),I=R;T.ownerSVGElement=R,T.className=c,T.projection=i8(e,v),T.filterFacets=(C,P)=>g_(p,{channels:P,groups:m_(C,P)}),T.getMarkState=C=>{let P=y.get(C),$=f.get(C);return{...P,channels:{...P.channels,...$?.channels}}},T.dispatchValue=C=>{I.value!==C&&(I.value=C,I.dispatchEvent(new Event("input",{bubbles:!0})))};let E=new Set;for(let[C,P]of y)if(C.initializer!=null){let $=C.facet==="super"?w:v,U=C.initializer(P.data,P.facets,P.channels,b,$,T);if(U.data!==void 0&&(P.data=U.data),U.facets!==void 0&&(P.facets=U.facets),U.channels!==void 0){let{fx:X,fy:tt,...nt}=U.channels;FZ(nt),Object.assign(P.channels,nt);for(let st of Object.values(nt)){let{scale:Y}=st;Y!=null&&!Dk(ue.get(Y))&&(oD(st,e),E.add(Y))}(X!=null||tt!=null)&&f.set(C,!0)}}if(E.size){let C=new Map;Nm(C,y,e,X=>E.has(X)),Nm(d,y,e,X=>E.has(X));let P=qZ(wm(C,e),g),{scales:$,...U}=rE(P);Object.assign(g,P),Object.assign(b,U),Object.assign(b.scales,$)}let O,F;p!==void 0&&(O={x:x?.domain(),y:_?.domain()},p=eF(p,O),F=nF(x,_,m));for(let[C,P]of y)P.values=C.scale(P.channels,b,T);let{width:S,height:A}=m;zt(R).attr("class",c).attr("fill","currentColor").attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("text-anchor","middle").attr("width",S).attr("height",A).attr("viewBox",`0 0 ${S} ${A}`).attr("aria-label",s).attr("aria-description",a).call(C=>C.append("style").text(`:where(.${c}) {
59
+ ${m}`)).style("margin-left",l?`${+l}px`:null).style("width",d===void 0?null:`${+d}px`).style("font-variant",le(o,"normal")).call(Af,f).node()}var N_=new Map([["symbol",s7],["color",u7],["opacity",PQ]]);function c7(e={}){for(let[t,n]of N_){let r=e[t];if(Oo(r)){let i=nc(e),o;if(t==="symbol"){let{fill:s,stroke:a=s===void 0&&Oo(e.color)?"color":void 0}=e;o={fill:s,stroke:a}}return n(o_(t,r,o),YE(i,r,e),s=>Oo(e[s])?o_(s,e[s]):null)}}throw new Error("unknown legend type; no scale found")}function l7(e,t,n={}){return(r,i)=>{if(!N_.has(r))throw new Error(`unknown legend type: ${r}`);if(r in e)return N_.get(r)(e[r],YE(t,n[r],i),o=>e[o])}}function YE({className:e,...t},{label:n,ticks:r,tickFormat:i}={},o){return WC(o,{className:e,...t},{label:n,ticks:r,tickFormat:i})}function u7(e,{legend:t=!0,...n}){if(t===!0&&(t=e.type==="ordinal"?"swatches":"ramp"),e.domain!==void 0)switch(`${t}`.toLowerCase()){case"swatches":return o7(e,n);case"ramp":return wB(e,n);default:throw new Error(`unknown legend type: ${t}`)}}function PQ({type:e,interpolate:t,...n},{legend:r=!0,color:i=rn(0,0,0),...o}){if(!t)throw new Error(`${e} opacity scales are not supported`);if(r===!0&&(r="ramp"),`${r}`.toLowerCase()!=="ramp")throw new Error(`${r} opacity legends are not supported`);return u7({type:e,...n,interpolate:$Q(i)},{legend:r,...o})}function $Q(e){let{r:t,g:n,b:r}=rn(e)||rn(0,0,0);return i=>`rgba(${t},${n},${r},${i})`}function f7(e,t,n){let r=[];for(let[i,o]of N_){let s=n[i];if(s?.legend&&i in e){let a=o(e[i],YE(t,e[i],s),c=>e[c]);a!=null&&r.push(a)}}return r}var UQ={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},zQ={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1},Lm=class extends wt{constructor(t={}){let{anchor:n=null,inset:r=0,insetTop:i=r,insetRight:o=r,insetBottom:s=r,insetLeft:a=r,rx:c,ry:l}=t;super(Xa,void 0,t,n==null?UQ:zQ),this.anchor=WT(n,"anchor",["top","right","bottom","left"]),this.insetTop=Nt(i),this.insetRight=Nt(o),this.insetBottom=Nt(s),this.insetLeft=Nt(a),this.rx=Nt(c),this.ry=Nt(l)}render(t,n,r,i,o){let{marginTop:s,marginRight:a,marginBottom:c,marginLeft:l,width:u,height:f}=i,{anchor:d,insetTop:h,insetRight:p,insetBottom:m,insetLeft:g,rx:y,ry:b}=this,x=l+g,_=u-a-p,v=s+h,w=f-c-m;return ct(d?"svg:line":"svg:rect",o).datum(0).call(Ft,this,i,o).call(Rt,this).call(Zt,this,r).call(It,this,{}).call(d==="left"?T=>T.attr("x1",x).attr("x2",x).attr("y1",v).attr("y2",w):d==="right"?T=>T.attr("x1",_).attr("x2",_).attr("y1",v).attr("y2",w):d==="top"?T=>T.attr("x1",x).attr("x2",_).attr("y1",v).attr("y2",v):d==="bottom"?T=>T.attr("x1",x).attr("x2",_).attr("y1",w).attr("y2",w):T=>T.attr("x",x).attr("y",v).attr("width",_-x).attr("height",w-v).attr("rx",y).attr("ry",b)).node()}};function Uf(e){return new Lm(e)}var GE={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},qQ=new Set(["geometry","href","src","ariaLabel","scales"]),Cm=class extends wt{constructor(t,n={}){n.tip&&(n={...n,tip:!1}),n.title===void 0&&cr(t)&&B1(t)&&(n={...n,title:W});let{x:r,y:i,x1:o,x2:s,y1:a,y2:c,anchor:l,preferredAnchor:u="bottom",monospace:f,fontFamily:d=f?"ui-monospace, monospace":void 0,fontSize:h,fontStyle:p,fontVariant:m,fontWeight:g,lineHeight:y=1,lineWidth:b=20,frameAnchor:x,format:_,textAnchor:v="start",textOverflow:w,textPadding:T=8,title:M,pointerSize:R=12,pathFilter:I="drop-shadow(0 3px 4px rgba(0,0,0,0.2))"}=n;super(t,{x:{value:o!=null&&s!=null?null:r,scale:"x",optional:!0},y:{value:a!=null&&c!=null?null:i,scale:"y",optional:!0},x1:{value:o,scale:"x",optional:s==null},y1:{value:a,scale:"y",optional:c==null},x2:{value:s,scale:"x",optional:o==null},y2:{value:c,scale:"y",optional:a==null},title:{value:M,optional:!0}},n,GE),this.anchor=$1(l,"anchor"),this.preferredAnchor=$1(u,"preferredAnchor"),this.frameAnchor=Fo(x),this.textAnchor=le(v,"middle"),this.textPadding=+T,this.pointerSize=+R,this.pathFilter=ze(I),this.lineHeight=+y,this.lineWidth=+b,this.textOverflow=$E(w),this.monospace=!!f,this.fontFamily=ze(d),this.fontSize=Nt(h),this.fontStyle=ze(p),this.fontVariant=ze(m),this.fontWeight=ze(g);for(let A in GE)A in this.channels&&(this[A]=GE[A]);this.splitLines=zE(this),this.clipLine=qE(this),this.format={..._}}render(t,n,r,i,o){let s=this,{x:a,y:c,fx:l,fy:u}=n,{ownerSVGElement:f,document:d}=o,{anchor:h,monospace:p,lineHeight:m,lineWidth:g}=this,{textPadding:y,pointerSize:b,pathFilter:x}=this,{marginTop:_,marginLeft:v}=i,{x1:w,y1:T,x2:M,y2:R,x:I=w??M,y:A=T??R}=r,O=l?l(t.fx)-v:0,F=u?u(t.fy)-_:0,[S,E]=yn(this,i),N=DE(r,S),L=kE(r,E),B=p?x_:b_,C=B(Rl),P,$;"title"in r?(P=r.channels,$=WQ):(P=GQ.call(this,r,n),$=XQ);let U=ct("svg:g",o).call(Ft,this,i,o).call(UE,this).call(It,this,{x:I&&a,y:A&&c}).call(nt=>nt.selectAll().data(t).enter().append("g").attr("transform",st=>`translate(${Math.round(N(st))},${Math.round(L(st))})`).call(Rt,this).call(st=>st.append("path").attr("filter",x)).call(st=>st.append("text").each(function(Y){let rt=qt(this);this.setAttribute("fill","currentColor"),this.setAttribute("fill-opacity",1),this.setAttribute("stroke","none");let q=$.call(s,Y,t,P,n,r);if(typeof q=="string")for(let H of s.splitLines(q))X(rt,{value:s.clipLine(H)});else{let H=new Set;for(let ot of q){let{label:z=""}=ot;z&&H.has(z)||(H.add(z),X(rt,ot))}}})));function X(nt,{label:st,value:Y,color:rt,opacity:q}){st??="",Y??="";let H=rt!=null||q!=null,ot,z=g*100,[Lt]=Dl(st,z,B,C);if(Lt>=0)st=st.slice(0,Lt).trimEnd()+Rl,ot=Y.trim(),Y="";else{(st||!Y&&!H)&&(Y=" "+Y);let[Wt]=Dl(Y,z-B(st),B,C);Wt>=0&&(ot=Y.trim(),Y=Y.slice(0,Wt).trimEnd()+Rl)}let dt=nt.append("tspan").attr("x",0).attr("dy",`${m}em`).text("\u200B");st&&dt.append("tspan").attr("font-weight","bold").text(st),Y&&dt.append(()=>d.createTextNode(Y)),H&&dt.append("tspan").text(" \u25A0").attr("fill",rt).attr("fill-opacity",q).style("user-select","none"),ot&&dt.append("title").text(ot)}function tt(){let{width:nt,height:st}=i.facet??i;U.selectChildren().each(function(Y){let{x:rt,width:q,height:H}=this.getBBox();q=Math.round(q),H=Math.round(H);let ot=h;if(ot===void 0){let dt=N(Y)+O,Wt=L(Y)+F,Xt=dt+q+b+y*2<nt,et=dt-q-b-y*2>0,oe=Wt+H+b+y*2<st,wr=Wt-H-b-y*2>0;ot=Xt&&et?oe&&wr?s.preferredAnchor:wr?"bottom":"top":oe&&wr?Xt?"left":"right":(Xt||et)&&(oe||wr)?`${wr?"bottom":"top"}-${Xt?"left":"right"}`:s.preferredAnchor}let z=this.firstChild,Lt=this.lastChild;if(z.setAttribute("d",YQ(ot,b,y,q,H)),rt)for(let dt of Lt.childNodes)dt.setAttribute("x",-rt);Lt.setAttribute("y",`${+jQ(ot,Lt.childNodes.length,m).toFixed(6)}em`),Lt.setAttribute("transform",`translate(${VQ(ot,b,y,q,H)})`)}),U.attr("visibility",null)}return t.length&&(U.attr("visibility","hidden"),f.isConnected?Promise.resolve().then(tt):typeof requestAnimationFrame<"u"&&requestAnimationFrame(tt)),U.node()}};function O_(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Be(t,n)),new Cm(e,{...r,x:t,y:n})}function jQ(e,t,n){return/^top(?:-|$)/.test(e)?.94-n:-.29-t*n}function VQ(e,t,n,r,i){switch(e){case"middle":return[-r/2,i/2];case"top-left":return[n,t+n];case"top":return[-r/2,t/2+n];case"top-right":return[-r-n,t+n];case"right":return[-t/2-r-n,i/2];case"bottom-left":return[n,-t-n];case"bottom":return[-r/2,-t/2-n];case"bottom-right":return[-r-n,-t-n];case"left":return[n+t/2,i/2]}}function YQ(e,t,n,r,i){let o=r+n*2,s=i+n*2;switch(e){case"middle":return`M${-o/2},${-s/2}h${o}v${s}h${-o}z`;case"top-left":return`M0,0l${t},${t}h${o-t}v${s}h${-o}z`;case"top":return`M0,0l${t/2},${t/2}h${(o-t)/2}v${s}h${-o}v${-s}h${(o-t)/2}z`;case"top-right":return`M0,0l${-t},${t}h${t-o}v${s}h${o}z`;case"right":return`M0,0l${-t/2},${-t/2}v${t/2-s/2}h${-o}v${s}h${o}v${t/2-s/2}z`;case"bottom-left":return`M0,0l${t},${-t}h${o-t}v${-s}h${-o}z`;case"bottom":return`M0,0l${t/2},${-t/2}h${(o-t)/2}v${-s}h${-o}v${s}h${(o-t)/2}z`;case"bottom-right":return`M0,0l${-t},${-t}h${t-o}v${-s}h${o}z`;case"left":return`M0,0l${t/2},${-t/2}v${t/2-s/2}h${o}v${s}h${-o}v${t/2-s/2}z`}}function GQ({channels:e},t){let n={},r=this.format;r=d7(r,e,"x"),r=d7(r,e,"y"),this.format=r;for(let i in r){let o=r[i];if(!(o===null||o===!1))if(i==="fx"||i==="fy")n[i]=!0;else{let s=Im(e,i);s&&(n[i]=s)}}for(let i in e){if(i in n||i in r||qQ.has(i))continue;let o=Im(e,i);o&&(n[i]=o)}this.facet&&(t.fx&&!("fx"in r)&&(n.fx=!0),t.fy&&!("fy"in r)&&(n.fy=!0));for(let i in n){let o=this.format[i];if(typeof o=="string"){let s=n[i]?.value??t[i]?.domain()??[];this.format[i]=(Oe(s)?Mo:ci)(o)}else if(o===void 0||o===!0){let s=t[i];this.format[i]=s?.bandwidth?Fm(s,s.domain()):zi}}return n}function d7(e,t,n){if(!(n in e))return e;let r=`${n}1`,i=`${n}2`;if((r in e||!(r in t))&&(i in e||!(i in t)))return e;let o=Object.entries(e),s=e[n];return o.splice(o.findIndex(([a])=>a===n)+1,0,[r,s],[i,s]),Object.fromEntries(o)}function WQ(e,t,{title:n}){return zi(n.value[e],e)}function*XQ(e,t,n,r,i){for(let o in n){if(o==="fx"||o==="fy"){yield{label:R_(r,n,o),value:this.format[o](t[o],e)};continue}if(o==="x1"&&"x2"in n||o==="y1"&&"y2"in n)continue;let s=n[o];if(o==="x2"&&"x1"in n)yield{label:p7(r,n,"x"),value:h7(this.format.x2,n.x1,s,e)};else if(o==="y2"&&"y1"in n)yield{label:p7(r,n,"y"),value:h7(this.format.y2,n.y1,s,e)};else{let a=s.value[e],c=s.scale;if(!Ue(a)&&c==null)continue;yield{label:R_(r,n,o),value:this.format[o](a,e),color:c==="color"?i[o][e]:null,opacity:c==="opacity"?i[o][e]:null}}}}function h7(e,t,n,r){return n.hint?.length?`${e(n.value[r]-t.value[r],r)}`:`${e(t.value[r],r)}\u2013${e(n.value[r],r)}`}function p7(e,t,n){let r=R_(e,t,`${n}1`,n),i=R_(e,t,`${n}2`,n);return r===i?r:`${r}\u2013${i}`}function R_(e,t,n,r=n){let i=t[n],o=e[i?.scale??n];return String(o?.label??i?.label??r)}function Pm(e={}){let{facet:t,style:n,title:r,subtitle:i,caption:o,ariaLabel:s,ariaDescription:a}=e,c=Ef(e.className),l=e.marks===void 0?[]:y7(e.marks);l.push(...eK(l));let u=JQ(t,e),f=new Map;for(let C of l){let P=g7(C,u,e);P&&f.set(C,P)}let d=new Map;u&&Bm(d,[u],e),Bm(d,f,e);let h=y7(nK(l,d,e));for(let C of h){let P=g7(C,u,e);P&&f.set(C,P)}l.unshift(...h);let p=mB(d,e);if(p!==void 0){let C=u?l_(p,u):void 0;for(let $ of l){if($.facet===null||$.facet==="super")continue;let U=f.get($);U!==void 0&&(U.facetsIndex=$.fx!=null||$.fy!=null?l_(p,U):C)}let P=new Set;for(let{facetsIndex:$}of f.values())$?.forEach((U,X)=>{U?.length>0&&P.add(X)});p.forEach(0<P.size&&P.size<p.length?($,U)=>$.empty=!P.has(U):$=>$.empty=!1);for(let $ of l)if($.facet==="exclude"){let U=f.get($);U!==void 0&&(U.facetsIndex=bB(U.facetsIndex))}}for(let C of fe.keys())Oo(e[C])&&C!=="fx"&&C!=="fy"&&d.set(C,[]);let m=new Map;for(let C of l){if(m.has(C))throw new Error("duplicate mark; each mark must be unique");let{facetsIndex:P,channels:$}=f.get(C)??{},{data:U,facets:X,channels:tt}=C.initialize(P,$,e);HE(tt,e),m.set(C,{data:U,facets:X,channels:tt})}let g=Nm(Bm(d,m,e),e),y=hB(g,l,e);sB(g,y);let b=SE(g),{fx:x,fy:_}=b,v=x||_?IE(g,y):y,w=x||_?lK(b,y):y,T=nc(e),M=T.document,R=Ts("svg").call(M.documentElement),I=R;T.ownerSVGElement=R,T.className=c,T.projection=x5(e,v),T.filterFacets=(C,P)=>l_(p,{channels:P,groups:a_(C,P)}),T.getMarkState=C=>{let P=m.get(C),$=f.get(C);return{...P,channels:{...P.channels,...$?.channels}}},T.dispatchValue=C=>{I.value!==C&&(I.value=C,I.dispatchEvent(new Event("input",{bubbles:!0})))};let A=new Set;for(let[C,P]of m)if(C.initializer!=null){let $=C.facet==="super"?w:v,U=C.initializer(P.data,P.facets,P.channels,b,$,T);if(U.data!==void 0&&(P.data=U.data),U.facets!==void 0&&(P.facets=U.facets),U.channels!==void 0){let{fx:X,fy:tt,...nt}=U.channels;KQ(nt),Object.assign(P.channels,nt);for(let st of Object.values(nt)){let{scale:Y}=st;Y!=null&&!HC(fe.get(Y))&&(_7(st,e),A.add(Y))}(X!=null||tt!=null)&&f.set(C,!0)}}if(A.size){let C=new Map;Bm(C,m,e,X=>A.has(X)),Bm(d,m,e,X=>A.has(X));let P=cK(Nm(C,e),g),{scales:$,...U}=SE(P);Object.assign(g,P),Object.assign(b,U),Object.assign(b.scales,$)}let O,F;p!==void 0&&(O={x:x?.domain(),y:_?.domain()},p=yB(p,O),F=gB(x,_,y));for(let[C,P]of m)P.values=C.scale(P.channels,b,T);let{width:S,height:E}=y;qt(R).attr("class",c).attr("fill","currentColor").attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("text-anchor","middle").attr("width",S).attr("height",E).attr("viewBox",`0 0 ${S} ${E}`).attr("aria-label",s).attr("aria-description",a).call(C=>C.append("style").text(`:where(.${c}) {
59
60
  --plot-background: white;
60
61
  display: block;
61
62
  height: auto;
@@ -65,26 +66,4 @@ ${y}`)).style("margin-left",l?`${+l}px`:null).style("width",d===void 0?null:`${+
65
66
  :where(.${c} text),
66
67
  :where(.${c} tspan) {
67
68
  white-space: pre;
68
- }`)).call(Tf,n);for(let C of l){let{channels:P,values:$,facets:U}=y.get(C);if(p===void 0||C.facet==="super"){let X=null;if(U&&(X=U[0],X=C.filter(X,P,$),X.length===0))continue;let tt=C.render(X,b,$,w,T);if(tt==null)continue;R.appendChild(tt)}else{let X;for(let tt of p){if(!(C.facetAnchor?.(p,O,tt)??!tt.empty))continue;let nt=null;if(U){let Y=f.has(C);if(nt=U[Y?tt.i:0],nt=C.filter(nt,P,$),nt.length===0)continue;!Y&&nt===U[0]&&(nt=qs(nt)),nt.fx=tt.x,nt.fy=tt.y,nt.fi=tt.i}let st=C.render(nt,b,$,v,T);if(st!=null){(X??=zt(R).append("g")).append(()=>st).datum(tt);for(let Y of["aria-label","aria-description","aria-hidden","transform"])st.hasAttribute(Y)&&(X.attr(Y,st.getAttribute(Y)),st.removeAttribute(Y))}}X?.selectChildren().attr("transform",F)}}let N=QF(g,T,e),{figure:D=r!=null||i!=null||o!=null||N.length>0}=e;D&&(I=M.createElement("figure"),I.className=`${c}-figure`,I.style.maxWidth="initial",r!=null&&I.append(tD(M,r,"h2")),i!=null&&I.append(tD(M,i,"h3")),I.append(...N,R),o!=null&&I.append(RZ(M,o))),I.scale=H8(b.scales),I.legend=XF(g,T,e);let B=t8();return B>0&&zt(R).append("text").attr("x",S).attr("y",20).attr("dy","-1em").attr("text-anchor","end").attr("font-family","initial").text("\u26A0\uFE0F").append("title").text(`${B.toLocaleString("en-US")} warning${B===1?"":"s"}. Please check the console.`),I}function tD(e,t,n){if(t.ownerDocument)return t;let r=e.createElement(n);return r.append(t),r}function RZ(e,t){let n=e.createElement("figcaption");return n.append(t),n}function OZ({marks:e=[],...t}={}){return Rm({...t,marks:[...e,this]})}mt.prototype.plot=OZ;function eD(e){return e.flat(1/0).filter(t=>t!=null).map(kZ)}function kZ(e){return typeof e.render=="function"?e:new ME(e)}var ME=class extends mt{constructor(t){if(typeof t!="function")throw new TypeError("invalid mark; missing render function");super(),this.render=t}render(){}};function NE(e,t){for(let n in e)oD(e[n],t);return e}function oD(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:OT(s,i)}=t[n]??{};a!=null&&(e.value=Yt(e.value,a),e.transform=!1)}function FZ(e){for(let t in e)YT(t,e[t])}function Nm(e,t,n,r=wk){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(!a8(n)){let c=n.x?.domain===void 0,l=n.y?.domain===void 0;if(c||l){let[u,f]=l8(s);c&&AE(e,"x",u),l&&AE(e,"y",f)}}}else AE(e,a,s)}return e}function AE(e,t,n){let r=e.get(t);r!==void 0?r.push(n):e.set(t,[n])}function DZ(e,t){if(e==null)return;let{x:n,y:r}=e;if(n==null&&r==null)return;let i=je(e.data);if(i==null)throw new Error("missing facet data");let o={};n!=null&&(o.fx=vf(i,{value:n,scale:"fx"})),r!=null&&(o.fy=vf(i,{value:r,scale:"fy"})),NE(o,t);let s=m_(i,o);return{channels:o,groups:s,data:e.data}}function nD(e,t,n){if(e.facet===null||e.facet==="super")return;let{fx:r,fy:i}=e;if(r!=null||i!=null){let c=je(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=vf(c,{value:r,scale:"fx"})),i!=null&&(l.fy=vf(c,{value:i,scale:"fy"})),NE(l,n),{channels:l,groups:m_(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)&&je(e.data)?.length===a.length&&qn(`Warning: the ${e.ariaLabel} mark appears to use faceted data, but isn\u2019t faceted. The mark data has the same length as the facet data and the mark facet option is "auto", but the mark data and facet data are distinct. If this mark should be faceted, set the mark facet option to true; otherwise, suppress this warning by setting the mark facet option to false.`)}function LZ(e,t={}){return ve({...t,x:null,y:null},(n,r,i,o,s,a)=>a.getMarkState(e))}function CZ(e){let t=[];for(let n of e){let r=n.tip;if(r){r===!0?r={}:typeof r=="string"&&(r={pointer:r});let{pointer:i,preferredAnchor:o}=r;i=/^x$/i.test(i)?Ff:/^y$/i.test(i)?Tl:kf,r=i(LZ(n,r)),r.title=null,o===void 0&&(r.preferredAnchor=i===Tl?"left":"bottom");let s=$_(n.data,r);s.facet=n.facet,s.facetAnchor=n.facetAnchor,t.push(s)}}return t}function BZ(e,t,n){let{projection:r,x:i={},y:o={},fx:s={},fy:a={},axis:c,grid:l,facet:u={},facet:{axis:f=c,grid:d}=u,x:{axis:h=c,grid:p=h===null?null:l}=i,y:{axis:y=c,grid:g=y===null?null:l}=o,fx:{axis:m=f,grid:b=m===null?null:d}=s,fy:{axis:x=f,grid:_=x===null?null:d}=a}=n;(r||!Lo(i)&&!rD("x",e))&&(h=p=null),(r||!Lo(o)&&!rD("y",e))&&(y=g=null),t.has("fx")||(m=b=null),t.has("fy")||(x=_=null),h===void 0&&(h=!j_(e,"x")),y===void 0&&(y=!j_(e,"y")),m===void 0&&(m=!j_(e,"fx")),x===void 0&&(x=!j_(e,"fy")),h===!0&&(h="bottom"),y===!0&&(y="left"),m===!0&&(m=h==="top"||h===null?"bottom":"top"),x===!0&&(x=y==="right"||y===null?"left":"right");let v=[];return z_(v,_,D_,a),U_(v,x,O_,"right","left",u,a),z_(v,b,C_,s),U_(v,m,k_,"top","bottom",u,s),z_(v,g,F_,o),U_(v,y,Im,"left","right",n,o),z_(v,p,L_,i),U_(v,h,Tm,"bottom","top",n,i),v}function U_(e,t,n,r,i,o,s){if(!t)return;let a=PZ(t);s=$Z(a?r:t,o,s);let{line:c}=s;(n===Im||n===Tm)&&c&&!Gs(c)&&e.push(Bf(UZ(s))),e.push(n(s)),a&&e.push(n({...s,anchor:i,label:null}))}function z_(e,t,n,r){!t||Gs(t)||e.push(n(zZ(t,r)))}function PZ(e){return/^\s*both\s*$/i.test(e)}function $Z(e,t,{line:n=t.line,ticks:r,tickSize:i,tickSpacing:o,tickPadding:s,tickFormat:a,tickRotate:c,fontVariant:l,ariaLabel:u,ariaDescription:f,label:d=t.label,labelAnchor:h,labelArrow:p=t.labelArrow,labelOffset:y}){return{anchor:e,line:n,ticks:r,tickSize:i,tickSpacing:o,tickPadding:s,tickFormat:a,tickRotate:c,fontVariant:l,ariaLabel:u,ariaDescription:f,label:d,labelAnchor:h,labelArrow:p,labelOffset:y}}function UZ(e){let{anchor:t,line:n}=e;return{anchor:t,facetAnchor:t+"-empty",stroke:n===!0?void 0:n}}function zZ(e,{stroke:t=Za(e)?e:void 0,ticks:n=jZ(e)?e:void 0,tickSpacing:r,ariaLabel:i,ariaDescription:o}){return{stroke:t,ticks:n,tickSpacing:r,ariaLabel:i,ariaDescription:o}}function jZ(e){switch(typeof e){case"number":return!0;case"string":return!Za(e)}return or(e)||typeof e?.range=="function"}function j_(e,t){let n=`${t}-axis `;return e.some(r=>r.ariaLabel?.startsWith(n))}function rD(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 qZ(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 VZ({fx:e,fy:t},n){let{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=d_(n),l=e&&iD(e),u=t&&iD(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 iD(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 YZ=new Map([["basis",ZI],["basis-closed",KI],["basis-open",JI],["bundle",tT],["bump-x",GI],["bump-y",WI],["cardinal",eT],["cardinal-closed",nT],["cardinal-open",rT],["catmull-rom",iT],["catmull-rom-closed",oT],["catmull-rom-open",sT],["linear",$s],["linear-closed",aT],["monotone-x",lT],["monotone-y",uT],["natural",fT],["step",dT],["step-after",pT],["step-before",hT]]);function Om(e=$s,t){if(typeof e=="function")return e;let n=YZ.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 q_(e=sc,t){return typeof e!="function"&&`${e}`.toLowerCase()==="auto"?sc:Om(e,t)}function sc(e){return $s(e)}function qo(e={y:"count"},t={}){[e,t]=OE(e,t);let{x:n,y:r}=t;return RE(V_(n,t,W),null,null,r,e,El(t))}function Vo(e={x:"count"},t={}){[e,t]=OE(e,t);let{x:n,y:r}=t;return RE(null,V_(r,t,W),n,null,e,Al(t))}function Ks(e={fill:"count"},t={}){[e,t]=OE(e,t);let{x:n,y:r}=GZ(t);return RE(n,r,null,null,e,El(Al(t)))}function cD(e,t,n={}){if(n?.interval==null)return n;let{reduce:r=t_}=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 cD(qo,"y",Wi(e,"x"))}function $f(e={}){return cD(Vo,"x",Wi(e,"y"))}function RE(e,t,n,r,{data:i=J1,filter:o=dm,sort:s,reverse:a,...c}={},l={}){e=sD(e),t=sD(t),c=WZ(c,l),i=fD(i,W),s=s==null?void 0:lD("sort",s,l),o=o==null?void 0:uD("filter",o,l),n!=null&&$o(c,"x","x1","x2")&&(n=null),r!=null&&$o(c,"y","y1","y2")&&(r=null);let[u,f]=kn(e),[d,h]=kn(e),[p,y]=kn(t),[g,m]=kn(t),[b,x]=n!=null?[n,"x"]:r!=null?[r,"y"]:[],[_,v]=kn(b),{x:w,y:T,z:M,fill:R,stroke:I,x1:E,x2:O,y1:F,y2:S,domain:A,cumulative:N,thresholds:D,interval:B,...C}=l,[P,$]=kn(M),[U]=Ne(R),[X]=Ne(I),[tt,nt]=kn(U),[st,Y]=kn(X);return{..."z"in l&&{z:P||M},..."fill"in l&&{fill:tt||R},..."stroke"in l&&{stroke:st||I},...gn(C,(rt,j,H)=>{let ot=_l(dt(rt,b),H?.[x]),z=dt(rt,M),Nt=dt(rt,U),lt=dt(rt,X),Wt=mm(c,{z,fill:Nt,stroke:lt}),Xt=[],et=[],oe=ot&&v([]),Ir=z&&$([]),Hi=Nt&&nt([]),H$=lt&&Y([]),qA=e&&f([]),Q$=e&&h([]),VA=t&&y([]),Z$=t&&m([]),K$=QZ(e,t,rt),J$=0;for(let Ul of c)Ul.initialize(rt);s&&s.initialize(rt),o&&o.initialize(rt);for(let Ul of j){let YA=[];for(let bd of c)bd.scope("facet",Ul);s&&s.scope("facet",Ul),o&&o.scope("facet",Ul);for(let[bd,t9]of Ka(Ul,Wt))for(let[e9,hy]of Ka(t9,ot))for(let[Qi,gc]of K$(hy))if(!(o&&!o.reduce(Qi,gc))){YA.push(J$++),et.push(i.reduceIndex(Qi,rt,gc)),ot&&oe.push(e9),z&&Ir.push(Wt===z?bd:z[(Qi.length>0?Qi:hy)[0]]),Nt&&Hi.push(Wt===Nt?bd:Nt[(Qi.length>0?Qi:hy)[0]]),lt&&H$.push(Wt===lt?bd:lt[(Qi.length>0?Qi:hy)[0]]),qA&&(qA.push(gc.x1),Q$.push(gc.x2)),VA&&(VA.push(gc.y1),Z$.push(gc.y2));for(let n9 of c)n9.reduce(Qi,gc);s&&s.reduce(Qi)}Xt.push(YA)}return qT(Xt,s,a),{data:et,facets:Xt}}),...!$o(c,"x")&&(u?{x1:u,x2:d,x:gf(u,d)}:{x:w,x1:E,x2:O}),...!$o(c,"y")&&(p?{y1:p,y2:g,y:gf(p,g)}:{y:T,y1:F,y2:S}),..._&&{[x]:_},...Object.fromEntries(c.map(({name:rt,output:j})=>[rt,j]))}}function OE({cumulative:e,domain:t,thresholds:n,interval:r,...i},o){return[i,{cumulative:e,domain:t,thresholds:n,interval:r,...o}]}function V_(e,{cumulative:t,domain:n,thresholds:r,interval:i},o){return e={...mi(e)},e.domain===void 0&&(e.domain=n),e.cumulative===void 0&&(e.cumulative=t),e.thresholds===void 0&&(e.thresholds=r),e.interval===void 0&&(e.interval=i),e.value===void 0&&(e.value=o),e.thresholds=kE(e.thresholds,e.interval),e}function GZ(e){let{x:t,y:n}=e;return t=V_(t,e),n=V_(n,e),[t.value,n.value]=Le(t.value,n.value),{x:t,y:n}}function sD(e){if(e==null)return;let{value:t,cumulative:n,domain:r=se,thresholds:i}=e,o=s=>{let a=dt(s,t),c;if(Re(a)||HZ(i)){a=Yt(a,ET,Float64Array);let[u,f]=typeof r=="function"?r(a):r,d=typeof i=="function"&&!Qa(i)?i(a,u,f):i;typeof d=="number"&&(d=Lp(u,f,d)),Qa(d)&&(r===se&&(u=d.floor(u),f=d.offset(d.floor(f))),d=d.range(u,d.offset(f))),c=d}else{a=Qe(a);let[u,f]=typeof r=="function"?r(a):r,d=typeof i=="function"&&!Qa(i)?i(a,u,f):i;if(typeof d=="number")if(r===se){let h=ws(u,f,d);if(isFinite(h))if(h>0){let p=Math.round(u/h),y=Math.round(f/h);p*h<=u||--p,y*h>f||++y;let g=y-p+1;d=new Float64Array(g);for(let m=0;m<g;++m)d[m]=(p+m)*h}else if(h<0){h=-h;let p=Math.round(u*h),y=Math.round(f*h);p/h<=u||--p,y/h>f||++y;let g=y-p+1;d=new Float64Array(g);for(let m=0;m<g;++m)d[m]=(p+m)/h}else d=[u];else d=[u]}else d=An(u,f,d);else Qa(d)&&(r===se&&(u=d.floor(u),f=d.offset(d.floor(f))),d=d.range(u,d.offset(f)));c=d}let l=[];if(c.length===1)l.push([c[0],c[0]]);else for(let u=1;u<c.length;++u)l.push([c[u-1],c[u]]);return l.bin=(n<0?KZ:n>0?ZZ:FE)(l,c,a),l};return o.label=Fn(t),o}function kE(e,t,n=aD){if(e===void 0)return t===void 0?n:Bo(t);if(typeof e=="string"){switch(e.toLowerCase()){case"freedman-diaconis":return C0;case"scott":return Rh;case"sturges":return Ma;case"auto":return aD}return cm(e)}return e}function WZ(e,t){return zT(e,t,lD)}function lD(e,t,n){return Z1(e,t,n,uD)}function uD(e,t,n){return K1(e,t,n,fD)}function fD(e,t){return wf(e,t,XZ)}function XZ(e){switch(`${e}`.toLowerCase()){case"x":return JZ;case"x1":return eK;case"x2":return nK;case"y":return tK;case"y1":return rK;case"y2":return iK}throw new Error(`invalid bin reduce: ${e}`)}function aD(e,t,n){return Math.min(200,Rh(e,t,n))}function HZ(e){return Tk(e)||or(e)&&Re(e)}function QZ(e,t,n){let r=e?.(n),i=t?.(n);return r&&i?function*(o){let s=r.bin(o);for(let[a,[c,l]]of r.entries()){let u=i.bin(s[a]);for(let[f,[d,h]]of i.entries())yield[u[f],{data:n,x1:c,y1:d,x2:l,y2:h}]}}:r?function*(o){let s=r.bin(o);for(let[a,[c,l]]of r.entries())yield[s[a],{data:n,x1:c,x2:l}]}:function*(o){let s=i.bin(o);for(let[a,[c,l]]of i.entries())yield[s[a],{data:n,y1:c,y2:l}]}}function FE(e,t,n){return t=Qe(t),r=>{let i=e.map(()=>[]);for(let o of r)i[_s(t,n[o])-1]?.push(o);return i}}function ZZ(e,t,n){let r=FE(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 KZ(e,t,n){let r=FE(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 dD(e,t){let n=(+e+ +t)/2;return e instanceof Date?new Date(n):n}var JZ={reduceIndex(e,t,{x1:n,x2:r}){return dD(n,r)}},tK={reduceIndex(e,t,{y1:n,y2:r}){return dD(n,r)}},eK={reduceIndex(e,t,{x1:n}){return n}},nK={reduceIndex(e,t,{x2:n}){return n}},rK={reduceIndex(e,t,{y1:n}){return n}},iK={reduceIndex(e,t,{y2:n}){return n}};function Uf(e={}){return MT(e)?e:{...e,x:W}}function zf(e={}){return NT(e)?e:{...e,y:W}}function hD(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=Ha(e);let o=e[ST]=new Uint32Array(n+i);t=t.map(a=>Ha(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 DE(e={},t={}){arguments.length===1&&([e,t]=Vf(e));let{y1:n,y:r=n,x:i,...o}=t,[s,a,c,l]=Yf(r,i,"y","x",e,o);return{...s,y1:n,y:a,x1:c,x2:l,x:gf(c,l)}}function yD(e={},t={}){arguments.length===1&&([e,t]=Vf(e));let{y1:n,y:r=n,x:i}=t,[o,s,a]=Yf(r,i,"y","x",e,t);return{...o,y1:n,y:s,x:a}}function gD(e={},t={}){arguments.length===1&&([e,t]=Vf(e));let{y1:n,y:r=n,x:i}=t,[o,s,,a]=Yf(r,i,"y","x",e,t);return{...o,y1:n,y:s,x:a}}function LE(e={},t={}){arguments.length===1&&([e,t]=Vf(e));let{x1:n,x:r=n,y:i,...o}=t,[s,a,c,l]=Yf(r,i,"x","y",e,o);return{...s,x1:n,x:a,y1:c,y2:l,y:gf(c,l)}}function bD(e={},t={}){arguments.length===1&&([e,t]=Vf(e));let{x1:n,x:r=n,y:i}=t,[o,s,a]=Yf(r,i,"x","y",e,t);return{...o,x1:n,x:s,y:a}}function xD(e={},t={}){arguments.length===1&&([e,t]=Vf(e));let{x1:n,x:r=n,y:i}=t,[o,s,,a]=Yf(r,i,"x","y",e,t);return{...o,x1:n,x:s,y:a}}function jf({x:e,x1:t,x2:n,...r}={}){return r=Wi(r,"y"),t===void 0&&n===void 0?DE({x:e,...r}):([t,n]=RT(e,t,n),{...r,x1:t,x2:n})}function qf({y:e,y1:t,y2:n,...r}={}){return r=Wi(r,"x"),t===void 0&&n===void 0?LE({y:e,...r}):([t,n]=RT(e,t,n),{...r,y1:t,y2:n})}function Vf(e){let{offset:t,order:n,reverse:r,...i}=e;return[{offset:t,order:n,reverse:r},i]}var oK={length:!0};function Yf(e,t=lm,n,r,{offset:i,order:o,reverse:s},a){if(t===null)throw new Error(`stack requires ${r}`);let c=jn(a),[l,u]=kn(e),[f,d]=yn(t),[h,p]=yn(t);return f.hint=h.hint=oK,i=sK(i),o=lK(o,i,r),[gn(a,(y,g,m)=>{({data:y,facets:g}=hD(y,g));let b=e==null?void 0:u(_l(dt(y,e),m?.[n])),x=dt(y,t,Float64Array),_=dt(y,c),v=o&&o(y,b,x,_),w=y.length,T=d(new Float64Array(w)),M=p(new Float64Array(w)),R=[];for(let I of g){let E=b?Array.from(cn(I,O=>b[O]).values()):[I];if(v)for(let O of E)O.sort(v);for(let O of E){let F=0,S=0;s&&O.reverse();for(let A of O){let N=x[A];N<0?F=M[A]=(T[A]=F)+N:N>0?S=M[A]=(T[A]=S)+N:M[A]=T[A]=S}}R.push(E)}return i&&i(R,T,M,_),{data:y,facets:g}}),l,f,h]}function sK(e){if(e!=null){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"expand":case"normalize":return aK;case"center":case"silhouette":return cK;case"wiggle":return wD}throw new Error(`unknown offset: ${e}`)}}function _D(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 aK(e,t,n){for(let r of e)for(let i of r){let[o,s]=_D(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 cK(e,t,n){for(let r of e){for(let i of r){let[o,s]=_D(i,n);for(let a of i){let c=(s+o)/2;t[a]-=c,n[a]-=c}}vD(r,t,n)}SD(e,t,n)}function wD(e,t,n,r){for(let i of e){let o=new Xn,s=0;for(let a of i){let c=-1,l=a.map(h=>Math.abs(n[h]-t[h])),u=a.map(h=>{c=r?r[h]:++c;let p=n[h]-t[h],y=o.has(c)?p-o.get(c):0;return o.set(c,p),y}),f=[0,...O0(u)];for(let h of a)t[h]+=s,n[h]+=s;let d=Mn(l);d&&(s-=Mn(l,(h,p)=>(u[p]/2+f[p])*h)/d)}vD(i,t,n)}SD(e,t,n)}function vD(e,t,n){let r=ae(e,i=>ae(i,o=>t[o]));for(let i of e)for(let o of i)t[o]-=r,n[o]-=r}function SD(e,t,n){let r=e.length;if(r===1)return;let i=e.map(a=>a.flat()),o=i.map(a=>(ae(a,c=>t[c])+Ut(a,c=>n[c]))/2),s=ae(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 lK(e,t,n){if(e===void 0&&t===wD)return pD(hn);if(e!=null){if(typeof e=="string"){let r=e.startsWith("-"),i=r?gl:hn;switch((r?e.slice(1):e).toLowerCase()){case"value":case n:return uK(i);case"z":return fK(i);case"sum":return dK(i);case"appearance":return hK(i);case"inside-out":return pD(i)}return mD(IT(e))}if(typeof e=="function")return(e.length===1?mD:pK)(e);if(Array.isArray(e))return mK(e);throw new Error(`invalid order: ${e}`)}}function uK(e){return(t,n,r)=>(i,o)=>e(r[i],r[o])}function fK(e){return(t,n,r,i)=>(o,s)=>e(i[o],i[s])}function dK(e){return Y_(e,(t,n,r,i)=>xu(ir(t),o=>Mn(o,s=>r[s]),o=>i[o]))}function hK(e){return Y_(e,(t,n,r,i)=>xu(ir(t),o=>n[qc(o,s=>r[s])],o=>i[o]))}function pD(e){return Y_(e,(t,n,r,i)=>{let o=ir(t),s=xu(o,f=>n[qc(f,d=>r[d])],f=>i[f]),a=Ui(o,f=>Mn(f,d=>r[d]),f=>i[f]),c=[],l=[],u=0;for(let f of s)u<0?(u+=a.get(f),c.push(f)):(u-=a.get(f),l.push(f));return l.reverse().concat(c)})}function mD(e){return t=>{let n=dt(t,e);return(r,i)=>hn(n[r],n[i])}}function pK(e){return t=>(n,r)=>e(t[n],t[r])}function mK(e){return Y_(hn,()=>e)}function Y_(e,t){return(n,r,i,o)=>{if(!o)throw new Error("missing channel: z");let s=new Xn(t(n,r,i,o).map((a,c)=>[a,c]));return(a,c)=>e(s.get(o[a]),s.get(o[c]))}}var yK={ariaLabel:"area",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},kl=class extends mt{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:jn(n),optional:!0}},n,yK),this.z=a,this.curve=Om(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(Mt,this,i,o).call(bt,this,n,0,0).call(u=>u.selectAll().data(o_(t,[s,a,c,l],this,r)).enter().append("path").call(Tt,this).call(Il,this,r).attr("d",of().curve(this.curve).defined(f=>f>=0).x0(f=>s[f]).y0(f=>a[f]).x1(f=>c[f]).y1(f=>l[f]))).node()}};function km(e,t){return t===void 0?Js(e,{x:js,y:Xa}):new kl(e,t)}function ac(e,t){let{y:n=Ie,...r}=$f(t);return new kl(e,jf(Uf({...r,y1:n,y2:void 0})))}function Js(e,t){let{x:n=Ie,...r}=Pf(t);return new kl(e,qf(zf({...r,x1:n,x2:void 0})))}var gK={ariaLabel:"link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},Fm=class extends mt{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,gK),this.curve=q_(a,c),Xi(this,n)}project(t,n,r){this.curve!==sc&&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(Mt,this,i,o).call(bt,this,n).call(f=>f.selectAll().data(t).enter().append("path").call(Tt,this).attr("d",u===sc&&o.projection?bK(o.projection,s,a,c,l):d=>{let h=Kn(),p=u(h);return p.lineStart(),p.point(s[d],a[d]),p.point(c[d],l[d]),p.lineEnd(),h}).call(Qt,this,r).call(Zs,this,r,o)).node()}};function bK(e,t,n,r,i){let o=Rn(e);return t=Qe(t),n=Qe(n),r=Qe(r),i=Qe(i),s=>o({type:"LineString",coordinates:[[t[s],n[s]],[r[s],i[s]]]})}function G_(e,{x:t,x1:n,x2:r,y:i,y1:o,y2:s,...a}={}){return[n,r]=Dm(t,n,r),[o,s]=Dm(i,o,s),new Fm(e,{...a,x1:n,x2:r,y1:o,y2:s})}function Dm(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 xK={ariaLabel:"arrow",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:1,strokeWidth:1.5},Lm=class extends mt{constructor(t,n={}){let{x1:r,y1:i,x2:o,y2:s,bend:a=0,headAngle:c=60,headLength:l=8,inset:u=0,insetStart:f=u,insetEnd:d=u,sweep:h}=n;super(t,{x1:{value:r,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},n,xK),this.bend=a===!0?22.5:Math.max(-90,Math.min(90,a)),this.headAngle=+c,this.headLength=+l,this.insetStart=+f,this.insetEnd=+d,this.sweep=_K(h)}render(t,n,r,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a,SW:u}=r,{strokeWidth:f,bend:d,headAngle:h,headLength:p,insetStart:y,insetEnd:g}=this,m=u?_=>u[_]:pn(f===void 0?1:f),b=h*Df/2,x=p/1.5;return at("svg:g",o).call(Mt,this,i,o).call(bt,this,n).call(_=>_.selectAll().data(t).enter().append("path").call(Tt,this).attr("d",v=>{let w=s[v],T=a[v],M=c[v],R=l[v],I=Math.hypot(M-w,R-T);if(I<=y+g)return null;let E=Math.atan2(R-T,M-w),O=Math.min(x*m(v),I/3),F=this.sweep(w,T,M,R)*d*Df,S=Math.hypot(I/Math.tan(F),I)/2;if(y||g)if(S<1e5){let tt=Math.sign(F),[nt,st]=wK([w,T],[M,R],S,tt);if(y&&([w,T]=ID([nt,st,S],[w,T,y],-tt*Math.sign(y))),g){let[Y,rt]=ID([nt,st,S],[M,R,g],tt*Math.sign(g));E+=Math.atan2(rt-st,Y-nt)-Math.atan2(R-st,M-nt),M=Y,R=rt}}else{let tt=M-w,nt=R-T,st=Math.hypot(tt,nt);y&&(w+=tt/st*y,T+=nt/st*y),g&&(M-=tt/st*g,R-=nt/st*g)}let A=E+F,N=A+b,D=A-b,B=M-O*Math.cos(N),C=R-O*Math.sin(N),P=M-O*Math.cos(D),$=R-O*Math.sin(D),U=S<1e5?`A${S},${S} 0,0,${F>0?1:0} `:"L",X=O?`M${B},${C}L${M},${R}L${P},${$}`:"";return`M${w},${T}${U}${M},${R}${X}`}).call(Qt,this,r)).node()}};function _K(e=1){if(typeof e=="number")return pn(Math.sign(e));if(typeof e=="function")return(t,n,r,i)=>Math.sign(e(t,n,r,i));switch(Ze(e,"sweep",["+x","-x","+y","-y"])){case"+x":return(t,n,r)=>Gt(t,r);case"-x":return(t,n,r)=>Wn(t,r);case"+y":return(t,n,r,i)=>Gt(n,i);case"-y":return(t,n,r,i)=>Wn(n,i)}}function wK([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 ID([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 TD(e,{x:t,x1:n,x2:r,y:i,y1:o,y2:s,...a}={}){return[n,r]=Dm(t,n,r),[o,s]=Dm(i,o,s),new Lm(e,{...a,x1:n,x2:r,y1:o,y2:s})}var Gf=class extends mt{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=It(s),this.insetRight=It(a),this.insetBottom=It(c),this.insetLeft=It(l),this.rx=ce(u,"auto"),this.ry=ce(f,"auto")}render(t,n,r,i,o){let{rx:s,ry:a}=this;return at("svg:g",o).call(Mt,this,i,o).call(this._transform,this,n).call(c=>c.selectAll().data(t).enter().append("rect").call(Tt,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(ct,"rx",s).call(ct,"ry",a).call(Qt,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)}},ED={ariaLabel:"bar"},Cm=class extends Gf{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,ED)}_transform(t,n,{x:r}){t.call(bt,n,{x:r},0,0)}_x({x:t},{x1:n,x2:r},{marginLeft:i}){let{insetLeft:o}=this;return sr(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 sr(t)?s-i-o-a-c:l=>Math.max(0,Math.abs(r[l]-n[l])-a-c)}},Bm=class extends Gf{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,ED)}_transform(t,n,{y:r}){t.call(bt,n,{y:r},0,0)}_y({y:t},{y1:n,y2:r},{marginTop:i}){let{insetTop:o}=this;return sr(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 sr(t)?s-i-o-a-c:l=>Math.max(0,Math.abs(r[l]-n[l])-a-c)}};function Yo(e,t={}){return mf(t)||(t={...t,y:Ie,x2:W}),new Cm(e,jf(__(Uf(t))))}function Go(e,t={}){return mf(t)||(t={...t,x:Ie,y2:W}),new Bm(e,qf(w_(zf(t))))}var vK={ariaLabel:"cell"},Fl=class extends Gf{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,vK)}_transform(t,n){t.call(bt,n,{},0,0)}};function cc(e,{x:t,y:n,...r}={}){return[t,n]=Le(t,n),new Fl(e,{...r,x:t,y:n})}function AD(e,{x:t=Ie,fill:n,stroke:r,...i}={}){return n===void 0&&Ne(r)[0]===void 0&&(n=W),new Fl(e,{...i,x:t,fill:n,stroke:r})}function MD(e,{y:t=Ie,fill:n,stroke:r,...i}={}){return n===void 0&&Ne(r)[0]===void 0&&(n=W),new Fl(e,{...i,y:t,fill:n,stroke:r})}var SK={ariaLabel:"dot",fill:"none",stroke:"currentColor",strokeWidth:1.5};function Pm(e){return e.sort===void 0&&e.reverse===void 0?H1({channel:"-r"},e):e}var Dl=class extends mt{constructor(t,n={}){let{x:r,y:i,r:o,rotate:s,symbol:a=Us,frameAnchor:c}=n,[l,u]=ie(s,0),[f,d]=Bk(a),[h,p]=ie(o,f==null?3:4.5);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:h,scale:"r",filter:rr,optional:!0},rotate:{value:l,optional:!0},symbol:{value:f,scale:"auto",optional:!0}},Pm(n),SK),this.r=p,this.rotate=u,this.symbol=d,this.frameAnchor=Po(c);let{channels:y}=this,{symbol:g}=y;if(g){let{fill:m,stroke:b}=y;g.hint={fill:m?m.value===g.value?"color":"currentColor":this.fill??"currentColor",stroke:b?b.value===g.value?"color":"currentColor":this.stroke??"none"}}}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,r:u,rotate:f,symbol:d}=r,{r:h,rotate:p,symbol:y}=this,[g,m]=bn(this,i),b=y===Us,x=u?void 0:h*h*Math.PI;return qa(h)&&(t=[]),at("svg:g",o).call(Mt,this,i,o).call(bt,this,{x:c&&s,y:l&&a}).call(_=>_.selectAll().data(t).enter().append(b?"circle":"path").call(Tt,this).call(b?v=>{v.attr("cx",c?w=>c[w]:g).attr("cy",l?w=>l[w]:m).attr("r",u?w=>u[w]:h)}:v=>{v.attr("transform",ic`translate(${c?w=>c[w]:g},${l?w=>l[w]:m})${f?w=>` rotate(${f[w]})`:p?` rotate(${p})`:""}`).attr("d",u&&d?w=>{let T=Kn();return d[w].draw(T,u[w]*u[w]*Math.PI),T}:u?w=>{let T=Kn();return y.draw(T,u[w]*u[w]*Math.PI),T}:d?w=>{let T=Kn();return d[w].draw(T,x),T}:(()=>{let w=Kn();return y.draw(w,x),w})())}).call(Qt,this,r)).node()}};function gi(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Le(t,n)),new Dl(e,{...r,x:t,y:n})}function ND(e,{x:t=W,...n}={}){return new Dl(e,S_({...n,x:t}))}function RD(e,{y:t=W,...n}={}){return new Dl(e,v_({...n,y:t}))}function OD(e,t){return gi(e,{...t,symbol:"circle"})}function kD(e,t){return gi(e,{...t,symbol:"hexagon"})}var IK={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Ll=class extends mt{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:jn(n),optional:!0}},n,IK),this.z=o,this.curve=q_(s,a),Xi(this,n)}filter(t){return t}project(t,n,r){this.curve!==sc&&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(Mt,this,i,o).call(bt,this,n).call(l=>l.selectAll().data(o_(t,[s,a],this,r)).enter().append("path").call(Tt,this).call(Il,this,r).call(lF,this,r,o).attr("d",c===sc&&o.projection?TK(o.projection,s,a):Vp().curve(c).defined(u=>u>=0).x(u=>s[u]).y(u=>a[u]))).node()}};function TK(e,t,n){let r=Rn(e);return t=Qe(t),n=Qe(n),i=>{let o=[],s=[o];for(let a of i)a===-1?(o=[],s.push(o)):o.push([t[a],n[a]]);return r({type:"MultiLineString",coordinates:s})}}function Cl(e,{x:t,y:n,...r}={}){return[t,n]=Le(t,n),new Ll(e,{...r,x:t,y:n})}function lc(e,{x:t=W,y:n=Ie,...r}={}){return new Ll(e,$f({...r,x:t,y:n}))}function uc(e,{x:t=Ie,y:n=W,...r}={}){return new Ll(e,Pf({...r,x:t,y:n}))}var EK={ariaLabel:"rect"},Bl=class extends mt{constructor(t,n={}){let{x1:r,y1:i,x2:o,y2:s,inset:a=0,insetTop:c=a,insetRight:l=a,insetBottom:u=a,insetLeft:f=a,rx:d,ry:h}=n;super(t,{x1:{value:r,scale:"x",type:r!=null&&o==null?"band":void 0,optional:!0},y1:{value:i,scale:"y",type:i!=null&&s==null?"band":void 0,optional:!0},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},n,EK),this.insetTop=It(c),this.insetRight=It(l),this.insetBottom=It(u),this.insetLeft=It(f),this.rx=ce(d,"auto"),this.ry=ce(h,"auto")}render(t,n,r,i,o){let{x:s,y:a}=n,{x1:c,y1:l,x2:u,y2:f}=r,{marginTop:d,marginRight:h,marginBottom:p,marginLeft:y,width:g,height:m}=i,{projection:b}=o,{insetTop:x,insetRight:_,insetBottom:v,insetLeft:w,rx:T,ry:M}=this,R=(s?.bandwidth?s.bandwidth():0)-w-_,I=(a?.bandwidth?a.bandwidth():0)-x-v;return at("svg:g",o).call(Mt,this,i,o).call(bt,this,{},0,0).call(E=>E.selectAll().data(t).enter().append("rect").call(Tt,this).attr("x",c&&(b||!sr(s))?u?O=>Math.min(c[O],u[O])+w:O=>c[O]+w:y+w).attr("y",l&&(b||!sr(a))?f?O=>Math.min(l[O],f[O])+x:O=>l[O]+x:d+x).attr("width",c&&(b||!sr(s))?u?O=>Math.max(0,Math.abs(u[O]-c[O])+R):R:g-h-y-_-w).attr("height",l&&(b||!sr(a))?f?O=>Math.max(0,Math.abs(l[O]-f[O])+I):I:m-d-p-x-v).call(ct,"rx",T).call(ct,"ry",M).call(Qt,this,r)).node()}};function $m(e,t){return new Bl(e,yE(gE(t)))}function Wf(e,t={}){return mf(t)||(t={...t,y:Ie,x2:W,interval:1}),new Bl(e,jf(gE(Uf(t))))}function Xf(e,t={}){return mf(t)||(t={...t,x:Ie,y2:W,interval:1}),new Bl(e,qf(yE(zf(t))))}function BE(e,t){t=AK(t);let{x:n,y:r,color:i,size:o}=t,s=W_(e,n),a=W_(e,r),c=W_(e,i),l=W_(e,o),{fx:u,fy:f,x:{value:d,reduce:h,zero:p,...y},y:{value:g,reduce:m,zero:b,...x},color:{value:_,color:v,reduce:w},size:{value:T,reduce:M},mark:R}=t;if(h===void 0&&(h=m==null&&d==null&&T==null&&g!=null?"count":null),m===void 0&&(m=h==null&&g==null&&T==null&&d!=null?"count":null),M===void 0&&T==null&&w==null&&h==null&&m==null&&(d==null||Te(s))&&(g==null||Te(a))&&(M="count"),p===void 0&&(p=X_(h)?!0:void 0),b===void 0&&(b=X_(m)?!0:void 0),d==null&&g==null)throw new Error("must specify x or y");if(h!=null&&g==null)throw new Error("reducing x requires y");if(m!=null&&d==null)throw new Error("reducing y requires x");R===void 0&&(R=T!=null||M!=null?"dot":X_(h)||X_(m)||w!=null?"bar":d!=null&&g!=null?Te(s)||Te(a)||h==null&&m==null&&!Um(s)&&!Um(a)?"dot":"line":d!=null||g!=null?"rule":null);let I,E,O;switch(R){case"dot":O=gi,E="stroke";break;case"line":O=s&&a||h!=null||m!=null?b||m!=null||s&&Um(s)?uc:p||h!=null||a&&Um(a)?lc:Cl:s?lc:uc,E="stroke",DD(c)&&(I=null);break;case"area":O=!(b||m!=null)&&(p||h!=null||a&&Um(a))?ac:Js,E="fill",DD(c)&&(I=null);break;case"rule":O=s?Yr:Gr,E="stroke";break;case"bar":O=h!=null?Te(a)?FD(h)&&s&&Te(s)?cc:Yo:Wf:m!=null?Te(s)?FD(m)&&a&&Te(a)?cc:Go:Xf:w!=null||M!=null?s&&Te(s)&&a&&Te(a)?cc:s&&Te(s)?Go:a&&Te(a)?Yo:$m:s&&Ys(s)&&!(a&&Ys(a))?Yo:a&&Ys(a)&&!(s&&Ys(s))?Go:cc,E="fill";break;default:throw new Error(`invalid mark: ${R}`)}let F={fx:u,fy:f,x:s??void 0,y:a??void 0,[E]:c??v,z:I,r:l??void 0,tip:!0},S,A={[E]:w??void 0,r:M??void 0};if(h!=null&&m!=null)throw new Error("cannot reduce both x and y");return m!=null?(A.y=m,S=Te(s)?Ja:qo):h!=null?(A.x=h,S=Te(a)?tc:Vo):(w!=null||M!=null)&&(s&&a?S=Te(s)&&Te(a)?pm:Te(s)?Vo:Te(a)?qo:Ks:s?S=Te(s)?Ja:qo:a&&(S=Te(a)?tc:Vo)),(S===Ks||S===qo)&&(F.x={value:s,...y}),(S===Ks||S===Vo)&&(F.y={value:a,...x}),p===void 0&&(p=s&&!(S===Ks||S===qo)&&(O===Yo||O===ac||O===Wf||O===Gr)),b===void 0&&(b=a&&!(S===Ks||S===Vo)&&(O===Go||O===Js||O===Xf||O===Yr)),{fx:u??null,fy:f??null,x:{value:d??null,reduce:h??null,zero:!!p,...y},y:{value:g??null,reduce:m??null,zero:!!b,...x},color:{value:_??null,reduce:w??null,...v!==void 0&&{color:v}},size:{value:T??null,reduce:M??null},mark:R,markImpl:LD[O],markOptions:F,transformImpl:LD[S],transformOptions:A,colorMode:E}}function CD(e,t){let n=BE(e,t),{fx:r,fy:i,x:{zero:o},y:{zero:s},markOptions:a,transformOptions:c,colorMode:l}=n,u=CE[n.markImpl],f=CE[n.transformImpl],d=r!=null||i!=null?Bf({strokeOpacity:.1}):null,h=[o?Yr([0]):null,s?Gr([0]):null],p=u(e,f?f(c,a):a);return l==="stroke"?Ke(d,h,p):Ke(d,p,h)}function Um(e){let t,n;for(let r of e){if(r==null)continue;if(t===void 0){t=r;continue}let i=Math.sign(Gt(t,r));if(i){if(n!==void 0&&i!==n)return!1;t=r,n=i}}return!0}function AK({x:e,y:t,color:n,size:r,fx:i,fy:o,mark:s}={}){return qr(e)||(e=Hf(e)),qr(t)||(t=Hf(t)),qr(n)||(n=Za(n)?{color:n}:Hf(n)),qr(r)||(r=Hf(r)),qr(i)&&({value:i}=Hf(i)),qr(o)&&({value:o}=Hf(o)),s!=null&&(s=`${s}`.toLowerCase()),{x:e,y:t,color:n,size:r,fx:i,fy:o,mark:s}}function W_(e,t){let n=dt(e,t.value);return n&&(n.label=Fn(t.value)),n}function Hf(e){return MK(e)?{reduce:e}:{value:e}}function X_(e){return/^(?:distinct|count|sum|proportion)$/i.test(e)}function FD(e){return/^(?:first|last|mode)$/i.test(e)}function MK(e){if(e==null)return!1;if(typeof e.reduceIndex=="function"||typeof e.reduce=="function"&&mn(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 DD(e){return e?new Cr(e).size>e.length>>1:!1}var CE={dot:gi,line:Cl,lineX:lc,lineY:uc,areaX:ac,areaY:Js,ruleX:Yr,ruleY:Gr,barX:Yo,barY:Go,rect:$m,rectX:Wf,rectY:Xf,cell:cc,bin:Ks,binX:qo,binY:Vo,group:pm,groupX:Ja,groupY:tc},LD=Object.fromEntries(Object.entries(CE).map(([e,t])=>[t,e]));function Qf(e,t={}){let{x:n,x1:r,x2:i}=t;n===void 0&&r===void 0&&i===void 0&&(t={...t,x:n=W});let o={};return n!=null&&(o.x=e),r!=null&&(o.x1=e),i!=null&&(o.x2=e),Sr(o,t)}function Zf(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),Sr(o,t)}function Sr(e={},t={}){let n=jn(t),r=Object.entries(e).map(([i,o])=>{let s=V1(i,t);if(s==null)throw new Error(`missing channel: ${i}`);let[a,c]=yn(s);return{key:i,input:s,output:a,setOutput:c,map:NK(o)}});return{...gn(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?cn(l,f=>s[f]).values():[l])r.forEach(({map:f},d)=>f.mapIndex(u,a[d],c[d]));return{data:i,facets:o}}),...Object.fromEntries(r.map(({key:i,output:o})=>[i,o]))}}function NK(e){if(e==null)throw new Error("missing map");if(typeof e.mapIndex=="function")return e;if(typeof e.map=="function"&&mn(e))return RK(e);if(typeof e=="function")return PE(yf(e));switch(`${e}`.toLowerCase()){case"cumsum":return kK;case"rank":return PE((t,n)=>Oh(t,r=>n[r]));case"quantile":return PE((t,n)=>OK(t,r=>n[r]))}throw new Error(`invalid map: ${e}`)}function RK(e){return console.warn("deprecated map interface; implement mapIndex instead."),{mapIndex:e.map.bind(e)}}function OK(e,t){let n=po(e,t)-1;return Oh(e,t).map(r=>r/n)}function PE(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 kK={mapIndex(e,t,n){let r=0;for(let i of e)n[i]=r+=t[i]}};function BD(e={},t){return arguments.length===1&&(t=e),Qf(Kf(e),t)}function PD(e={},t){return arguments.length===1&&(t=e),Zf(Kf(e),t)}function Kf(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=DK(r),qn(`Warning: the shift option is deprecated; please use anchor "${i}" instead.`)),!((t=Math.floor(t))>0))throw new Error(`invalid k: ${t}`);return LK(n)(t,FK(i,t),o)}function FK(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 DK(e){switch(`${e}`.toLowerCase()){case"centered":return"middle";case"leading":return"start";case"trailing":return"end"}throw new Error(`invalid shift: ${e}`)}function LK(e="mean"){if(typeof e=="string"){if(/^p\d{2}$/i.test(e))return H_(pf(e));switch(e.toLowerCase()){case"deviation":return H_(ii);case"max":return Q_((t,n)=>Ut(t,r=>n[r]));case"mean":return CK;case"median":return H_(zi);case"min":return Q_((t,n)=>ae(t,r=>n[r]));case"mode":return Q_((t,n)=>Su(t,r=>n[r]));case"sum":return $D;case"variance":return H_(Aa);case"difference":return $K;case"ratio":return UK;case"first":return zK;case"last":return jK}}if(typeof e!="function")throw new Error(`invalid reduce: ${e}`);return Q_(yf(e))}function H_(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(qs(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(qs(i,0,c+t),a);for(let c=0,l=i.length-n;c<l;++c)s[i[c+n]]=e(qs(i,c,c+t),a)}}}function Q_(e){return(t,n,r)=>r?{mapIndex(i,o,s){let a=0;for(let c=0;c<t-1;++c)a+=Ue(o[i[c]]);for(let c=0,l=i.length-t+1;c<l;++c)a+=Ue(o[i[c+t-1]]),a===t&&(s[i[c+n]]=e(qs(i,c,c+t),o)),a-=Ue(o[i[c]])}}:{mapIndex(i,o,s){for(let a=-n;a<0;++a)s[i[a+n]]=e(qs(i,0,a+t),o);for(let a=0,c=i.length-n;a<c;++a)s[i[a+n]]=e(qs(i,a,a+t),o)}}}function $D(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 CK(e,t,n){if(n){let r=$D(e,t,n);return{mapIndex(i,o,s){r.mapIndex(i,o,s);for(let a=0,c=i.length-e+1;a<c;++a)s[i[a+t]]/=e}}}else return{mapIndex(r,i,o){let s=0,a=0,c=r.length;for(let l=0,u=Math.min(c,e-t-1);l<u;++l){let f=i[r[l]];f!==null&&!isNaN(f=+f)&&(s+=f,++a)}for(let l=-t,u=c-t;l<u;++l){let f=i[r[l+e-1]],d=i[r[l]];f!==null&&!isNaN(f=+f)&&(s+=f,++a),o[r[l+t]]=s/a,d!==null&&!isNaN(d=+d)&&(s-=d,--a)}}}}function BK(e,t,n,r){for(let i=n+r;n<i;++n){let o=e[t[n]];if(Ue(o))return o}}function PK(e,t,n,r){for(let i=n+r-1;i>=n;--i){let o=e[t[i]];if(Ue(o))return o}}function UD(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 zD(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 $K(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]]=zD(i,r,s,e)-UD(i,r,s,e)}}}function UK(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]]=zD(i,r,s,e)/UD(i,r,s,e)}}}function zK(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]]=BK(i,r,s,e)}}}function jK(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]]=PK(i,r,s,e)}}}var ta={n:20,k:2,color:"currentColor",opacity:.2,strict:!0,anchor:"end"};function jD(e,{x:t=W,y:n,k:r=ta.k,color:i=ta.color,opacity:o=ta.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return Ke(ne(s)?null:ac(e,Sr({x1:fc({k:-r,...f}),x2:fc({k:r,...f})},{x1:t,x2:t,y:n,fill:s,fillOpacity:a,...f})),ne(c)?null:lc(e,Sr({x:fc(f)},{x:t,y:n,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function qD(e,{x:t,y:n=W,k:r=ta.k,color:i=ta.color,opacity:o=ta.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return Ke(ne(s)?null:Js(e,Sr({y1:fc({k:-r,...f}),y2:fc({k:r,...f})},{x:t,y1:n,y2:n,fill:s,fillOpacity:a,...f})),ne(c)?null:uc(e,Sr({y:fc(f)},{x:t,y:n,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function fc({n:e=ta.n,k:t=0,strict:n=ta.strict,anchor:r=ta.anchor}={}){return Kf({k:e,reduce:i=>vs(i)+t*(ii(i)||0),strict:n,anchor:r})}var qK={ariaLabel:"tick",fill:null,stroke:"currentColor"},Z_=class extends mt{constructor(t,n,r){super(t,n,r,qK),Xi(this,r)}render(t,n,r,i,o){return at("svg:g",o).call(Mt,this,i,o).call(this._transform,this,n).call(s=>s.selectAll().data(t).enter().append("line").call(Tt,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(Qt,this,r).call(Zs,this,r,o)).node()}},zm=class extends Z_{constructor(t,n={}){let{x:r,y:i,inset:o=0,insetTop:s=o,insetBottom:a=o}=n;super(t,{x:{value:r,scale:"x"},y:{value:i,scale:"y",type:"band",optional:!0}},n),this.insetTop=It(s),this.insetBottom=It(a)}_transform(t,n,{x:r}){t.call(bt,n,{x:r},Oe,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}},jm=class extends Z_{constructor(t,n={}){let{x:r,y:i,inset:o=0,insetRight:s=o,insetLeft:a=o}=n;super(t,{y:{value:i,scale:"y"},x:{value:r,scale:"x",type:"band",optional:!0}},n),this.insetRight=It(s),this.insetLeft=It(a)}_transform(t,n,{y:r}){t.call(bt,n,{y:r},0,Oe)}_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 K_(e,{x:t=W,...n}={}){return new zm(e,{...n,x:t})}function J_(e,{y:t=W,...n}={}){return new jm(e,{...n,y:t})}function VD(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?tc:hm;return Ke(Gr(e,u({x1:$E,x2:UE},{x:t,y:n,stroke:o,strokeOpacity:s,...l})),Yo(e,u({x1:"p25",x2:"p75"},{x:t,y:n,fill:r,fillOpacity:i,...l})),K_(e,u({x:"p50"},{x:t,y:n,stroke:o,strokeOpacity:s,strokeWidth:a,sort:c,...l})),gi(e,Sr({x:GD},{x:t,y:n,z:n,stroke:o,strokeOpacity:s,...l})))}function YD(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?Ja:hm;return Ke(Yr(e,u({y1:$E,y2:UE},{x:n,y:t,stroke:o,strokeOpacity:s,...l})),Go(e,u({y1:"p25",y2:"p75"},{x:n,y:t,fill:r,fillOpacity:i,...l})),J_(e,u({y:"p50"},{x:n,y:t,stroke:o,strokeOpacity:s,strokeWidth:a,sort:c,...l})),gi(e,Sr({y:GD},{x:n,y:t,z:n,stroke:o,strokeOpacity:s,...l})))}function GD(e){let t=$E(e),n=UE(e);return e.map(r=>r<t||r>n?r:NaN)}function $E(e){let t=WD(e)*2.5-XD(e)*1.5;return ae(e,n=>n>=t?n:NaN)}function UE(e){let t=XD(e)*2.5-WD(e)*1.5;return Ut(e,n=>n<=t?n:NaN)}function WD(e){return Hn(e,.25)}function XD(e){return Hn(e,.75)}var VK={ariaLabel:"raster",stroke:null,pixelSize:1};function Jf(e,t){let n=+e;if(isNaN(n))throw new Error(`invalid ${t}: ${e}`);return n}function HD(e,t){let n=Math.floor(e);if(isNaN(n))throw new Error(`invalid ${t}: ${e}`);return n}var Vm=class extends mt{constructor(t,n,r={},i){let{width:o,height:s,x:a,y:c,x1:l=a==null?0:void 0,y1:u=c==null?0:void 0,x2:f=a==null?o:void 0,y2:d=c==null?s:void 0,pixelSize:h=i.pixelSize,blur:p=0,interpolate:y}=r;if(o!=null&&(o=HD(o,"width")),s!=null&&(s=HD(s,"height")),l!=null&&(l=Jf(l,"x1")),u!=null&&(u=Jf(u,"y1")),f!=null&&(f=Jf(f,"x2")),d!=null&&(d=Jf(d,"y2")),a==null&&(l==null||f==null))throw new Error("missing x");if(c==null&&(u==null||d==null))throw new Error("missing y");t!=null&&o!=null&&s!=null&&(a===void 0&&l!=null&&f!=null&&(a=KK(l,f,o,s)),c===void 0&&u!=null&&d!=null&&(c=JK(u,d,o,s))),super(t,{x:{value:a,scale:"x",optional:!0},y:{value:c,scale:"y",optional:!0},x1:{value:l==null?null:[l],scale:"x",optional:!0,filter:null},y1:{value:u==null?null:[u],scale:"y",optional:!0,filter:null},x2:{value:f==null?null:[f],scale:"x",optional:!0,filter:null},y2:{value:d==null?null:[d],scale:"y",optional:!0,filter:null},...n},r,i),this.width=o,this.height=s,this.pixelSize=Jf(h,"pixelSize"),this.blur=Jf(p,"blur"),this.interpolate=a==null||c==null?null:YK(y)}},Ym=class extends Vm{constructor(t,n={}){let{imageRendering:r}=n;if(t==null){let{fill:i,fillOpacity:o}=n;ie(o)[0]!==void 0&&(n=tw("fillOpacity",n)),Ne(i)[0]!==void 0&&(n=tw("fill",n))}super(t,void 0,n,VK),this.imageRendering=ce(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,d,h]=ZD(r,i,o),p=d-u,y=h-f,{pixelSize:g,width:m=Math.round(Math.abs(p)/g),height:b=Math.round(Math.abs(y)/g)}=this,x=m*b,{fill:_,fillOpacity:v}=r,w=0;if(this.interpolate){let A=m/p,N=b/y,D=Yt(a,C=>(C-u)*A,Float64Array),B=Yt(c,C=>(C-f)*N,Float64Array);_&&(_=this.interpolate(t,m,b,D,B,_)),v&&(v=this.interpolate(t,m,b,D,B,v))}else this.data==null&&t&&(w=t.fi*x);let T=l.createElement("canvas");T.width=m,T.height=b;let M=T.getContext("2d"),R=M.createImageData(m,b),I=R.data,{r:E,g:O,b:F}=ln(this.fill)??{r:0,g:0,b:0},S=(this.fillOpacity??1)*255;for(let A=0;A<x;++A){let N=A<<2;if(_){let D=s(_[A+w]);if(D==null){I[N+3]=0;continue}({r:E,g:O,b:F}=ln(D))}v&&(S=v[A+w]*255),I[N+0]=E,I[N+1]=O,I[N+2]=F,I[N+3]=S}return this.blur>0&&b2(R,this.blur),M.putImageData(R,0,0),at("svg:g",o).call(Mt,this,i,o).call(bt,this,n).call(A=>A.append("image").attr("transform",`translate(${u},${f}) scale(${Math.sign(d-u)},${Math.sign(h-f)})`).attr("width",Math.abs(p)).attr("height",Math.abs(y)).attr("preserveAspectRatio","none").call(ct,"image-rendering",this.imageRendering).call(Tt,this).attr("xlink:href",T.toDataURL())).node()}};function zE(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&&Ak(t)&&(r=js,i=Xa,o===void 0&&(o=vk)),[t,{...s,x:r,y:i,[e]:o}]}function QD(){let[e,t]=zE("fill",...arguments);return new Ym(e,e==null||t.fill!==void 0||t.fillOpacity!==void 0?t:{...t,fill:W})}function ZD({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 jE({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),ZD(Sf(a,i),o,s)}function tw(e,t={}){let{[e]:n}=t;if(typeof n!="function")throw new Error(`invalid ${e}: not a function`);return ve({...t,[e]:void 0},function(r,i,o,s,a,c){let{x:l,y:u}=s;if(!l)throw new Error("missing scale: x");if(!u)throw new Error("missing scale: y");let[f,d,h,p]=jE(o,s,a,c),y=h-f,g=p-d,{pixelSize:m}=this,{width:b=Math.round(Math.abs(y)/m),height:x=Math.round(Math.abs(g)/m)}=t,_=new Array(b*x*(i?i.length:1)),v=y/b,w=g/x,T=0;for(let M of i??[void 0])for(let R=.5;R<x;++R)for(let I=.5;I<b;++I,++T)_[T]=n(l.invert(f+I*v),u.invert(d+R*w),M);return{data:_,facets:i,channels:{[e]:{value:_,scale:"auto"}}}})}function YK(e){if(typeof e=="function")return e;if(e==null)return ew;switch(`${e}`.toLowerCase()){case"none":return ew;case"nearest":return VE;case"barycentric":return qE();case"random-walk":return YE()}throw new Error(`invalid interpolate: ${e}`)}function ew(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 qE({random:e=al(42)}={}){return(t,n,r,i,o,s)=>{let{points:a,triangles:c,hull:l}=ci.from(t,h=>i[h],h=>o[h]),u=new s.constructor(n*r).fill(NaN),f=new Uint8Array(n*r),d=ZK(s,e);for(let h=0;h<c.length;h+=3){let p=c[h],y=c[h+1],g=c[h+2],m=a[2*p],b=a[2*y],x=a[2*g],_=a[2*p+1],v=a[2*y+1],w=a[2*g+1],T=Math.min(m,b,x),M=Math.max(m,b,x),R=Math.min(_,v,w),I=Math.max(_,v,w),E=(v-w)*(m-x)+(_-w)*(x-b);if(!E)continue;let O=s[t[p]],F=s[t[y]],S=s[t[g]];for(let A=Math.floor(T);A<M;++A)for(let N=Math.floor(R);N<I;++N){if(A<0||A>=n||N<0||N>=r)continue;let D=A+.5,B=N+.5,C=((v-w)*(D-x)+(B-w)*(x-b))/E;if(C<0)continue;let P=((w-_)*(D-x)+(B-w)*(m-x))/E;if(P<0)continue;let $=1-C-P;if($<0)continue;let U=A+n*N;u[U]=d(O,C,F,P,S,$,A,N),f[U]=1}}return GK(u,f,i,o,s,n,r,l,t,d),u}}function GK(e,t,n,r,i,o,s,a,c,l){n=Float64Array.from(a,h=>n[c[h]]),r=Float64Array.from(a,h=>r[c[h]]),i=Array.from(a,h=>i[c[h]]);let u=n.length,f=Array.from({length:u},(h,p)=>XK(p,n,r)),d=0;for(let h=0;h<s;++h){let p=h+.5;for(let y=0;y<o;++y){let g=y+o*h;if(!t[g]){let m=y+.5;for(let b=0;b<u;++b){let x=(u+d+(b%2?(b+1)/2:-b/2))%u;if(f[x](m,p)){let _=WK(n.at(x-1),r.at(x-1),n[x],r[x],m,p);e[g]=l(i.at(x-1),_,i[x],1-_,i[x],0,y,h),d=x;break}}}}}}function WK(e,t,n,r,i,o){let s=n-e,a=r-t,c=s*(n-i)+a*(r-o),l=s*(i-e)+a*(o-t);return c>0&&l>0?c/(c+l):+(c>l)}function qm(e,t,n,r){return e*r-n*t}function XK(e,t,n){let r=t.length,i=t.at(e-2),o=n.at(e-2),s=t.at(e-1),a=n.at(e-1),c=t[e],l=n[e],u=t.at(e+1-r),f=n.at(e+1-r),d=s-c,h=a-l,p=i-s,y=o-a,g=c-u,m=l-f,b=Math.hypot(d,h),x=Math.hypot(p,y),_=Math.hypot(g,m);return(v,w)=>{let T=v-s,M=w-a,R=v-c,I=w-l;return qm(T,M,R,I)>-1e-6&&qm(T,M,d,h)*x-qm(T,M,p,y)*b>-1e-6&&qm(R,I,g,m)*b-qm(R,I,d,h)*_<=0}}function VE(e,t,n,r,i,o){let s=new o.constructor(t*n),a=ci.from(e,u=>r[u],u=>i[u]),c,l;for(let u=.5,f=0;u<n;++u){l=c;for(let d=.5;d<t;++d,++f)l=a.find(d,u,l),d===.5&&(c=l),s[f]=o[e[l]]}return s}function YE({random:e=al(42),minDistance:t=.5,maxSteps:n=2}={}){return(r,i,o,s,a,c)=>{let l=new c.constructor(i*o),u=ci.from(r,p=>s[p],p=>a[p]),f,d,h;for(let p=.5,y=0;p<o;++p){d=f;for(let g=.5;g<i;++g,++y){let m=g,b=p;h=d=u.find(m,b,d),g===.5&&(f=d);let x,_=0;for(;(x=Math.hypot(s[r[h]]-m,a[r[h]]-b))>t&&_<n;){let v=e(g,p,_)*2*Math.PI;m+=Math.cos(v)*x,b+=Math.sin(v)*x,h=u.find(m,b,h),++_}l[y]=c[r[h]]}}return l}}function HK(e,t,n,r,i,o){return t*e+r*n+o*i}function QK(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 ZK(e,t){return Ys(e)||Re(e)?HK:QK(t)}function KK(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 JK(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 KD={ariaLabel:"contour",fill:"none",stroke:"currentColor",strokeMiterlimit:1,pixelSize:2},Gm=class extends Vm{constructor(t,{smooth:n=!0,value:r,...i}={}){let o=i_({},i,KD);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:Fn(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=tw("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}},tJ(i),KD);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=Rn();return at("svg:g",o).call(Mt,this,i,o).call(bt,this,n).call(c=>{c.selectAll().data(t).enter().append("path").call(Tt,this).attr("d",l=>a(s[l])).call(Qt,this,r)}).node()}};function tJ({thresholds:e,interval:t,...n}){return e=kE(e,t,Ma),ve(n,function(r,i,o,s,a,c){let[l,u,f,d]=jE(o,s,a,c),h=f-l,p=d-u,{pixelSize:y,width:g=Math.round(Math.abs(h)/y),height:m=Math.round(Math.abs(p)/y)}=this,b=g/h,x=m/p,_=o.value.value,v=[];if(this.interpolate){let{x:I,y:E}=nc(o,s,c),O=Yt(I,N=>(N-l)*b,Float64Array),F=Yt(E,N=>(N-u)*x,Float64Array),S=[o.x,o.y,o.value],A=[O,F,_];for(let N of i){let D=this.filter(N,S,A);v.push(this.interpolate(D,g,m,O,F,_))}}else if(i){let I=g*m,E=i.length;for(let O=0;O<E;++O)v.push(_.slice(O*I,O*I+I))}else v.push(_);if(this.blur>0)for(let I of v)Eh({data:I,width:g,height:m},this.blur);let w=eJ(e,_,...nJ(v));if(w===null)throw new Error(`unsupported thresholds: ${e}`);let{contour:T}=La().size([g,m]).smooth(this.smooth),M=[],R=[];for(let I of v)R.push($e(M.length,M.push(...Yt(w,E=>T(I,E)))));for(let{coordinates:I}of M)for(let E of I)for(let O of E)for(let F of O)F[0]=F[0]/b+l,F[1]=F[1]/x+u;return{data:M,facets:R,channels:e_(this.contourChannels,M)}})}function eJ(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 je(e);let i=An(...wu(n,r,e),e);for(;i[i.length-1]>=r;)i.pop();for(;i[1]<n;)i.shift();return i}function tL(){return new Gm(...zE("value",...arguments))}function nJ(e){return[ae(e,t=>ae(t,JD)),Ut(e,t=>Ut(t,JD))]}function JD(e){return isFinite(e)?e:NaN}function rL(e,t){return GE(kf,e,t)}function iL(e,t={}){return GE(Ff,e,t)}function oL(e,t={}){return GE(Tl,e,t)}function GE(e,t,n={}){let{x:r,y:i,maxRadius:o}=n,s=e({px:r,py:i,maxRadius:o}),a=[];r!=null&&a.push(Yr(t,eL("x",{...s,inset:-6},n))),i!=null&&a.push(Gr(t,eL("y",{...s,inset:-6},n))),r!=null&&a.push(jo(t,nL("x",{...s,dy:9,frameAnchor:"bottom",lineAnchor:"top"},n))),i!=null&&a.push(jo(t,nL("y",{...s,dx:-9,frameAnchor:"left",textAnchor:"end"},n)));for(let c of a)c.ariaLabel=`crosshair ${c.ariaLabel}`;return Ke(...a)}function sL(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:rJ(e,u)}}function rJ(e,t){return t==null?t:function(n,r,{x:i,y:o,px:s,py:a,...c},...l){let{channels:{x:u,y:f,...d}={},...h}=t.call(this,n,r,{...c,x:s,y:a},...l);return{channels:{...d,...u&&{px:u,...e==="x"&&{x:u}},...f&&{py:f,...e==="y"&&{y:f}}},...h}}}function eL(e,t,n){let{color:r="currentColor",opacity:i=.2,ruleStroke:o=r,ruleStrokeOpacity:s=i,ruleStrokeWidth:a}=n;return{...sL(e,t,n),stroke:o,strokeOpacity:s,strokeWidth:a}}function nL(e,t,n){let{color:r="currentColor",textFill:i=r,textFillOpacity:o,textStroke:s="var(--plot-background)",textStrokeOpacity:a,textStrokeWidth:c=5}=n;return{...sL(e,t,iJ(e,n)),fill:i,fillOpacity:o,stroke:s,strokeOpacity:a,strokeWidth:c}}function iJ(e,t){return ve(t,(n,r,i)=>({channels:{text:{value:ym(i,e)?.value}}}))}var oJ={ariaLabel:"delaunay link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},sJ={ariaLabel:"delaunay mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},aJ={ariaLabel:"hull",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:1},cJ={ariaLabel:"voronoi",fill:"none",stroke:"currentColor",strokeMiterlimit:1},lJ={ariaLabel:"voronoi mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},WE=class extends mt{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,oJ),this.curve=Om(s,a),Xi(this,n)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,z:u}=r,{curve:f}=this,[d,h]=bn(this,i),p=c?b=>c[b]:pn(d),y=l?b=>l[b]:pn(h),g=this;function m(b){let x=-1,_=[],v={};for(let S in r)v[S]=[];let w=[],T=[],M=[],R=[];function I(S,A){S=b[S],A=b[A],_.push(++x),w[x]=p(S),M[x]=y(S),T[x]=p(A),R[x]=y(A);for(let N in r)v[N].push(r[N][A])}let{halfedges:E,hull:O,triangles:F}=ci.from(b,p,y);for(let S=0;S<E.length;++S){let A=E[S];A>S&&I(F[S],F[A])}for(let S=0;S<O.length;++S)I(O[S],O[(S+1)%O.length]);zt(this).selectAll().data(_).enter().append("path").call(Tt,g).attr("d",S=>{let A=Kn(),N=f(A);return N.lineStart(),N.point(w[S],M[S]),N.point(T[S],R[S]),N.lineEnd(),A}).call(Qt,g,v).call(Zs,g,v,o)}return at("svg:g",o).call(Mt,this,i,o).call(bt,this,{x:c&&s,y:l&&a}).call(u?b=>b.selectAll().data(cn(t,x=>u[x]).values()).enter().append("g").each(m):b=>b.datum(t).each(m)).node()}},Wm=class extends mt{constructor(t,n={},r,i=({z:o})=>o){let{x:o,y:s}=n;super(t,{x:{value:o,scale:"x",optional:!0},y:{value:s,scale:"y",optional:!0},z:{value:i(n),optional:!0}},n,r)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,z:u}=r,[f,d]=bn(this,i),h=c?m=>c[m]:pn(f),p=l?m=>l[m]:pn(d),y=this;function g(m){let b=ci.from(m,h,p);zt(this).append("path").datum(m[0]).call(Tt,y).attr("d",y._render(b,i)).call(Qt,y,r)}return at("svg:g",o).call(Mt,this,i,o).call(bt,this,{x:c&&s,y:l&&a}).call(u?m=>m.selectAll().data(cn(t,b=>u[b]).values()).enter().append("g").each(g):m=>m.datum(t).each(g)).node()}},XE=class extends Wm{constructor(t,n={}){super(t,n,sJ),this.fill="none"}_render(t){return t.render()}},HE=class extends Wm{constructor(t,n={}){super(t,n,aJ,jn)}_render(t){return t.renderHull()}},QE=class extends mt{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,cJ)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,z:u}=r,[f,d]=bn(this,i),h=c?m=>c[m]:pn(f),p=l?m=>l[m]:pn(d),y=this;function g(m){let b=ci.from(m,h,p),x=aL(b,i);zt(this).selectAll().data(m).enter().append("path").call(Tt,y).attr("d",(_,v)=>x.renderCell(v)).call(Qt,y,r)}return at("svg:g",o).call(Mt,this,i,o).call(bt,this,{x:c&&s,y:l&&a}).call(u?m=>m.selectAll().data(cn(t,b=>u[b]).values()).enter().append("g").each(g):m=>m.datum(t).each(g)).node()}},ZE=class extends Wm{constructor(t,n){super(t,n,lJ),this.fill="none"}_render(t,n){return aL(t,n).render()}};function aL(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 Xm(e,t,{x:n,y:r,...i}={}){return[n,r]=Le(n,r),new e(t,{...i,x:n,y:r})}function cL(e,t){return Xm(WE,e,t)}function lL(e,t){return Xm(XE,e,t)}function uL(e,t){return Xm(HE,e,t)}function fL(e,t){return Xm(QE,e,t)}function dL(e,t){return Xm(ZE,e,t)}var uJ={ariaLabel:"density",fill:"none",stroke:"currentColor",strokeMiterlimit:1},Hm=class extends mt{constructor(t,{x:n,y:r,z:i,weight:o,fill:s,stroke:a,...c}={}){let l=hL(s)&&(s="currentColor",!0),u=hL(a)&&(a="currentColor",!0);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:r,scale:"y",optional:!0},z:{value:jn({z:i,fill:s,stroke:a}),optional:!0},weight:{value:o,optional:!0}},dJ({...c,fill:s,stroke:a},l,u),uJ),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=Rn();return at("svg:g",o).call(Mt,this,i,o).call(bt,this,{}).call(c=>c.selectAll().data(t).enter().append("path").call(Tt,this).call(Qt,this,r).attr("d",l=>a(s[l]))).node()}};function pL(e,{x:t,y:n,...r}={}){return[t,n]=Le(t,n),new Hm(e,{...r,x:t,y:n})}var fJ=new Set(["x","y","z","weight"]);function dJ(e,t,n){let{bandwidth:i,thresholds:o}=e;return i=i===void 0?20:+i,o=o===void 0?20:typeof o?.[Symbol.iterator]=="function"?Qe(o):+o,ve(e,function(s,a,c,l,u,f){let d=c.weight?Qe(c.weight.value):null,h=c.z?.value,{z:p}=this,[y,g]=bn(this,u),{width:m,height:b}=u,{x,y:_}=nc(c,l,f),v=Object.fromEntries(Object.entries(c).filter(([F])=>!fJ.has(F)).map(([F,S])=>[F,{...S,value:[]}])),w=t&&[],T=n&&[],M=sS().x(x?F=>x[F]:y).y(_?F=>_[F]:g).weight(d?F=>d[F]:1).size([m,b]).bandwidth(i),R=[];for(let F of a){let S=[];R.push(S);for(let A of h?bm(F,h,p):[F]){let N=M.contours(A);S.push([A,N])}}let I=o;if(!(I instanceof xl)){let F=0;for(let S of R)for(let[,A]of S){let N=A.max;N>F&&(F=N)}I=Float64Array.from({length:o-1},(S,A)=>F*100*(A+1)/o)}let E=[],O=[];for(let F of R){let S=[];E.push(S);for(let[A,N]of F)for(let D of I){S.push(O.length),O.push(N(D/100)),w&&w.push(D),T&&T.push(D);for(let B in v)v[B].value.push(c[B].value[A[0]])}}return w&&w.push(0),T&&T.push(0),{data:s,facets:E,channels:{...v,...w&&{fill:{value:w,scale:"color"}},...T&&{stroke:{value:T,scale:"color"}},contours:{value:O}}}})}function hL(e){return/^density$/i.test(e)}function gL(e,{x1:t,x2:n,y1:r,y2:i,x:o=t===void 0&&n===void 0?Ie:void 0,y:s=r===void 0&&i===void 0?W:void 0,fill:a,positiveFill:c="#3ca951",negativeFill:l="#4269d0",fillOpacity:u=1,positiveFillOpacity:f=u,negativeFillOpacity:d=u,stroke:h,strokeOpacity:p,z:y=Ne(h)[0],clip:g,tip:m,render:b,...x}={}){return[t,n]=mL(o,t,n),[r,i]=mL(s,r,i),t===n&&r===i&&(r=dc(0)),{tip:m}=Wi({tip:m},"x"),Ke(ne(c)?null:Object.assign(km(e,{x1:t,x2:n,y1:r,y2:i,z:y,fill:c,fillOpacity:f,render:Of(b,yL(!0)),clip:g,...x}),{ariaLabel:"positive difference"}),ne(l)?null:Object.assign(km(e,{x1:t,x2:n,y1:r,y2:i,z:y,fill:l,fillOpacity:d,render:Of(b,yL(!1)),clip:g,...x}),{ariaLabel:"negative difference"}),Cl(e,{x:n,y:i,z:y,stroke:h,strokeOpacity:p,tip:m,clip:!0,...x}))}function mL(e,t,n){return t===void 0&&n===void 0?t=n=dc(e):t===void 0?(n=dc(n),t=e===void 0?n:dc(e)):n===void 0?(t=dc(t),n=e===void 0?t:dc(e)):(t=dc(t),n=dc(n)),[t,n]}function dc(e){let t,{value:n,label:r=Fn(n)}=mi(e);return{transform:i=>t||(t=dt(i,n)),label:r}}function yL(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===f_(n.y)<0?u:f).fill(l);let d=s(t,n,{...r,x2:a,y2:f},i,o),h=s(t,n,{...r,x1:c,y1:u},i,o),p=d.querySelector("g")??d,y=h.querySelector("g")??h;for(let g=0;p.firstChild;g+=2){let m=r_(),b=at("svg:clipPath",o).attr("id",m).node();b.appendChild(p.firstChild),y.childNodes[g].setAttribute("clip-path",`url(#${m})`),y.insertBefore(b,y.childNodes[g])}return h}}var hJ={ariaLabel:"geo",fill:"none",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Qm=class extends mt{constructor(t,n={}){let[r,i]=ie(n.r,3);super(t,{geometry:{value:n.geometry,scale:"projection"},r:{value:r,scale:"r",filter:rr,optional:!0}},Pm(n),hJ),this.r=i}render(t,n,r,i,o){let{geometry:s,r:a}=r,c=Rn(o.projection??pJ(n)),{r:l}=this;return qa(l)?t=[]:l!==void 0&&c.pointRadius(l),at("svg:g",o).call(Mt,this,i,o).call(bt,this,n).call(u=>{u.selectAll().data(t).enter().append("path").call(Tt,this).attr("d",a?f=>c.pointRadius(a[f])(s[f]):f=>c(s[f])).call(Qt,this,r)}).node()}};function pJ({x:e,y:t}){if(e||t)return e??=n=>n,t??=n=>n,ol({point(n,r){this.stream.point(e(n),t(r))}})}function nw(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 Qm(e,{geometry:t,...n})}function bL({strokeWidth:e=1.5,...t}={}){return nw({type:"Sphere"},{strokeWidth:e,...t})}function xL({strokeOpacity:e=.1,...t}={}){return nw(MS(),{strokeOpacity:e,...t})}var td=.5,ed=0;function _L(e={fill:"count"},{binWidth:t,...n}={}){let{z:r}=n;return t=t===void 0?20:It(t),e=jT(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),ve(n,(i,o,s,a,c,l)=>{let{x:u,y:f,z:d,fill:h,stroke:p,symbol:y}=s;if(u===void 0)throw new Error("missing channel: x");if(f===void 0)throw new Error("missing channel: y");({x:u,y:f}=nc(s,a,l)),d=d?d.value:dt(i,r),h=h?.value,p=p?.value,y=y?.value;let g=mm(e,{z:d,fill:h,stroke:p,symbol:y}),m=d&&[],b=h&&[],x=p&&[],_=y&&[],v=[],w=[],T=[],M=-1;for(let O of e)O.initialize(i);for(let O of o){let F=[];for(let S of e)S.scope("facet",O);for(let[S,A]of Ka(O,g))for(let{index:N,extent:D}of mJ(i,A,u,f,t)){F.push(++M),w.push(D.x),T.push(D.y),d&&m.push(g===d?S:d[N[0]]),h&&b.push(g===h?S:h[N[0]]),p&&x.push(g===p?S:p[N[0]]),y&&_.push(g===y?S:y[N[0]]);for(let B of e)B.reduce(N,D)}v.push(F)}let R=s.x.scale,I=s.y.scale,E={x:{value:w,source:a[R]?{value:Yt(w,a[R].invert),scale:R}:null},y:{value:T,source:a[I]?{value:Yt(T,a[I].invert),scale:I}:null},...d&&{z:{value:m}},...h&&{fill:{value:b,scale:"auto"}},...p&&{stroke:{value:x,scale:"auto"}},...y&&{symbol:{value:_,scale:"auto"}},...Object.fromEntries(e.map(({name:O,output:F})=>[O,{scale:"auto",label:F.label,radius:O==="r"?t/2:void 0,value:F.transform()}]))};return{data:i,facets:v,channels:E}})}function mJ(e,t,n,r,i){let o=i*(1.5/kT),s=new Map;for(let a of t){let c=n[a],l=r[a];if(isNaN(c)||isNaN(l))continue;let u=Math.round(l=(l-ed)/o),f=Math.round(c=(c-td)/i-(u&1)/2),d=l-u;if(Math.abs(d)*3>1){let y=c-f,g=f+(c<f?-1:1)/2,m=u+(l<u?-1:1),b=c-g,x=l-m;y*y+d*d>b*b+x*x&&(f=g+(u&1?1:-1)/2,u=m)}let h=`${f},${u}`,p=s.get(h);p===void 0&&(p={index:[],extent:{data:e,x:(f+(u&1)/2)*i+td,y:u*o+ed}},s.set(h,p)),p.index.push(a)}return s.values()}var yJ={ariaLabel:"hexgrid",fill:"none",stroke:"currentColor",strokeOpacity:.1};function wL(e){return new Zm(e)}var Zm=class extends mt{constructor({binWidth:t=20,clip:n=!0,...r}={}){super(Wa,void 0,{clip:n,...r},yJ),this.binWidth=It(t)}render(t,n,r,i,o){let{binWidth:s}=this,{marginTop:a,marginRight:c,marginBottom:l,marginLeft:u,width:f,height:d}=i,h=u-td,p=f-c-td,y=a-ed,g=d-l-ed,m=s/2,b=m*FT,x=b/2,_=m*2,v=b*1.5,w=Math.floor(h/_),T=Math.ceil(p/_),M=Math.floor((y+x)/v),R=Math.ceil((g-x)/v)+1,I=`m0,${hc(-b)}l${hc(m)},${hc(x)}v${hc(b)}l${hc(-m)},${hc(x)}`,E=I;for(let O=M;O<R;++O)for(let F=w;F<T;++F)E+=`M${hc(F*_+(O&1)*m)},${hc(O*v)}${I}`;return at("svg:g",o).datum(0).call(Mt,this,i,o).call(bt,this,{},Oe+td,Oe+ed).call(O=>O.append("path").call(Tt,this).call(Qt,this,r).attr("d",E)).node()}};function hc(e){return Math.round(e*1e3)/1e3}var gJ={ariaLabel:"image",fill:null,stroke:null};function bJ(e){return/^\.*\//.test(e)}function xJ(e){return/^(blob|data|file|http|https):/i.test(e)}function _J(e){return typeof e=="string"&&(bJ(e)||xJ(e))?[void 0,e]:[e,void 0]}var Km=class extends mt{constructor(t,n={}){let{x:r,y:i,r:o,width:s,height:a,rotate:c,src:l,preserveAspectRatio:u,crossOrigin:f,frameAnchor:d,imageRendering:h}=n;o==null&&(o=void 0),o===void 0&&s===void 0&&a===void 0?s=a=16:s===void 0&&a!==void 0?s=a:a===void 0&&s!==void 0&&(a=s);let[p,y]=_J(l),[g,m]=ie(o),[b,x]=ie(s,m!==void 0?m*2:void 0),[_,v]=ie(a,m!==void 0?m*2:void 0),[w,T]=ie(c,0);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:g,scale:"r",filter:rr,optional:!0},width:{value:b,filter:rr,optional:!0},height:{value:_,filter:rr,optional:!0},rotate:{value:w,optional:!0},src:{value:p,optional:!0}},Pm(n),gJ),this.src=y,this.width=x,this.rotate=T,this.height=v,this.r=m,this.preserveAspectRatio=ce(u,"xMidYMid"),this.crossOrigin=ze(f),this.frameAnchor=Po(d),this.imageRendering=ce(h,"auto")}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,width:u,height:f,r:d,rotate:h,src:p}=r,{r:y,width:g,height:m,rotate:b}=this,[x,_]=bn(this,i);return at("svg:g",o).call(Mt,this,i,o).call(bt,this,{x:c&&s,y:l&&a}).call(v=>v.selectAll().data(t).enter().append("image").call(Tt,this).attr("x",vL(c,u,d,x,g,y)).attr("y",vL(l,f,d,_,m,y)).attr("width",u?w=>u[w]:g!==void 0?g:d?w=>d[w]*2:y*2).attr("height",f?w=>f[w]:m!==void 0?m:d?w=>d[w]*2:y*2).attr("transform",h?w=>`rotate(${h[w]})`:b?`rotate(${b})`:null).attr("transform-origin",h||b?ic`${c?w=>c[w]:x}px ${l?w=>l[w]:_}px`:null).call(ct,"href",p?w=>p[w]:this.src).call(ct,"preserveAspectRatio",this.preserveAspectRatio).call(ct,"crossorigin",this.crossOrigin).call(ct,"image-rendering",this.imageRendering).call(ct,"clip-path",d?w=>`circle(${d[w]}px)`:y!==void 0?`circle(${y}px)`:null).call(Qt,this,r)).node()}};function vL(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 SL(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Le(t,n)),new Km(e,{...r,x:t,y:n})}function wJ(e,t,n){var r=1e-8,i=t-1,o=n-1,s=0,a,c,l,u,f,d,h,p,y,g,m;if(e<=0)return 0;if(e>=1)return 1;for(t>=1&&n>=1?(l=e<.5?e:1-e,u=Math.sqrt(-2*Math.log(l)),h=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,e<.5&&(h=-h),p=(h*h-3)/6,y=2/(1/(2*t-1)+1/(2*n-1)),g=h*Math.sqrt(p+y)/y-(1/(2*n-1)-1/(2*t-1))*(p+5/6-2/(3*y)),h=t/(t+n*Math.exp(2*g))):(a=Math.log(t/(t+n)),c=Math.log(n/(t+n)),u=Math.exp(t*a)/t,f=Math.exp(n*c)/n,g=u+f,e<u/g?h=Math.pow(t*g*e,1/t):h=1-Math.pow(n*g*(1-e),1/n)),m=-nd(t)-nd(n)+nd(t+n);s<10;s++){if(h===0||h===1)return h;if(d=vJ(h,t,n)-e,u=Math.exp(i*Math.log(h)+o*Math.log(1-h)+m),f=d/u,h-=u=f/(1-.5*Math.min(1,f*(i/h-o/(1-h)))),h<=0&&(h=.5*(h+u)),h>=1&&(h=.5*(h+u+1)),Math.abs(u)<r*h&&s>0)break}return h}function vJ(e,t,n){var r=e===0||e===1?0:Math.exp(nd(t+n)-nd(t)-nd(n)+t*Math.log(e)+n*Math.log(1-e));return e<0||e>1?!1:e<(t+1)/(t+n+2)?r*IL(e,t,n)/t:1-r*IL(1-e,n,t)/n}function IL(e,t,n){var r=1e-30,i=1,o=t+n,s=t+1,a=t-1,c=1,l=1-o*e/s,u,f,d,h;for(Math.abs(l)<r&&(l=r),l=1/l,h=l;i<=100&&(u=2*i,f=i*(n-i)*e/((a+u)*(t+u)),l=1+f*l,Math.abs(l)<r&&(l=r),c=1+f/c,Math.abs(c)<r&&(c=r),l=1/l,h*=l*c,f=-(t+i)*(o+i)*e/((t+u)*(s+u)),l=1+f*l,Math.abs(l)<r&&(l=r),c=1+f/c,Math.abs(c)<r&&(c=r),l=1/l,d=l*c,h*=d,!(Math.abs(d-1)<3e-7));i++);return h}function nd(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 TL(e,t){var n=wJ(2*Math.min(e,1-e),.5*t,.5);return n=Math.sqrt(t*(1-n)/n),e>.5?n:-n}var SJ={ariaLabel:"linear-regression",fill:"currentColor",fillOpacity:.1,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},rw=class extends mt{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:jn(n),optional:!0}},n,SJ),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(Mt,this,i,o).call(bt,this,n).call(u=>u.selectAll().data(c?bm(t,c,this.z):[t]).enter().call(f=>f.append("path").attr("fill","none").call(Tt,this).call(Il,this,{...r,fill:null,fillOpacity:null}).attr("d",d=>this._renderLine(d,s,a)).call(l&&!Gs(this.fill)?d=>d.select(IJ).attr("stroke","none").call(Tt,this).call(Il,this,{...r,stroke:null,strokeOpacity:null,strokeWidth:null}).attr("d",h=>this._renderBand(h,s,a)):()=>{}))).node()}};function IJ(){return this.parentNode.insertBefore(this.ownerDocument.createElementNS(oi.svg,"path"),this)}var KE=class extends rw{constructor(t,n){super(t,n)}_renderBand(t,n,r){let{ci:i,precision:o}=this,[s,a]=se(t,u=>r[u]),c=iw(t,r,n),l=ML(t,r,n,(1-i)/2,c);return of().y(u=>u).x0(u=>l(u,-1)).x1(u=>l(u,1))($e(s,a-o/2,o).concat(a))}_renderLine(t,n,r){let[i,o]=se(t,a=>r[a]),s=iw(t,r,n);return`M${s(i)},${i}L${s(o)},${o}`}},JE=class extends rw{constructor(t,n){super(t,n)}_renderBand(t,n,r){let{ci:i,precision:o}=this,[s,a]=se(t,u=>n[u]),c=iw(t,n,r),l=ML(t,n,r,(1-i)/2,c);return of().x(u=>u).y0(u=>l(u,-1)).y1(u=>l(u,1))($e(s,a-o/2,o).concat(a))}_renderLine(t,n,r){let[i,o]=se(t,a=>n[a]),s=iw(t,n,r);return`M${i},${s(i)}L${o},${s(o)}`}};function EL(e,{y:t=Ie,x:n=W,stroke:r,fill:i=ne(r)?"currentColor":r,...o}={}){return new KE(e,$f({...o,x:n,y:t,fill:i,stroke:r}))}function AL(e,{x:t=Ie,y:n=W,stroke:r,fill:i=ne(r)?"currentColor":r,...o}={}){return new JE(e,Pf({...o,x:t,y:n,fill:i,stroke:r}))}function iw(e,t,n){let r=0,i=0,o=0,s=0;for(let u of e){let f=t[u],d=n[u];r+=f,i+=d,o+=f*d,s+=f*f}let a=e.length,c=(a*o-r*i)/(a*s-r*r),l=(i-c*r)/a;return u=>c*u+l}function ML(e,t,n,r,i){let o=Mn(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=TL(r,e.length-2);return(u,f)=>{let d=i(u),h=c*Math.sqrt(1/e.length+(u-o)**2/s);return d+f*l*h}}function Jm({path:e=W,delimiter:t,frameAnchor:n,treeLayout:r=sl,treeSort:i,treeSeparation:o,treeAnchor:s,treeFilter:a,...c}={}){s=cw(s),i=OL(i),a!=null&&(a=eA(a)),n===void 0&&(n=s.frameAnchor);let l=kL(t),u=$L(c,eA),[f,d]=yn(),[h,p]=yn();return{x:f,y:h,frameAnchor:n,...gn(c,(y,g)=>{let m=l(dt(y,e)),b=d([]),x=p([]),_=-1,v=[],w=[],T=nx().path(R=>m[R]),M=r();M.nodeSize&&M.nodeSize([1,1]),M.separation&&o!==void 0&&M.separation(o??lm);for(let R of u)R[sw]=R[BL]([]);for(let R of g){let I=[],E=T(R.filter(O=>m[O]!=null)).each(O=>O.data=y[O.data]);i!=null&&E.sort(i),M(E);for(let O of E.descendants())if(!(a!=null&&!a(O))){I.push(++_),v[_]=O.data,s.position(O,_,b,x);for(let F of u)F[sw][_]=F[PL](O)}w.push(I)}return{data:v,facets:w}}),...Object.fromEntries(u)}}function aw({path:e=W,delimiter:t,curve:n="bump-x",stroke:r="#555",strokeWidth:i=1.5,strokeOpacity:o=.5,treeLayout:s=sl,treeSort:a,treeSeparation:c,treeAnchor:l,treeFilter:u,...f}={}){l=cw(l),a=OL(a),u!=null&&(u=RL(u)),f={curve:n,stroke:r,strokeWidth:i,strokeOpacity:o,...f};let d=kL(t),h=$L(f,RL),[p,y]=yn(),[g,m]=yn(),[b,x]=yn(),[_,v]=yn();return{x1:p,x2:g,y1:b,y2:_,...gn(f,(w,T)=>{let M=d(dt(w,e)),R=y([]),I=m([]),E=x([]),O=v([]),F=-1,S=[],A=[],N=nx().path(B=>M[B]),D=s();D.nodeSize&&D.nodeSize([1,1]),D.separation&&c!==void 0&&D.separation(c??lm);for(let B of h)B[sw]=B[BL]([]);for(let B of T){let C=[],P=N(B.filter($=>M[$]!=null)).each($=>$.data=w[$.data]);a!=null&&P.sort(a),D(P);for(let{source:$,target:U}of P.links())if(!(u!=null&&!u(U,$))){C.push(++F),S[F]=U.data,l.position($,F,R,E),l.position(U,F,I,O);for(let X of h)X[sw][F]=X[PL](U,$)}A.push(C)}return{data:S,facets:A}}),...Object.fromEntries(h)}}function cw(e="left"){switch(`${e}`.trim().toLowerCase()){case"left":return TJ;case"right":return EJ}throw new Error(`invalid tree anchor: ${e}`)}var TJ={frameAnchor:"left",dx:6,position({x:e,y:t},n,r,i){r[n]=t,i[n]=-e}},EJ={frameAnchor:"right",dx:-6,position({x:e,y:t},n,r,i){r[n]=-t,i[n]=-e}};function OL(e){return e==null||typeof e=="function"?e:`${e}`.trim().toLowerCase().startsWith("node:")?NL(eA(e)):NL(AJ(e))}function NL(e){return(t,n)=>hn(e(t),e(n))}function AJ(e){return t=>t.data?.[e]}function kL(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=>MJ(r,t))}var tA=92,FL=47;function MJ(e,t){if(t===tA)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 tA: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 FL: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 NJ(e){let t=!1;for(let n=0,r=e.length;n<r;++n){switch(e.charCodeAt(n)){case tA:if(!t){t=!0;continue}case FL:t&&(e=e.slice(0,n-1)+e.slice(n),--n,--r);break}t=!1}return e}function DL(e){return mn(e)&&typeof e.node=="function"}function RJ(e){return mn(e)&&typeof e.link=="function"}function eA(e){if(DL(e))return e.node;if(e=`${e}`.trim().toLowerCase(),!!e.startsWith("node:")){switch(e){case"node:name":return rA;case"node:path":return nA;case"node:internal":return LL;case"node:external":return CL;case"node:depth":return iA;case"node:height":return oA}throw new Error(`invalid node value: ${e}`)}}function RL(e){if(DL(e))return e.node;if(RJ(e))return e.link;if(e=`${e}`.trim().toLowerCase(),!(!e.startsWith("node:")&&!e.startsWith("parent:"))){switch(e){case"parent:name":return ow(rA);case"parent:path":return ow(nA);case"parent:depth":return ow(iA);case"parent:height":return ow(oA);case"node:name":return rA;case"node:path":return nA;case"node:internal":return LL;case"node:external":return CL;case"node:depth":return iA;case"node:height":return oA}throw new Error(`invalid link value: ${e}`)}}function nA(e){return e.id}function rA(e){return OJ(e.id)}function iA(e){return e.depth}function oA(e){return e.height}function LL(e){return!!e.children}function CL(e){return!e.children}function ow(e){return(t,n)=>n==null?void 0:e(n)}function OJ(e){let t=e.length;for(;--t>0&&!kJ(e,t););return NJ(e.slice(t+1))}function kJ(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if(!(n&1))return!0}return!1}var BL=2,PL=3,sw=4;function $L(e,t){let n=[];for(let r in e){let i=e[r],o=t(i);o!==void 0&&n.push([r,...yn(i),o])}return n}function sA(e,{fill:t,stroke:n,strokeWidth:r,strokeOpacity:i,strokeLinejoin:o,strokeLinecap:s,strokeMiterlimit:a,strokeDasharray:c,strokeDashoffset:l,marker:u,markerStart:f=u,markerEnd:d=u,dot:h=ne(f)&&ne(d),text:p="node:name",textStroke:y="var(--plot-background)",title:g="node:path",dx:m,dy:b,textAnchor:x,treeLayout:_=sl,textLayout:v=_===sl||_===tx?"mirrored":"normal",tip:w,...T}={}){if(m===void 0&&(m=cw(T.treeAnchor).dx),x!==void 0)throw new Error("textAnchor is not a configurable tree option");v=Ze(v,"textLayout",["mirrored","normal"]);function M(R){return jo(e,Jm({treeLayout:_,text:p,fill:t===void 0?"currentColor":t,stroke:y,dx:m,dy:b,title:g,...R,...T}))}return Ke(G_(e,aw({treeLayout:_,markerStart:f,markerEnd:d,stroke:n!==void 0?n:t===void 0?"node:internal":t,strokeWidth:r,strokeOpacity:i,strokeLinejoin:o,strokeLinecap:s,strokeMiterlimit:a,strokeDasharray:c,strokeDashoffset:l,...T})),h?gi(e,Jm({treeLayout:_,fill:t===void 0?"node:internal":t,title:g,tip:w,...T})):null,p!=null?v==="mirrored"?[M({textAnchor:"start",treeFilter:"node:external"}),M({textAnchor:"end",treeFilter:"node:internal",dx:-m})]:M():null)}function UL(e,t){return sA(e,{...t,treeLayout:tx})}function zL({geometry:e=W,...t}={}){return ve({...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),d=Rn(a);for(let h=0;h<l;++h)[u[h],f[h]]=d.centroid(c[h]);return{data:n,facets:r,channels:{x:{value:u,scale:a==null?"x":null,source:null},y:{value:f,scale:a==null?"y":null,source:null}}}})}function jL({geometry:e=W,...t}={}){let n;return{...t,x:{transform:r=>Float64Array.from(n=dt(dt(r,e),vS),([i])=>i)},y:{transform:()=>Float64Array.from(n,([,r])=>r)}}}var JL=l9(KL(),1);var UJ=({marginLeft:e})=>[1,e],zJ=({width:e,marginRight:t})=>[-1,e-t],jJ=({width:e,marginLeft:t,marginRight:n})=>[0,(t+e-n)/2],qJ=({marginTop:e})=>[1,e],VJ=({height:e,marginBottom:t})=>[-1,e-t],YJ=({height:e,marginTop:t,marginBottom:n})=>[0,(t+e-n)/2];function t5(e){return typeof e=="string"?{anchor:e}:e}function e5(e={},t={}){arguments.length===1&&([e,t]=r5(e));let{anchor:n="left",padding:r=1,r:i=t.r}=t5(e);switch(`${n}`.toLowerCase()){case"left":n=UJ;break;case"right":n=zJ;break;case"middle":n=jJ;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return i5("x","y",n,It(r),i,t)}function n5(e={},t={}){arguments.length===1&&([e,t]=r5(e));let{anchor:n="bottom",padding:r=1,r:i=t.r}=t5(e);switch(`${n}`.toLowerCase()){case"top":n=qJ;break;case"bottom":n=VJ;break;case"middle":n=YJ;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return i5("y","x",n,It(r),i,t)}function r5(e){let{anchor:t,padding:n,...r}=e,{r:i}=r;return[{anchor:t,padding:n,r:i},r]}function i5(e,t,n,r,i,o){if(i!=null&&typeof i!="number"){let{channels:s,sort:a,reverse:c}=o;s=fm(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 ve(o,function(s,a,c,l,u,f){let{[t]:d,r:h}=c;if(!c[t])throw new Error(`missing channel: ${t}`);({[t]:d}=nc(c,l,f));let p=h?void 0:i!==void 0?It(i):this.r!==void 0?this.r:3;h&&(h=dt(h.value,l[h.scale]||W,Float64Array));let[y,g]=n(u),m=y?WJ:GJ,b=new Float64Array(d.length),x=h?_=>h[_]:()=>p;for(let _ of a){let v=(0,JL.default)();_=_.filter(h?T=>uf(d[T])&&rr(h[T]):T=>uf(d[T]));let w=new Float64Array(2*_.length+2);for(let T of _){let M=x(T),R=y?M+r:0,I=d[T]-M,E=d[T]+M,O=2;v.queryInterval(I-r,E+r,([,,S])=>{let A=b[S]-R,N=d[T]-d[S],D=r+(h?h[T]+h[S]:2*p),B=Math.sqrt(D*D-N*N);w[O++]=A-B,w[O++]=A+B});let F=w.slice(0,O);y&&(F=F.filter(S=>S>=0));t:for(let S of F.sort(m)){for(let A=0;A<O;A+=2)if(w[A]+1e-6<S&&S<w[A+1]-1e-6)continue t;b[T]=S+R;break}v.insert([I,E,T])}}y||(y=1);for(let _ of a)for(let v of _)b[v]=b[v]*y+g;return{data:s,facets:a,channels:{[e]:{value:b,source:null},[t]:{value:d,source:c[t]},...h&&{r:{value:h,source:c.r}}}}})}function GJ(e,t){return Math.abs(e)-Math.abs(t)}function WJ(e,t){return e-t}function s5(e,t){return arguments.length===1&&({basis:e,...t}=e),Qf(fw(e),t)}function a5(e,t){return arguments.length===1&&({basis:e,...t}=e),Zf(fw(e),t)}function fw(e){if(e===void 0)return o5;if(typeof e=="function")return dw(yf(e));if(/^p\d{2}$/i.test(e))return sd(pf(e));switch(`${e}`.toLowerCase()){case"deviation":return QJ;case"first":return o5;case"last":return HJ;case"max":return ZJ;case"mean":return KJ;case"median":return JJ;case"min":return ttt;case"sum":return ett;case"extent":return XJ}throw new Error(`invalid basis: ${e}`)}function dw(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 sd(e){return dw((t,n)=>e(t,r=>n[r]))}var XJ={mapIndex(e,t,n){let[r,i]=se(e,s=>t[s]),o=i-r;for(let s of e)n[s]=t[s]===null?NaN:(t[s]-r)/o}},o5=dw((e,t)=>{for(let n=0;n<e.length;++n){let r=t[e[n]];if(Ue(r))return r}}),HJ=dw((e,t)=>{for(let n=e.length-1;n>=0;--n){let r=t[e[n]];if(Ue(r))return r}}),QJ={mapIndex(e,t,n){let r=vs(e,o=>t[o]),i=ii(e,o=>t[o]);for(let o of e)n[o]=t[o]===null?NaN:i?(t[o]-r)/i:0}},ZJ=sd(Ut),KJ=sd(vs),JJ=sd(zi),ttt=sd(ae),ett=sd(Mn);function c5(e,t){return ntt("x",e,t)}function ntt(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]=q1(t.replace(/^[+-]/,"")),i*=l}t=bf(t),r=(l,u)=>t.offset(l,u)}let o=`${e}1`,s=`${e}2`,a=Sr({[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]=se(l);return l.domain=i<0?[u,r(f,i)]:[r(u,i),f],l},a}function l5(e,t={}){if(typeof e=="string")switch(e.toLowerCase()){case"first":return dA(t);case"last":return hA(t)}if(typeof e=="function")return pc(null,e,t);let n,r;for(n in e){if(r!==void 0)throw new Error("ambiguous selector; multiple inputs");r=rtt(e[n])}if(r===void 0)throw new Error(`invalid selector: ${e}`);return pc(n,r,t)}function rtt(e){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"min":return pA;case"max":return mA}throw new Error(`unknown selector: ${e}`)}function dA(e){return pc(null,itt,e)}function hA(e){return pc(null,ott,e)}function u5(e){return pc("x",pA,e)}function f5(e){return pc("y",pA,e)}function d5(e){return pc("x",mA,e)}function h5(e){return pc("y",mA,e)}function*itt(e){yield e[0]}function*ott(e){yield e[e.length-1]}function*pA(e,t){yield P0(e,n=>t[n])}function*mA(e,t){yield qc(e,n=>t[n])}function pc(e,t,n){if(e!=null){if(n[e]==null)throw new Error(`missing channel: ${e}`);e=n[e]}let r=jn(n);return gn(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?cn(l,d=>s[d]).values():[l])for(let d of t(f,a))u.push(d);c.push(u)}return{data:i,facets:c}})}var stt=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"],["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 att(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 p5(e,t,n){for(let r in e){let i=stt.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&&att(t,i.split("."),o)}}var ctt=new Set(["frame","hexgrid","sphere","graticule"]);async function y5(e){let t={marks:[]},n=[],{attributes:r,marks:i}=e;p5(r,t,n);let o=[];for(let a of i)for(let{type:c,data:l,options:u}of a.plotSpecs())ctt.has(c)?t.marks.push(hw[c](u)):t.marks.push(hw[c](l,u)),o.push(a.index);utt(t,e);let s=Rm(t);ftt(s,o),ltt(e,s,r,n);for(let a of e.interactors)await a.init(s);return s}function ltt(e,t,n,r){r.forEach(i=>{let o=n[i];if(o===zc){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 utt(e,t){let{marks:n}=t;pw("x",e,n,["x","x1","x2"]),pw("y",e,n,["y","y1","y2"]),pw("fx",e,n),pw("fy",e,n)}function pw(e,t,n,r=[e]){let i=t[e]||{};if(i.axis===null||i.label!==void 0)return;let o=n.map(u=>u.channelField(r)?.field);if(o.every(u=>u==null))return;let s,a,c;for(let u=0;u<o.length;++u){let{column:f,label:d}=o[u]||{};f===void 0&&d===void 0||(s===void 0&&a===void 0?(s=f,a=d,c=dtt(n[u].data,r)||"number"):a!==d?a=void 0:s!==f&&(s=void 0))}let l=a||s;if(l!==void 0){if((c==="number"||c==="date")&&(e==="x"||e==="y")){i.percent&&(l=`${l} (%)`);let u=(e==="x"?1:-1)*(i.reverse?-1:1);e==="x"||i.labelAnchor==="center"?l=e==="x"==u<0?`\u2190 ${l}`:`${l} \u2192`:l=`${u<0?"\u2191 ":"\u2193 "}${l}`}t[e]={...i,label:l}}}function ftt(e,t){let n=e.querySelectorAll('g[aria-label="facet"]');if(n.length)for(let r of n)m5(r,t);else m5(e,t)}function m5(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 dtt(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 htt={width:640,marginLeft:40,marginRight:20,marginTop:20,marginBottom:30},ny=class{constructor(t){this.attributes={...htt},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=h2()}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 y5(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 Sh(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 gA(...e){let t=new ny;return e.flat().forEach(n=>n(t)),t.marks.forEach(n=>Tn().connect(n)),t.element}var yA=class extends Map{request(t,n){if(this.has(t))n(this.get(t));else{let r=this.waiting||(this.waiting=new Map),i=r.get(t)||[];r.set(t,i.concat(n))}}set(t,n){this.has(t)&&console.warn(`Overwriting named plot "${t}".`);let{waiting:r}=this;return r?.has(t)&&(r.get(t).forEach(i=>i(n)),r.delete(t)),super.set(t,n)}},ad=new yA;function ptt(){ad.clear(),Tn().clear()}function g5(e){return t=>ad.set(e,t)}function b5(e,t,n){_r(n)?(n.addEventListener("value",r=>{e.setAttribute(t,r),e.update()}),n.value!==void 0&&e.setAttribute(t,n.value)):e.setAttribute(t,n)}function bA(e,t){return n=>{b5(n,e,t)}}function mw(e){return t=>{for(let[n,r]of Object.entries(e))b5(t,n,r)}}function x5(e){let{top:t,bottom:n,left:r,right:i}=e,o={};return t!==void 0&&(o.marginTop=t),n!==void 0&&(o.marginBottom=n),r!==void 0&&(o.marginLeft=r),i!==void 0&&(o.marginRight=i),mw(o)}function _5(e){return mw({xDomain:e,yDomain:e})}var L=e=>t=>bA(e,t),w5=L("style"),v5=L("width"),S5=L("height"),I5=L("margin"),T5=L("marginLeft"),E5=L("marginRight"),A5=L("marginTop"),M5=L("marginBottom"),N5=L("align"),R5=L("aspectRatio"),O5=L("axis"),k5=L("inset"),F5=L("grid"),D5=L("label"),L5=L("padding"),C5=L("round"),B5=L("xScale"),P5=L("xDomain"),$5=L("xRange"),U5=L("xNice"),z5=L("xInset"),j5=L("xInsetLeft"),q5=L("xInsetRight"),V5=L("xClamp"),Y5=L("xRound"),G5=L("xAlign"),W5=L("xPadding"),X5=L("xPaddingInner"),H5=L("xPaddingOuter"),Q5=L("xAxis"),Z5=L("xTicks"),K5=L("xTickSize"),J5=L("xTickSpacing"),tC=L("xTickPadding"),eC=L("xTickFormat"),nC=L("xTickRotate"),rC=L("xGrid"),iC=L("xLine"),oC=L("xLabel"),sC=L("xLabelAnchor"),aC=L("xLabelOffset"),cC=L("xFontVariant"),lC=L("xAriaLabel"),uC=L("xAriaDescription"),fC=L("xReverse"),dC=L("xZero"),hC=L("yScale"),pC=L("yDomain"),mC=L("yRange"),yC=L("yNice"),gC=L("yInset"),bC=L("yInsetTop"),xC=L("yInsetBottom"),_C=L("yClamp"),wC=L("yRound"),vC=L("yAlign"),SC=L("yPadding"),IC=L("yPaddingInner"),TC=L("yPaddingOuter"),EC=L("yAxis"),AC=L("yTicks"),MC=L("yTickSize"),NC=L("yTickSpacing"),RC=L("yTickPadding"),OC=L("yTickFormat"),kC=L("yTickRotate"),FC=L("yGrid"),DC=L("yLine"),LC=L("yLabel"),CC=L("yLabelAnchor"),BC=L("yLabelOffset"),PC=L("yFontVariant"),$C=L("yAriaLabel"),UC=L("yAriaDescription"),zC=L("yReverse"),jC=L("yZero"),qC=L("facetMargin"),VC=L("facetMarginTop"),YC=L("facetMarginBottom"),GC=L("facetMarginLeft"),WC=L("facetMarginRight"),XC=L("facetGrid"),HC=L("facetLabel"),QC=L("fxDomain"),ZC=L("fxRange"),KC=L("fxNice"),JC=L("fxInset"),tB=L("fxInsetLeft"),eB=L("fxInsetRight"),nB=L("fxRound"),rB=L("fxAlign"),iB=L("fxPadding"),oB=L("fxPaddingInner"),sB=L("fxPaddingOuter"),aB=L("fxAxis"),cB=L("fxTicks"),lB=L("fxTickSize"),uB=L("fxTickSpacing"),fB=L("fxTickPadding"),dB=L("fxTickFormat"),hB=L("fxTickRotate"),pB=L("fxGrid"),mB=L("fxLine"),yB=L("fxLabel"),gB=L("fxLabelAnchor"),bB=L("fxLabelOffset"),xB=L("fxFontVariant"),_B=L("fxAriaLabel"),wB=L("fxAriaDescription"),vB=L("fxReverse"),SB=L("fyDomain"),IB=L("fyRange"),TB=L("fyNice"),EB=L("fyInset"),AB=L("fyInsetTop"),MB=L("fyInsetBottom"),NB=L("fyRound"),RB=L("fyAlign"),OB=L("fyPadding"),kB=L("fyPaddingInner"),FB=L("fyPaddingOuter"),DB=L("fyAxis"),LB=L("fyTicks"),CB=L("fyTickSize"),BB=L("fyTickSpacing"),PB=L("fyTickPadding"),$B=L("fyTickFormat"),UB=L("fyTickRotate"),zB=L("fyGrid"),jB=L("fyLine"),qB=L("fyLabel"),VB=L("fyLabelAnchor"),YB=L("fyLabelOffset"),GB=L("fyFontVariant"),WB=L("fyAriaLabel"),XB=L("fyAriaDescription"),HB=L("fyReverse"),QB=L("colorScale"),ZB=L("colorDomain"),KB=L("colorRange"),JB=L("colorClamp"),t7=L("colorNice"),e7=L("colorScheme"),n7=L("colorInterpolate"),r7=L("colorPivot"),i7=L("colorSymmetric"),o7=L("colorLabel"),s7=L("colorReverse"),a7=L("colorZero"),c7=L("colorTickFormat"),l7=L("opacityScale"),u7=L("opacityDomain"),f7=L("opacityRange"),d7=L("opacityClamp"),h7=L("opacityNice"),p7=L("opacityLabel"),m7=L("opacityReverse"),y7=L("opacityZero"),g7=L("opacityTickFormat"),b7=L("rScale"),x7=L("rDomain"),_7=L("rRange"),w7=L("rClamp"),v7=L("rNice"),S7=L("rZero"),I7=L("lengthScale"),T7=L("lengthDomain"),E7=L("lengthRange"),A7=L("lengthClamp"),M7=L("lengthNice"),N7=L("lengthZero"),R7=L("projectionType"),O7=L("projectionParallels"),k7=L("projectionPrecision"),F7=L("projectionRotate"),D7=L("projectionDomain"),L7=L("projectionInset"),C7=L("projectionInsetLeft"),B7=L("projectionInsetRight"),P7=L("projectionInsetTop"),$7=L("projectionInsetBottom"),U7=L("projectionClip");function _A(e,t){return{table:e,options:t}}var MA={};_i(MA,{area:()=>tP,areaX:()=>eP,areaY:()=>nP,arrow:()=>GP,axisFx:()=>ZP,axisFy:()=>KP,axisX:()=>HP,axisY:()=>QP,barX:()=>sP,barY:()=>aP,cell:()=>cP,cellX:()=>lP,cellY:()=>uP,circle:()=>gP,contour:()=>LP,delaunayLink:()=>qP,delaunayMesh:()=>VP,denseLine:()=>DP,density:()=>FP,densityX:()=>OP,densityY:()=>kP,dot:()=>pP,dotX:()=>mP,dotY:()=>yP,frame:()=>XP,geo:()=>r$,graticule:()=>o$,gridFx:()=>e$,gridFy:()=>n$,gridX:()=>JP,gridY:()=>t$,hexagon:()=>bP,hexbin:()=>PP,hexgrid:()=>$P,hull:()=>YP,image:()=>RP,line:()=>rP,lineX:()=>iP,lineY:()=>oP,link:()=>WP,raster:()=>CP,rasterTile:()=>BP,rect:()=>fP,rectX:()=>dP,rectY:()=>hP,regressionY:()=>UP,ruleX:()=>vP,ruleY:()=>SP,sphere:()=>i$,spike:()=>NP,text:()=>xP,textX:()=>_P,textY:()=>wP,tickX:()=>IP,tickY:()=>TP,vector:()=>EP,vectorX:()=>AP,vectorY:()=>MP,voronoi:()=>zP,voronoiMesh:()=>jP});function cd(e){return typeof e!="string"?!1:(e=e.toLowerCase().trim(),e==="none"||e==="currentcolor"||e.startsWith("url(")&&e.endsWith(")")||e.startsWith("var(")&&e.endsWith(")")||Br(e)!==null)}var mtt=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"]);function z7(e){return mtt.has(e)}var ytt=new Set(["asterisk","circle","cross","diamond","diamond2","hexagon","plus","square","square2","star","times","triangle","triangle2","wye"]);function j7(e){return ytt.has(`${e}`.toLowerCase())}function ry(e){return typeof e?.getChild=="function"}var gtt=2,btt=10;function yw(e){return ry(e)?xtt(e):e}function xtt(e){let{batches:t,numRows:n}=e;if(!n)return[];let r=Array.from({length:n},()=>({}));for(let i=0,o=0;o<t.length;++o){let s=t[o],{schema:a,numRows:c,numCols:l}=s;for(let u=0;u<l;++u){let f=s.getChildAt(u),{name:d,type:h}=a.fields[u],p=_tt(h);for(let y=i,g=0;g<c;++g,++y)r[y][d]=p(f.get(g))}i+=c}return r}function _tt(e){let{typeId:t}=e;return t===btt?n=>n==null?n:new Date(n):t===gtt&&e.bitWidth>=64?n=>n==null?n:Number(n):n=>n}var q7=e=>e==="stroke"||e==="fill",wtt=e=>e==="symbol",vtt=(e,t)=>e!=="sort"&&t!=null&&!Array.isArray(t),wA=(e,t)=>({channel:e,field:t,as:t instanceof mr?t.column:e}),vA=(e,t)=>({channel:e,value:t}),ar=class extends xr{constructor(t,n,r,i={}){super(n?.options?.filterBy),this.type=t,this.reqs=i,this.source=n,Array.isArray(this.source)&&(this.data=this.source);let o=this.channels=[],s=this.params=new Set,a=(c,l)=>{let u=typeof l;if(u==="function"&&l[N0]){let f=l(this,c);for(let d in f)a(d,f[d])}else if(u==="string")z7(c)||q7(c)&&cd(l)||wtt(c)&&j7(l)?o.push(vA(c,l)):o.push(wA(c,Cc(l)));else if(gs(l))if(Array.isArray(l.columns))o.push(wA(c,l)),s.add(l);else{let f=vA(c,l.value);o.push(f),l.addEventListener("value",d=>(f.value=d,this.update()))}else u==="object"&&vtt(c,l)?o.push(wA(c,l)):l!==void 0&&o.push(vA(c,l))};for(let c in r)a(c,r[c])}setPlot(t,n){this.plot=t,this.index=n,t.addParams(this,this.params),this.source?.table&&this.queryPending()}hasOwnData(){return this.source==null||Array.isArray(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 SA(n,r).where(t)}queryPending(){return this.plot.pending(this),this}queryResult(t){return this.data=yw(t),this}update(){return this.plot.update(this)}plotSpecs(){let{type:t,data:n,channels:r}=this,i={};for(let o of r)i[o.channel]=bi(o);return[{type:t,data:n,options:i}]}};function bi(e){return Object.hasOwn(e,"value")?e.value:q7(e.channel)?{value:e.as,scale:"color"}:e.as}function SA(e,t,n=[]){let r=pt.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 Wr(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"?_h(n):n}function iy(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 IA={x:["min","max"]},TA={y:["min","max"]},gw={...IA,...TA};function V7(e,t,n,r,i){let{plot:o,stats:s}=e,a=o.getAttribute(r),c=o.getAttribute(i);if(Array.isArray(a)&&!a[$i])return a;{let{field:l}=e.channelField(n),{column:u}=l,{min:f,max:d}=s[u],h=EA(t,u)||(c?ks().domain([f,d]).nice().domain():[f,d]);return a!==zc&&(h[$i]=!0),o.setAttribute(r,h,{silent:!0}),h}}function Wo(e,t){return V7(e,t,"x","xDomain","xNice")}function Xo(e,t){return V7(e,t,"y","yDomain","yNice")}function EA(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 bw=class extends ar{constructor(t,n,r){let i=t.endsWith("X")?"y":"x",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||{},{field:a,as:c}=this.channelField(r),l=super.query(t);if(s){let{column:u}=a,{count:f,max:d,min:h}=o[u],p=r==="x"?n.innerWidth():n.innerHeight(),[y,g]=EA(t,u)||[h,d],m=(g-y)/(d-h);if(f*m>p*4){let b=Wr(this,r,c),x=this.channelField(r==="x"?"y":"x").as,_=l.select().map(v=>v.as).filter(v=>v!==c&&v!==x);return Stt(l,b,c,x,y,g,p,_)}}return l.orderby(c)}};function Stt(e,t,n,r,i,o,s,a=[]){let c=q`FLOOR(${s/(o-i)}::DOUBLE * (${t} - ${+i}::DOUBLE))::INTEGER`,l=u=>pt.from(e).select(u).groupby(c,a);return pt.union(l([{[n]:Lr(n),[r]:gh(r,n)},...a]),l([{[n]:Dr(n),[r]:bh(r,n)},...a]),l([{[n]:gh(n,r),[r]:Lr(r)},...a]),l([{[n]:bh(n,r),[r]:Dr(r)},...a])).orderby(a,n)}function oy(e,t=!1){let n=new Float64Array(5),r=new Float64Array(4);Itt(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 Itt(e,t,n){let i=Float64Array.of(.84,1.8675,.84,-1.8675,-.34015,-.1299,-.34015,.1299),o=Math.exp(-1.783/n),s=Math.exp(-1.723/n),a=.6318/n,c=1.997/n,l=Float64Array.of(-o*Math.cos(a),o*Math.sin(a),-o*Math.cos(-a),o*Math.sin(-a),-s*Math.cos(c),s*Math.sin(c),-s*Math.cos(-c),s*Math.sin(-c)),u=n*2.5066282746310007,f=Float64Array.of(i[0],i[1],0,0,0,0,0,0),d=Float64Array.of(1,0,l[0],l[1],0,0,0,0,0,0),h,p;for(p=2;p<8;p+=2){for(f[p]=l[p]*f[p-2]-l[p+1]*f[p-1],f[p+1]=l[p]*f[p-1]+l[p+1]*f[p-2],h=p-2;h>0;h-=2)f[h]+=l[p]*f[h-2]-l[p+1]*f[h-1],f[h+1]+=l[p]*f[h-1]+l[p+1]*f[h-2];for(h=0;h<=p;h+=2)f[h]+=i[p]*d[h]-i[p+1]*d[h+1],f[h+1]+=i[p]*d[h+1]+i[p+1]*d[h];for(d[p+2]=l[p]*d[p]-l[p+1]*d[p+1],d[p+3]=l[p]*d[p+1]+l[p+1]*d[p],h=p;h>0;h-=2)d[h]+=l[p]*d[h-2]-l[p+1]*d[h-1],d[h+1]+=l[p]*d[h-1]+l[p+1]*d[h-2]}for(p=0;p<4;++p)h=p<<1,t[p]=f[h]/u,e[p+1]=d[h+2]}function Y7(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);xw(e,n.subarray(u),r,1,o,s,a,f)}for(let l=0;l<r;++l){let u=c.subarray(l);xw(t,u,i,r,o,s,a,u)}return c}function xw(e,t,n,r=1,i=new Float64Array(n),o=new Float64Array(n),s=new Float64Array(5),a=i,c=Ttt){let l=r*2,u=r*3,f=r*4,d=r*n,h,p;for(c(i,t,n,r,e.b_causal,3,e.a,4,e.sum_causal,s,e.sigma),p=4,h=f;p<n;++p,h+=r)i[p]=e.b_causal[0]*t[h]+e.b_causal[1]*t[h-r]+e.b_causal[2]*t[h-l]+e.b_causal[3]*t[h-u]-e.a[1]*i[p-1]-e.a[2]*i[p-2]-e.a[3]*i[p-3]-e.a[4]*i[p-4];for(c(o,t,n,-r,e.b_anticausal,4,e.a,4,e.sum_anticausal,s,e.sigma),p=4,h=d-r*5;p<n;++p,h-=r)o[p]=e.b_anticausal[1]*t[h+r]+e.b_anticausal[2]*t[h+l]+e.b_anticausal[3]*t[h+u]+e.b_anticausal[4]*t[h+f]-e.a[1]*o[p-1]-e.a[2]*o[p-2]-e.a[3]*o[p-3]-e.a[4]*o[p-4];if(e.negative)for(p=0,h=0;p<n;++p,h+=r)a[h]=i[p]+o[n-p-1];else for(p=0,h=0;p<n;++p,h+=r)a[h]=Math.max(0,i[p]+o[n-p-1]);return a}function Ttt(e,t,n,r,i,o,s,a,c,l){let u=Math.abs(r)*n,f=r<0?u+r:0,d,h,p;for(h=0;h<a;++h)for(l[h]=h<=o?i[h]:0,p=1;p<=a&&p<=h;++p)l[h]-=s[p]*l[h-p];for(p=0;p<a;++p)for(e[p]=0,h=1;h<=p;++h)d=f+r*h,d>=0&&d<u&&(e[p]+=l[p-h]*t[d]);let y=t[f];if(y>0)for(p=0;p<a;++p)e[p]+=l[p]*y}function G7(e,t){return X7(new Float64Array(e),t)}function W7(e,t,n,r=[]){return r.length?Object.values(Ett(e*t,n,r)):[{grid:X7(new Float64Array(e*t),n)}]}function X7(e,t){if(ry(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 Ett(e,t,n){let r={},i=o=>(r[o]||(r[o]={key:o,grid:new Float64Array(e)})).grid;if(ry(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}function _n(e,t,n,r){_r(n)?(r=r||(()=>e.requestUpdate()),n.addEventListener("value",i=>(e[t]=i,r())),e[t]=n.value):e[t]=n}var sy=class extends ar{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"?IA:TA),this.dim=a,_n(this,"bins",i),_n(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[$i]}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"?Wo:Xo)(this,t),c=Wr(this,i);return Att(SA(r,o,[i]).where(t.concat(Me(c,[s,a]))),iy(c,s,a,n),this.channelField("weight")?"weight":null)}queryResult(t){return this.grid=G7(this.bins,t),this.convolve()}convolve(){let{bins:t,bandwidth:n,dim:r,grid:i,plot:o,extent:[s,a]}=this,c=i.some(b=>b<0),l=r==="x"?o.innerWidth():o.innerHeight(),u=oy(n*(t-1)/l,c),f=xw(u,i,t),d=this.data=[],h=r==="x"?"y":"x",p=this.channelField(r).as,y=+s,g=(a-y)/(t-1),m=1/g;for(let b=0;b<t;++b)d.push({[p]:y+b*g,[h]:f[b]*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]=bi(s);return[{type:t,data:n,options:o}]}};function Att(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 pt.from(pt.unionAll(i,o)).select({index:"i",value:br("w")}).groupby("index").having(mu("value",0))}var Ho=class extends ar{constructor(t,n,r){let{bandwidth:i=20,binType:o="linear",binWidth:s=2,binPad:a=1,...c}=r,l=Mtt(c);super(t,n,c,gw),this.densityMap=l,_n(this,"bandwidth",i,()=>this.grids?this.convolve().update():null),_n(this,"binWidth",s),_n(this,"binType",o),_n(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[$i]&&!n[$i]}query(t=[]){let{plot:n,binType:r,binPad:i,channels:o,densityMap:s,source:a}=this,[c,l]=this.extentX=Wo(this,t),[u,f]=this.extentY=Xo(this,t),[d,h]=this.bins=this.binDimensions(this),p=Wr(this,"x"),y=Wr(this,"y"),g=!!n.getAttribute("xReverse"),m=!!n.getAttribute("yReverse"),b=H7(p,c,l,d,g,this.binPad),x=H7(y,u,f,h,m,this.binPad),_=i?[Me(p,[c,l]),Me(y,[u,f])]:[Ta(c,p),Ia(p,l),Ta(u,y),Ia(y,f)],v=pt.from(a.table).where(t.concat(_)),w=this.groupby=[],T=gr();for(let M of o)if(Object.hasOwn(M,"field")){let{as:R,channel:I,field:E}=M;E.aggregate?(T=E,s[I]=!0):I==="weight"?T=br(E):I!=="x"&&I!=="y"&&(v.select({[R]:E}),w.push(R))}return r==="linear"?Rtt(v,b,x,T,d,w):Ntt(v,b,x,T,d,w)}binDimensions(){let{plot:t,binWidth:n}=this;return[Math.round(t.innerWidth()/n),Math.round(t.innerHeight()/n)]}queryResult(t){let[n,r]=this.bins;return this.grids=W7(n,r,t,this.groupby),this.convolve()}convolve(){let{bandwidth:t,bins:n,grids:r,plot:i}=this;if(t<=0)this.kde=this.grids.map(({key:o,grid:s})=>(s.key=o,s));else{let o=i.innerWidth(),s=i.innerHeight(),[a,c]=n,l=r.some(({grid:d})=>d.some(h=>h<0)),u=oy(t*(a-1)/o,l),f=oy(t*(c-1)/s,l);this.kde=this.grids.map(({key:d,grid:h})=>{let p=Y7(u,f,h,n);return p.key=d,p})}return this}plotSpecs(){throw new Error("Unimplemented. Use a Grid2D mark subclass.")}};function Mtt(e){let t={};for(let n in e)e[n]==="density"&&(delete e[n],t[n]=!0);return t}function H7(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 Ntt(e,t,n,r,i,o){return e.select({index:q`FLOOR(${t})::INTEGER + FLOOR(${n})::INTEGER * ${i}`,value:r}).groupby("index",o)}function Rtt(e,t,n,r,i,o){let s=r.column?`* ${r.column}`:"",a=(d,h)=>e.clone().select({xp:t,yp:n,i:d,w:h}),c=a(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 pt.from(pt.unionAll(c,l,u,f)).select({index:"i",value:br("w")},o).groupby("index",o).having(mu("value",0))}var _w=class extends Ho{constructor(t,n){let{type:r="dot",binsX:i,binsY:o,...s}=n;s.binPad=s.binPad??0,super(r,t,s),_n(this,"binsX",i),_n(this,"binsY",o)}convolve(){super.convolve();let{bins:t,binPad:n,extentX:r,extentY:i}=this,[o,s]=t,[a,c]=r,[l,u]=i,f=(c-a)/(o-n),d=(u-l)/(s-n),h=n?0:.5;return this.data=Ott(this.kde,t,a,l,f,d,h),this}binDimensions(){let{plot:t,binWidth:n,binsX:r,binsY:i}=this;return[r??Math.round(t.innerWidth()/n),i??Math.round(t.innerHeight()/n)]}plotSpecs(){let{type:t,channels:n,densityMap:r,data:i}=this,o={};for(let s of n){let{channel:a}=s;o[a]=a==="x"||a==="y"?a:bi(s)}for(let s in r)r[s]&&(o[s]="density");return[{type:t,data:i,options:o}]}};function Ott(e,t,n,r,i,o,s){let a=1/(i*o),[c,l]=t,u=[];for(let f of e)for(let d=0,h=0;h<l;++h)for(let p=0;p<c;++p,++d)u.push({x:n+(p+s)*i,y:r+(h+s)*o,density:f[d]*a});return u}function ww(e,t,n,r,i,o){let s=(o.length>>2)-1;for(let a=0,c=0;a<r;++a)for(let l=0,u=(r-a-1)*n;l<n;++l,c+=4){let f=s*i(e[l+u])<<2;t[c+0]=o[f+0],t[c+1]=o[f+1],t[c+2]=o[f+2],t[c+3]=o[f+3]}}function ld(e,t){let n=new Uint8ClampedArray(4*e),r=e-1;for(let i=0;i<=r;++i){let o=t(i/r),{r:s,g:a,b:c,opacity:l=1}=typeof o=="string"?ln(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 vw(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 Sw(e="black"){let{r:t,g:n,b:r}=ln(e);return i=>({r:t,g:n,b:r,opacity:i})}var ud=class extends Ho{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}=ktt(this,i,o),l=Ftt(this),u=r.indexOf(this.channelField("fill")?.as),f=u<0?[]:n.map(({key:d})=>d[u]);return this.data=n.map(d=>{let h=Dtt(this,f,d.key?.[u]);return ww(d,c.data,i,o,l,h),a.putImageData(c,0,0),{src:s.toDataURL()}}),this}plotSpecs(){let{type:t,plot:n,data:r}=this,i={src:"src",width:n.innerWidth(),height:n.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:r,options:i}]}};function ktt(e,t,n){if(!e.image||e.image.w!==t||e.image.h!==n){let r=vw(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 Ftt(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 zo({x:{type:o,domain:i,range:[0,1]}}).apply}function Dtt(e,t,n,r=1024){let{densityMap:i,plot:o}=e,s=o.getAttribute("colorScheme"),a;if(i.fill){if(s)try{return ld(r,zo({color:{scheme:s,domain:[0,1]}}).interpolate)}catch(c){console.warn(c)}}else if(t.length){let c=o.getAttribute("colorRange");a=zo({color:{domain:t,range:c,scheme:s||(c?void 0:"tableau10")}}).apply(n)}else{let c=e.channelField("fill");a=cd(c?.value)?c.value:void 0}return ld(r,Sw(a))}var Iw=class extends ud{constructor(t,n){let{normalize:r=!0,...i}=n;super(t,{bandwidth:0,...i}),_n(this,"normalize",r)}query(t=[]){let{plot:n,channels:r,normalize:i,source:o}=this,[s,a]=Wo(this,t),[c,l]=Xo(this,t),[u,f]=this.bins=this.binDimensions(this),d=Wr(this,"x"),h=Wr(this,"y"),p=!!n.getAttribute("xReverse"),y=!!n.getAttribute("yReverse"),g=iy(d,s,a,u,p,this.binPad),m=iy(h,c,l,f,y,this.binPad),b=pt.from(o.table).where(Ltt(this,t)),x=this.groupby=[],_=[];for(let v of r)if(Object.hasOwn(v,"field")){let{channel:w,field:T}=v;w==="z"?(b.select({[w]:T}),_.push("z")):w!=="x"&&w!=="y"&&(b.select({[w]:T}),x.push(w))}return Ctt(b,g,m,_,u,f,x,i)}};function Ltt(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"?yr(s.children.filter(a=>i(a))):s;return Array.isArray(t)?t.filter(s=>i(s)).map(s=>o(s)):o(t)}function Ctt(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=pt.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(yr(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=pt.select({x:q`GREATEST(MAX(ABS(dx)), MAX(ABS(dy)))`}).from("pairs"),d=pt.select({i:q`UNNEST(range((${f})))::INTEGER`}),h=pt.unionAll(pt.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)`),pt.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)`),pt.select(c,{x:"x0",y:"y0"}).from("pairs").where(pu("dx"))),p=["x"].concat(c).join(", "),y=pt.from("raster").select(c,"x","y",a?{w:q`1.0 / COUNT(*) OVER (PARTITION BY ${p})`}:null).where(yr(Me("x",[0,i]),Me("y",[0,o])));return pt.with({pairs:u,indices:d,raster:h,points:y}).from("points").select(s,{index:q`x + y * ${i}::INTEGER`,value:a?br("w"):gr()}).groupby("index",s)}var Tw=class extends Ho{constructor(t,n){let{thresholds:r=10,...i}=n;super("geo",t,i),_n(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=Ut(r.map(w=>Ut(w)));a=Array.from({length:a-1},(w,T)=>v*(T+1)/a)}(n.fill||n.stroke)&&this.plot.getAttribute("colorScale")!=="log"&&this.plot.setAttribute("colorZero",!0);let[c,l]=t,[u,f]=s.getAttribute("xDomain"),[d,h]=s.getAttribute("yDomain"),p=(f-u)/c,y=(h-d)/l,g=+u,m=+d,b=v=>g+v*p,x=v=>m+v*y,_=La().size(t);return this.data=r.flatMap(v=>a.map(w=>{let T=Btt(_.contour(v,w),b,x);return o.forEach((M,R)=>T[M]=v.key[R]),T.density=w,T})),this}plotSpecs(){let{type:t,channels:n,densityMap:r,data:i}=this,o={};for(let s of n){let{channel:a}=s;a!=="x"&&a!=="y"&&(o[a]=bi(s))}return r.fill&&(o.fill="density"),r.stroke&&(o.stroke="density"),[{type:t,data:i,options:o}]}};function Btt(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}var Ew=class extends ar{constructor(t,n){let{type:r="hexagon",binWidth:i=20,...o}=n;super(r,t,{r:i/2,clip:!0,...o},gw),this.binWidth=i}get filterIndexable(){let t=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return t&&n&&!t[$i]&&!n[$i]}query(t=[]){if(this.hasOwnData())return null;let{plot:n,binWidth:r,channels:i,source:o}=this,[s,a]=Wo(this,t),[c,l]=Xo(this,t),u=.5-n.getAttribute("marginLeft"),f=0-n.getAttribute("marginTop"),d=`${r}::DOUBLE`,h=`${r*(1.5/Math.sqrt(3))}::DOUBLE`,p=`${n.innerWidth()/(a-s)}::DOUBLE`,y=`${n.innerHeight()/(l-c)}::DOUBLE`,g,m,b=new Set,x={};for(let M of i)M.channel==="orderby"?_.orderby(M.value):M.channel==="x"?g=M:M.channel==="y"?m=M:Object.hasOwn(M,"field")&&(x[M.as]=M.field,M.field.aggregate&&M.field.columns.forEach(R=>b.add(R)));let _=pt.select({[g.as]:q`${s}::DOUBLE + ((x + 0.5 * (y & 1)) * ${d} + ${u})::DOUBLE / ${p}`,[m.as]:q`${l}::DOUBLE - (y * ${h} + ${f})::DOUBLE / ${y}`,...x}).groupby("x","y"),v=`${p} * (${g.field} - ${s}::DOUBLE)`,w=`${y} * (${l}::DOUBLE - ${m.field})`,T=pt.select({py:q`(${w} - ${f}) / ${h}`,pj:q`ROUND(py)::INTEGER`,px:q`(${v} - ${u}) / ${d} - 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(b)).from(o.table).where(wa(g.field),wa(m.field),t);return _.from(T)}};var Aw=class extends Ho{constructor(t,n){let{origin:r=[0,0],dim:i="xy",...o}=n;super("image",t,o),this.origin=r,this.tileX=i.toLowerCase().includes("x"),this.tileY=i.toLowerCase().includes("y")}setPlot(t,n){let r=()=>{this.stats&&this.rasterize()};t.addAttributeListener("schemeColor",r),super.setPlot(t,n)}requestQuery(){return this.requestTiles()}query(t=[]){return this._filter=t,null}tileQuery(t){let{plot:n,binType:r,binPad:i,channels:o,densityMap:s,source:a}=this,[[c,l],[u,f]]=t,[d,h]=this.bins,p=Wr(this,"x"),y=Wr(this,"y"),g=!!n.getAttribute("xReverse"),m=!!n.getAttribute("yReverse"),b=Q7(p,c,l,d,g,i),x=Q7(y,u,f,h,m,i),_=i?[Me(p,[c,l]),Me(y,[u,f])]:[Ta(c,p),Ia(p,l),Ta(u,y),Ia(y,f)],v=pt.from(a.table).where(_),w=this.groupby=[],T=gr();for(let M of o)if(Object.hasOwn(M,"field")){let{channel:R,field:I}=M;I.aggregate?(T=I,s[R]=!0):R==="weight"?T=br(I):R!=="x"&&R!=="y"&&(v.select({[R]:I}),w.push(R))}return r==="linear"?Vtt(v,b,x,T,d,w):qtt(v,b,x,T,d,w)}async requestTiles(){let t=Tn();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]=Wo(this,this._filter),[f,d]=Xo(this,this._filter),h=u-l,p=d-f,y=Math.floor((l-o)*(a-n)/h),g=Math.floor((f-s)*(c-n)/p),m=(I,E)=>[[o+I*h,o+(I+1)*h],[s+E*p,s+(E+1)*p]],b=Math.floor((l-o)/h),x=r?Z7((u-o)/h):b,_=Math.floor((f-s)/p),v=i?Z7((d-s)/p):_,w=[];for(let I=b;I<=x;++I)for(let E=_;E<=v;++E)w.push([I,E]);let T=w.map(([I,E])=>t.query(this.tileQuery(m(I,E)))),M=[];if(r)for(let I=_;I<=v;++I)M.push([x+1,I]),M.push([b-1,I]);if(i){let I=r?b-1:b,E=r?x+1:x;for(let O=I;O<=E;++O)M.push([O,v+1]),M.push([O,_-1])}this.prefetch=M.map(([I,E])=>t.prefetch(this.tileQuery(m(I,E))));let R=await Promise.all(T);this.grids=[{grid:Ptt(a,c,y,g,w,R)}],this.convolve().update()}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:t,kde:n,groupby:r}=this,[i,o]=t,{canvas:s,ctx:a,img:c}=Utt(this,i,o),l=ztt(this),u=r.indexOf(this.channelField("fill")?.as),f=u<0?[]:n.map(({key:d})=>d[u]);return this.data=n.map(d=>{let h=jtt(this,f,d.key?.[u]);return ww(d,c.data,i,o,l,h),a.putImageData(c,0,0),{src:s.toDataURL()}}),this}plotSpecs(){let{type:t,data:n,plot:r}=this,i={src:"src",width:r.innerWidth(),height:r.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:n,options:i}]}};function Ptt(e,t,n,r,i,o){let s=new Float64Array(e*t);return o.forEach((a,c)=>{let[l,u]=i[c],f=l*e-n,d=u*t-r;$tt(e,t,s,a,f,d)}),s}function $tt(e,t,n,r,i,o){let s=r.numRows;if(s===0)return;let a=r.getChild("index").toArray(),c=r.getChild("value").toArray();for(let l=0;l<s;++l){let u=a[l],f=i+u%e,d=o+Math.floor(u/e);0<=f&&f<e&&0<=d&&d<t&&(n[f+d*e]=c[l])}}function Utt(e,t,n){if(!e.image||e.image.w!==t||e.image.h!==n){let r=vw(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 ztt(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 zo({x:{type:o,domain:i,range:[0,1]}}).apply}function jtt(e,t,n,r=1024){let{densityMap:i,plot:o}=e,s=o.getAttribute("colorScheme"),a;if(i.fill){if(s)try{return ld(r,zo({color:{scheme:s,domain:[0,1]}}).interpolate)}catch(c){console.warn(c)}}else if(t.length){let c=o.getAttribute("colorRange");a=zo({color:{domain:t,range:c,scheme:s||(c?void 0:"tableau10")}}).apply(n)}else{let c=e.channelField("fill");a=cd(c?.value)?c.value:void 0}return ld(r,Sw(a))}function Q7(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 qtt(e,t,n,r,i,o){return e.select({index:q`FLOOR(${t})::INTEGER + FLOOR(${n})::INTEGER * ${i}`,value:r}).groupby("index",o)}function Vtt(e,t,n,r,i,o){let s=r.column?`* ${r.column}`:"",a=(d,h)=>e.clone().select({xp:t,yp:n,i:d,w:h}),c=a(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 pt.from(pt.unionAll(c,l,u,f)).select({index:"i",value:br("w")},o).groupby("index",o).having(Ug("value",0))}function Z7(e){let t=Math.floor(e);return t===e?t-1:t}function Ytt(e,t,n){var r=1e-8,i=t-1,o=n-1,s=0,a,c,l,u,f,d,h,p,y,g,m;if(e<=0)return 0;if(e>=1)return 1;for(t>=1&&n>=1?(l=e<.5?e:1-e,u=Math.sqrt(-2*Math.log(l)),h=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,e<.5&&(h=-h),p=(h*h-3)/6,y=2/(1/(2*t-1)+1/(2*n-1)),g=h*Math.sqrt(p+y)/y-(1/(2*n-1)-1/(2*t-1))*(p+5/6-2/(3*y)),h=t/(t+n*Math.exp(2*g))):(a=Math.log(t/(t+n)),c=Math.log(n/(t+n)),u=Math.exp(t*a)/t,f=Math.exp(n*c)/n,g=u+f,e<u/g?h=Math.pow(t*g*e,1/t):h=1-Math.pow(n*g*(1-e),1/n)),m=-fd(t)-fd(n)+fd(t+n);s<10;s++){if(h===0||h===1)return h;if(d=Gtt(h,t,n)-e,u=Math.exp(i*Math.log(h)+o*Math.log(1-h)+m),f=d/u,h-=u=f/(1-.5*Math.min(1,f*(i/h-o/(1-h)))),h<=0&&(h=.5*(h+u)),h>=1&&(h=.5*(h+u+1)),Math.abs(u)<r*h&&s>0)break}return h}function Gtt(e,t,n){var r=e===0||e===1?0:Math.exp(fd(t+n)-fd(t)-fd(n)+t*Math.log(e)+n*Math.log(1-e));return e<0||e>1?!1:e<(t+1)/(t+n+2)?r*K7(e,t,n)/t:1-r*K7(1-e,n,t)/n}function K7(e,t,n){var r=1e-30,i=1,o=t+n,s=t+1,a=t-1,c=1,l=1-o*e/s,u,f,d,h;for(Math.abs(l)<r&&(l=r),l=1/l,h=l;i<=100&&(u=2*i,f=i*(n-i)*e/((a+u)*(t+u)),l=1+f*l,Math.abs(l)<r&&(l=r),c=1+f/c,Math.abs(c)<r&&(c=r),l=1/l,h*=l*c,f=-(t+i)*(o+i)*e/((t+u)*(s+u)),l=1+f*l,Math.abs(l)<r&&(l=r),c=1+f/c,Math.abs(c)<r&&(c=r),l=1/l,d=l*c,h*=d,!(Math.abs(d-1)<3e-7));i++);return h}function fd(e){var t=0,n=[76.18009172947146,-86.5053203294167,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],r=1.000000000190015,i,o,s;for(s=(o=i=e)+5.5,s-=(i+.5)*Math.log(s);t<6;t++)r+=n[t]/++o;return Math.log(2.506628274631*r/i)-s}function J7(e,t){var n=Ytt(2*Math.min(e,1-e),.5*t,.5);return n=Math.sqrt(t*(1-n)/n),e>.5?n:-n}var Mw=class extends ar{constructor(t,n){let{ci:r=.95,precision:i=4,...o}=n;super("line",t,o);let s=()=>this.modelFit?this.confidenceBand().update():null;_n(this,"ci",r,s),_n(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 pt.from(super.query(t)).select({intercept:Hv(r,n),slope:Qv(r,n),n:Zv(r,n),ssy:Kv(r,n),ssx:Jv(r,n),xm:t2(r,n),x0:xh(Lr(n).where(wa(r))),x1:xh(Dr(n).where(wa(r)))}).select(i).groupby(i)}queryResult(t){return this.modelFit=yw(t),this.lineData=this.modelFit.flatMap(n=>Wtt(n)),this.confidenceBand()}confidenceBand(){let{ci:t,modelFit:n,precision:r,plot:i}=this,o=i.innerWidth();return this.areaData=t?n.flatMap(s=>Xtt(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=bi(a);break;case"strokeOpacity":o.strokeOpacity=bi(a);break;case"fillOpacity":s.fillOpacity=bi(a);break;default:o[a.channel]=s[a.channel]=bi(a);break}return[...i?[{type:"areaY",data:n,options:s}]:[],{type:"line",data:t,options:o}]}};function Wtt(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 Xtt(e,t,n,r){let{x0:i,x1:o,xm:s,intercept:a,slope:c,n:l,ssx:u,ssy:f,...d}=n,h=t*(o-i)/r,p=J7((1-e)/2,l-2)*Math.sqrt(f/(l-2));return $e(i,o-h/2,h).concat(o).map(y=>{let g=a+y*c,m=p*Math.sqrt(1/l+(y-s)**2/u);return{x:y,y1:g-m,y2:g+m,...d}})}var Htt=new Set(["frame","axisX","axisY","axisFx","axisFy","gridX","gridY","gridFx","gridFy","hexgrid","graticule","sphere"]);function yt(e,t,n){arguments.length===2&&(n=t,t=Htt.has(e)?null:[{}]);let r=e.startsWith("area")||e.startsWith("line")?bw:ar;return AA(r,e,t,n)}function AA(e,t,n,r){return i=>{i.addMark(new e(t,n,r))}}function $l(e,t,n){return r=>{r.addMark(new e(t,n))}}var tP=(...e)=>yt("area",...e),eP=(...e)=>yt("areaX",...e),nP=(...e)=>yt("areaY",...e),rP=(...e)=>yt("line",...e),iP=(...e)=>yt("lineX",...e),oP=(...e)=>yt("lineY",...e),sP=(...e)=>yt("barX",...e),aP=(...e)=>yt("barY",...e),cP=(...e)=>yt("cell",...e),lP=(...e)=>yt("cellX",...e),uP=(...e)=>yt("cellY",...e),fP=(...e)=>yt("rect",...e),dP=(...e)=>yt("rectX",...e),hP=(...e)=>yt("rectY",...e),pP=(...e)=>yt("dot",...e),mP=(...e)=>yt("dotX",...e),yP=(...e)=>yt("dotY",...e),gP=(...e)=>yt("circle",...e),bP=(...e)=>yt("hexagon",...e),xP=(...e)=>yt("text",...e),_P=(...e)=>yt("textX",...e),wP=(...e)=>yt("textY",...e),vP=(...e)=>yt("ruleX",...e),SP=(...e)=>yt("ruleY",...e),IP=(...e)=>yt("tickX",...e),TP=(...e)=>yt("tickY",...e),EP=(...e)=>yt("vector",...e),AP=(...e)=>yt("vectoX",...e),MP=(...e)=>yt("vectorY",...e),NP=(...e)=>yt("spike",...e),RP=(...e)=>yt("image",...e),OP=(...e)=>AA(sy,"areaX",...e),kP=(...e)=>AA(sy,"areaY",...e),FP=(...e)=>$l(_w,...e),DP=(...e)=>$l(Iw,...e),LP=(...e)=>$l(Tw,...e),CP=(...e)=>$l(ud,...e),BP=(...e)=>$l(Aw,...e),PP=(...e)=>$l(Ew,...e),$P=(...e)=>yt("hexgrid",...e),UP=(...e)=>$l(Mw,...e),zP=(...e)=>yt("voronoi",...e),jP=(...e)=>yt("voronoiMesh",...e),qP=(...e)=>yt("delaunayLink",...e),VP=(...e)=>yt("delaunayMesh",...e),YP=(...e)=>yt("hull",...e),GP=(...e)=>yt("arrow",...e),WP=(...e)=>yt("link",...e),XP=(...e)=>yt("frame",...e),HP=(...e)=>yt("axisX",...e),QP=(...e)=>yt("axisY",...e),ZP=(...e)=>yt("axisFx",...e),KP=(...e)=>yt("axisFy",...e),JP=(...e)=>yt("gridX",...e),t$=(...e)=>yt("gridY",...e),e$=(...e)=>yt("gridFx",...e),n$=(...e)=>yt("gridFy",...e),r$=(...e)=>yt("geo",...e),i$=(...e)=>yt("sphere",...e),o$=(...e)=>yt("graticule",...e);var kA={};_i(kA,{highlight:()=>f$,intervalX:()=>g$,intervalXY:()=>x$,intervalY:()=>b$,nearestX:()=>m$,nearestY:()=>y$,pan:()=>_$,panX:()=>w$,panY:()=>v$,panZoom:()=>S$,panZoomX:()=>I$,panZoomY:()=>T$,toggle:()=>fy,toggleColor:()=>p$,toggleX:()=>d$,toggleY:()=>h$});function s$(e){let t=e.toLowerCase(),n=e.length,r="";for(let i=0;i<n;++i)r+=(e[i]!==t[i]?"-":"")+t[i];return r}function dd(e){let t={};for(let n in e)t[s$(n)]=e[n];return t}function Qtt(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 Nw=class{constructor(t,{selection:n,channels:r={}}){this.mark=Qtt(t),this.selection=n;let i=Object.entries(dd(r));this.channels=i.length?i:[["opacity",.2]],this.selection.addEventListener("value",vh(()=>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 Ztt(o,s);for(let c=0;c<n.length;++c){let l=n[c],u=i[c],f=a(l.__data__);for(let d=0;d<r.length;++d){let[h,p]=r[d];l.setAttribute(h,f?u[d]:p)}}}};async function Ztt(e,t){let n=t?.predicate(e);if(!n||n.length===0)return()=>!0;let r=e.filterBy?.predicate(e,!0),i={__:yr(n)},o=e.query(r),s=o.groupby().length?o.select(i):o.$select(i),a=await Tn().query(s),c=a.getChild?.("__");return a.numRows||a.length?c?l=>c.get(l):l=>a[l].__:()=>!1}var hd=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)=>zg(n[l].field,ei(c)));return a.length>1?yr(a):a[0]});i=o.length>1?hu(o):o[0]}return{source:this,schema:{type:"point"},clients:this.peers?r.plot.markSet:new Set().add(r),value:t,predicate:i}}init(t,n,r){let{mark:i,channels:o,selection:s}=this,{data:a}=i;r=r||(l=>{let u=a[l.__data__];return o.map(f=>u[f.as])}),n=n||`[data-index="${i.index}"]`;let c=new Set(t.querySelectorAll(n));t.addEventListener("pointerdown",l=>{let u=s.single?s.value:this.value,f=l.target,d=null;if(Ktt(c,f)){let h=r(f);l.shiftKey&&u?.length?(d=u.filter(p=>NA(p,h)),d.length===u.length&&d.push(h)):u?.length===1&&!NA(u[0],h)?d=null:d=[h]}this.value=d,Jtt(u,d)&&s.update(this.clause(d))}),t.addEventListener("pointerenter",()=>{this.selection.activate(this.clause([this.channels.map(()=>0)]))})}};function Ktt(e,t){return e.has(t)||e.has(t.parentNode)||e.has(t.parentNode?.parentNode)}function Jtt(e,t){return e==null||t==null?e!=null||t!=null:e.length!==t.length||e.some((n,r)=>NA(n,t[r]))}function NA(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}function RA(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 a$(){return RA(eS())}function c$(){return RA(J2())}function l$(){return RA(tS())}function ay(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 Qo(e,t){let n=e.channelField(t)?.field;return n?.basis||n}function cy(e,t,n=1){return t.invert(n*Math.floor(e/n))}function Rw(){let e=this,t=e.getScreenCTM,n;e.getScreenCTM=()=>e.isConnected?n=t.call(e):n}var ly=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||Qo(t,[n,n+"1",n+"2"]),this.style=a&&dd(a),this.brush=n==="y"?l$():c$(),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=>cy(r,this.scale,this.pixelSize)).sort((r,i)=>r-i)),ay(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?Me(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([[ae(o),ae(s)],[Ut(o),Ut(s)]]);let a=zt(t).selectAll('g[aria-label="facet"]'),c=a.size()?a:zt(t);if(this.g=c.append("g").attr("class",`interval-${r}`).each(Rw).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 Ow=(e,t)=>e-t,kw=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||Qo(t,["x","x1","x2"]),this.yfield=i||Qo(t,["y","y1","y2"]),this.style=a&&dd(a),this.brush=a$(),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=>cy(u,i,r)).sort(Ow),a=[c[1],l[1]].map(u=>cy(u,o,r)).sort(Ow)}(!ay(s,n?.[0])||!ay(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?yr(Me(i,t[0]),Me(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([[ae(s),ae(a)],[Ut(s),Ut(a)]]);let c=zt(t).selectAll('g[aria-label="facet"]'),l=c.size()?c:zt(t);if(this.g=l.append("g").attr("class","interval-xy").each(Rw).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(Ow),[d,h]=this.value[1].map(o.apply).sort(Ow);this.g.call(n.moveSilent,[[u,d],[f,h]])}t.addEventListener("pointerenter",()=>this.activate())}};var u$=(e,t)=>e-t,Fw=class{constructor(t,{x:n=new wr,y:r=new wr,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||Qo(t,["x","x1","x2"]),this.yfield=o||Qo(t,["y","y1","y2"]),this.zoom=OA(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=tet(t,this.xscale);this.xsel.update(this.clause(n,this.xfield,this.xscale))}if(this.pany){let n=eet(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?Me(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(u$),c=this.yscale.range.slice().sort(u$),l=OA(n,[-1/0,1/0],a),u=OA(r,[-1/0,1/0],c),f=gT().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 jr(1,0,0)).on("zoom",({transform:d})=>this.publish(d));if(zt(i).call(f),n||r){let d=!1;i.addEventListener("mouseenter",()=>{if(!d){if(d=!0,n){let{xscale:h,xfield:p}=this;o.activate(this.clause(h.domain,p,h))}if(r){let{yscale:h,yfield:p}=this;s.activate(this.clause(h.domain,p,h))}}}),i.addEventListener("mouseleave",()=>d=!1)}}};function OA(e,t,n){return e?Array.isArray(e)?e:t:n}function tet(e,t){return t.range.map(e.invertX,e).map(t.invert,t)}function eet(e,t){return t.range.map(e.invertY,e).map(t.invert,t)}var uy=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||Qo(t,[r])}clause(t){let{clients:n,field:r}=this,i=t?Sa(r,ei(t)):null;return{source:this,schema:{type:"point"},clients:n,value:t,predicate:i}}init(t){let n=this,{mark:r,channel:i,selection:o}=this,{data:s}=r,a=r.channelField(i).as,c=zt(t).selectAll('g[aria-label="facet"]'),l=c.size()?c:zt(t),u=t.scale(i),f=!ri(o);l.on("pointerdown pointermove",function(d){let[h,p]=Ln(d,this),y=net(s,a,u.invert(i==="x"?h:p));o.update(f?y:n.clause(y))}),!f&&t.addEventListener("pointerenter",()=>{this.selection.activate(this.clause(0))})}};function net(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}function mc(e,t){return n=>{let r=n.marks[n.marks.length-1];n.addInteractor(new e(r,t))}}function f$({by:e,...t}){return mc(Nw,{selection:e,channels:t})}function fy({as:e,...t}){return mc(hd,{...t,selection:e})}function d$(e){return fy({...e,channels:["x"]})}function h$(e){return fy({...e,channels:["y"]})}function p$(e){return fy({...e,channels:["color"]})}function m$({as:e,...t}){return mc(uy,{...t,selection:e,channel:"x"})}function y$({as:e,...t}){return mc(uy,{...t,selection:e,channel:"y"})}function g$({as:e,...t}){return mc(ly,{...t,selection:e,channel:"x"})}function b$({as:e,...t}){return mc(ly,{...t,selection:e,channel:"y"})}function x$({as:e,...t}){return mc(kw,{...t,selection:e})}function pd(e){return mc(Fw,e)}function _$(e={}){return pd({...e,zoom:!1})}function w$(e={}){return pd({...e,zoom:!1,pany:!1})}function v$(e={}){return pd({...e,zoom:!1,panx:!1})}function S$(e={}){return pd(e)}function I$(e={}){return pd({...e,pany:!1})}function T$(e={}){return pd({...e,panx:!1})}var DA={};_i(DA,{colorLegend:()=>E$,opacityLegend:()=>A$,symbolLegend:()=>M$});var dy=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=ret(t,n);this.selection&&i&&(this.handler=new hd(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 ret({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}function FA(e,t={}){if(t.for){let{for:n,...r}=t,i=new dy(e,r),o=typeof n,s=a=>a.addLegend(i,!1);return o==="string"?ad.request(n,s):n.value&&s(n.value),i.element}else return n=>n.addLegend(new dy(e,t))}var E$=e=>FA("color",e),A$=e=>FA("opacity",e),M$=e=>FA("symbol",e);function N$({direction:e="vertical",wrap:t=!1},n){let r=document.createElement("div");return r.style.display="flex",r.style.flexDirection=e==="vertical"?"column":"row",r.style.flexWrap=t?t===!0?"wrap":t:"nowrap",r.style.justifyContent="flex-start",r.style.alignItems="flex-start",n.forEach(i=>r.appendChild(i)),r.value={element:r},r}function Dw(...e){return N$({direction:"vertical"},e.flat())}function Lw(...e){return N$({direction:"horizontal"},e.flat())}function R$({dim:e="width",size:t=10}){let n=document.createElement("span");n.style.display="inline-block",n.style[e]=Number.isNaN(+t)?t:`${t}px`;let r={element:n};return n.value=r,n}function Cw(e){return R$({dim:"height",size:e})}function Bw(e){return R$({dim:"width",size:e})}function LA(e){return e}function Pw(e){if(e==null)return LA;var t,n,r=e.scale[0],i=e.scale[1],o=e.translate[0],s=e.translate[1];return function(a,c){c||(t=n=0);var l=2,u=a.length,f=new Array(u);for(f[0]=(t+=a[0])*r+o,f[1]=(n+=a[1])*i+s;l<u;)f[l]=a[l],++l;return f}}function O$(e,t){for(var n,r=e.length,i=r-t;i<--r;)n=e[i],e[i++]=e[r],e[r]=n}function CA(e,t){return typeof t=="string"&&(t=e.objects[t]),t.type==="GeometryCollection"?{type:"FeatureCollection",features:t.geometries.map(function(n){return k$(e,n)})}:k$(e,t)}function k$(e,t){var n=t.id,r=t.bbox,i=t.properties==null?{}:t.properties,o=$w(e,t);return n==null&&r==null?{type:"Feature",properties:i,geometry:o}:r==null?{type:"Feature",id:n,properties:i,geometry:o}:{type:"Feature",id:n,bbox:r,properties:i,geometry:o}}function $w(e,t){var n=Pw(e.transform),r=e.arcs;function i(u,f){f.length&&f.pop();for(var d=r[u<0?~u:u],h=0,p=d.length;h<p;++h)f.push(n(d[h],h));u<0&&O$(f,p)}function o(u){return n(u)}function s(u){for(var f=[],d=0,h=u.length;d<h;++d)i(u[d],f);return f.length<2&&f.push(f[0]),f}function a(u){for(var f=s(u);f.length<4;)f.push(f[0]);return f}function c(u){return u.map(a)}function l(u){var f=u.type,d;switch(f){case"GeometryCollection":return{type:f,geometries:u.geometries.map(l)};case"Point":d=o(u.coordinates);break;case"MultiPoint":d=u.coordinates.map(o);break;case"LineString":d=s(u.arcs);break;case"MultiLineString":d=u.arcs.map(s);break;case"Polygon":d=c(u.arcs);break;case"MultiPolygon":d=u.arcs.map(c);break;default:return null}return{type:f,coordinates:d}}return l(t)}function BA(e,t){var n={},r={},i={},o=[],s=-1;t.forEach(function(l,u){var f=e.arcs[l<0?~l:l],d;f.length<3&&!f[1][0]&&!f[1][1]&&(d=t[++s],t[s]=l,t[u]=d)}),t.forEach(function(l){var u=a(l),f=u[0],d=u[1],h,p;if(h=i[f])if(delete i[h.end],h.push(l),h.end=d,p=r[d]){delete r[p.start];var y=p===h?h:h.concat(p);r[y.start=h.start]=i[y.end=p.end]=y}else r[h.start]=i[h.end]=h;else if(h=r[d])if(delete r[h.start],h.unshift(l),h.start=f,p=i[f]){delete i[p.end];var g=p===h?h:p.concat(h);r[g.start=p.start]=i[g.end=h.end]=g}else r[h.start]=i[h.end]=h;else h=[l],r[h.start=f]=i[h.end=d]=h});function a(l){var u=e.arcs[l<0?~l:l],f=u[0],d;return e.transform?(d=[0,0],u.forEach(function(h){d[0]+=h[0],d[1]+=h[1]})):d=u[u.length-1],l<0?[d,f]:[f,d]}function c(l,u){for(var f in l){var d=l[f];delete u[d.start],delete d.start,delete d.end,d.forEach(function(h){n[h<0?~h:h]=1}),o.push(d)}}return c(i,r),c(r,i),t.forEach(function(l){n[l<0?~l:l]||o.push([l])}),o}function PA(e){return $w(e,F$.apply(this,arguments))}function F$(e,t,n){var r,i,o;if(arguments.length>1)r=iet(e,t,n);else for(i=0,r=new Array(o=e.arcs.length);i<o;++i)r[i]=i;return{type:"MultiLineString",arcs:BA(e,r)}}function iet(e,t,n){var r=[],i=[],o;function s(f){var d=f<0?~f:f;(i[d]||(i[d]=[])).push({i:f,g:o})}function a(f){f.forEach(s)}function c(f){f.forEach(a)}function l(f){f.forEach(c)}function u(f){switch(o=f,f.type){case"GeometryCollection":f.geometries.forEach(u);break;case"LineString":a(f.arcs);break;case"MultiLineString":case"Polygon":c(f.arcs);break;case"MultiPolygon":l(f.arcs);break}}return u(t),i.forEach(n==null?function(f){r.push(f[0].i)}:function(f){n(f[0].g,f[f.length-1].g)&&r.push(f[0].i)}),r}function Uw(e){let t=typeof e;return t==="object"?e?.param:t==="string"?aet(e):null}function aet(e){return e?.[0]==="$"?e.slice(1):null}function yc(e){return[e].flat()}function Xr(e){return Array.isArray(e)}function md(e){return e!==null&&typeof e=="object"&&!Xr(e)}function yd(e){let t=typeof e;return t==="number"||t==="string"}function rn(e){return typeof e=="string"}function xi(e){return typeof e=="function"}function Ce(e,t){throw Object.assign(Error(e),{data:t})}function zw(e,t,n){t=cet(t,n);let r=n.dataFormats.get(t.type);if(r)return r(e,t,n);Ce("Unrecognized data format type.",t)}function cet(e,t){return Xr(e)&&(e={type:"json",data:e}),rn(e)&&(e={type:"table",query:e}),{...e,type:uet(e),file:det(e,t)}}function uet(e){return e.type||fet(e.file)||"table"}function fet(e){let t=e?.lastIndexOf(".");return t>0?e.slice(t+1):null}function det({file:e},t){return e&&t.baseURL?new URL(e,t.baseURL).toString():e}function D$(e,t){let{query:n,type:r,...i}=t;if(n)return fo(e,n,i)}function L$(e,t){let{file:n,type:r,...i}=t;return f0(e,n,i)}function C$(e,t){let{file:n,type:r,...i}=t;return l0(e,n,i)}function B$(e,t){let{data:n,file:r,type:i,...o}=t;return n?d0(e,n,o):u0(e,r,o)}var het={menu:w0,search:S0,slider:T0,table:M0},pet=new Map([["intersect",()=>wr.intersect()],["crossfilter",()=>wr.crossfilter()],["union",()=>wr.union()],["single",()=>wr.single()],["value",({date:e,value:t},n)=>Array.isArray(t)?Pi.array(t.map(r=>n.maybeParam(r))):Pi.value(Uc(e,t))]]),met=new Map([["plot",{type:Xr,parse:$$}],["mark",{type:rn,parse:Fet}],["legend",{type:rn,parse:U$}],["hconcat",{type:Xr,parse:ket}],["vconcat",{type:Xr,parse:Oet}],["hspace",{type:yd,parse:Met}],["vspace",{type:yd,parse:Net}],["input",{type:rn,parse:Ret}]]),yet=new Map([["csv",C$],["json",B$],["geojson",Tet],["topojson",Eet],["parquet",L$],["table",D$]]),get=new Map([["avg",Jg],["bin",Ih],["count",gr],["dateMonth",i0],["dateMonthDay",o0],["dateDay",s0],["bin",Ih],["max",Dr],["median",t0],["min",Lr],["mode",n0],["quantile",e0],["sum",br],["row_number",jg],["rank",qg],["dense_rank",Vg],["percent_rank",Yg],["cume_dist",Gg],["ntile",Wg],["lag",Xg],["lead",Hg],["first_value",Qg],["last_value",Zg],["nth_value",Kg]]),bet=new Map(Object.entries(MA)),xet=new Map(Object.entries(het)),_et=new Map(Object.entries(DA)),wet=new Map(Object.entries(xA)),vet=new Map(Object.entries(kA));function Iet(e,t){return e=rn(e)?JSON.parse(e):e,new gd(t).parse(e)}var gd=class{constructor({specParsers:t=met,paramParsers:n=pet,dataFormats:r=yet,transforms:i=get,attributes:o=wet,interactors:s=vet,legends:a=_et,inputs:c=xet,marks:l=bet,params:u=[],datasets:f=[],baseURL:d=null}={}){this.specParsers=t,this.paramParsers=n,this.dataFormats=r,this.transforms=i,this.attributes=o,this.interactors=s,this.legends=a,this.inputs=c,this.marks=l,this.params=new Map(u),this.datasets=new Map(f),this.baseURL=d,this.postQueue=[]}after(t){this.postQueue.push(t)}maybeParam(t,n=()=>Pi.value()){let{params:r}=this,i=Uw(t);if(i){if(r.has(i))return r.get(i);{let o=n();return r.set(i,o),o}}return t}maybeSelection(t){return this.maybeParam(t,()=>wr.intersect())}maybeTransform(t){if(md(t))return t.expr?j$(t,this):t.agg?$et(t,this):Uet(t,this)}async parse(t){let{meta:n,data:r={},plotDefaults:i={},params:o,...s}=t;for(let c in r){let l=await zw(c,r[c],this);l?.data?this.datasets.set(c,l.data):l&&await Tn().exec(l)}this.plotDefaults=Object.keys(i).map(c=>z$(i,c,this));for(let c in o)this.params.set(c,Aet(o[c],this));let a=$A(s,this);return this.postQueue.forEach(c=>c()),this.postQueue=[],this.plotDefaults={},a}};async function P$(e){let{data:t,file:n}=e;return t||await fetch(n).then(r=>r.json())}async function Tet(e,t){return{data:await P$(t)}}async function Eet(e,t){let n=await P$(t),r;if(t.feature)r=CA(n,n.objects[t.feature]);else{let i=t.mesh?n.objects[t.mesh]:void 0,o={interior:(s,a)=>s!==a,exterior:(s,a)=>s===a}[t.filter];r=PA(n,i,o)}return{data:r&&r.features||[r]}}function Aet(e,t){e=md(e)?e:{value:e};let{select:n="value"}=e,r=t.paramParsers.get(n);return r||Ce(`Unrecognized param type: ${n}`,e),r(e,t)}function $A(e,t){for(let[n,{type:r,parse:i}]of t.specParsers){let o=e[n];if(o!=null){if(r(o))return i(e,t);Ce(`Invalid property type: ${n}`,e)}}Ce("Invalid specification.",e)}function Met(e){return Bw(e.hspace)}function Net(e){return Cw(e.vspace)}function Ret(e,t){let{input:n,...r}=e,i=t.inputs.get(n);xi(i)||Ce(`Unrecognized input: ${n}`,e);for(let o in r)r[o]=t.maybeSelection(r[o]);return i(r)}function Oet(e,t){return Dw(e.vconcat.map(n=>$A(n,t)))}function ket(e,t){return Lw(e.hconcat.map(n=>$A(n,t)))}function $$(e,t){let{plot:n,...r}=e,i=t.plotDefaults.concat(Object.keys(r).map(s=>z$(e,s,t))),o=n.map(s=>Det(s,t));return gA(i,o)}function Fet(e,t){return $$({plot:[e]},t)}function U$(e,t){let{legend:n,...r}=e,i=`${n}Legend`,o=t.legends.get(i);xi(o)||Ce(`Unrecognized legend type: ${n}`,e);for(let s in r)r[s]=t.maybeSelection(r[s]);return o(r)}function z$(e,t,n){let r=n.attributes.get(t);xi(r)||Ce(`Unrecognized attribute: ${t}`,e);let i=e[t],o=i==="Fixed"?zc:n.maybeParam(i);return r(o)}function Det(e,t){return rn(e.mark)?Let(e,t):rn(e.legend)?U$(e,t):rn(e.select)?Pet(e,t):Ce("Invalid plot entry.",e)}function Let(e,t){let{mark:n,data:r,...i}=e,o=t.marks.get(n);xi(o)||Ce(`Unrecognized mark type: ${n}`,e);let s=Cet(r,t);for(let a in i)i[a]=Bet(i[a],t);return s?o(s,i):o(i)}function Cet(e,t){if(!e)return null;if(Xr(e))return e;let{from:n,...r}=e;if(t.datasets.has(n))return t.datasets.get(n);for(let i in r)r[i]=t.maybeSelection(r[i]);return _A(n,r)}function Bet(e,t){return t.maybeTransform(e)||t.maybeParam(e)}function Pet(e,t){let{select:n,...r}=e,i=t.interactors.get(n);xi(i)||Ce(`Unrecognized interactor type: ${n}`,e);for(let o in r)r[o]=t.maybeSelection(r[o]);return i(r)}function j$(e,t,n="expr"){let{label:r}=e,o=e[n].split(/(\\'|\\"|"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\$\w+)/g),s=[""],a=[];for(let c=0,l=0;c<o.length;++c){let u=o[c];u.startsWith("$")?(a[l]=t.maybeParam(u),s[++l]=""):s[l]+=u}return q(s,...a).annotate({label:r})}function $et(e,t){return j$(e,t,"agg").annotate({aggregate:!0})}function Uet(e,t){let{transforms:n}=t,r;for(let a in e)n.has(a)&&(r=a);if(!r)return;let i=n.get(r),o=r==="count"||r==null?[]:yc(e[r]),s=i(...o);if(e.distinct&&(s=s.distinct()),e.orderby){let a=yc(e.orderby).map(c=>t.maybeParam(c));s=s.orderby(a)}if(e.partitionby){let a=yc(e.partitionby).map(c=>t.maybeParam(c));s=s.partitionby(a)}return e.rows?s=s.rows(t.maybeParam(e.rows)):e.range&&(s=s.range(t.maybeParam(e.range))),s}var q$="https://cdn.jsdelivr.net/npm/topojson@3.0.2/+esm",zet=new Map([["plot",{type:Xr,parse:G$}],["mark",{type:rn,parse:rnt}],["legend",{type:rn,parse:W$}],["hconcat",{type:Xr,parse:nnt}],["vconcat",{type:Xr,parse:ent}],["hspace",{type:yd,parse:Ket}],["vspace",{type:yd,parse:Jet}],["input",{type:rn,parse:tnt}]]),jet=new Map([["csv",Xet],["json",Het],["geojson",Qet],["topojson",Zet],["parquet",Wet],["table",Get]]);function qet(e,t){return e=rn(e)?JSON.parse(e):e,new UA(t).generate(e)}function jw(e){return e?.length?[""]:[]}var UA=class extends gd{constructor(t){super({specParsers:zet,dataFormats:jet,...t}),this.imports=t?.imports||new Map([["@uwdata/vgplot","* as vg"]]),this.depth=0}async generate(t){let{meta:n,data:r={},plotDefaults:i={},params:o,...s}=t,a=await Promise.all(Object.keys(r).flatMap(h=>{let p=zw(h,r[h],this);return p?p.data?`const ${h} = ${p.data};`:`await vg.coordinator().exec(
69
- ${p}
70
- );`:[]})),c=Object.keys(i).map(h=>X$(i,h,this)),l=[];c.length&&(this.plotDefaults="defaultAttributes",l=["const defaultAttributes = [",c.map(h=>" "+h).join(`,
71
- `),"];"]);for(let h in o)this.params.set(`$${h}`,Yet(o[h],this));let u=[`export default ${jA(s,this)};`],f=[];for(let[h,p]of this.params)f.push(`const ${h} = ${p};`);let d=[];for(let[h,p]of this.imports)d.push(rn(p)?`import ${p} from "${h}";`:`import { ${p.join(", ")} } from "${h}";`);return[...d,...jw(d),...a,...jw(a),...f,...jw(f),...l,...jw(l),...u].join(`
72
- `)}addImport(t,n){this.imports.has(t)||this.imports.set(t,[]),this.imports.get(t).push(n)}setImports(t,n){this.imports.set(t,n)}maybeParam(t,n="vg.Param.value()"){let{params:r}=this,i=Uw(t);if(i){let o=`$${i}`;return r.has(o)||r.set(o,n),o}return JSON.stringify(t)}maybeSelection(t){return this.maybeParam(t,"vg.Selection.intersect()")}maybeTransform(t){if(md(t))return t.expr?V$(t,this):t.agg?V$(t,this,"agg","agg"):Vet(t,this)}indent(){this.depth+=1}undent(){this.depth-=1}tab(){return Array.from({length:this.depth},()=>" ").join("")}};function V$(e,t,n="expr",r="sql"){let{label:i}=e,s=e[n].split(/(\\'|\\"|"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\$\w+)/g),a="";for(let c=0;c<s.length;++c){let l=s[c];l.startsWith("$")?a+=`\${${t.maybeParam(l)}}`:a+=l}return`vg.${r}\`${a}\``+(i?`.annotate({ label: ${JSON.stringify(i)} })`:"")}function Vet(e,t){let{transforms:n}=t,r;for(let s in e)n.has(s)&&(r=s);if(!r)return;let i=r==="count"||r==null?[]:yc(e[r]),o=`vg.${r}(`+i.map(s=>t.maybeParam(s)).join(", ")+")";if(e.distinct&&(o+=".distinct()"),e.orderby){let s=yc(e.orderby).map(a=>t.maybeParam(a));o+=`.orderby(${s.join(", ")})`}if(e.partitionby){let s=yc(e.partitionby).map(a=>t.maybeParam(a));o+=`.partitionby(${s.join(", ")})`}return e.rows?o+=`.rows(${t.maybeParam(e.rows)})`:e.range&&(o+=`.range(${t.maybeParam(e.rows)})`),o}function Yet(e,t){e=md(e)?e:{value:e};let{select:n="value"}=e;if(t.paramParsers.get(n)||Ce(`Unrecognized param type: ${n}`,e),n==="value"){let{value:i,date:o}=e;return Array.isArray(i)?`vg.Param.array([${i.map(s=>t.maybeParam(s)).join(", ")}])`:o?`vg.Param.value(new Date(${JSON.stringify(o)}))`:`vg.Param.value(${JSON.stringify(i)})`}else return`vg.Selection.${n}()`}function zA(e){let t=[];for(let n in e)t.push(`${n}: ${JSON.stringify(e[n])}`);return t.length?`, { ${t.join(", ")} }`:""}function Get(e,t){let{query:n,type:r,...i}=t;if(n)return`\`${fo(e,n,i)}\``}function Wet(e,t){let{file:n,type:r,...i}=t;return`vg.loadParquet("${e}", "${n}"${zA(i)})`}function Xet(e,t){let{file:n,type:r,...i}=t;return`vg.loadCSV("${e}", "${n}"${zA(i)})`}function Het(e,t){let{data:n,file:r,type:i,...o}=t,s=zA(o);if(n){let a=`[
73
- `+n.map(c=>JSON.stringify(c)).join(`,
74
- `)+`
75
- ]`;return`vg.loadObjects("${e}", ${a}${s})`}else return`vg.loadCSV("${e}", "${r}"${s})`}function Y$(e){let{data:t,file:n}=e;return t?JSON.stringify(t):`await fetch("${n}")
76
- .then(r => r.json())`}function Qet(e,t,n){return n.datasets.set(e,e),{data:Y$(t)}}function Zet(e,t,n){n.datasets.set(e,e);let r=Y$(t),i;if(t.feature){n.addImport(q$,"feature");let o=`json.objects['${t.feature}']`;i=r+`
77
- .then(json => feature(json, ${o}).features)`}else{n.addImport(q$,"mesh");let o=t.mesh?`json.objects['${t.mesh}']`:"undefined",s=t.filter==="interior"?", (a, b) => a !== b":t.filter==="exterior"?", (a, b) => a === b":"";i=r+`
78
- .then(json => [mesh(json, ${o}${s})])`}return{data:i}}function jA(e,t){for(let[n,{type:r,parse:i}]of t.specParsers){let o=e[n];if(o!=null){if(r(o))return i(e,t);Ce(`Invalid property type: ${n}`,e)}}Ce("Invalid specification.",e)}function Ket(e,t){return`${t.tab()}vg.hspace(${e.hspace})`}function Jet(e,t){return`${t.tab()}vg.vspace(${e.vspace})`}function tnt(e,t){let{input:n,...r}=e,i=t.inputs.get(n);xi(i)||Ce(`Unrecognized input: ${n}`,e);let o=[];for(let s in r)o.push(`${s}: ${t.maybeSelection(r[s])}`);return`${t.tab()}vg.${n}({ ${o.join(", ")} })`}function ent(e,t){t.indent();let n=e.vconcat.map(r=>jA(r,t));return t.undent(),`${t.tab()}vg.vconcat(
79
- ${n.join(`,
80
- `)}
81
- ${t.tab()})`}function nnt(e,t){t.indent();let n=e.hconcat.map(r=>jA(r,t));return t.undent(),`${t.tab()}vg.hconcat(
82
- ${n.join(`,
83
- `)}
84
- ${t.tab()})`}function G$(e,t){let{plot:n,...r}=e;t.indent();let i=[...t.plotDefaults?[`${t.tab()}...defaultAttributes`]:[],...Object.keys(r).map(a=>X$(e,a,t))],s=n.map(a=>int(a,t)).concat(i);return t.undent(),`${t.tab()}vg.plot(
85
- ${s.join(`,
86
- `)}
87
- ${t.tab()})`}function rnt(e,t){return G$({plot:[e]},t)}function W$(e,t){let{legend:n,...r}=e,i=`${n}Legend`;xi(t.legends.get(i))||Ce(`Unrecognized legend type: ${n}`,e);let o=[];for(let s in r)o.push(`${s}: ${t.maybeSelection(r[s])}`);return`${t.tab()}vg.${i}({ ${o.join(", ")} })`}function X$(e,t,n){let r=n.attributes.get(t);xi(r)||Ce(`Unrecognized attribute: ${t}`,e);let i=e[t],o=i==="Fixed"?"vg.Fixed":n.maybeParam(i);return`${n.tab()}vg.${t}(${o})`}function int(e,t){return rn(e.mark)?ont(e,t):rn(e.legend)?W$(e,t):rn(e.select)?cnt(e,t):Ce("Invalid plot entry.",e)}function ont(e,t){let{mark:n,data:r,...i}=e;xi(t.marks.get(n))||Ce(`Unrecognized mark type: ${n}`,e);let o=snt(r,t),s=[];for(let u in i)s.push(`${u}: ${ant(i[u],t)}`);let a=o||"",c=s.length?`{ ${s.join(", ")} }`:"",l=`${a}${c}`;return a&&c&&(t.indent(),l=`
88
- ${t.tab()}${a},
89
- ${t.tab()}${c}
90
- `,t.undent(),l+=t.tab()),`${t.tab()}vg.${n}(${l})`}function snt(e,t){if(!e)return null;if(Xr(e))return JSON.stringify(e);let{from:n,...r}=e;if(t.datasets.has(n))return t.datasets.get(n);{let i=[];for(let s in r)i.push(`${s}: ${t.maybeSelection(r[s])}`);let o=i.length?`, { ${i.join(", ")} }`:"";return`vg.from("${n}"${o})`}}function ant(e,t){return t.maybeTransform(e)||t.maybeParam(e)}function cnt(e,t){let{select:n,...r}=e;xi(t.interactors.get(n))||Ce(`Unrecognized interactor type: ${n}`,e);let i=[];for(let o in r)i.push(`${o}: ${t.maybeSelection(r[o])}`);return`${t.tab()}vg.${n}({ ${i.join(", ")} })`}export{wh as Coordinator,zc as Fixed,ar as Mark,xr as MosaicClient,Pi as Param,gd as ParseContext,ny as Plot,pt as Query,wr as Selection,V3 as agg,N5 as align,yr as and,tP as area,eP as areaX,nP as areaY,bh as argmax,gh as argmin,i6 as arrayAgg,GP as arrow,R5 as aspectRatio,bA as attribute,mw as attributes,Jg as avg,O5 as axis,ZP as axisFx,KP as axisFy,HP as axisX,QP as axisY,sP as barX,aP as barY,Ih as bin,r0 as cast,xh as castDouble,o6 as castInteger,cP as cell,lP as cellX,uP as cellY,gP as circle,JB as colorClamp,ZB as colorDomain,n7 as colorInterpolate,o7 as colorLabel,E$ as colorLegend,t7 as colorNice,r7 as colorPivot,KB as colorRange,s7 as colorReverse,QB as colorScale,e7 as colorScheme,i7 as colorSymmetric,c7 as colorTickFormat,a7 as colorZero,Cc as column,LP as contour,Tn as coordinator,t6 as corr,gr as count,e6 as covarPop,Gg as cume_dist,s0 as dateDay,i0 as dateMonth,o0 as dateMonthDay,qP as delaunayLink,VP as delaunayMesh,DP as denseLine,Vg as dense_rank,FP as density,OP as densityX,kP as densityY,pP as dot,mP as dotX,yP as dotY,Z3 as entropy,Sa as eq,XC as facetGrid,HC as facetLabel,qC as facetMargin,YC as facetMarginBottom,GC as facetMarginLeft,WC as facetMarginRight,VC as facetMarginTop,Qg as first_value,XP as frame,_A as from,rB as fxAlign,wB as fxAriaDescription,_B as fxAriaLabel,aB as fxAxis,QC as fxDomain,xB as fxFontVariant,pB as fxGrid,JC as fxInset,tB as fxInsetLeft,eB as fxInsetRight,yB as fxLabel,gB as fxLabelAnchor,bB as fxLabelOffset,mB as fxLine,KC as fxNice,iB as fxPadding,oB as fxPaddingInner,sB as fxPaddingOuter,ZC as fxRange,vB as fxReverse,nB as fxRound,dB as fxTickFormat,fB as fxTickPadding,hB as fxTickRotate,lB as fxTickSize,uB as fxTickSpacing,cB as fxTicks,RB as fyAlign,XB as fyAriaDescription,WB as fyAriaLabel,DB as fyAxis,SB as fyDomain,GB as fyFontVariant,zB as fyGrid,EB as fyInset,MB as fyInsetBottom,AB as fyInsetTop,qB as fyLabel,VB as fyLabelAnchor,YB as fyLabelOffset,jB as fyLine,TB as fyNice,OB as fyPadding,kB as fyPaddingInner,FB as fyPaddingOuter,IB as fyRange,HB as fyReverse,NB as fyRound,$B as fyTickFormat,PB as fyTickPadding,UB as fyTickRotate,CB as fyTickSize,BB as fyTickSpacing,LB as fyTicks,r$ as geo,o$ as graticule,F5 as grid,e$ as gridFx,n$ as gridFy,JP as gridX,t$ as gridY,mu as gt,P3 as gte,Lw as hconcat,S5 as height,bP as hexagon,PP as hexbin,$P as hexgrid,f$ as highlight,Bw as hspace,YP as hull,RP as image,k5 as inset,g$ as intervalX,x$ as intervalXY,b$ as intervalY,Me as isBetween,$3 as isDistinct,z3 as isNotBetween,zg as isNotDistinct,wa as isNotNull,pu as isNull,Q3 as kurtosis,D5 as label,Xg as lag,n6 as last,Zg as last_value,Hg as lead,A7 as lengthClamp,T7 as lengthDomain,M7 as lengthNice,E7 as lengthRange,I7 as lengthScale,N7 as lengthZero,rP as line,iP as lineX,oP as lineY,WP as link,ei as literal,l0 as loadCSV,u0 as loadJSON,d0 as loadObjects,f0 as loadParquet,Ia as lt,Ta as lte,Y3 as mad,I5 as margin,M5 as marginBottom,T5 as marginLeft,E5 as marginRight,A5 as marginTop,x5 as margins,Dr as max,t0 as median,w0 as menu,Lr as min,n0 as mode,g5 as name,ad as namedPlots,m$ as nearestX,y$ as nearestY,Ug as neq,C3 as not,Kg as nth_value,Wg as ntile,d7 as opacityClamp,u7 as opacityDomain,p7 as opacityLabel,A$ as opacityLegend,h7 as opacityNice,f7 as opacityRange,m7 as opacityReverse,l7 as opacityScale,g7 as opacityTickFormat,y7 as opacityZero,hu as or,L5 as padding,_$ as pan,w$ as panX,v$ as panY,S$ as panZoom,I$ as panZoomX,T$ as panZoomY,Iet as parseSpec,Yg as percent_rank,gA as plot,G3 as product,U7 as projectionClip,D7 as projectionDomain,L7 as projectionInset,$7 as projectionInsetBottom,C7 as projectionInsetLeft,B7 as projectionInsetRight,P7 as projectionInsetTop,O7 as projectionParallels,k7 as projectionPrecision,F7 as projectionRotate,R7 as projectionType,e0 as quantile,w7 as rClamp,x7 as rDomain,v7 as rNice,_7 as rRange,b7 as rScale,S7 as rZero,qg as rank,CP as raster,BP as rasterTile,fP as rect,dP as rectX,hP as rectY,UP as regressionY,ptt as reset,v6 as restConnector,C5 as round,jg as row_number,vP as ruleX,SP as ruleY,S0 as search,H3 as skewness,T0 as slider,Pg as socketConnector,qet as specToModule,i$ as sphere,NP as spike,q as sql,X3 as stddev,J3 as stddevPop,r6 as stringAgg,w5 as style,br as sum,M$ as symbolLegend,M0 as table,xP as text,_P as textX,wP as textY,IP as tickX,TP as tickY,fy as toggle,p$ as toggleColor,d$ as toggleX,h$ as toggleY,K3 as varPop,W3 as variance,Dw as vconcat,EP as vector,AP as vectorX,MP as vectorY,zP as voronoi,jP as voronoiMesh,Cw as vspace,R6 as wasmConnector,v5 as width,G5 as xAlign,uC as xAriaDescription,lC as xAriaLabel,Q5 as xAxis,V5 as xClamp,P5 as xDomain,cC as xFontVariant,rC as xGrid,z5 as xInset,j5 as xInsetLeft,q5 as xInsetRight,oC as xLabel,sC as xLabelAnchor,aC as xLabelOffset,iC as xLine,U5 as xNice,W5 as xPadding,X5 as xPaddingInner,H5 as xPaddingOuter,$5 as xRange,fC as xReverse,Y5 as xRound,B5 as xScale,eC as xTickFormat,tC as xTickPadding,nC as xTickRotate,K5 as xTickSize,J5 as xTickSpacing,Z5 as xTicks,dC as xZero,_5 as xyDomain,vC as yAlign,UC as yAriaDescription,$C as yAriaLabel,EC as yAxis,_C as yClamp,pC as yDomain,PC as yFontVariant,FC as yGrid,gC as yInset,xC as yInsetBottom,bC as yInsetTop,LC as yLabel,CC as yLabelAnchor,BC as yLabelOffset,DC as yLine,yC as yNice,SC as yPadding,IC as yPaddingInner,TC as yPaddingOuter,mC as yRange,zC as yReverse,wC as yRound,hC as yScale,OC as yTickFormat,RC as yTickPadding,kC as yTickRotate,MC as yTickSize,NC as yTickSpacing,AC as yTicks,jC as yZero};
69
+ }`)).call(Af,n);for(let C of l){let{channels:P,values:$,facets:U}=m.get(C);if(p===void 0||C.facet==="super"){let X=null;if(U&&(X=U[0],X=C.filter(X,P,$),X.length===0))continue;let tt=C.render(X,b,$,w,T);if(tt==null)continue;R.appendChild(tt)}else{let X;for(let tt of p){if(!(C.facetAnchor?.(p,O,tt)??!tt.empty))continue;let nt=null;if(U){let Y=f.has(C);if(nt=U[Y?tt.i:0],nt=C.filter(nt,P,$),nt.length===0)continue;!Y&&nt===U[0]&&(nt=Ys(nt)),nt.fx=tt.x,nt.fy=tt.y,nt.fi=tt.i}let st=C.render(nt,b,$,v,T);if(st!=null){(X??=qt(R).append("g")).append(()=>st).datum(tt);for(let Y of["aria-label","aria-description","aria-hidden","transform"])st.hasAttribute(Y)&&(X.attr(Y,st.getAttribute(Y)),st.removeAttribute(Y))}}X?.selectChildren().attr("transform",F)}}let N=f7(g,T,e),{figure:L=r!=null||i!=null||o!=null||N.length>0}=e;L&&(I=M.createElement("figure"),I.className=`${c}-figure`,I.style.maxWidth="initial",r!=null&&I.append(m7(M,r,"h2")),i!=null&&I.append(m7(M,i,"h3")),I.append(...N,R),o!=null&&I.append(HQ(M,o))),I.scale=uB(b.scales),I.legend=l7(g,T,e),I.projection=T.projection;let B=m5();return B>0&&qt(R).append("text").attr("x",S).attr("y",20).attr("dy","-1em").attr("text-anchor","end").attr("font-family","initial").text("\u26A0\uFE0F").append("title").text(`${B.toLocaleString("en-US")} warning${B===1?"":"s"}. Please check the console.`),I}function m7(e,t,n){if(t.ownerDocument)return t;let r=e.createElement(n);return r.append(t),r}function HQ(e,t){let n=e.createElement("figcaption");return n.append(t),n}function ZQ({marks:e=[],...t}={}){return Pm({...t,marks:[...e,this]})}wt.prototype.plot=ZQ;function y7(e){return e.flat(1/0).filter(t=>t!=null).map(QQ)}function QQ(e){return typeof e.render=="function"?e:new XE(e)}var XE=class extends wt{constructor(t){if(typeof t!="function")throw new TypeError("invalid mark; missing render function");super(),this.render=t}render(){}};function HE(e,t){for(let n in e)_7(e[n],t);return e}function _7(e,t){let{scale:n,transform:r=!0}=e;if(n==null||!r)return;let{type:i,percent:o,interval:s,transform:a=o?c=>c*100:QT(s,i)}=t[n]??{};a!=null&&(e.value=Yt(e.value,a),e.transform=!1)}function KQ(e){for(let t in e)fE(t,e[t])}function Bm(e,t,n,r=CC){for(let{channels:i}of t.values())for(let o in i){let s=i[o],{scale:a}=s;if(a!=null&&r(a))if(a==="projection"){if(!v5(n)){let c=n.x?.domain===void 0,l=n.y?.domain===void 0;if(c||l){let[u,f]=I5(s);c&&WE(e,"x",u),l&&WE(e,"y",f)}}}else WE(e,a,s)}return e}function WE(e,t,n){let r=e.get(t);r!==void 0?r.push(n):e.set(t,[n])}function JQ(e,t){if(e==null)return;let{x:n,y:r}=e;if(n==null&&r==null)return;let i=qe(e.data);if(i==null)throw new Error("missing facet data");let o={};n!=null&&(o.fx=If(i,{value:n,scale:"fx"})),r!=null&&(o.fy=If(i,{value:r,scale:"fy"})),HE(o,t);let s=a_(i,o);return{channels:o,groups:s,data:e.data}}function g7(e,t,n){if(e.facet===null||e.facet==="super")return;let{fx:r,fy:i}=e;if(r!=null||i!=null){let c=qe(e.data??r??i);if(c===void 0)throw new Error(`missing facet data in ${e.ariaLabel}`);if(c===null)return;let l={};return r!=null&&(l.fx=If(c,{value:r,scale:"fx"})),i!=null&&(l.fy=If(c,{value:i,scale:"fy"})),HE(l,n),{channels:l,groups:a_(c,l)}}if(t===void 0)return;let{channels:o,groups:s,data:a}=t;if(e.facet!=="auto"||e.data===a)return{channels:o,groups:s};a.length>0&&(s.size>1||s.size===1&&o.fx&&o.fy&&[...s][0][1].size>1)&&qe(e.data)?.length===a.length&&jn(`Warning: the ${e.ariaLabel} mark appears to use faceted data, but isn\u2019t faceted. The mark data has the same length as the facet data and the mark facet option is "auto", but the mark data and facet data are distinct. If this mark should be faceted, set the mark facet option to true; otherwise, suppress this warning by setting the mark facet option to false.`)}function tK(e,t={}){return Se({...t,x:null,y:null},(n,r,i,o,s,a)=>a.getMarkState(e))}function eK(e){let t=[];for(let n of e){let r=n.tip;if(r){r===!0?r={}:typeof r=="string"&&(r={pointer:r});let{pointer:i,preferredAnchor:o}=r;i=/^x$/i.test(i)?Cf:/^y$/i.test(i)?Al:Lf,r=i(tK(n,r)),r.title=null,o===void 0&&(r.preferredAnchor=i===Al?"left":"bottom");let s=O_(n.data,r);s.facet=n.facet,s.facetAnchor=n.facetAnchor,t.push(s)}}return t}function nK(e,t,n){let{projection:r,x:i={},y:o={},fx:s={},fy:a={},axis:c,grid:l,facet:u={},facet:{axis:f=c,grid:d}=u,x:{axis:h=c,grid:p=h===null?null:l}=i,y:{axis:m=c,grid:g=m===null?null:l}=o,fx:{axis:y=f,grid:b=y===null?null:d}=s,fy:{axis:x=f,grid:_=x===null?null:d}=a}=n;(r||!Oo(i)&&!b7("x",e))&&(h=p=null),(r||!Oo(o)&&!b7("y",e))&&(m=g=null),t.has("fx")||(y=b=null),t.has("fy")||(x=_=null),h===void 0&&(h=!F_(e,"x")),m===void 0&&(m=!F_(e,"y")),y===void 0&&(y=!F_(e,"fx")),x===void 0&&(x=!F_(e,"fy")),h===!0&&(h="bottom"),m===!0&&(m="left"),y===!0&&(y=h==="top"||h===null?"bottom":"top"),x===!0&&(x=m==="right"||m===null?"left":"right");let v=[];return k_(v,_,E_,a),D_(v,x,S_,"right","left",u,a),k_(v,b,M_,s),D_(v,y,I_,"top","bottom",u,s),k_(v,g,T_,o),D_(v,m,Dm,"left","right",n,o),k_(v,p,A_,i),D_(v,h,km,"bottom","top",n,i),v}function D_(e,t,n,r,i,o,s){if(!t)return;let a=rK(t);s=iK(a?r:t,o,s);let{line:c}=s;(n===Dm||n===km)&&c&&!Xs(c)&&e.push(Uf(oK(s))),e.push(n(s)),a&&e.push(n({...s,anchor:i,label:null}))}function k_(e,t,n,r){!t||Xs(t)||e.push(n(sK(t,r)))}function rK(e){return/^\s*both\s*$/i.test(e)}function iK(e,t,{line:n=t.line,ticks:r,tickSize:i,tickSpacing:o,tickPadding:s,tickFormat:a,tickRotate:c,fontVariant:l,ariaLabel:u,ariaDescription:f,label:d=t.label,labelAnchor:h,labelArrow:p=t.labelArrow,labelOffset:m}){return{anchor:e,line:n,ticks:r,tickSize:i,tickSpacing:o,tickPadding:s,tickFormat:a,tickRotate:c,fontVariant:l,ariaLabel:u,ariaDescription:f,label:d,labelAnchor:h,labelArrow:p,labelOffset:m}}function oK(e){let{anchor:t,line:n}=e;return{anchor:t,facetAnchor:t+"-empty",stroke:n===!0?void 0:n}}function sK(e,{stroke:t=Ka(e)?e:void 0,ticks:n=aK(e)?e:void 0,tickSpacing:r,ariaLabel:i,ariaDescription:o}){return{stroke:t,ticks:n,tickSpacing:r,ariaLabel:i,ariaDescription:o}}function aK(e){switch(typeof e){case"number":return!0;case"string":return!Ka(e)}return cr(e)||typeof e?.range=="function"}function F_(e,t){let n=`${t}-axis `;return e.some(r=>r.ariaLabel?.startsWith(n))}function b7(e,t){for(let n of t)for(let r in n.channels){let{scale:i}=n.channels[r];if(i===e||i==="projection")return!0}return!1}function cK(e,t){for(let n in e){let r=e[n],i=t[n];r.label===void 0&&i&&(r.label=i.label)}return e}function lK({fx:e,fy:t},n){let{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=i_(n),l=e&&x7(e),u=t&&x7(t);return{marginTop:t?u[0]:r,marginRight:e?a-l[1]:i,marginBottom:t?c-u[1]:o,marginLeft:e?l[0]:s,inset:{marginTop:n.marginTop,marginRight:n.marginRight,marginBottom:n.marginBottom,marginLeft:n.marginLeft},width:a,height:c}}function x7(e){let t=e.domain(),n=e(t[0]),r=e(t[t.length-1]);return r<n&&([n,r]=[r,n]),[n,r+e.bandwidth()]}var uK=new Map([["basis",gT],["basis-closed",bT],["basis-open",xT],["bundle",_T],["bump-x",dT],["bump-y",hT],["cardinal",wT],["cardinal-closed",vT],["cardinal-open",ST],["catmull-rom",IT],["catmull-rom-closed",TT],["catmull-rom-open",ET],["linear",Us],["linear-closed",AT],["monotone-x",NT],["monotone-y",RT],["natural",OT],["step",DT],["step-after",FT],["step-before",kT]]);function $m(e=Us,t){if(typeof e=="function")return e;let n=uK.get(`${e}`.toLowerCase());if(!n)throw new Error(`unknown curve: ${e}`);if(t!==void 0){if("beta"in n)return n.beta(t);if("tension"in n)return n.tension(t);if("alpha"in n)return n.alpha(t)}return n}function L_(e=ac,t){return typeof e!="function"&&`${e}`.toLowerCase()==="auto"?ac:$m(e,t)}function ac(e){return Us(e)}function Po(e={y:"count"},t={}){[e,t]=QE(e,t);let{x:n,y:r}=t;return ZE(C_(n,t,W),null,null,r,e,Ml(t))}function $o(e={x:"count"},t={}){[e,t]=QE(e,t);let{x:n,y:r}=t;return ZE(null,C_(r,t,W),n,null,e,Nl(t))}function ta(e={fill:"count"},t={}){[e,t]=QE(e,t);let{x:n,y:r}=fK(t);return ZE(n,r,null,null,e,Ml(Nl(t)))}function S7(e,t,n={}){if(n?.interval==null)return n;let{reduce:r=G1}=n,i={filter:null};return n[t]!=null&&(i[t]=r),n[`${t}1`]!=null&&(i[`${t}1`]=r),n[`${t}2`]!=null&&(i[`${t}2`]=r),e(i,n)}function zf(e={}){return S7(Po,"y",ji(e,"x"))}function qf(e={}){return S7($o,"x",ji(e,"y"))}function ZE(e,t,n,r,{data:i=Y1,filter:o=_m,sort:s,reverse:a,...c}={},l={}){e=w7(e),t=w7(t),c=dK(c,l),i=E7(i,W),s=s==null?void 0:I7("sort",s,l),o=o==null?void 0:T7("filter",o,l),n!=null&&Lo(c,"x","x1","x2")&&(n=null),r!=null&&Lo(c,"y","y1","y2")&&(r=null);let[u,f]=Rn(e),[d,h]=Rn(e),[p,m]=Rn(t),[g,y]=Rn(t),[b,x]=n!=null?[n,"x"]:r!=null?[r,"y"]:[],[_,v]=Rn(b),{x:w,y:T,z:M,fill:R,stroke:I,x1:A,x2:O,y1:F,y2:S,domain:E,cumulative:N,thresholds:L,interval:B,...C}=l,[P,$]=Rn(M),[U]=Re(R),[X]=Re(I),[tt,nt]=Rn(U),[st,Y]=Rn(X);return{..."z"in l&&{z:P||M},..."fill"in l&&{fill:tt||R},..."stroke"in l&&{stroke:st||I},...mn(C,(rt,q,H)=>{let ot=vl(mt(rt,b),H?.[x]),z=mt(rt,M),Lt=mt(rt,U),dt=mt(rt,X),Wt=Sm(c,{z,fill:Lt,stroke:dt}),Xt=[],et=[],oe=ot&&v([]),wr=z&&$([]),Gi=Lt&&nt([]),x$=dt&&Y([]),gR=e&&f([]),_$=e&&h([]),bR=t&&m([]),w$=t&&y([]),v$=mK(e,t,rt),S$=0;for(let jl of c)jl.initialize(rt);s&&s.initialize(rt),o&&o.initialize(rt);for(let jl of q){let xR=[];for(let xd of c)xd.scope("facet",jl);s&&s.scope("facet",jl),o&&o.scope("facet",jl);for(let[xd,I$]of Ja(jl,Wt))for(let[T$,ky]of Ja(I$,ot))for(let[Wi,bc]of v$(ky))if(!(o&&!o.reduce(Wi,bc))){xR.push(S$++),et.push(i.reduceIndex(Wi,rt,bc)),ot&&oe.push(T$),z&&wr.push(Wt===z?xd:z[(Wi.length>0?Wi:ky)[0]]),Lt&&Gi.push(Wt===Lt?xd:Lt[(Wi.length>0?Wi:ky)[0]]),dt&&x$.push(Wt===dt?xd:dt[(Wi.length>0?Wi:ky)[0]]),gR&&(gR.push(bc.x1),_$.push(bc.x2)),bR&&(bR.push(bc.y1),w$.push(bc.y2));for(let E$ of c)E$.reduce(Wi,bc);s&&s.reduce(Wi)}Xt.push(xR)}return lE(Xt,s,a),{data:et,facets:Xt}}),...!Lo(c,"x")&&(u?{x1:u,x2:d,x:xf(u,d)}:{x:w,x1:A,x2:O}),...!Lo(c,"y")&&(p?{y1:p,y2:g,y:xf(p,g)}:{y:T,y1:F,y2:S}),..._&&{[x]:_},...Object.fromEntries(c.map(({name:rt,output:q})=>[rt,q]))}}function QE({cumulative:e,domain:t,thresholds:n,interval:r,...i},o){return[i,{cumulative:e,domain:t,thresholds:n,interval:r,...o}]}function C_(e,{cumulative:t,domain:n,thresholds:r,interval:i},o){return e={...pi(e)},e.domain===void 0&&(e.domain=n),e.cumulative===void 0&&(e.cumulative=t),e.thresholds===void 0&&(e.thresholds=r),e.interval===void 0&&(e.interval=i),e.value===void 0&&(e.value=o),e.thresholds=KE(e.thresholds,e.interval),e}function fK(e){let{x:t,y:n}=e;return t=C_(t,e),n=C_(n,e),[t.value,n.value]=Be(t.value,n.value),{x:t,y:n}}function w7(e){if(e==null)return;let{value:t,cumulative:n,domain:r=ae,thresholds:i}=e,o=s=>{let a=mt(s,t),c;if(Oe(a)||pK(i)){a=Yt(a,GT,Float64Array);let[u,f]=typeof r=="function"?r(a):r,d=typeof i=="function"&&!Qa(i)?i(a,u,f):i;typeof d=="number"&&(d=qp(u,f,d)),Qa(d)&&(r===ae&&(u=d.floor(u),f=d.offset(d.floor(f))),d=d.range(u,d.offset(f))),c=d}else{a=Qe(a);let[u,f]=typeof r=="function"?r(a):r,d=typeof i=="function"&&!Qa(i)?i(a,u,f):i;if(typeof d=="number")if(r===ae){let h=vs(u,f,d);if(isFinite(h))if(h>0){let p=Math.round(u/h),m=Math.round(f/h);p*h<=u||--p,m*h>f||++m;let g=m-p+1;d=new Float64Array(g);for(let y=0;y<g;++y)d[y]=(p+y)*h}else if(h<0){h=-h;let p=Math.round(u*h),m=Math.round(f*h);p/h<=u||--p,m/h>f||++m;let g=m-p+1;d=new Float64Array(g);for(let y=0;y<g;++y)d[y]=(p+y)/h}else d=[u];else d=[u]}else d=Tn(u,f,d);else Qa(d)&&(r===ae&&(u=d.floor(u),f=d.offset(d.floor(f))),d=d.range(u,d.offset(f)));c=d}let l=[];if(c.length===1)l.push([c[0],c[0]]);else for(let u=1;u<c.length;++u)l.push([c[u-1],c[u]]);return l.bin=(n<0?gK:n>0?yK:JE)(l,c,a),l};return o.label=On(t),o}function KE(e,t,n=v7){if(e===void 0)return t===void 0?n:ko(t);if(typeof e=="string"){switch(e.toLowerCase()){case"freedman-diaconis":return M0;case"scott":return Bh;case"sturges":return Na;case"auto":return v7}return ym(e)}return e}function dK(e,t){return aE(e,t,I7)}function I7(e,t,n){return j1(e,t,n,T7)}function T7(e,t,n){return V1(e,t,n,E7)}function E7(e,t){return Sf(e,t,hK)}function hK(e){switch(`${e}`.toLowerCase()){case"x":return bK;case"x1":return _K;case"x2":return wK;case"y":return xK;case"y1":return vK;case"y2":return SK}throw new Error(`invalid bin reduce: ${e}`)}function v7(e,t,n){return Math.min(200,Bh(e,t,n))}function pK(e){return UC(e)||cr(e)&&Oe(e)}function mK(e,t,n){let r=e?.(n),i=t?.(n);return r&&i?function*(o){let s=r.bin(o);for(let[a,[c,l]]of r.entries()){let u=i.bin(s[a]);for(let[f,[d,h]]of i.entries())yield[u[f],{data:n,x1:c,y1:d,x2:l,y2:h}]}}:r?function*(o){let s=r.bin(o);for(let[a,[c,l]]of r.entries())yield[s[a],{data:n,x1:c,x2:l}]}:function*(o){let s=i.bin(o);for(let[a,[c,l]]of i.entries())yield[s[a],{data:n,y1:c,y2:l}]}}function JE(e,t,n){return t=Qe(t),r=>{let i=e.map(()=>[]);for(let o of r)i[ws(t,n[o])-1]?.push(o);return i}}function yK(e,t,n){let r=JE(e,t,n);return i=>{let o=r(i);for(let s=1,a=o.length;s<a;++s){let c=o[s-1],l=o[s];for(let u of c)l.push(u)}return o}}function gK(e,t,n){let r=JE(e,t,n);return i=>{let o=r(i);for(let s=o.length-2;s>=0;--s){let a=o[s+1],c=o[s];for(let l of a)c.push(l)}return o}}function A7(e,t){let n=(+e+ +t)/2;return e instanceof Date?new Date(n):n}var bK={reduceIndex(e,t,{x1:n,x2:r}){return A7(n,r)}},xK={reduceIndex(e,t,{y1:n,y2:r}){return A7(n,r)}},_K={reduceIndex(e,t,{x1:n}){return n}},wK={reduceIndex(e,t,{x2:n}){return n}},vK={reduceIndex(e,t,{y1:n}){return n}},SK={reduceIndex(e,t,{y2:n}){return n}};function jf(e={}){return XT(e)?e:{...e,x:W}}function Vf(e={}){return HT(e)?e:{...e,y:W}}function M7(e,t){if(t.length===1)return{data:e,facets:t};let n=e.length,r=new Uint8Array(n),i=0;for(let a of t)for(let c of a)r[c]&&++i,r[c]=1;if(i===0)return{data:e,facets:t};e=Za(e);let o=e[jT]=new Uint32Array(n+i);t=t.map(a=>Za(a,Uint32Array));let s=n;r.fill(0);for(let a of t)for(let c=0,l=a.length;c<l;++c){let u=a[c];r[u]?(a[c]=s,e[s]=e[u],o[s]=u,++s):o[u]=u,r[u]=1}return{data:e,facets:t}}function tA(e={},t={}){arguments.length===1&&([e,t]=Wf(e));let{y1:n,y:r=n,x:i,...o}=t,[s,a,c,l]=Xf(r,i,"y","x",e,o);return{...s,y1:n,y:a,x1:c,x2:l,x:xf(c,l)}}function O7(e={},t={}){arguments.length===1&&([e,t]=Wf(e));let{y1:n,y:r=n,x:i}=t,[o,s,a]=Xf(r,i,"y","x",e,t);return{...o,y1:n,y:s,x:a}}function D7(e={},t={}){arguments.length===1&&([e,t]=Wf(e));let{y1:n,y:r=n,x:i}=t,[o,s,,a]=Xf(r,i,"y","x",e,t);return{...o,y1:n,y:s,x:a}}function eA(e={},t={}){arguments.length===1&&([e,t]=Wf(e));let{x1:n,x:r=n,y:i,...o}=t,[s,a,c,l]=Xf(r,i,"x","y",e,o);return{...s,x1:n,x:a,y1:c,y2:l,y:xf(c,l)}}function k7(e={},t={}){arguments.length===1&&([e,t]=Wf(e));let{x1:n,x:r=n,y:i}=t,[o,s,a]=Xf(r,i,"x","y",e,t);return{...o,x1:n,x:s,y:a}}function F7(e={},t={}){arguments.length===1&&([e,t]=Wf(e));let{x1:n,x:r=n,y:i}=t,[o,s,,a]=Xf(r,i,"x","y",e,t);return{...o,x1:n,x:s,y:a}}function Yf({x:e,x1:t,x2:n,...r}={}){return r=ji(r,"y"),t===void 0&&n===void 0?tA({x:e,...r}):([t,n]=ZT(e,t,n),{...r,x1:t,x2:n})}function Gf({y:e,y1:t,y2:n,...r}={}){return r=ji(r,"x"),t===void 0&&n===void 0?eA({y:e,...r}):([t,n]=ZT(e,t,n),{...r,y1:t,y2:n})}function Wf(e){let{offset:t,order:n,reverse:r,...i}=e;return[{offset:t,order:n,reverse:r},i]}var IK={length:!0};function Xf(e,t=gm,n,r,{offset:i,order:o,reverse:s},a){if(t===null)throw new Error(`stack requires ${r}`);let c=qn(a),[l,u]=Rn(e),[f,d]=pn(t),[h,p]=pn(t);return f.hint=h.hint=IK,i=TK(i),o=MK(o,i,r),[mn(a,(m,g,y)=>{({data:m,facets:g}=M7(m,g));let b=e==null?void 0:u(vl(mt(m,e),y?.[n])),x=mt(m,t,Float64Array),_=mt(m,c),v=o&&o(m,b,x,_),w=m.length,T=d(new Float64Array(w)),M=p(new Float64Array(w)),R=[];for(let I of g){let A=b?Array.from(an(I,O=>b[O]).values()):[I];if(v)for(let O of A)O.sort(v);for(let O of A){let F=0,S=0;s&&O.reverse();for(let E of O){let N=x[E];N<0?F=M[E]=(T[E]=F)+N:N>0?S=M[E]=(T[E]=S)+N:M[E]=T[E]=S}}R.push(A)}return i&&i(R,T,M,_),{data:m,facets:g}}),l,f,h]}function TK(e){if(e!=null){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"expand":case"normalize":return EK;case"center":case"silhouette":return AK;case"wiggle":return C7}throw new Error(`unknown offset: ${e}`)}}function L7(e,t){let n=0,r=0;for(let i of e){let o=t[i];o<n&&(n=o),o>r&&(r=o)}return[n,r]}function EK(e,t,n){for(let r of e)for(let i of r){let[o,s]=L7(i,n);for(let a of i){let c=1/(s-o||1);t[a]=c*(t[a]-o),n[a]=c*(n[a]-o)}}}function AK(e,t,n){for(let r of e){for(let i of r){let[o,s]=L7(i,n);for(let a of i){let c=(s+o)/2;t[a]-=c,n[a]-=c}}B7(r,t,n)}P7(e,t,n)}function C7(e,t,n,r){for(let i of e){let o=new Zn,s=0;for(let a of i){let c=-1,l=a.map(h=>Math.abs(n[h]-t[h])),u=a.map(h=>{c=r?r[h]:++c;let p=n[h]-t[h],m=o.has(c)?p-o.get(c):0;return o.set(c,p),m}),f=[0,...S0(u)];for(let h of a)t[h]+=s,n[h]+=s;let d=En(l);d&&(s-=En(l,(h,p)=>(u[p]/2+f[p])*h)/d)}B7(i,t,n)}P7(e,t,n)}function B7(e,t,n){let r=ce(e,i=>ce(i,o=>t[o]));for(let i of e)for(let o of i)t[o]-=r,n[o]-=r}function P7(e,t,n){let r=e.length;if(r===1)return;let i=e.map(a=>a.flat()),o=i.map(a=>(ce(a,c=>t[c])+Gt(a,c=>n[c]))/2),s=ce(o);for(let a=0;a<r;a++){let c=s-o[a];for(let l of i[a])t[l]+=c,n[l]+=c}}function MK(e,t,n){if(e===void 0&&t===C7)return N7(fn);if(e!=null){if(typeof e=="string"){let r=e.startsWith("-"),i=r?xl:fn;switch((r?e.slice(1):e).toLowerCase()){case"value":case n:return NK(i);case"z":return RK(i);case"sum":return OK(i);case"appearance":return DK(i);case"inside-out":return N7(i)}return R7(VT(e))}if(typeof e=="function")return(e.length===1?R7:kK)(e);if(Array.isArray(e))return FK(e);throw new Error(`invalid order: ${e}`)}}function NK(e){return(t,n,r)=>(i,o)=>e(r[i],r[o])}function RK(e){return(t,n,r,i)=>(o,s)=>e(i[o],i[s])}function OK(e){return B_(e,(t,n,r,i)=>_u(ar(t),o=>En(o,s=>r[s]),o=>i[o]))}function DK(e){return B_(e,(t,n,r,i)=>_u(ar(t),o=>n[Yc(o,s=>r[s])],o=>i[o]))}function N7(e){return B_(e,(t,n,r,i)=>{let o=ar(t),s=_u(o,f=>n[Yc(f,d=>r[d])],f=>i[f]),a=Ci(o,f=>En(f,d=>r[d]),f=>i[f]),c=[],l=[],u=0;for(let f of s)u<0?(u+=a.get(f),c.push(f)):(u-=a.get(f),l.push(f));return l.reverse().concat(c)})}function R7(e){return t=>{let n=mt(t,e);return(r,i)=>fn(n[r],n[i])}}function kK(e){return t=>(n,r)=>e(t[n],t[r])}function FK(e){return B_(fn,()=>e)}function B_(e,t){return(n,r,i,o)=>{if(!o)throw new Error("missing channel: z");let s=new Zn(t(n,r,i,o).map((a,c)=>[a,c]));return(a,c)=>e(s.get(o[a]),s.get(o[c]))}}var LK={ariaLabel:"area",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Fl=class extends wt{constructor(t,n={}){let{x1:r,y1:i,x2:o,y2:s,z:a,curve:c,tension:l}=n;super(t,{x1:{value:r,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0},z:{value:qn(n),optional:!0}},n,LK),this.z=a,this.curve=$m(c,l)}filter(t){return t}render(t,n,r,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a}=r;return ct("svg:g",o).call(Ft,this,i,o).call(It,this,n,0,0).call(u=>u.selectAll().data(Q1(t,[s,a,c,l],this,r)).enter().append("path").call(Rt,this).call(El,this,r).attr("d",sf().curve(this.curve).defined(f=>f>=0).x0(f=>s[f]).y0(f=>a[f]).x1(f=>c[f]).y1(f=>l[f]))).node()}};function Um(e,t){return t===void 0?ea(e,{x:Vs,y:Ha}):new Fl(e,t)}function cc(e,t){let{y:n=Ae,...r}=qf(t);return new Fl(e,Yf(jf({...r,y1:n,y2:void 0})))}function ea(e,t){let{x:n=Ae,...r}=zf(t);return new Fl(e,Gf(Vf({...r,x1:n,x2:void 0})))}var CK={ariaLabel:"link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},zm=class extends wt{constructor(t,n={}){let{x1:r,y1:i,x2:o,y2:s,curve:a,tension:c}=n;super(t,{x1:{value:r,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},n,CK),this.curve=L_(a,c),Vi(this,n)}project(t,n,r){this.curve!==ac&&super.project(t,n,r)}render(t,n,r,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a}=r,{curve:u}=this;return ct("svg:g",o).call(Ft,this,i,o).call(It,this,n).call(f=>f.selectAll().data(t).enter().append("path").call(Rt,this).attr("d",u===ac&&o.projection?BK(o.projection,s,a,c,l):d=>{let h=er(),p=u(h);return p.lineStart(),p.point(s[d],a[d]),p.point(c[d],l[d]),p.lineEnd(),h}).call(Zt,this,r).call(Js,this,r,o)).node()}};function BK(e,t,n,r,i){let o=Mn(e);return t=Qe(t),n=Qe(n),r=Qe(r),i=Qe(i),s=>o({type:"LineString",coordinates:[[t[s],n[s]],[r[s],i[s]]]})}function P_(e,{x:t,x1:n,x2:r,y:i,y1:o,y2:s,...a}={}){return[n,r]=qm(t,n,r),[o,s]=qm(i,o,s),new zm(e,{...a,x1:n,x2:r,y1:o,y2:s})}function qm(e,t,n){if(e===void 0){if(t===void 0){if(n!==void 0)return[n]}else if(n===void 0)return[t]}else{if(t===void 0)return n===void 0?[e]:[e,n];if(n===void 0)return[e,t]}return[t,n]}var PK={ariaLabel:"arrow",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:1,strokeWidth:1.5},jm=class extends wt{constructor(t,n={}){let{x1:r,y1:i,x2:o,y2:s,bend:a=0,headAngle:c=60,headLength:l=8,inset:u=0,insetStart:f=u,insetEnd:d=u,sweep:h}=n;super(t,{x1:{value:r,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},n,PK),this.bend=a===!0?22.5:Math.max(-90,Math.min(90,a)),this.headAngle=+c,this.headLength=+l,this.insetStart=+f,this.insetEnd=+d,this.sweep=$K(h)}render(t,n,r,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a,SW:u}=r,{strokeWidth:f,bend:d,headAngle:h,headLength:p,insetStart:m,insetEnd:g}=this,y=u?_=>u[_]:dn(f===void 0?1:f),b=h*Bf/2,x=p/1.5;return ct("svg:g",o).call(Ft,this,i,o).call(It,this,n).call(_=>_.selectAll().data(t).enter().append("path").call(Rt,this).attr("d",v=>{let w=s[v],T=a[v],M=c[v],R=l[v],I=Math.hypot(M-w,R-T);if(I<=m+g)return null;let A=Math.atan2(R-T,M-w),O=Math.min(x*y(v),I/3),F=this.sweep(w,T,M,R)*d*Bf,S=Math.hypot(I/Math.tan(F),I)/2;if(m||g)if(S<1e5){let tt=Math.sign(F),[nt,st]=UK([w,T],[M,R],S,tt);if(m&&([w,T]=$7([nt,st,S],[w,T,m],-tt*Math.sign(m))),g){let[Y,rt]=$7([nt,st,S],[M,R,g],tt*Math.sign(g));A+=Math.atan2(rt-st,Y-nt)-Math.atan2(R-st,M-nt),M=Y,R=rt}}else{let tt=M-w,nt=R-T,st=Math.hypot(tt,nt);m&&(w+=tt/st*m,T+=nt/st*m),g&&(M-=tt/st*g,R-=nt/st*g)}let E=A+F,N=E+b,L=E-b,B=M-O*Math.cos(N),C=R-O*Math.sin(N),P=M-O*Math.cos(L),$=R-O*Math.sin(L),U=S<1e5?`A${S},${S} 0,0,${F>0?1:0} `:"L",X=O?`M${B},${C}L${M},${R}L${P},${$}`:"";return`M${w},${T}${U}${M},${R}${X}`}).call(Zt,this,r)).node()}};function $K(e=1){if(typeof e=="number")return dn(Math.sign(e));if(typeof e=="function")return(t,n,r,i)=>Math.sign(e(t,n,r,i));switch(Ke(e,"sweep",["+x","-x","+y","-y"])){case"+x":return(t,n,r)=>Ut(t,r);case"-x":return(t,n,r)=>Hn(t,r);case"+y":return(t,n,r,i)=>Ut(n,i);case"-y":return(t,n,r,i)=>Hn(n,i)}}function UK([e,t],[n,r],i,o){let s=n-e,a=r-t,c=Math.hypot(s,a),l=o*Math.sqrt(i*i-c*c/4)/c;return[(e+n)/2-a*l,(t+r)/2+s*l]}function $7([e,t,n],[r,i,o],s){let a=r-e,c=i-t,l=Math.hypot(a,c),u=(a*a+c*c-o*o+n*n)/(2*l),f=s*Math.sqrt(n*n-u*u);return[e+(a*u+c*f)/l,t+(c*u-a*f)/l]}function U7(e,{x:t,x1:n,x2:r,y:i,y1:o,y2:s,...a}={}){return[n,r]=qm(t,n,r),[o,s]=qm(i,o,s),new jm(e,{...a,x1:n,x2:r,y1:o,y2:s})}var Hf=class extends wt{constructor(t,n,r={},i){super(t,n,r,i);let{inset:o=0,insetTop:s=o,insetRight:a=o,insetBottom:c=o,insetLeft:l=o,rx:u,ry:f}=r;this.insetTop=Nt(s),this.insetRight=Nt(a),this.insetBottom=Nt(c),this.insetLeft=Nt(l),this.rx=le(u,"auto"),this.ry=le(f,"auto")}render(t,n,r,i,o){let{rx:s,ry:a}=this;return ct("svg:g",o).call(Ft,this,i,o).call(this._transform,this,n).call(c=>c.selectAll().data(t).enter().append("rect").call(Rt,this).attr("x",this._x(n,r,i)).attr("width",this._width(n,r,i)).attr("y",this._y(n,r,i)).attr("height",this._height(n,r,i)).call(ft,"rx",s).call(ft,"ry",a).call(Zt,this,r)).node()}_x(t,{x:n},{marginLeft:r}){let{insetLeft:i}=this;return n?o=>n[o]+i:r+i}_y(t,{y:n},{marginTop:r}){let{insetTop:i}=this;return n?o=>n[o]+i:r+i}_width({x:t},{x:n},{marginRight:r,marginLeft:i,width:o}){let{insetLeft:s,insetRight:a}=this,c=n&&t?t.bandwidth():o-r-i;return Math.max(0,c-s-a)}_height({y:t},{y:n},{marginTop:r,marginBottom:i,height:o}){let{insetTop:s,insetBottom:a}=this,c=n&&t?t.bandwidth():o-r-i;return Math.max(0,c-s-a)}},z7={ariaLabel:"bar"},Vm=class extends Hf{constructor(t,n={}){let{x1:r,x2:i,y:o}=n;super(t,{x1:{value:r,scale:"x"},x2:{value:i,scale:"x"},y:{value:o,scale:"y",type:"band",optional:!0}},n,z7)}_transform(t,n,{x:r}){t.call(It,n,{x:r},0,0)}_x({x:t},{x1:n,x2:r},{marginLeft:i}){let{insetLeft:o}=this;return lr(t)?i+o:s=>Math.min(n[s],r[s])+o}_width({x:t},{x1:n,x2:r},{marginRight:i,marginLeft:o,width:s}){let{insetLeft:a,insetRight:c}=this;return lr(t)?s-i-o-a-c:l=>Math.max(0,Math.abs(r[l]-n[l])-a-c)}},Ym=class extends Hf{constructor(t,n={}){let{x:r,y1:i,y2:o}=n;super(t,{y1:{value:i,scale:"y"},y2:{value:o,scale:"y"},x:{value:r,scale:"x",type:"band",optional:!0}},n,z7)}_transform(t,n,{y:r}){t.call(It,n,{y:r},0,0)}_y({y:t},{y1:n,y2:r},{marginTop:i}){let{insetTop:o}=this;return lr(t)?i+o:s=>Math.min(n[s],r[s])+o}_height({y:t},{y1:n,y2:r},{marginTop:i,marginBottom:o,height:s}){let{insetTop:a,insetBottom:c}=this;return lr(t)?s-i-o-a-c:l=>Math.max(0,Math.abs(r[l]-n[l])-a-c)}};function Uo(e,t={}){return gf(t)||(t={...t,y:Ae,x2:W}),new Vm(e,Yf(d_(jf(t))))}function zo(e,t={}){return gf(t)||(t={...t,x:Ae,y2:W}),new Ym(e,Gf(h_(Vf(t))))}var zK={ariaLabel:"cell"},Ll=class extends Hf{constructor(t,{x:n,y:r,...i}={}){super(t,{x:{value:n,scale:"x",type:"band",optional:!0},y:{value:r,scale:"y",type:"band",optional:!0}},i,zK)}_transform(t,n){t.call(It,n,{},0,0)}};function lc(e,{x:t,y:n,...r}={}){return[t,n]=Be(t,n),new Ll(e,{...r,x:t,y:n})}function q7(e,{x:t=Ae,fill:n,stroke:r,...i}={}){return n===void 0&&Re(r)[0]===void 0&&(n=W),new Ll(e,{...i,x:t,fill:n,stroke:r})}function j7(e,{y:t=Ae,fill:n,stroke:r,...i}={}){return n===void 0&&Re(r)[0]===void 0&&(n=W),new Ll(e,{...i,y:t,fill:n,stroke:r})}var qK={ariaLabel:"dot",fill:"none",stroke:"currentColor",strokeWidth:1.5};function Gm(e){return e.sort===void 0&&e.reverse===void 0?z1({channel:"-r"},e):e}var Cl=class extends wt{constructor(t,n={}){let{x:r,y:i,r:o,rotate:s,symbol:a=zs,frameAnchor:c}=n,[l,u]=ie(s,0),[f,d]=KC(a),[h,p]=ie(o,f==null?3:4.5);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:h,scale:"r",filter:sr,optional:!0},rotate:{value:l,optional:!0},symbol:{value:f,scale:"auto",optional:!0}},Gm(n),qK),this.r=p,this.rotate=u,this.symbol=d,this.frameAnchor=Fo(c);let{channels:m}=this,{symbol:g}=m;if(g){let{fill:y,stroke:b}=m;g.hint={fill:y?y.value===g.value?"color":"currentColor":this.fill??"currentColor",stroke:b?b.value===g.value?"color":"currentColor":this.stroke??"none"}}}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,r:u,rotate:f,symbol:d}=r,{r:h,rotate:p,symbol:m}=this,[g,y]=yn(this,i),b=m===zs,x=u?void 0:h*h*Math.PI;return Va(h)&&(t=[]),ct("svg:g",o).call(Ft,this,i,o).call(It,this,{x:c&&s,y:l&&a}).call(_=>_.selectAll().data(t).enter().append(b?"circle":"path").call(Rt,this).call(b?v=>{v.attr("cx",c?w=>c[w]:g).attr("cy",l?w=>l[w]:y).attr("r",u?w=>u[w]:h)}:v=>{v.attr("transform",oc`translate(${c?w=>c[w]:g},${l?w=>l[w]:y})${f?w=>` rotate(${f[w]})`:p?` rotate(${p})`:""}`).attr("d",u&&d?w=>{let T=er();return d[w].draw(T,u[w]*u[w]*Math.PI),T}:u?w=>{let T=er();return m.draw(T,u[w]*u[w]*Math.PI),T}:d?w=>{let T=er();return d[w].draw(T,x),T}:(()=>{let w=er();return m.draw(w,x),w})())}).call(Zt,this,r)).node()}};function yi(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Be(t,n)),new Cl(e,{...r,x:t,y:n})}function V7(e,{x:t=W,...n}={}){return new Cl(e,m_({...n,x:t}))}function Y7(e,{y:t=W,...n}={}){return new Cl(e,p_({...n,y:t}))}function G7(e,t){return yi(e,{...t,symbol:"circle"})}function W7(e,t){return yi(e,{...t,symbol:"hexagon"})}var jK={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Bl=class extends wt{constructor(t,n={}){let{x:r,y:i,z:o,curve:s,tension:a}=n;super(t,{x:{value:r,scale:"x"},y:{value:i,scale:"y"},z:{value:qn(n),optional:!0}},n,jK),this.z=o,this.curve=L_(s,a),Vi(this,n)}filter(t){return t}project(t,n,r){this.curve!==ac&&super.project(t,n,r)}render(t,n,r,i,o){let{x:s,y:a}=r,{curve:c}=this;return ct("svg:g",o).call(Ft,this,i,o).call(It,this,n).call(l=>l.selectAll().data(Q1(t,[s,a],this,r)).enter().append("path").call(Rt,this).call(El,this,r).call(IB,this,r,o).attr("d",c===ac&&o.projection?VK(o.projection,s,a):Qp().curve(c).defined(u=>u>=0).x(u=>s[u]).y(u=>a[u]))).node()}};function VK(e,t,n){let r=Mn(e);return t=Qe(t),n=Qe(n),i=>{let o=[],s=[o];for(let a of i)a===-1?(o=[],s.push(o)):o.push([t[a],n[a]]);return r({type:"MultiLineString",coordinates:s})}}function Pl(e,{x:t,y:n,...r}={}){return[t,n]=Be(t,n),new Bl(e,{...r,x:t,y:n})}function uc(e,{x:t=W,y:n=Ae,...r}={}){return new Bl(e,qf({...r,x:t,y:n}))}function fc(e,{x:t=Ae,y:n=W,...r}={}){return new Bl(e,zf({...r,x:t,y:n}))}var YK={ariaLabel:"rect"},$l=class extends wt{constructor(t,n={}){let{x1:r,y1:i,x2:o,y2:s,inset:a=0,insetTop:c=a,insetRight:l=a,insetBottom:u=a,insetLeft:f=a,rx:d,ry:h}=n;super(t,{x1:{value:r,scale:"x",type:r!=null&&o==null?"band":void 0,optional:!0},y1:{value:i,scale:"y",type:i!=null&&s==null?"band":void 0,optional:!0},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},n,YK),this.insetTop=Nt(c),this.insetRight=Nt(l),this.insetBottom=Nt(u),this.insetLeft=Nt(f),this.rx=le(d,"auto"),this.ry=le(h,"auto")}render(t,n,r,i,o){let{x:s,y:a}=n,{x1:c,y1:l,x2:u,y2:f}=r,{marginTop:d,marginRight:h,marginBottom:p,marginLeft:m,width:g,height:y}=i,{projection:b}=o,{insetTop:x,insetRight:_,insetBottom:v,insetLeft:w,rx:T,ry:M}=this,R=(s?.bandwidth?s.bandwidth():0)-w-_,I=(a?.bandwidth?a.bandwidth():0)-x-v;return ct("svg:g",o).call(Ft,this,i,o).call(It,this,{},0,0).call(A=>A.selectAll().data(t).enter().append("rect").call(Rt,this).attr("x",c&&(b||!lr(s))?u?O=>Math.min(c[O],u[O])+w:O=>c[O]+w:m+w).attr("y",l&&(b||!lr(a))?f?O=>Math.min(l[O],f[O])+x:O=>l[O]+x:d+x).attr("width",c&&(b||!lr(s))?u?O=>Math.max(0,Math.abs(u[O]-c[O])+R):R:g-h-m-_-w).attr("height",l&&(b||!lr(a))?f?O=>Math.max(0,Math.abs(l[O]-f[O])+I):I:y-d-p-x-v).call(ft,"rx",T).call(ft,"ry",M).call(Zt,this,r)).node()}};function Wm(e,t){return new $l(e,CE(BE(t)))}function Zf(e,t={}){return gf(t)||(t={...t,y:Ae,x2:W,interval:1}),new $l(e,Yf(BE(jf(t))))}function Qf(e,t={}){return gf(t)||(t={...t,x:Ae,y2:W,interval:1}),new $l(e,Gf(CE(Vf(t))))}function rA(e,t){t=GK(t);let{x:n,y:r,color:i,size:o}=t,s=$_(e,n),a=$_(e,r),c=$_(e,i),l=$_(e,o),{fx:u,fy:f,x:{value:d,reduce:h,zero:p,...m},y:{value:g,reduce:y,zero:b,...x},color:{value:_,color:v,reduce:w},size:{value:T,reduce:M},mark:R}=t;if(h===void 0&&(h=y==null&&d==null&&T==null&&g!=null?"count":null),y===void 0&&(y=h==null&&g==null&&T==null&&d!=null?"count":null),M===void 0&&T==null&&w==null&&h==null&&y==null&&(d==null||Me(s))&&(g==null||Me(a))&&(M="count"),p===void 0&&(p=U_(h)?!0:void 0),b===void 0&&(b=U_(y)?!0:void 0),d==null&&g==null)throw new Error("must specify x or y");if(h!=null&&g==null)throw new Error("reducing x requires y");if(y!=null&&d==null)throw new Error("reducing y requires x");R===void 0&&(R=T!=null||M!=null?"dot":U_(h)||U_(y)||w!=null?"bar":d!=null&&g!=null?Me(s)||Me(a)||h==null&&y==null&&!Xm(s)&&!Xm(a)?"dot":"line":d!=null||g!=null?"rule":null);let I,A,O;switch(R){case"dot":O=yi,A="stroke";break;case"line":O=s&&a||h!=null||y!=null?b||y!=null||s&&Xm(s)?fc:p||h!=null||a&&Xm(a)?uc:Pl:s?uc:fc,A="stroke",H7(c)&&(I=null);break;case"area":O=!(b||y!=null)&&(p||h!=null||a&&Xm(a))?cc:ea,A="fill",H7(c)&&(I=null);break;case"rule":O=s?jr:Vr,A="stroke";break;case"bar":O=h!=null?Me(a)?X7(h)&&s&&Me(s)?lc:Uo:Zf:y!=null?Me(s)?X7(y)&&a&&Me(a)?lc:zo:Qf:w!=null||M!=null?s&&Me(s)&&a&&Me(a)?lc:s&&Me(s)?zo:a&&Me(a)?Uo:Wm:s&&Ws(s)&&!(a&&Ws(a))?Uo:a&&Ws(a)&&!(s&&Ws(s))?zo:lc,A="fill";break;default:throw new Error(`invalid mark: ${R}`)}let F={fx:u,fy:f,x:s??void 0,y:a??void 0,[A]:c??v,z:I,r:l??void 0,tip:!0},S,E={[A]:w??void 0,r:M??void 0};if(h!=null&&y!=null)throw new Error("cannot reduce both x and y");return y!=null?(E.y=y,S=Me(s)?tc:Po):h!=null?(E.x=h,S=Me(a)?ec:$o):(w!=null||M!=null)&&(s&&a?S=Me(s)&&Me(a)?vm:Me(s)?$o:Me(a)?Po:ta:s?S=Me(s)?tc:Po:a&&(S=Me(a)?ec:$o)),(S===ta||S===Po)&&(F.x={value:s,...m}),(S===ta||S===$o)&&(F.y={value:a,...x}),p===void 0&&(p=s&&!(S===ta||S===Po)&&(O===Uo||O===cc||O===Zf||O===Vr)),b===void 0&&(b=a&&!(S===ta||S===$o)&&(O===zo||O===ea||O===Qf||O===jr)),{fx:u??null,fy:f??null,x:{value:d??null,reduce:h??null,zero:!!p,...m},y:{value:g??null,reduce:y??null,zero:!!b,...x},color:{value:_??null,reduce:w??null,...v!==void 0&&{color:v}},size:{value:T??null,reduce:M??null},mark:R,markImpl:Z7[O],markOptions:F,transformImpl:Z7[S],transformOptions:E,colorMode:A}}function Q7(e,t){let n=rA(e,t),{fx:r,fy:i,x:{zero:o},y:{zero:s},markOptions:a,transformOptions:c,colorMode:l}=n,u=nA[n.markImpl],f=nA[n.transformImpl],d=r!=null||i!=null?Uf({strokeOpacity:.1}):null,h=[o?jr([0]):null,s?Vr([0]):null],p=u(e,f?f(c,a):a);return l==="stroke"?Je(d,h,p):Je(d,p,h)}function Xm(e){let t,n;for(let r of e){if(r==null)continue;if(t===void 0){t=r;continue}let i=Math.sign(Ut(t,r));if(i){if(n!==void 0&&i!==n)return!1;t=r,n=i}}return!0}function GK({x:e,y:t,color:n,size:r,fx:i,fy:o,mark:s}={}){return zr(e)||(e=Kf(e)),zr(t)||(t=Kf(t)),zr(n)||(n=Ka(n)?{color:n}:Kf(n)),zr(r)||(r=Kf(r)),zr(i)&&({value:i}=Kf(i)),zr(o)&&({value:o}=Kf(o)),s!=null&&(s=`${s}`.toLowerCase()),{x:e,y:t,color:n,size:r,fx:i,fy:o,mark:s}}function $_(e,t){let n=mt(e,t.value);return n&&(n.label=On(t.value)),n}function Kf(e){return WK(e)?{reduce:e}:{value:e}}function U_(e){return/^(?:distinct|count|sum|proportion)$/i.test(e)}function X7(e){return/^(?:first|last|mode)$/i.test(e)}function WK(e){if(e==null)return!1;if(typeof e.reduceIndex=="function"||typeof e.reduce=="function"&&hn(e)||/^p\d{2}$/i.test(e))return!0;switch(`${e}`.toLowerCase()){case"first":case"last":case"count":case"distinct":case"sum":case"proportion":case"proportion-facet":case"deviation":case"min":case"min-index":case"max":case"max-index":case"mean":case"median":case"variance":case"mode":return!0}return!1}function H7(e){return e?new Qn(e).size>e.length>>1:!1}var nA={dot:yi,line:Pl,lineX:uc,lineY:fc,areaX:cc,areaY:ea,ruleX:jr,ruleY:Vr,barX:Uo,barY:zo,rect:Wm,rectX:Zf,rectY:Qf,cell:lc,bin:ta,binX:Po,binY:$o,group:vm,groupX:tc,groupY:ec},Z7=Object.fromEntries(Object.entries(nA).map(([e,t])=>[t,e]));function Jf(e,t={}){let{x:n,x1:r,x2:i}=t;n===void 0&&r===void 0&&i===void 0&&(t={...t,x:n=W});let o={};return n!=null&&(o.x=e),r!=null&&(o.x1=e),i!=null&&(o.x2=e),_r(o,t)}function td(e,t={}){let{y:n,y1:r,y2:i}=t;n===void 0&&r===void 0&&i===void 0&&(t={...t,y:n=W});let o={};return n!=null&&(o.y=e),r!=null&&(o.y1=e),i!=null&&(o.y2=e),_r(o,t)}function _r(e={},t={}){let n=qn(t),r=Object.entries(e).map(([i,o])=>{let s=C1(i,t);if(s==null)throw new Error(`missing channel: ${i}`);let[a,c]=pn(s);return{key:i,input:s,output:a,setOutput:c,map:XK(o)}});return{...mn(t,(i,o)=>{let s=mt(i,n),a=r.map(({input:l})=>mt(i,l)),c=r.map(({setOutput:l})=>l(new Array(i.length)));for(let l of o)for(let u of s?an(l,f=>s[f]).values():[l])r.forEach(({map:f},d)=>f.mapIndex(u,a[d],c[d]));return{data:i,facets:o}}),...Object.fromEntries(r.map(({key:i,output:o})=>[i,o]))}}function XK(e){if(e==null)throw new Error("missing map");if(typeof e.mapIndex=="function")return e;if(typeof e.map=="function"&&hn(e))return HK(e);if(typeof e=="function")return iA(bf(e));switch(`${e}`.toLowerCase()){case"cumsum":return QK;case"rank":return iA((t,n)=>Ph(t,r=>n[r]));case"quantile":return iA((t,n)=>ZK(t,r=>n[r]))}throw new Error(`invalid map: ${e}`)}function HK(e){return console.warn("deprecated map interface; implement mapIndex instead."),{mapIndex:e.map.bind(e)}}function ZK(e,t){let n=lo(e,t)-1;return Ph(e,t).map(r=>r/n)}function iA(e){return{mapIndex(t,n,r){let i=e(t,n);if(i.length!==t.length)throw new Error("map function returned a mismatched length");for(let o=0,s=t.length;o<s;++o)r[t[o]]=i[o]}}}var QK={mapIndex(e,t,n){let r=0;for(let i of e)n[i]=r+=t[i]}};function K7(e={},t){return arguments.length===1&&(t=e),Jf(ed(e),t)}function J7(e={},t){return arguments.length===1&&(t=e),td(ed(e),t)}function ed(e={}){typeof e=="number"&&(e={k:e});let{k:t,reduce:n,shift:r,anchor:i,strict:o}=e;if(i===void 0&&r!==void 0&&(i=JK(r),jn(`Warning: the shift option is deprecated; please use anchor "${i}" instead.`)),!((t=Math.floor(t))>0))throw new Error(`invalid k: ${t}`);return tJ(n)(t,KK(i,t),o)}function KK(e="middle",t){switch(`${e}`.toLowerCase()){case"middle":return t-1>>1;case"start":return 0;case"end":return t-1}throw new Error(`invalid anchor: ${e}`)}function JK(e){switch(`${e}`.toLowerCase()){case"centered":return"middle";case"leading":return"start";case"trailing":return"end"}throw new Error(`invalid shift: ${e}`)}function tJ(e="mean"){if(typeof e=="string"){if(/^p\d{2}$/i.test(e))return z_(yf(e));switch(e.toLowerCase()){case"deviation":return z_(ri);case"max":return q_((t,n)=>Gt(t,r=>n[r]));case"mean":return eJ;case"median":return z_(Bi);case"min":return q_((t,n)=>ce(t,r=>n[r]));case"mode":return q_((t,n)=>Iu(t,r=>n[r]));case"sum":return tP;case"variance":return z_(Ma);case"difference":return iJ;case"ratio":return oJ;case"first":return sJ;case"last":return aJ}}if(typeof e!="function")throw new Error(`invalid reduce: ${e}`);return q_(bf(e))}function z_(e){return(t,n,r)=>r?{mapIndex(i,o,s){let a=l=>o[l]==null?NaN:+o[l],c=0;for(let l=0;l<t-1;++l)isNaN(a(l))&&++c;for(let l=0,u=i.length-t+1;l<u;++l)isNaN(a(l+t-1))&&++c,s[i[l+n]]=c===0?e(Ys(i,l,l+t),a):NaN,isNaN(a(l))&&--c}}:{mapIndex(i,o,s){let a=c=>o[c]==null?NaN:+o[c];for(let c=-n;c<0;++c)s[i[c+n]]=e(Ys(i,0,c+t),a);for(let c=0,l=i.length-n;c<l;++c)s[i[c+n]]=e(Ys(i,c,c+t),a)}}}function q_(e){return(t,n,r)=>r?{mapIndex(i,o,s){let a=0;for(let c=0;c<t-1;++c)a+=Ue(o[i[c]]);for(let c=0,l=i.length-t+1;c<l;++c)a+=Ue(o[i[c+t-1]]),a===t&&(s[i[c+n]]=e(Ys(i,c,c+t),o)),a-=Ue(o[i[c]])}}:{mapIndex(i,o,s){for(let a=-n;a<0;++a)s[i[a+n]]=e(Ys(i,0,a+t),o);for(let a=0,c=i.length-n;a<c;++a)s[i[a+n]]=e(Ys(i,a,a+t),o)}}}function tP(e,t,n){return n?{mapIndex(r,i,o){let s=0,a=0;for(let c=0;c<e-1;++c){let l=i[r[c]];l===null||isNaN(l)?++s:a+=+l}for(let c=0,l=r.length-e+1;c<l;++c){let u=i[r[c]],f=i[r[c+e-1]];f===null||isNaN(f)?++s:a+=+f,o[r[c+t]]=s===0?a:NaN,u===null||isNaN(u)?--s:a-=+u}}}:{mapIndex(r,i,o){let s=0,a=r.length;for(let c=0,l=Math.min(a,e-t-1);c<l;++c)s+=+i[r[c]]||0;for(let c=-t,l=a-t;c<l;++c)s+=+i[r[c+e-1]]||0,o[r[c+t]]=s,s-=+i[r[c]]||0}}}function eJ(e,t,n){if(n){let r=tP(e,t,n);return{mapIndex(i,o,s){r.mapIndex(i,o,s);for(let a=0,c=i.length-e+1;a<c;++a)s[i[a+t]]/=e}}}else return{mapIndex(r,i,o){let s=0,a=0,c=r.length;for(let l=0,u=Math.min(c,e-t-1);l<u;++l){let f=i[r[l]];f!==null&&!isNaN(f=+f)&&(s+=f,++a)}for(let l=-t,u=c-t;l<u;++l){let f=i[r[l+e-1]],d=i[r[l]];f!==null&&!isNaN(f=+f)&&(s+=f,++a),o[r[l+t]]=s/a,d!==null&&!isNaN(d=+d)&&(s-=d,--a)}}}}function nJ(e,t,n,r){for(let i=n+r;n<i;++n){let o=e[t[n]];if(Ue(o))return o}}function rJ(e,t,n,r){for(let i=n+r-1;i>=n;--i){let o=e[t[i]];if(Ue(o))return o}}function eP(e,t,n,r){for(let i=n+r;n<i;++n){let o=e[t[n]];if(o!==null&&!isNaN(o=+o))return o}}function nP(e,t,n,r){for(let i=n+r-1;i>=n;--i){let o=e[t[i]];if(o!==null&&!isNaN(o=+o))return o}}function iJ(e,t,n){return n?{mapIndex(r,i,o){for(let s=0,a=r.length-e;s<a;++s){let c=i[r[s]],l=i[r[s+e-1]];o[r[s+t]]=c===null||l===null?NaN:l-c}}}:{mapIndex(r,i,o){for(let s=-t,a=r.length-e+t+1;s<a;++s)o[r[s+t]]=nP(i,r,s,e)-eP(i,r,s,e)}}}function oJ(e,t,n){return n?{mapIndex(r,i,o){for(let s=0,a=r.length-e;s<a;++s){let c=i[r[s]],l=i[r[s+e-1]];o[r[s+t]]=c===null||l===null?NaN:l/c}}}:{mapIndex(r,i,o){for(let s=-t,a=r.length-e+t+1;s<a;++s)o[r[s+t]]=nP(i,r,s,e)/eP(i,r,s,e)}}}function sJ(e,t,n){return n?{mapIndex(r,i,o){for(let s=0,a=r.length-e;s<a;++s)o[r[s+t]]=i[r[s]]}}:{mapIndex(r,i,o){for(let s=-t,a=r.length-e+t+1;s<a;++s)o[r[s+t]]=nJ(i,r,s,e)}}}function aJ(e,t,n){return n?{mapIndex(r,i,o){for(let s=0,a=r.length-e;s<a;++s)o[r[s+t]]=i[r[s+e-1]]}}:{mapIndex(r,i,o){for(let s=-t,a=r.length-e+t+1;s<a;++s)o[r[s+t]]=rJ(i,r,s,e)}}}var na={n:20,k:2,color:"currentColor",opacity:.2,strict:!0,anchor:"end"};function rP(e,{x:t=W,y:n,k:r=na.k,color:i=na.color,opacity:o=na.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return Je(ne(s)?null:cc(e,_r({x1:dc({k:-r,...f}),x2:dc({k:r,...f})},{x1:t,x2:t,y:n,fill:s,fillOpacity:a,...f})),ne(c)?null:uc(e,_r({x:dc(f)},{x:t,y:n,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function iP(e,{x:t,y:n=W,k:r=na.k,color:i=na.color,opacity:o=na.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return Je(ne(s)?null:ea(e,_r({y1:dc({k:-r,...f}),y2:dc({k:r,...f})},{x:t,y1:n,y2:n,fill:s,fillOpacity:a,...f})),ne(c)?null:fc(e,_r({y:dc(f)},{x:t,y:n,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function dc({n:e=na.n,k:t=0,strict:n=na.strict,anchor:r=na.anchor}={}){return ed({k:e,reduce:i=>Ss(i)+t*(ri(i)||0),strict:n,anchor:r})}var cJ={ariaLabel:"tick",fill:null,stroke:"currentColor"},j_=class extends wt{constructor(t,n,r){super(t,n,r,cJ),Vi(this,r)}render(t,n,r,i,o){return ct("svg:g",o).call(Ft,this,i,o).call(this._transform,this,n).call(s=>s.selectAll().data(t).enter().append("line").call(Rt,this).attr("x1",this._x1(n,r,i)).attr("x2",this._x2(n,r,i)).attr("y1",this._y1(n,r,i)).attr("y2",this._y2(n,r,i)).call(Zt,this,r).call(Js,this,r,o)).node()}},Hm=class extends j_{constructor(t,n={}){let{x:r,y:i,inset:o=0,insetTop:s=o,insetBottom:a=o}=n;super(t,{x:{value:r,scale:"x"},y:{value:i,scale:"y",type:"band",optional:!0}},n),this.insetTop=Nt(s),this.insetBottom=Nt(a)}_transform(t,n,{x:r}){t.call(It,n,{x:r},De,0)}_x1(t,{x:n}){return r=>n[r]}_x2(t,{x:n}){return r=>n[r]}_y1({y:t},{y:n},{marginTop:r}){let{insetTop:i}=this;return n&&t?o=>n[o]+i:r+i}_y2({y:t},{y:n},{height:r,marginBottom:i}){let{insetBottom:o}=this;return n&&t?s=>n[s]+t.bandwidth()-o:r-i-o}},Zm=class extends j_{constructor(t,n={}){let{x:r,y:i,inset:o=0,insetRight:s=o,insetLeft:a=o}=n;super(t,{y:{value:i,scale:"y"},x:{value:r,scale:"x",type:"band",optional:!0}},n),this.insetRight=Nt(s),this.insetLeft=Nt(a)}_transform(t,n,{y:r}){t.call(It,n,{y:r},0,De)}_x1({x:t},{x:n},{marginLeft:r}){let{insetLeft:i}=this;return n&&t?o=>n[o]+i:r+i}_x2({x:t},{x:n},{width:r,marginRight:i}){let{insetRight:o}=this;return n&&t?s=>n[s]+t.bandwidth()-o:r-i-o}_y1(t,{y:n}){return r=>n[r]}_y2(t,{y:n}){return r=>n[r]}};function V_(e,{x:t=W,...n}={}){return new Hm(e,{...n,x:t})}function Y_(e,{y:t=W,...n}={}){return new Zm(e,{...n,y:t})}function oP(e,{x:t=W,y:n=null,fill:r="#ccc",fillOpacity:i,stroke:o="currentColor",strokeOpacity:s,strokeWidth:a=2,sort:c,...l}={}){let u=n!=null?ec:wm;return Je(Vr(e,u({x1:oA,x2:sA},{x:t,y:n,stroke:o,strokeOpacity:s,...l})),Uo(e,u({x1:"p25",x2:"p75"},{x:t,y:n,fill:r,fillOpacity:i,...l})),V_(e,u({x:"p50"},{x:t,y:n,stroke:o,strokeOpacity:s,strokeWidth:a,sort:c,...l})),yi(e,_r({x:aP},{x:t,y:n,z:n,stroke:o,strokeOpacity:s,...l})))}function sP(e,{y:t=W,x:n=null,fill:r="#ccc",fillOpacity:i,stroke:o="currentColor",strokeOpacity:s,strokeWidth:a=2,sort:c,...l}={}){let u=n!=null?tc:wm;return Je(jr(e,u({y1:oA,y2:sA},{x:n,y:t,stroke:o,strokeOpacity:s,...l})),zo(e,u({y1:"p25",y2:"p75"},{x:n,y:t,fill:r,fillOpacity:i,...l})),Y_(e,u({y:"p50"},{x:n,y:t,stroke:o,strokeOpacity:s,strokeWidth:a,sort:c,...l})),yi(e,_r({y:aP},{x:n,y:t,z:n,stroke:o,strokeOpacity:s,...l})))}function aP(e){let t=oA(e),n=sA(e);return e.map(r=>r<t||r>n?r:NaN)}function oA(e){let t=cP(e)*2.5-lP(e)*1.5;return ce(e,n=>n>=t?n:NaN)}function sA(e){let t=lP(e)*2.5-cP(e)*1.5;return Gt(e,n=>n<=t?n:NaN)}function cP(e){return Kn(e,.25)}function lP(e){return Kn(e,.75)}var lJ={ariaLabel:"raster",stroke:null,pixelSize:1};function nd(e,t){let n=+e;if(isNaN(n))throw new Error(`invalid ${t}: ${e}`);return n}function uP(e,t){let n=Math.floor(e);if(isNaN(n))throw new Error(`invalid ${t}: ${e}`);return n}var Km=class extends wt{constructor(t,n,r={},i){let{width:o,height:s,x:a,y:c,x1:l=a==null?0:void 0,y1:u=c==null?0:void 0,x2:f=a==null?o:void 0,y2:d=c==null?s:void 0,pixelSize:h=i.pixelSize,blur:p=0,interpolate:m}=r;if(o!=null&&(o=uP(o,"width")),s!=null&&(s=uP(s,"height")),l!=null&&(l=nd(l,"x1")),u!=null&&(u=nd(u,"y1")),f!=null&&(f=nd(f,"x2")),d!=null&&(d=nd(d,"y2")),a==null&&(l==null||f==null))throw new Error("missing x");if(c==null&&(u==null||d==null))throw new Error("missing y");t!=null&&o!=null&&s!=null&&(a===void 0&&l!=null&&f!=null&&(a=gJ(l,f,o,s)),c===void 0&&u!=null&&d!=null&&(c=bJ(u,d,o,s))),super(t,{x:{value:a,scale:"x",optional:!0},y:{value:c,scale:"y",optional:!0},x1:{value:l==null?null:[l],scale:"x",optional:!0,filter:null},y1:{value:u==null?null:[u],scale:"y",optional:!0,filter:null},x2:{value:f==null?null:[f],scale:"x",optional:!0,filter:null},y2:{value:d==null?null:[d],scale:"y",optional:!0,filter:null},...n},r,i),this.width=o,this.height=s,this.pixelSize=nd(h,"pixelSize"),this.blur=nd(p,"blur"),this.interpolate=a==null||c==null?null:uJ(m)}},Jm=class extends Km{constructor(t,n={}){let{imageRendering:r}=n;if(t==null){let{fill:i,fillOpacity:o}=n;ie(o)[0]!==void 0&&(n=G_("fillOpacity",n)),Re(i)[0]!==void 0&&(n=G_("fill",n))}super(t,void 0,n,lJ),this.imageRendering=le(r,"auto")}scale(t,{color:n,...r},i){return super.scale(t,r,i)}render(t,n,r,i,o){let s=n[r.channels.fill?.scale]??(E=>E),{x:a,y:c}=r,{document:l}=o,[u,f,d,h]=dP(r,i,o),p=d-u,m=h-f,{pixelSize:g,width:y=Math.round(Math.abs(p)/g),height:b=Math.round(Math.abs(m)/g)}=this,x=y*b,{fill:_,fillOpacity:v}=r,w=0;if(this.interpolate){let E=y/p,N=b/m,L=Yt(a,C=>(C-u)*E,Float64Array),B=Yt(c,C=>(C-f)*N,Float64Array);_&&(_=this.interpolate(t,y,b,L,B,_)),v&&(v=this.interpolate(t,y,b,L,B,v))}else this.data==null&&t&&(w=t.fi*x);let T=l.createElement("canvas");T.width=y,T.height=b;let M=T.getContext("2d"),R=M.createImageData(y,b),I=R.data,{r:A,g:O,b:F}=rn(this.fill)??{r:0,g:0,b:0},S=(this.fillOpacity??1)*255;for(let E=0;E<x;++E){let N=E<<2;if(_){let L=s(_[E+w]);if(L==null){I[N+3]=0;continue}({r:A,g:O,b:F}=rn(L))}v&&(S=v[E+w]*255),I[N+0]=A,I[N+1]=O,I[N+2]=F,I[N+3]=S}return this.blur>0&&P2(R,this.blur),M.putImageData(R,0,0),ct("svg:g",o).call(Ft,this,i,o).call(It,this,n).call(E=>E.append("image").attr("transform",`translate(${u},${f}) scale(${Math.sign(d-u)},${Math.sign(h-f)})`).attr("width",Math.abs(p)).attr("height",Math.abs(m)).attr("preserveAspectRatio","none").call(ft,"image-rendering",this.imageRendering).call(Rt,this).attr("xlink:href",T.toDataURL())).node()}};function aA(e,t,n){arguments.length<3&&(n=t,t=null);let{x:r,y:i,[e]:o,...s}=n;return r===void 0&&i===void 0&&qC(t)&&(r=Vs,i=Ha,o===void 0&&(o=BC)),[t,{...s,x:r,y:i,[e]:o}]}function fP(){let[e,t]=aA("fill",...arguments);return new Jm(e,e==null||t.fill!==void 0||t.fillOpacity!==void 0?t:{...t,fill:W})}function dP({x1:e,y1:t,x2:n,y2:r},i,{projection:o}){let{width:s,height:a,marginTop:c,marginRight:l,marginBottom:u,marginLeft:f}=i;return[e&&o==null?e[0]:f,t&&o==null?t[0]:c,n&&o==null?n[0]:s-l,r&&o==null?r[0]:a-u]}function cA({x1:e,y1:t,x2:n,y2:r},i,o,s){let a={};return e&&(a.x1=e),t&&(a.y1=t),n&&(a.x2=n),r&&(a.y2=r),dP(Tf(a,i),o,s)}function G_(e,t={}){let{[e]:n}=t;if(typeof n!="function")throw new Error(`invalid ${e}: not a function`);return Se({...t,[e]:void 0},function(r,i,o,s,a,c){let{x:l,y:u}=s;if(!l)throw new Error("missing scale: x");if(!u)throw new Error("missing scale: y");let[f,d,h,p]=cA(o,s,a,c),m=h-f,g=p-d,{pixelSize:y}=this,{width:b=Math.round(Math.abs(m)/y),height:x=Math.round(Math.abs(g)/y)}=t,_=new Array(b*x*(i?i.length:1)),v=m/b,w=g/x,T=0;for(let M of i??[void 0])for(let R=.5;R<x;++R)for(let I=.5;I<b;++I,++T)_[T]=n(l.invert(f+I*v),u.invert(d+R*w),M);return{data:_,facets:i,channels:{[e]:{value:_,scale:"auto"}}}})}function uJ(e){if(typeof e=="function")return e;if(e==null)return W_;switch(`${e}`.toLowerCase()){case"none":return W_;case"nearest":return uA;case"barycentric":return lA();case"random-walk":return fA()}throw new Error(`invalid interpolate: ${e}`)}function W_(e,t,n,r,i,o){let s=new Array(t*n);for(let a of e)r[a]<0||r[a]>=t||i[a]<0||i[a]>=n||(s[Math.floor(i[a])*t+Math.floor(r[a])]=o[a]);return s}function lA({random:e=ll(42)}={}){return(t,n,r,i,o,s)=>{let{points:a,triangles:c,hull:l}=ai.from(t,h=>i[h],h=>o[h]),u=new s.constructor(n*r).fill(NaN),f=new Uint8Array(n*r),d=yJ(s,e);for(let h=0;h<c.length;h+=3){let p=c[h],m=c[h+1],g=c[h+2],y=a[2*p],b=a[2*m],x=a[2*g],_=a[2*p+1],v=a[2*m+1],w=a[2*g+1],T=Math.min(y,b,x),M=Math.max(y,b,x),R=Math.min(_,v,w),I=Math.max(_,v,w),A=(v-w)*(y-x)+(_-w)*(x-b);if(!A)continue;let O=s[t[p]],F=s[t[m]],S=s[t[g]];for(let E=Math.floor(T);E<M;++E)for(let N=Math.floor(R);N<I;++N){if(E<0||E>=n||N<0||N>=r)continue;let L=E+.5,B=N+.5,C=((v-w)*(L-x)+(B-w)*(x-b))/A;if(C<0)continue;let P=((w-_)*(L-x)+(B-w)*(y-x))/A;if(P<0)continue;let $=1-C-P;if($<0)continue;let U=E+n*N;u[U]=d(O,C,F,P,S,$,E,N),f[U]=1}}return fJ(u,f,i,o,s,n,r,l,t,d),u}}function fJ(e,t,n,r,i,o,s,a,c,l){n=Float64Array.from(a,h=>n[c[h]]),r=Float64Array.from(a,h=>r[c[h]]),i=Array.from(a,h=>i[c[h]]);let u=n.length,f=Array.from({length:u},(h,p)=>hJ(p,n,r)),d=0;for(let h=0;h<s;++h){let p=h+.5;for(let m=0;m<o;++m){let g=m+o*h;if(!t[g]){let y=m+.5;for(let b=0;b<u;++b){let x=(u+d+(b%2?(b+1)/2:-b/2))%u;if(f[x](y,p)){let _=dJ(n.at(x-1),r.at(x-1),n[x],r[x],y,p);e[g]=l(i.at(x-1),_,i[x],1-_,i[x],0,m,h),d=x;break}}}}}}function dJ(e,t,n,r,i,o){let s=n-e,a=r-t,c=s*(n-i)+a*(r-o),l=s*(i-e)+a*(o-t);return c>0&&l>0?c/(c+l):+(c>l)}function Qm(e,t,n,r){return e*r-n*t}function hJ(e,t,n){let r=t.length,i=t.at(e-2),o=n.at(e-2),s=t.at(e-1),a=n.at(e-1),c=t[e],l=n[e],u=t.at(e+1-r),f=n.at(e+1-r),d=s-c,h=a-l,p=i-s,m=o-a,g=c-u,y=l-f,b=Math.hypot(d,h),x=Math.hypot(p,m),_=Math.hypot(g,y);return(v,w)=>{let T=v-s,M=w-a,R=v-c,I=w-l;return Qm(T,M,R,I)>-1e-6&&Qm(T,M,d,h)*x-Qm(T,M,p,m)*b>-1e-6&&Qm(R,I,g,y)*b-Qm(R,I,d,h)*_<=0}}function uA(e,t,n,r,i,o){let s=new o.constructor(t*n),a=ai.from(e,u=>r[u],u=>i[u]),c,l;for(let u=.5,f=0;u<n;++u){l=c;for(let d=.5;d<t;++d,++f)l=a.find(d,u,l),d===.5&&(c=l),s[f]=o[e[l]]}return s}function fA({random:e=ll(42),minDistance:t=.5,maxSteps:n=2}={}){return(r,i,o,s,a,c)=>{let l=new c.constructor(i*o),u=ai.from(r,p=>s[p],p=>a[p]),f,d,h;for(let p=.5,m=0;p<o;++p){d=f;for(let g=.5;g<i;++g,++m){let y=g,b=p;h=d=u.find(y,b,d),g===.5&&(f=d);let x,_=0;for(;(x=Math.hypot(s[r[h]]-y,a[r[h]]-b))>t&&_<n;){let v=e(g,p,_)*2*Math.PI;y+=Math.cos(v)*x,b+=Math.sin(v)*x,h=u.find(y,b,h),++_}l[m]=c[r[h]]}}return l}}function pJ(e,t,n,r,i,o){return t*e+r*n+o*i}function mJ(e){return(t,n,r,i,o,s,a,c)=>{let l=e(a,c);return l<n?t:l<n+i?r:o}}function yJ(e,t){return Ws(e)||Oe(e)?pJ:mJ(t)}function gJ(e,t,n){return{transform(r){let i=r.length,o=new Float64Array(i),s=(t-e)/n,a=e+s/2;for(let c=0;c<i;++c)o[c]=c%n*s+a;return o}}}function bJ(e,t,n,r){return{transform(i){let o=i.length,s=new Float64Array(o),a=(t-e)/r,c=e+a/2;for(let l=0;l<o;++l)s[l]=Math.floor(l/n)%r*a+c;return s}}}var hP={ariaLabel:"contour",fill:"none",stroke:"currentColor",strokeMiterlimit:1,pixelSize:2},ty=class extends Km{constructor(t,{smooth:n=!0,value:r,...i}={}){let o=Z1({},i,hP);if(r===void 0){for(let a in o)if(o[a].value!=null){if(r!==void 0)throw new Error("ambiguous contour value");r=i[a],i[a]="value"}}if(r!=null){let a={transform:c=>c.map(l=>l.value),label:On(r)};for(let c in o)i[c]==="value"&&(i[c]=a)}if(t==null){if(r==null)throw new Error("missing contour value");i=G_("value",{value:r,...i}),r=null}else{let{interpolate:a}=i;r===void 0&&(r=W),a===void 0&&(i.interpolate="nearest")}super(t,{value:{value:r,optional:!0}},xJ(i),hP);let s={geometry:{value:W}};for(let a in this.channels){let c=this.channels[a],{scale:l}=c;l==="x"||l==="y"||a==="value"||(s[a]=c,delete this.channels[a])}this.contourChannels=s,this.smooth=!!n}filter(t,{x:n,y:r,value:i,...o},s){return super.filter(t,o,s)}render(t,n,r,i,o){let{geometry:s}=r,a=Mn();return ct("svg:g",o).call(Ft,this,i,o).call(It,this,n).call(c=>{c.selectAll().data(t).enter().append("path").call(Rt,this).attr("d",l=>a(s[l])).call(Zt,this,r)}).node()}};function xJ({thresholds:e,interval:t,...n}){return e=KE(e,t,Na),Se(n,function(r,i,o,s,a,c){let[l,u,f,d]=cA(o,s,a,c),h=f-l,p=d-u,{pixelSize:m,width:g=Math.round(Math.abs(h)/m),height:y=Math.round(Math.abs(p)/m)}=this,b=g/h,x=y/p,_=o.value.value,v=[];if(this.interpolate){let{x:I,y:A}=rc(o,s,c),O=Yt(I,N=>(N-l)*b,Float64Array),F=Yt(A,N=>(N-u)*x,Float64Array),S=[o.x,o.y,o.value],E=[O,F,_];for(let N of i){let L=this.filter(N,S,E);v.push(this.interpolate(L,g,y,O,F,_))}}else if(i){let I=g*y,A=i.length;for(let O=0;O<A;++O)v.push(_.slice(O*I,O*I+I))}else v.push(_);if(this.blur>0)for(let I of v)kh({data:I,width:g,height:y},this.blur);let w=_J(e,_,...wJ(v));if(w===null)throw new Error(`unsupported thresholds: ${e}`);let{contour:T}=Ca().size([g,y]).smooth(this.smooth),M=[],R=[];for(let I of v)R.push($e(M.length,M.push(...Yt(w,A=>T(I,A)))));for(let{coordinates:I}of M)for(let A of I)for(let O of A)for(let F of O)F[0]=F[0]/b+l,F[1]=F[1]/x+u;return{data:M,facets:R,channels:W1(this.contourChannels,M)}})}function _J(e,t,n,r){if(typeof e?.range=="function")return e.range(e.floor(n),r);if(typeof e=="function"&&(e=e(t,n,r)),typeof e!="number")return qe(e);let i=Tn(...vu(n,r,e),e);for(;i[i.length-1]>=r;)i.pop();for(;i[1]<n;)i.shift();return i}function mP(){return new ty(...aA("value",...arguments))}function wJ(e){return[ce(e,t=>ce(t,pP)),Gt(e,t=>Gt(t,pP))]}function pP(e){return isFinite(e)?e:NaN}function bP(e,t){return dA(Lf,e,t)}function xP(e,t={}){return dA(Cf,e,t)}function _P(e,t={}){return dA(Al,e,t)}function dA(e,t,n={}){let{x:r,y:i,maxRadius:o}=n,s=e({px:r,py:i,maxRadius:o}),a=[];r!=null&&a.push(jr(t,yP("x",{...s,inset:-6},n))),i!=null&&a.push(Vr(t,yP("y",{...s,inset:-6},n))),r!=null&&a.push(Bo(t,gP("x",{...s,dy:9,frameAnchor:"bottom",lineAnchor:"top"},n))),i!=null&&a.push(Bo(t,gP("y",{...s,dx:-9,frameAnchor:"left",textAnchor:"end"},n)));for(let c of a)c.ariaLabel=`crosshair ${c.ariaLabel}`;return Je(...a)}function wP(e,{channels:t,...n},{facet:r,facetAnchor:i,fx:o,fy:s,[e]:a,channels:c,transform:l,initializer:u}){return{...n,facet:r,facetAnchor:i,fx:o,fy:s,[e]:a,channels:{...t,...c},transform:l,initializer:vJ(e,u)}}function vJ(e,t){return t==null?t:function(n,r,{x:i,y:o,px:s,py:a,...c},...l){let{channels:{x:u,y:f,...d}={},...h}=t.call(this,n,r,{...c,x:s,y:a},...l);return{channels:{...d,...u&&{px:u,...e==="x"&&{x:u}},...f&&{py:f,...e==="y"&&{y:f}}},...h}}}function yP(e,t,n){let{color:r="currentColor",opacity:i=.2,ruleStroke:o=r,ruleStrokeOpacity:s=i,ruleStrokeWidth:a}=n;return{...wP(e,t,n),stroke:o,strokeOpacity:s,strokeWidth:a}}function gP(e,t,n){let{color:r="currentColor",textFill:i=r,textFillOpacity:o,textStroke:s="var(--plot-background)",textStrokeOpacity:a,textStrokeWidth:c=5}=n;return{...wP(e,t,SJ(e,n)),fill:i,fillOpacity:o,stroke:s,strokeOpacity:a,strokeWidth:c}}function SJ(e,t){return Se(t,(n,r,i)=>({channels:{text:{value:Im(i,e)?.value}}}))}var IJ={ariaLabel:"delaunay link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},TJ={ariaLabel:"delaunay mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},EJ={ariaLabel:"hull",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:1},AJ={ariaLabel:"voronoi",fill:"none",stroke:"currentColor",strokeMiterlimit:1},MJ={ariaLabel:"voronoi mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},hA=class extends wt{constructor(t,n={}){let{x:r,y:i,z:o,curve:s,tension:a}=n;super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},z:{value:o,optional:!0}},n,IJ),this.curve=$m(s,a),Vi(this,n)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,z:u}=r,{curve:f}=this,[d,h]=yn(this,i),p=c?b=>c[b]:dn(d),m=l?b=>l[b]:dn(h),g=this;function y(b){let x=-1,_=[],v={};for(let S in r)v[S]=[];let w=[],T=[],M=[],R=[];function I(S,E){S=b[S],E=b[E],_.push(++x),w[x]=p(S),M[x]=m(S),T[x]=p(E),R[x]=m(E);for(let N in r)v[N].push(r[N][E])}let{halfedges:A,hull:O,triangles:F}=ai.from(b,p,m);for(let S=0;S<A.length;++S){let E=A[S];E>S&&I(F[S],F[E])}for(let S=0;S<O.length;++S)I(O[S],O[(S+1)%O.length]);qt(this).selectAll().data(_).enter().append("path").call(Rt,g).attr("d",S=>{let E=er(),N=f(E);return N.lineStart(),N.point(w[S],M[S]),N.point(T[S],R[S]),N.lineEnd(),E}).call(Zt,g,v).call(Js,g,v,o)}return ct("svg:g",o).call(Ft,this,i,o).call(It,this,{x:c&&s,y:l&&a}).call(u?b=>b.selectAll().data(an(t,x=>u[x]).values()).enter().append("g").each(y):b=>b.datum(t).each(y)).node()}},ey=class extends wt{constructor(t,n={},r,i=({z:o})=>o){let{x:o,y:s}=n;super(t,{x:{value:o,scale:"x",optional:!0},y:{value:s,scale:"y",optional:!0},z:{value:i(n),optional:!0}},n,r)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,z:u}=r,[f,d]=yn(this,i),h=c?y=>c[y]:dn(f),p=l?y=>l[y]:dn(d),m=this;function g(y){let b=ai.from(y,h,p);qt(this).append("path").datum(y[0]).call(Rt,m).attr("d",m._render(b,i)).call(Zt,m,r)}return ct("svg:g",o).call(Ft,this,i,o).call(It,this,{x:c&&s,y:l&&a}).call(u?y=>y.selectAll().data(an(t,b=>u[b]).values()).enter().append("g").each(g):y=>y.datum(t).each(g)).node()}},pA=class extends ey{constructor(t,n={}){super(t,n,TJ),this.fill="none"}_render(t){return t.render()}},mA=class extends ey{constructor(t,n={}){super(t,n,EJ,qn)}_render(t){return t.renderHull()}},yA=class extends wt{constructor(t,n={}){let{x:r,y:i,z:o}=n;super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},z:{value:o,optional:!0}},n,AJ)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,z:u}=r,[f,d]=yn(this,i),h=c?y=>c[y]:dn(f),p=l?y=>l[y]:dn(d),m=this;function g(y){let b=ai.from(y,h,p),x=vP(b,i);qt(this).selectAll().data(y).enter().append("path").call(Rt,m).attr("d",(_,v)=>x.renderCell(v)).call(Zt,m,r)}return ct("svg:g",o).call(Ft,this,i,o).call(It,this,{x:c&&s,y:l&&a}).call(u?y=>y.selectAll().data(an(t,b=>u[b]).values()).enter().append("g").each(g):y=>y.datum(t).each(g)).node()}},gA=class extends ey{constructor(t,n){super(t,n,MJ),this.fill="none"}_render(t,n){return vP(t,n).render()}};function vP(e,t){let{width:n,height:r,marginTop:i,marginRight:o,marginBottom:s,marginLeft:a}=t;return e.voronoi([a,i,n-o,r-s])}function ny(e,t,{x:n,y:r,...i}={}){return[n,r]=Be(n,r),new e(t,{...i,x:n,y:r})}function SP(e,t){return ny(hA,e,t)}function IP(e,t){return ny(pA,e,t)}function TP(e,t){return ny(mA,e,t)}function EP(e,t){return ny(yA,e,t)}function AP(e,t){return ny(gA,e,t)}var NJ={ariaLabel:"density",fill:"none",stroke:"currentColor",strokeMiterlimit:1},ry=class extends wt{constructor(t,{x:n,y:r,z:i,weight:o,fill:s,stroke:a,...c}={}){let l=MP(s)&&(s="currentColor",!0),u=MP(a)&&(a="currentColor",!0);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:r,scale:"y",optional:!0},z:{value:qn({z:i,fill:s,stroke:a}),optional:!0},weight:{value:o,optional:!0}},OJ({...c,fill:s,stroke:a},l,u),NJ),l&&(this.fill=void 0),u&&(this.stroke=void 0),this.z=i}filter(t){return t}render(t,n,r,i,o){let{contours:s}=r,a=Mn();return ct("svg:g",o).call(Ft,this,i,o).call(It,this,{}).call(c=>c.selectAll().data(t).enter().append("path").call(Rt,this).call(Zt,this,r).attr("d",l=>a(s[l]))).node()}};function NP(e,{x:t,y:n,...r}={}){return[t,n]=Be(t,n),new ry(e,{...r,x:t,y:n})}var RJ=new Set(["x","y","z","weight"]);function OJ(e,t,n){let{bandwidth:i,thresholds:o}=e;return i=i===void 0?20:+i,o=o===void 0?20:typeof o?.[Symbol.iterator]=="function"?Qe(o):+o,Se(e,function(s,a,c,l,u,f){let d=c.weight?Qe(c.weight.value):null,h=c.z?.value,{z:p}=this,[m,g]=yn(this,u),{width:y,height:b}=u,{x,y:_}=rc(c,l,f),v=Object.fromEntries(Object.entries(c).filter(([F])=>!RJ.has(F)).map(([F,S])=>[F,{...S,value:[]}])),w=t&&[],T=n&&[],M=ES().x(x?F=>x[F]:m).y(_?F=>_[F]:g).weight(d?F=>d[F]:1).size([y,b]).bandwidth(i),R=[];for(let F of a){let S=[];R.push(S);for(let E of h?Em(F,h,p):[F]){let N=M.contours(E);S.push([E,N])}}let I=o;if(!(I instanceof wl)){let F=0;for(let S of R)for(let[,E]of S){let N=E.max;N>F&&(F=N)}I=Float64Array.from({length:o-1},(S,E)=>F*100*(E+1)/o)}let A=[],O=[];for(let F of R){let S=[];A.push(S);for(let[E,N]of F)for(let L of I){S.push(O.length),O.push(N(L/100)),w&&w.push(L),T&&T.push(L);for(let B in v)v[B].value.push(c[B].value[E[0]])}}return w&&w.push(0),T&&T.push(0),{data:s,facets:A,channels:{...v,...w&&{fill:{value:w,scale:"color"}},...T&&{stroke:{value:T,scale:"color"}},contours:{value:O}}}})}function MP(e){return/^density$/i.test(e)}function DP(e,{x1:t,x2:n,y1:r,y2:i,x:o=t===void 0&&n===void 0?Ae:void 0,y:s=r===void 0&&i===void 0?W:void 0,fill:a,positiveFill:c="#3ca951",negativeFill:l="#4269d0",fillOpacity:u=1,positiveFillOpacity:f=u,negativeFillOpacity:d=u,stroke:h,strokeOpacity:p,z:m=Re(h)[0],clip:g,tip:y,render:b,...x}={}){return[t,n]=RP(o,t,n),[r,i]=RP(s,r,i),t===n&&r===i&&(r=hc(0)),{tip:y}=ji({tip:y},"x"),Je(ne(c)?null:Object.assign(Um(e,{x1:t,x2:n,y1:r,y2:i,z:m,fill:c,fillOpacity:f,render:Ff(b,OP(!0)),clip:g,...x}),{ariaLabel:"positive difference"}),ne(l)?null:Object.assign(Um(e,{x1:t,x2:n,y1:r,y2:i,z:m,fill:l,fillOpacity:d,render:Ff(b,OP(!1)),clip:g,...x}),{ariaLabel:"negative difference"}),Pl(e,{x:n,y:i,z:m,stroke:h,strokeOpacity:p,tip:y,clip:!0,...x}))}function RP(e,t,n){return t===void 0&&n===void 0?t=n=hc(e):t===void 0?(n=hc(n),t=e===void 0?n:hc(e)):n===void 0?(t=hc(t),n=e===void 0?t:hc(e)):(t=hc(t),n=hc(n)),[t,n]}function hc(e){let t,{value:n,label:r=On(n)}=pi(e);return{transform:i=>t||(t=mt(i,n)),label:r}}function OP(e){return(t,n,r,i,o,s)=>{let{x1:a,x2:c}=r,{height:l}=i,u=new Float32Array(a.length),f=new Float32Array(c.length);(e===r_(n.y)<0?u:f).fill(l);let d=s(t,n,{...r,x2:a,y2:f},i,o),h=s(t,n,{...r,x1:c,y1:u},i,o),p=d.querySelector("g")??d,m=h.querySelector("g")??h;for(let g=0;p.firstChild;g+=2){let y=H1(),b=ct("svg:clipPath",o).attr("id",y).node();b.appendChild(p.firstChild),m.childNodes[g].setAttribute("clip-path",`url(#${y})`),m.insertBefore(b,m.childNodes[g])}return h}}var DJ={ariaLabel:"geo",fill:"none",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},iy=class extends wt{constructor(t,n={}){let[r,i]=ie(n.r,3);super(t,{geometry:{value:n.geometry,scale:"projection"},r:{value:r,scale:"r",filter:sr,optional:!0}},Gm(n),DJ),this.r=i}render(t,n,r,i,o){let{geometry:s,r:a}=r,c=Mn(o.projection??kJ(n)),{r:l}=this;return Va(l)?t=[]:l!==void 0&&c.pointRadius(l),ct("svg:g",o).call(Ft,this,i,o).call(It,this,n).call(u=>{u.selectAll().data(t).enter().append("path").call(Rt,this).attr("d",a?f=>c.pointRadius(a[f])(s[f]):f=>c(s[f])).call(Zt,this,r)}).node()}};function kJ({x:e,y:t}){if(e||t)return e??=n=>n,t??=n=>n,al({point(n,r){this.stream.point(e(n),t(r))}})}function X_(e,{geometry:t=W,...n}={}){switch(e?.type){case"FeatureCollection":e=e.features;break;case"GeometryCollection":e=e.geometries;break;case"Feature":case"LineString":case"MultiLineString":case"MultiPoint":case"MultiPolygon":case"Point":case"Polygon":case"Sphere":e=[e];break}return new iy(e,{geometry:t,...n})}function kP({strokeWidth:e=1.5,...t}={}){return X_({type:"Sphere"},{strokeWidth:e,...t})}function FP({strokeOpacity:e=.1,...t}={}){return X_(XS(),{strokeOpacity:e,...t})}var rd=.5,id=0;function LP(e={fill:"count"},{binWidth:t,...n}={}){let{z:r}=n;return t=t===void 0?20:Nt(t),e=cE(e,n),Lo(e,"fill")&&(n.channels={...n.channels,fill:{value:[]}}),n.symbol===void 0&&(n.symbol="hexagon"),n.r===void 0&&!Lo(e,"r")&&(n.r=t/2),Se(n,(i,o,s,a,c,l)=>{let{x:u,y:f,z:d,fill:h,stroke:p,symbol:m}=s;if(u===void 0)throw new Error("missing channel: x");if(f===void 0)throw new Error("missing channel: y");({x:u,y:f}=rc(s,a,l)),d=d?d.value:mt(i,r),h=h?.value,p=p?.value,m=m?.value;let g=Sm(e,{z:d,fill:h,stroke:p,symbol:m}),y=d&&[],b=h&&[],x=p&&[],_=m&&[],v=[],w=[],T=[],M=-1;for(let O of e)O.initialize(i);for(let O of o){let F=[];for(let S of e)S.scope("facet",O);for(let[S,E]of Ja(O,g))for(let{index:N,extent:L}of FJ(i,E,u,f,t)){F.push(++M),w.push(L.x),T.push(L.y),d&&y.push(g===d?S:d[N[0]]),h&&b.push(g===h?S:h[N[0]]),p&&x.push(g===p?S:p[N[0]]),m&&_.push(g===m?S:m[N[0]]);for(let B of e)B.reduce(N,L)}v.push(F)}let R=s.x.scale,I=s.y.scale,A={x:{value:w,source:a[R]?{value:Yt(w,a[R].invert),scale:R}:null},y:{value:T,source:a[I]?{value:Yt(T,a[I].invert),scale:I}:null},...d&&{z:{value:y}},...h&&{fill:{value:b,scale:"auto"}},...p&&{stroke:{value:x,scale:"auto"}},...m&&{symbol:{value:_,scale:"auto"}},...Object.fromEntries(e.map(({name:O,output:F})=>[O,{scale:"auto",label:F.label,radius:O==="r"?t/2:void 0,value:F.transform()}]))};return{data:i,facets:v,channels:A}})}function FJ(e,t,n,r,i){let o=i*(1.5/KT),s=new Map;for(let a of t){let c=n[a],l=r[a];if(isNaN(c)||isNaN(l))continue;let u=Math.round(l=(l-id)/o),f=Math.round(c=(c-rd)/i-(u&1)/2),d=l-u;if(Math.abs(d)*3>1){let m=c-f,g=f+(c<f?-1:1)/2,y=u+(l<u?-1:1),b=c-g,x=l-y;m*m+d*d>b*b+x*x&&(f=g+(u&1?1:-1)/2,u=y)}let h=`${f},${u}`,p=s.get(h);p===void 0&&(p={index:[],extent:{data:e,x:(f+(u&1)/2)*i+rd,y:u*o+id}},s.set(h,p)),p.index.push(a)}return s.values()}var LJ={ariaLabel:"hexgrid",fill:"none",stroke:"currentColor",strokeOpacity:.1};function CP(e){return new oy(e)}var oy=class extends wt{constructor({binWidth:t=20,clip:n=!0,...r}={}){super(Xa,void 0,{clip:n,...r},LJ),this.binWidth=Nt(t)}render(t,n,r,i,o){let{binWidth:s}=this,{marginTop:a,marginRight:c,marginBottom:l,marginLeft:u,width:f,height:d}=i,h=u-rd,p=f-c-rd,m=a-id,g=d-l-id,y=s/2,b=y*JT,x=b/2,_=y*2,v=b*1.5,w=Math.floor(h/_),T=Math.ceil(p/_),M=Math.floor((m+x)/v),R=Math.ceil((g-x)/v)+1,I=`m0,${pc(-b)}l${pc(y)},${pc(x)}v${pc(b)}l${pc(-y)},${pc(x)}`,A=I;for(let O=M;O<R;++O)for(let F=w;F<T;++F)A+=`M${pc(F*_+(O&1)*y)},${pc(O*v)}${I}`;return ct("svg:g",o).datum(0).call(Ft,this,i,o).call(It,this,{},De+rd,De+id).call(O=>O.append("path").call(Rt,this).call(Zt,this,r).attr("d",A)).node()}};function pc(e){return Math.round(e*1e3)/1e3}var CJ={ariaLabel:"image",fill:null,stroke:null};function BJ(e){return/^\.*\//.test(e)}function PJ(e){return/^(blob|data|file|http|https):/i.test(e)}function $J(e){return typeof e=="string"&&(BJ(e)||PJ(e))?[void 0,e]:[e,void 0]}var sy=class extends wt{constructor(t,n={}){let{x:r,y:i,r:o,width:s,height:a,rotate:c,src:l,preserveAspectRatio:u,crossOrigin:f,frameAnchor:d,imageRendering:h}=n;o==null&&(o=void 0),o===void 0&&s===void 0&&a===void 0?s=a=16:s===void 0&&a!==void 0?s=a:a===void 0&&s!==void 0&&(a=s);let[p,m]=$J(l),[g,y]=ie(o),[b,x]=ie(s,y!==void 0?y*2:void 0),[_,v]=ie(a,y!==void 0?y*2:void 0),[w,T]=ie(c,0);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:g,scale:"r",filter:sr,optional:!0},width:{value:b,filter:sr,optional:!0},height:{value:_,filter:sr,optional:!0},rotate:{value:w,optional:!0},src:{value:p,optional:!0}},Gm(n),CJ),this.src=m,this.width=x,this.rotate=T,this.height=v,this.r=y,this.preserveAspectRatio=le(u,"xMidYMid"),this.crossOrigin=ze(f),this.frameAnchor=Fo(d),this.imageRendering=le(h,"auto")}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,width:u,height:f,r:d,rotate:h,src:p}=r,{r:m,width:g,height:y,rotate:b}=this,[x,_]=yn(this,i);return ct("svg:g",o).call(Ft,this,i,o).call(It,this,{x:c&&s,y:l&&a}).call(v=>v.selectAll().data(t).enter().append("image").call(Rt,this).attr("x",BP(c,u,d,x,g,m)).attr("y",BP(l,f,d,_,y,m)).attr("width",u?w=>u[w]:g!==void 0?g:d?w=>d[w]*2:m*2).attr("height",f?w=>f[w]:y!==void 0?y:d?w=>d[w]*2:m*2).attr("transform",h?w=>`rotate(${h[w]})`:b?`rotate(${b})`:null).attr("transform-origin",h||b?oc`${c?w=>c[w]:x}px ${l?w=>l[w]:_}px`:null).call(ft,"href",p?w=>p[w]:this.src).call(ft,"preserveAspectRatio",this.preserveAspectRatio).call(ft,"crossorigin",this.crossOrigin).call(ft,"image-rendering",this.imageRendering).call(ft,"clip-path",d?w=>`circle(${d[w]}px)`:m!==void 0?`circle(${m}px)`:null).call(Zt,this,r)).node()}};function BP(e,t,n,r,i,o){return t&&e?s=>e[s]-t[s]/2:t?s=>r-t[s]/2:e&&i!==void 0?s=>e[s]-i/2:i!==void 0?r-i/2:n&&e?s=>e[s]-n[s]:n?s=>r-n[s]:e?s=>e[s]-o:r-o}function PP(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Be(t,n)),new sy(e,{...r,x:t,y:n})}function UJ(e,t,n){var r=1e-8,i=t-1,o=n-1,s=0,a,c,l,u,f,d,h,p,m,g,y;if(e<=0)return 0;if(e>=1)return 1;for(t>=1&&n>=1?(l=e<.5?e:1-e,u=Math.sqrt(-2*Math.log(l)),h=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,e<.5&&(h=-h),p=(h*h-3)/6,m=2/(1/(2*t-1)+1/(2*n-1)),g=h*Math.sqrt(p+m)/m-(1/(2*n-1)-1/(2*t-1))*(p+5/6-2/(3*m)),h=t/(t+n*Math.exp(2*g))):(a=Math.log(t/(t+n)),c=Math.log(n/(t+n)),u=Math.exp(t*a)/t,f=Math.exp(n*c)/n,g=u+f,e<u/g?h=Math.pow(t*g*e,1/t):h=1-Math.pow(n*g*(1-e),1/n)),y=-od(t)-od(n)+od(t+n);s<10;s++){if(h===0||h===1)return h;if(d=zJ(h,t,n)-e,u=Math.exp(i*Math.log(h)+o*Math.log(1-h)+y),f=d/u,h-=u=f/(1-.5*Math.min(1,f*(i/h-o/(1-h)))),h<=0&&(h=.5*(h+u)),h>=1&&(h=.5*(h+u+1)),Math.abs(u)<r*h&&s>0)break}return h}function zJ(e,t,n){var r=e===0||e===1?0:Math.exp(od(t+n)-od(t)-od(n)+t*Math.log(e)+n*Math.log(1-e));return e<0||e>1?!1:e<(t+1)/(t+n+2)?r*$P(e,t,n)/t:1-r*$P(1-e,n,t)/n}function $P(e,t,n){var r=1e-30,i=1,o=t+n,s=t+1,a=t-1,c=1,l=1-o*e/s,u,f,d,h;for(Math.abs(l)<r&&(l=r),l=1/l,h=l;i<=100&&(u=2*i,f=i*(n-i)*e/((a+u)*(t+u)),l=1+f*l,Math.abs(l)<r&&(l=r),c=1+f/c,Math.abs(c)<r&&(c=r),l=1/l,h*=l*c,f=-(t+i)*(o+i)*e/((t+u)*(s+u)),l=1+f*l,Math.abs(l)<r&&(l=r),c=1+f/c,Math.abs(c)<r&&(c=r),l=1/l,d=l*c,h*=d,!(Math.abs(d-1)<3e-7));i++);return h}function od(e){var t=0,n=[76.18009172947146,-86.5053203294167,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],r=1.000000000190015,i,o,s;for(s=(o=i=e)+5.5,s-=(i+.5)*Math.log(s);t<6;t++)r+=n[t]/++o;return Math.log(2.506628274631*r/i)-s}function UP(e,t){var n=UJ(2*Math.min(e,1-e),.5*t,.5);return n=Math.sqrt(t*(1-n)/n),e>.5?n:-n}var qJ={ariaLabel:"linear-regression",fill:"currentColor",fillOpacity:.1,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},H_=class extends wt{constructor(t,n={}){let{x:r,y:i,z:o,ci:s=.95,precision:a=4}=n;if(super(t,{x:{value:r,scale:"x"},y:{value:i,scale:"y"},z:{value:qn(n),optional:!0}},n,qJ),this.z=o,this.ci=+s,this.precision=+a,!(0<=this.ci&&this.ci<1))throw new Error(`invalid ci; not in [0, 1): ${s}`);if(!(this.precision>0))throw new Error(`invalid precision: ${a}`)}render(t,n,r,i,o){let{x:s,y:a,z:c}=r,{ci:l}=this;return ct("svg:g",o).call(Ft,this,i,o).call(It,this,n).call(u=>u.selectAll().data(c?Em(t,c,this.z):[t]).enter().call(f=>f.append("path").attr("fill","none").call(Rt,this).call(El,this,{...r,fill:null,fillOpacity:null}).attr("d",d=>this._renderLine(d,s,a)).call(l&&!Xs(this.fill)?d=>d.select(jJ).attr("stroke","none").call(Rt,this).call(El,this,{...r,stroke:null,strokeOpacity:null,strokeWidth:null}).attr("d",h=>this._renderBand(h,s,a)):()=>{}))).node()}};function jJ(){return this.parentNode.insertBefore(this.ownerDocument.createElementNS(ii.svg,"path"),this)}var bA=class extends H_{constructor(t,n){super(t,n)}_renderBand(t,n,r){let{ci:i,precision:o}=this,[s,a]=ae(t,u=>r[u]),c=Z_(t,r,n),l=jP(t,r,n,(1-i)/2,c);return sf().y(u=>u).x0(u=>l(u,-1)).x1(u=>l(u,1))($e(s,a-o/2,o).concat(a))}_renderLine(t,n,r){let[i,o]=ae(t,a=>r[a]),s=Z_(t,r,n);return`M${s(i)},${i}L${s(o)},${o}`}},xA=class extends H_{constructor(t,n){super(t,n)}_renderBand(t,n,r){let{ci:i,precision:o}=this,[s,a]=ae(t,u=>n[u]),c=Z_(t,n,r),l=jP(t,n,r,(1-i)/2,c);return sf().x(u=>u).y0(u=>l(u,-1)).y1(u=>l(u,1))($e(s,a-o/2,o).concat(a))}_renderLine(t,n,r){let[i,o]=ae(t,a=>n[a]),s=Z_(t,n,r);return`M${i},${s(i)}L${o},${s(o)}`}};function zP(e,{y:t=Ae,x:n=W,stroke:r,fill:i=ne(r)?"currentColor":r,...o}={}){return new bA(e,qf({...o,x:n,y:t,fill:i,stroke:r}))}function qP(e,{x:t=Ae,y:n=W,stroke:r,fill:i=ne(r)?"currentColor":r,...o}={}){return new xA(e,zf({...o,x:t,y:n,fill:i,stroke:r}))}function Z_(e,t,n){let r=0,i=0,o=0,s=0;for(let u of e){let f=t[u],d=n[u];r+=f,i+=d,o+=f*d,s+=f*f}let a=e.length,c=(a*o-r*i)/(a*s-r*r),l=(i-c*r)/a;return u=>c*u+l}function jP(e,t,n,r,i){let o=En(e,u=>t[u])/e.length,s=0,a=0;for(let u of e)s+=(t[u]-o)**2,a+=(n[u]-i(t[u]))**2;let c=Math.sqrt(a/(e.length-2)),l=UP(r,e.length-2);return(u,f)=>{let d=i(u),h=c*Math.sqrt(1/e.length+(u-o)**2/s);return d+f*l*h}}function ay({path:e=W,delimiter:t,frameAnchor:n,treeLayout:r=cl,treeSort:i,treeSeparation:o,treeAnchor:s,treeFilter:a,...c}={}){s=tw(s),i=GP(i),a!=null&&(a=wA(a)),n===void 0&&(n=s.frameAnchor);let l=WP(t),u=t9(c,wA),[f,d]=pn(),[h,p]=pn();return{x:f,y:h,frameAnchor:n,...mn(c,(m,g)=>{let y=l(mt(m,e)),b=d([]),x=p([]),_=-1,v=[],w=[],T=Xb().path(R=>y[R]),M=r();M.nodeSize&&M.nodeSize([1,1]),M.separation&&o!==void 0&&M.separation(o??gm);for(let R of u)R[K_]=R[KP]([]);for(let R of g){let I=[],A=T(R.filter(O=>y[O]!=null)).each(O=>O.data=m[O.data]);i!=null&&A.sort(i),M(A);for(let O of A.descendants())if(!(a!=null&&!a(O))){I.push(++_),v[_]=O.data,s.position(O,_,b,x);for(let F of u)F[K_][_]=F[JP](O)}w.push(I)}return{data:v,facets:w}}),...Object.fromEntries(u)}}function J_({path:e=W,delimiter:t,curve:n="bump-x",stroke:r="#555",strokeWidth:i=1.5,strokeOpacity:o=.5,treeLayout:s=cl,treeSort:a,treeSeparation:c,treeAnchor:l,treeFilter:u,...f}={}){l=tw(l),a=GP(a),u!=null&&(u=YP(u)),f={curve:n,stroke:r,strokeWidth:i,strokeOpacity:o,...f};let d=WP(t),h=t9(f,YP),[p,m]=pn(),[g,y]=pn(),[b,x]=pn(),[_,v]=pn();return{x1:p,x2:g,y1:b,y2:_,...mn(f,(w,T)=>{let M=d(mt(w,e)),R=m([]),I=y([]),A=x([]),O=v([]),F=-1,S=[],E=[],N=Xb().path(B=>M[B]),L=s();L.nodeSize&&L.nodeSize([1,1]),L.separation&&c!==void 0&&L.separation(c??gm);for(let B of h)B[K_]=B[KP]([]);for(let B of T){let C=[],P=N(B.filter($=>M[$]!=null)).each($=>$.data=w[$.data]);a!=null&&P.sort(a),L(P);for(let{source:$,target:U}of P.links())if(!(u!=null&&!u(U,$))){C.push(++F),S[F]=U.data,l.position($,F,R,A),l.position(U,F,I,O);for(let X of h)X[K_][F]=X[JP](U,$)}E.push(C)}return{data:S,facets:E}}),...Object.fromEntries(h)}}function tw(e="left"){switch(`${e}`.trim().toLowerCase()){case"left":return VJ;case"right":return YJ}throw new Error(`invalid tree anchor: ${e}`)}var VJ={frameAnchor:"left",dx:6,position({x:e,y:t},n,r,i){r[n]=t,i[n]=-e}},YJ={frameAnchor:"right",dx:-6,position({x:e,y:t},n,r,i){r[n]=-t,i[n]=-e}};function GP(e){return e==null||typeof e=="function"?e:`${e}`.trim().toLowerCase().startsWith("node:")?VP(wA(e)):VP(GJ(e))}function VP(e){return(t,n)=>fn(e(t),e(n))}function GJ(e){return t=>t.data?.[e]}function WP(e="/"){if(e=`${e}`,e==="/")return n=>n;if(e.length!==1)throw new Error("delimiter must be exactly one character");let t=e.charCodeAt(0);return n=>n.map(r=>WJ(r,t))}var _A=92,XP=47;function WJ(e,t){if(t===_A)throw new Error("delimiter cannot be backslash");let n=!1;for(let r=0,i=e.length;r<i;++r){switch(e.charCodeAt(r)){case _A:if(!n){n=!0;continue}break;case t:n?(e=e.slice(0,r-1)+e.slice(r),--r,--i):e=e.slice(0,r)+"/"+e.slice(r+1);break;case XP:n?(e=e.slice(0,r)+"\\\\"+e.slice(r),r+=2,i+=2):(e=e.slice(0,r)+"\\"+e.slice(r),++r,++i);break}n=!1}return e}function XJ(e){let t=!1;for(let n=0,r=e.length;n<r;++n){switch(e.charCodeAt(n)){case _A:if(!t){t=!0;continue}case XP:t&&(e=e.slice(0,n-1)+e.slice(n),--n,--r);break}t=!1}return e}function HP(e){return hn(e)&&typeof e.node=="function"}function HJ(e){return hn(e)&&typeof e.link=="function"}function wA(e){if(HP(e))return e.node;if(e=`${e}`.trim().toLowerCase(),!!e.startsWith("node:")){switch(e){case"node:name":return SA;case"node:path":return vA;case"node:internal":return ZP;case"node:external":return QP;case"node:depth":return IA;case"node:height":return TA}throw new Error(`invalid node value: ${e}`)}}function YP(e){if(HP(e))return e.node;if(HJ(e))return e.link;if(e=`${e}`.trim().toLowerCase(),!(!e.startsWith("node:")&&!e.startsWith("parent:"))){switch(e){case"parent:name":return Q_(SA);case"parent:path":return Q_(vA);case"parent:depth":return Q_(IA);case"parent:height":return Q_(TA);case"node:name":return SA;case"node:path":return vA;case"node:internal":return ZP;case"node:external":return QP;case"node:depth":return IA;case"node:height":return TA}throw new Error(`invalid link value: ${e}`)}}function vA(e){return e.id}function SA(e){return ZJ(e.id)}function IA(e){return e.depth}function TA(e){return e.height}function ZP(e){return!!e.children}function QP(e){return!e.children}function Q_(e){return(t,n)=>n==null?void 0:e(n)}function ZJ(e){let t=e.length;for(;--t>0&&!QJ(e,t););return XJ(e.slice(t+1))}function QJ(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if(!(n&1))return!0}return!1}var KP=2,JP=3,K_=4;function t9(e,t){let n=[];for(let r in e){let i=e[r],o=t(i);o!==void 0&&n.push([r,...pn(i),o])}return n}function EA(e,{fill:t,stroke:n,strokeWidth:r,strokeOpacity:i,strokeLinejoin:o,strokeLinecap:s,strokeMiterlimit:a,strokeDasharray:c,strokeDashoffset:l,marker:u,markerStart:f=u,markerEnd:d=u,dot:h=ne(f)&&ne(d),text:p="node:name",textStroke:m="var(--plot-background)",title:g="node:path",dx:y,dy:b,textAnchor:x,treeLayout:_=cl,textLayout:v=_===cl||_===Gb?"mirrored":"normal",tip:w,...T}={}){if(y===void 0&&(y=tw(T.treeAnchor).dx),x!==void 0)throw new Error("textAnchor is not a configurable tree option");v=Ke(v,"textLayout",["mirrored","normal"]);function M(R){return Bo(e,ay({treeLayout:_,text:p,fill:t===void 0?"currentColor":t,stroke:m,dx:y,dy:b,title:g,...R,...T}))}return Je(P_(e,J_({treeLayout:_,markerStart:f,markerEnd:d,stroke:n!==void 0?n:t===void 0?"node:internal":t,strokeWidth:r,strokeOpacity:i,strokeLinejoin:o,strokeLinecap:s,strokeMiterlimit:a,strokeDasharray:c,strokeDashoffset:l,...T})),h?yi(e,ay({treeLayout:_,fill:t===void 0?"node:internal":t,title:g,tip:w,...T})):null,p!=null?v==="mirrored"?[M({textAnchor:"start",treeFilter:"node:external"}),M({textAnchor:"end",treeFilter:"node:internal",dx:-y})]:M():null)}function e9(e,t){return EA(e,{...t,treeLayout:Gb})}function n9({geometry:e=W,...t}={}){return Se({...t,x:null,y:null},(n,r,i,o,s,{projection:a})=>{let c=mt(n,e),l=c.length,u=new Float64Array(l),f=new Float64Array(l),d=Mn(a);for(let h=0;h<l;++h)[u[h],f[h]]=d.centroid(c[h]);return{data:n,facets:r,channels:{x:{value:u,scale:a==null?"x":null,source:null},y:{value:f,scale:a==null?"y":null,source:null}}}})}function r9({geometry:e=W,...t}={}){let n;return{...t,x:{transform:r=>Float64Array.from(n=mt(mt(r,e),qS),([i])=>i)},y:{transform:()=>Float64Array.from(n,([,r])=>r)}}}var p9=k$(h9(),1);var ott=({marginLeft:e})=>[1,e],stt=({width:e,marginRight:t})=>[-1,e-t],att=({width:e,marginLeft:t,marginRight:n})=>[0,(t+e-n)/2],ctt=({marginTop:e})=>[1,e],ltt=({height:e,marginBottom:t})=>[-1,e-t],utt=({height:e,marginTop:t,marginBottom:n})=>[0,(t+e-n)/2];function m9(e){return typeof e=="string"?{anchor:e}:e}function y9(e={},t={}){arguments.length===1&&([e,t]=b9(e));let{anchor:n="left",padding:r=1,r:i=t.r}=m9(e);switch(`${n}`.toLowerCase()){case"left":n=ott;break;case"right":n=stt;break;case"middle":n=att;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return x9("x","y",n,Nt(r),i,t)}function g9(e={},t={}){arguments.length===1&&([e,t]=b9(e));let{anchor:n="bottom",padding:r=1,r:i=t.r}=m9(e);switch(`${n}`.toLowerCase()){case"top":n=ctt;break;case"bottom":n=ltt;break;case"middle":n=utt;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return x9("y","x",n,Nt(r),i,t)}function b9(e){let{anchor:t,padding:n,...r}=e,{r:i}=r;return[{anchor:t,padding:n,r:i},r]}function x9(e,t,n,r,i,o){if(i!=null&&typeof i!="number"){let{channels:s,sort:a,reverse:c}=o;s=xm(s),s?.r===void 0&&(o={...o,channels:{...s,r:{value:i,scale:"r"}}}),a===void 0&&c===void 0&&(o.sort={channel:"-r"})}return Se(o,function(s,a,c,l,u,f){let{[t]:d,r:h}=c;if(!c[t])throw new Error(`missing channel: ${t}`);({[t]:d}=rc(c,l,f));let p=h?void 0:i!==void 0?Nt(i):this.r!==void 0?this.r:3;h&&(h=mt(h.value,l[h.scale]||W,Float64Array));let[m,g]=n(u),y=m?dtt:ftt,b=new Float64Array(d.length),x=h?_=>h[_]:()=>p;for(let _ of a){let v=(0,p9.default)();_=_.filter(h?T=>ff(d[T])&&sr(h[T]):T=>ff(d[T]));let w=new Float64Array(2*_.length+2);for(let T of _){let M=x(T),R=m?M+r:0,I=d[T]-M,A=d[T]+M,O=2;v.queryInterval(I-r,A+r,([,,S])=>{let E=b[S]-R,N=d[T]-d[S],L=r+(h?h[T]+h[S]:2*p),B=Math.sqrt(L*L-N*N);w[O++]=E-B,w[O++]=E+B});let F=w.slice(0,O);m&&(F=F.filter(S=>S>=0));t:for(let S of F.sort(y)){for(let E=0;E<O;E+=2)if(w[E]+1e-6<S&&S<w[E+1]-1e-6)continue t;b[T]=S+R;break}v.insert([I,A,T])}}m||(m=1);for(let _ of a)for(let v of _)b[v]=b[v]*m+g;return{data:s,facets:a,channels:{[e]:{value:b,source:null},[t]:{value:d,source:c[t]},...h&&{r:{value:h,source:c.r}}}}})}function ftt(e,t){return Math.abs(e)-Math.abs(t)}function dtt(e,t){return e-t}function w9(e,t){return arguments.length===1&&({basis:e,...t}=e),Jf(rw(e),t)}function v9(e,t){return arguments.length===1&&({basis:e,...t}=e),td(rw(e),t)}function rw(e){if(e===void 0)return _9;if(typeof e=="function")return iw(bf(e));if(/^p\d{2}$/i.test(e))return ld(yf(e));switch(`${e}`.toLowerCase()){case"deviation":return mtt;case"first":return _9;case"last":return ptt;case"max":return ytt;case"mean":return gtt;case"median":return btt;case"min":return xtt;case"sum":return _tt;case"extent":return htt}throw new Error(`invalid basis: ${e}`)}function iw(e){return{mapIndex(t,n,r){let i=+e(t,n);for(let o of t)r[o]=n[o]===null?NaN:n[o]/i}}}function ld(e){return iw((t,n)=>e(t,r=>n[r]))}var htt={mapIndex(e,t,n){let[r,i]=ae(e,s=>t[s]),o=i-r;for(let s of e)n[s]=t[s]===null?NaN:(t[s]-r)/o}},_9=iw((e,t)=>{for(let n=0;n<e.length;++n){let r=t[e[n]];if(Ue(r))return r}}),ptt=iw((e,t)=>{for(let n=e.length-1;n>=0;--n){let r=t[e[n]];if(Ue(r))return r}}),mtt={mapIndex(e,t,n){let r=Ss(e,o=>t[o]),i=ri(e,o=>t[o]);for(let o of e)n[o]=t[o]===null?NaN:i?(t[o]-r)/i:0}},ytt=ld(Gt),gtt=ld(Ss),btt=ld(Bi),xtt=ld(ce),_tt=ld(En);function S9(e,t){return wtt("x",e,t)}function wtt(e,t,n={}){let r,i=1;if(typeof t=="number")i=t,r=(l,u)=>+l+u;else{if(typeof t=="string"){let l=t.startsWith("-")?-1:1;[t,i]=L1(t.replace(/^[+-]/,"")),i*=l}t=_f(t),r=(l,u)=>t.offset(l,u)}let o=`${e}1`,s=`${e}2`,a=_r({[o]:l=>l.map(u=>r(u,i)),[s]:l=>l},n),c=a[s].transform;return a[s].transform=()=>{let l=c(),[u,f]=ae(l);return l.domain=i<0?[u,r(f,i)]:[r(u,i),f],l},a}function I9(e,t={}){if(typeof e=="string")switch(e.toLowerCase()){case"first":return DA(t);case"last":return kA(t)}if(typeof e=="function")return mc(null,e,t);let n,r;for(n in e){if(r!==void 0)throw new Error("ambiguous selector; multiple inputs");r=vtt(e[n])}if(r===void 0)throw new Error(`invalid selector: ${e}`);return mc(n,r,t)}function vtt(e){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"min":return FA;case"max":return LA}throw new Error(`unknown selector: ${e}`)}function DA(e){return mc(null,Stt,e)}function kA(e){return mc(null,Itt,e)}function T9(e){return mc("x",FA,e)}function E9(e){return mc("y",FA,e)}function A9(e){return mc("x",LA,e)}function M9(e){return mc("y",LA,e)}function*Stt(e){yield e[0]}function*Itt(e){yield e[e.length-1]}function*FA(e,t){yield R0(e,n=>t[n])}function*LA(e,t){yield Yc(e,n=>t[n])}function mc(e,t,n){if(e!=null){if(n[e]==null)throw new Error(`missing channel: ${e}`);e=n[e]}let r=qn(n);return mn(n,(i,o)=>{let s=mt(i,r),a=mt(i,e),c=[];for(let l of o){let u=[];for(let f of s?an(l,d=>s[d]).values():[l])for(let d of t(f,a))u.push(d);c.push(u)}return{data:i,facets:c}})}var Ttt=new Map([["style","style"],["width","width"],["height","height"],["margin","margin"],["marginLeft","marginLeft"],["marginRight","marginRight"],["marginTop","marginTop"],["marginBottom","marginBottom"],["align","align"],["aspectRatio","aspectRatio"],["axis","axis"],["inset","inset"],["grid","grid"],["label","label"],["padding","padding"],["round","round"],["xScale","x.type"],["xDomain","x.domain"],["xRange","x.range"],["xNice","x.nice"],["xInset","x.inset"],["xInsetLeft","x.insetLeft"],["xInsetRight","x.insetRight"],["xClamp","x.clamp"],["xRound","x.round"],["xAlign","x.align"],["xPadding","x.padding"],["xPaddingInner","x.paddingInner"],["xPaddingOuter","x.paddingOuter"],["xAxis","x.axis"],["xTicks","x.ticks"],["xTickSize","x.tickSize"],["xTickSpacing","x.tickSpacing"],["xTickPadding","x.tickPadding"],["xTickFormat","x.tickFormat"],["xTickRotate","x.tickRotate"],["xGrid","x.grid"],["xLine","x.line"],["xLabel","x.label"],["xLabelAnchor","x.labelAnchor"],["xLabelOffset","x.labelOffset"],["xFontVariant","x.fontVariant"],["xAriaLabel","x.ariaLabel"],["xAriaDescription","x.ariaDescription"],["xReverse","x.reverse"],["xZero","x.zero"],["xBase","x.base"],["xExponent","x.exponent"],["xConstant","x.constant"],["yScale","y.type"],["yDomain","y.domain"],["yRange","y.range"],["yNice","y.nice"],["yInset","y.inset"],["yInsetTop","y.insetTop"],["yInsetBottom","y.insetBottom"],["yClamp","y.clamp"],["yRound","y.round"],["yAlign","y.align"],["yPadding","y.padding"],["yPaddingInner","y.paddingInner"],["yPaddingOuter","y.paddingOuter"],["yAxis","y.axis"],["yTicks","y.ticks"],["yTickSize","y.tickSize"],["yTickSpacing","y.tickSpacing"],["yTickPadding","y.tickPadding"],["yTickFormat","y.tickFormat"],["yTickRotate","y.tickRotate"],["yGrid","y.grid"],["yLine","y.line"],["yLabel","y.label"],["yLabelAnchor","y.labelAnchor"],["yLabelOffset","y.labelOffset"],["yFontVariant","y.fontVariant"],["yAriaLabel","y.ariaLabel"],["yAriaDescription","y.ariaDescription"],["yReverse","y.reverse"],["yZero","y.zero"],["yBase","y.base"],["yExponent","y.exponent"],["yConstant","y.constant"],["facetMargin","facet.margin"],["facetMarginTop","facet.marginTop"],["facetMarginBottom","facet.marginBottom"],["facetMarginLeft","facet.marginLeft"],["facetMarginRight","facet.marginRight"],["facetGrid","facet.grid"],["facetLabel","facet.label"],["fxDomain","fx.domain"],["fxRange","fx.range"],["fxNice","fx.nice"],["fxInset","fx.inset"],["fxInsetLeft","fx.insetLeft"],["fxInsetRight","fx.insetRight"],["fxRound","fx.round"],["fxAlign","fx.align"],["fxPadding","fx.padding"],["fxPaddingInner","fx.paddingInner"],["fxPaddingOuter","fx.paddingOuter"],["fxAxis","fx.axis"],["fxTicks","fx.ticks"],["fxTickSize","fx.tickSize"],["fxTickSpacing","fx.tickSpacing"],["fxTickPadding","fx.tickPadding"],["fxTickFormat","fx.tickFormat"],["fxTickRotate","fx.tickRotate"],["fxGrid","fx.grid"],["fxLine","fx.line"],["fxLabel","fx.label"],["fxLabelAnchor","fx.labelAnchor"],["fxLabelOffset","fx.labelOffset"],["fxFontVariant","fx.fontVariant"],["fxAriaLabel","fx.ariaLabel"],["fxAriaDescription","fx.ariaDescription"],["fxReverse","fx.reverse"],["fyDomain","fy.domain"],["fyRange","fy.range"],["fyNice","fy.mice"],["fyInset","fy,inset"],["fyInsetTop","fy.insetTop"],["fyInsetBottom","fy.insetBottom"],["fyRound","fy.round"],["fyAlign","fy.align"],["fyPadding","fy.padding"],["fyPaddingInner","fy.paddingInner"],["fyPaddingOuter","fy.paddingOuter"],["fyAxis","fy.axis"],["fyTicks","fy.ticks"],["fyTickSize","fy.tickSize"],["fyTickSpacing","fy.tickSpacing"],["fyTickPadding","fy.tickPadding"],["fyTickFormat","fy.tickFormat"],["fyTickRotate","fy.tickRotate"],["fyGrid","fy.grid"],["fyLine","fy.line"],["fyLabel","fy.label"],["fyLabelAnchor","fy.labelAnchor"],["fyLabelOffset","fy.labelOffset"],["fyFontVariant","fy.fontVariant"],["fyAriaLabel","fy.ariaLabel"],["fyAriaDescription","fy.ariaDescription"],["fyReverse","fy.reverse"],["colorScale","color.type"],["colorDomain","color.domain"],["colorRange","color.range"],["colorClamp","color.clamp"],["colorN","color.n"],["colorNice","color.nice"],["colorScheme","color.scheme"],["colorInterpolate","color.interpolate"],["colorPivot","color.pivot"],["colorSymmetric","color.symmetric"],["colorLabel","color.label"],["colorReverse","color.reverse"],["colorZero","color.zero"],["colorTickFormat","color.tickFormat"],["colorBase","color.base"],["colorExponent","color.exponent"],["colorConstant","color.constant"],["opacityScale","opacity.type"],["opacityDomain","opacity.domain"],["opacityRange","opacity.range"],["opacityClamp","opacity.clamp"],["opacityNice","opacity.nice"],["opacityLabel","opacity.label"],["opacityReverse","opacity.reverse"],["opacityZero","opacity.zero"],["opacityTickFormat","opacity.tickFormat"],["opacityBase","opacity.base"],["opacityExponent","opacity.exponent"],["opacityConstant","opacity.constant"],["rScale","r.type"],["rDomain","r.domain"],["rRange","r.range"],["rClamp","r.clamp"],["rNice","r.nice"],["rZero","r.zero"],["rBase","r.base"],["rExponent","r.exponent"],["rConstant","r.constant"],["lengthScale","length.type"],["lengthDomain","length.domain"],["lengthRange","length.range"],["lengthClamp","length.clamp"],["lengthNice","length.nice"],["lengthZero","length.zero"],["lengthBase","length.base"],["lengthExponent","length.exponent"],["lengthConstant","length.constant"],["projectionType","projection.type"],["projectionParallels","projection.parallels"],["projectionPrecision","projection.precision"],["projectionRotate","projection.rotate"],["projectionDomain","projection.domain"],["projectionInset","projection.inset"],["projectionInsetLeft","projection.insetLeft"],["projectionInsetRight","projection.insetRight"],["projectionInsetTop","projection.insetTop"],["projectionInsetBottom","projection.insetBottom"],["projectionClip","projection.clip"]]);function Ett(e,t,n){for(let r=0;r<t.length;++r){let i=t[r];r===t.length-1?e[i]=n:e=e[i]||(e[i]={})}}function N9(e,t,n){for(let r in e){let i=Ttt.get(r);if(i==null)throw new Error(`Unrecognized plot attribute: ${r}`);let o=e[r];typeof o=="symbol"?n.push(r):o!==void 0&&Ett(t,i.split("."),o)}}var Att=new Set(["frame","hexgrid","sphere","graticule"]);async function O9(e){let t={marks:[]},n=[],{attributes:r,marks:i}=e;N9(r,t,n);let o=[];for(let a of i)for(let{type:c,data:l,options:u}of a.plotSpecs())Att.has(c)?t.marks.push(ow[c](u)):t.marks.push(ow[c](l,u)),o.push(a.index);Ntt(t,e);let s=Pm(t);Rtt(s,o),Mtt(e,s,r,n);for(let a of e.interactors)await a.init(s);return s}function Mtt(e,t,n,r){r.forEach(i=>{let o=n[i];if(o===co){if(!i.endsWith("Domain"))throw new Error(`Unsupported fixed attribute: ${i}`);let s=i.slice(0,-6),a=t.scale(s);a?.domain&&e.setAttribute(i,n[`${s}Reverse`]?a.domain.slice().reverse():a.domain)}else throw new Error(`Unrecognized symbol: ${o}`)})}function Ntt(e,t){let{marks:n}=t;sw("x",e,n,["x","x1","x2"]),sw("y",e,n,["y","y1","y2"]),sw("fx",e,n),sw("fy",e,n)}function sw(e,t,n,r=[e]){let i=t[e]||{};if(i.axis===null||i.label!==void 0)return;let o=n.map(u=>u.channelField(r)?.field);if(o.every(u=>u==null))return;let s,a,c;for(let u=0;u<o.length;++u){let{column:f,label:d}=o[u]||{};f===void 0&&d===void 0||(s===void 0&&a===void 0?(s=f,a=d,c=Ott(n[u].data,r)||"number"):a!==d?a=void 0:s!==f&&(s=void 0))}let l=a||s;if(l!==void 0){if((c==="number"||c==="date")&&(e==="x"||e==="y")){i.percent&&(l=`${l} (%)`);let u=(e==="x"?1:-1)*(i.reverse?-1:1);e==="x"||i.labelAnchor==="center"?l=e==="x"==u<0?`\u2190 ${l}`:`${l} \u2192`:l=`${u<0?"\u2191 ":"\u2193 "}${l}`}t[e]={...i,label:l}}}function Rtt(e,t){let n=e.querySelectorAll('g[aria-label="facet"]');if(n.length)for(let r of n)R9(r,t);else R9(e,t)}function R9(e,t){let n=-1;for(let r of e.children){let i=r.getAttribute("aria-label")||"";r.nodeName==="style"||i.includes("-axis")||i.includes("-grid")||r.setAttribute("data-index",t[++n])}}function Ott(e,t){for(let n of e)for(let r=0;r<t.length;++r){let i=n[t[r]];if(i!=null)return i instanceof Date?"date":typeof i}}var Dtt={width:640,marginLeft:40,marginRight:20,marginTop:20,marginBottom:30},uy=class{constructor(t){this.attributes={...Dtt},this.listeners=null,this.interactors=[],this.legends=[],this.marks=[],this.markset=null,this.element=t||document.createElement("div"),this.element.setAttribute("class","plot"),this.element.style.display="flex",this.element.value=this,this.params=new Map,this.synch=B2()}margins(){return{left:this.getAttribute("marginLeft"),top:this.getAttribute("marginTop"),bottom:this.getAttribute("marginBottom"),right:this.getAttribute("marginRight")}}innerWidth(){let{left:t,right:n}=this.margins();return this.getAttribute("width")-t-n}innerHeight(){let{top:t,bottom:n}=this.margins();return this.getAttribute("height")-t-n}pending(t){this.synch.pending(t)}update(t){return this.synch.ready(t)&&!this.pendingRender&&(this.pendingRender=!0,requestAnimationFrame(()=>this.render())),this.synch.promise}async render(){this.pendingRender=!1;let t=await O9(this),n=this.legends.flatMap(({legend:r,include:i})=>{let o=r.init(t);return i?o:[]});this.element.replaceChildren(t,...n),this.synch.resolve()}getAttribute(t){return this.attributes[t]}setAttribute(t,n,r){return Rh(this.attributes[t],n)?(n===void 0?delete this.attributes[t]:this.attributes[t]=n,r?.silent||this.listeners?.get(t)?.forEach(i=>i(t,n)),!0):!1}addAttributeListener(t,n){let r=this.listeners||(this.listeners=new Map);return r.has(t)||r.set(t,new Set),r.get(t).add(n),this}removeAttributeListener(t,n){return this.listeners?.get(t)?.delete(n)}addParams(t,n){let{params:r}=this;for(let i of n)r.has(i)?r.get(i).push(t):(r.set(i,[t]),i.addEventListener("value",()=>Promise.allSettled(r.get(i).map(o=>o.requestQuery()))))}addMark(t){return t.setPlot(this,this.marks.length),this.marks.push(t),this.markset=null,this}get markSet(){return this.markset||(this.markset=new Set(this.marks))}addInteractor(t){return this.interactors.push(t),this}addLegend(t,n=!0){t.setPlot(this),this.legends.push({legend:t,include:n})}};function aw(e){return typeof e!="string"?!1:(e=e.toLowerCase().trim(),e==="none"||e==="currentcolor"||e.startsWith("url(")&&e.endsWith(")")||e.startsWith("var(")&&e.endsWith(")")||Lr(e)!==null)}var ktt=new Set(["order","sort","label","anchor","curve","tension","marker","markerStart","markerMid","markerEnd","textAnchor","lineAnchor","lineHeight","textOverflow","monospace","fontFamily","fontSize","fontStyle","fontVariant","fontWeight","frameAnchor","strokeLinejoin","strokeLinecap","strokeMiterlimit","strokeDasharray","strokeDashoffset","mixBlendMode","shapeRendering","imageRendering","preserveAspectRatio","interpolate","crossOrigin","paintOrder","pointerEvents","target"]);function D9(e){return ktt.has(e)}var Ftt=new Set(["asterisk","circle","cross","diamond","diamond2","hexagon","plus","square","square2","star","times","triangle","triangle2","wye"]);function k9(e){return Ftt.has(`${e}`.toLowerCase())}function ud(e){return typeof e?.getChild=="function"}function F9(e){let{typeId:t}=e;return t===10?n=>n==null?n:new Date(n):t===2&&e.bitWidth>=64?n=>n==null?n:Number(n):n=>n}function cw(e){return ud(e)?Ltt(e):e}function Ltt(e){let{batches:t,numRows:n}=e;if(!n)return[];let r=Array.from({length:n},()=>({}));for(let i=0,o=0;o<t.length;++o){let s=t[o],{schema:a,numRows:c,numCols:l}=s;for(let u=0;u<l;++u){let f=s.getChildAt(u),{name:d,type:h}=a.fields[u],p=F9(h);for(let m=i,g=0;g<c;++g,++m)r[m][d]=p(f.get(g))}i+=c}return r}var L9=e=>e==="stroke"||e==="fill",Ctt=e=>e==="symbol",Btt=(e,t)=>e!=="sort"&&e!=="tip"&&t!=null&&!Array.isArray(t),CA=(e,t)=>({channel:e,field:t,as:t instanceof gr?t.column:e}),BA=(e,t)=>({channel:e,value:t}),lw=e=>Array.isArray(e),Dn=class extends ur{constructor(t,n,r,i={}){super(n?.options?.filterBy),this.type=t,this.reqs=i,this.source=n,lw(this.source)&&(this.data=this.source);let o=this.channels=[],s=this.detail=new Set,a=this.params=new Set,c=(l,u)=>{let f=typeof u;if(l==="channels")for(let d in u)s.add(d),c(d,u[d]);else if(f==="function"&&u[Oh]){let d=u(this,l);for(let h in d)c(h,d[h])}else if(f==="string")D9(l)||L9(l)&&aw(u)||Ctt(l)&&k9(u)?o.push(BA(l,u)):o.push(CA(l,Sa(u)));else if(ps(u))if(Array.isArray(u.columns))o.push(CA(l,u)),a.add(u);else{let d=BA(l,u.value);o.push(d),u.addEventListener("value",h=>(d.value=h,this.update()))}else f==="object"&&Btt(l,u)?o.push(CA(l,u)):u!==void 0&&o.push(BA(l,u))};for(let l in r)c(l,r[l])}setPlot(t,n){this.plot=t,this.index=n,t.addParams(this,this.params),this.source?.table&&this.queryPending()}hasOwnData(){return this.source==null||lw(this.source)}channel(t){return this.channels.find(n=>n.channel===t)}channelField(...t){let n=t.flat();for(let r of n){let i=this.channel(r);if(i?.field)return i}return null}fields(){if(this.hasOwnData())return null;let{source:{table:t},channels:n,reqs:r}=this,i=new Map;for(let{channel:o,field:s}of n){let a=s?.column;if(a){if(s.stats?.length||r[o]){i.has(a)||i.set(a,new Set);let c=i.get(a);r[o]?.forEach(l=>c.add(l)),s.stats?.forEach(l=>c.add(l))}}else continue}return Array.from(i,([o,s])=>({table:t,column:o,stats:Array.from(s)}))}fieldInfo(t){return this.stats=t.reduce((n,r)=>(n[r.column]=r,n),Object.create(null)),this}query(t=[]){if(this.hasOwnData())return null;let{channels:n,source:{table:r}}=this;return PA(n,r).where(t)}queryPending(){return this.plot.pending(this),this}queryResult(t){return this.data=cw(t),this}update(){return this.plot.update(this)}plotSpecs(){let{type:t,data:n,detail:r,channels:i}=this,o={},s={};for(let a of i){let c=r.has(a.channel)?s:o;c[a.channel]=gi(a)}return r.size&&(o.channels=s),[{type:t,data:n,options:o}]}};function gi(e){return Object.hasOwn(e,"value")?e.value:L9(e.channel)?{value:e.as,scale:"color"}:e.as}function PA(e,t,n=[]){let r=yt.from({source:t}),i=new Set,o=!1;for(let s of e){let{channel:a,field:c,as:l}=s;if(!n.includes(a)){if(a==="orderby")r.orderby(s.value);else if(c){if(c.aggregate)o=!0;else{if(i.has(l))continue;i.add(l)}r.select({[l]:c})}}}return o&&r.groupby(Array.from(i)),r}function zl(e,t){let{plot:n}=e,r=n.getAttribute(`${t}Scale`);if(!r){let{field:o}=e.channelField(t,`${t}1`,`${t}2`),{type:s}=e.stats[o.column];r=s==="date"?"time":"linear"}let i={type:r};switch(r){case"log":i.base=n.getAttribute(`${t}Base`)??10;break;case"pow":i.exponent=n.getAttribute(`${t}Exponent`)??1;break;case"symlog":i.constant=n.getAttribute(`${t}Constant`)??1;break}return Mh(i)}function Yr(e,t,n,r,i=1,o){let{field:s}=e.channelField(t);o=o??s;let{type:a,apply:c,sqlApply:l}=zl(e,t),u=!!e.plot.getAttribute(`${t}Reverse`),[f,d]=r.map(b=>c(b)),h=l(o),p=a==="time"||a==="utc"?h:o,m=d===f?0:(n-i)/(d-f),g=m!==1?` * ${m}::DOUBLE`:"";return[u?j`(${d} - ${h}::DOUBLE)${g}`:j`(${h}::DOUBLE - ${f})${g}`,p]}var $A={x:["min","max"]},UA={y:["min","max"]},uw={...$A,...UA};function C9(e,t,n,r,i){let{plot:o,stats:s}=e,a=o.getAttribute(r),c=o.getAttribute(i);if(Array.isArray(a)&&!a[Sn])return a;{let{field:l}=e.channelField(n),{column:u}=l,{min:f,max:d}=s[u],h=zA(t,u)||(c?ks().domain([f,d]).nice().domain():[f,d]);return a!==co&&(h[Sn]=!0),o.setAttribute(r,h,{silent:!0}),h}}function qo(e,t){return C9(e,t,"x","xDomain","xNice")}function jo(e,t){return C9(e,t,"y","yDomain","yNice")}function zA(e,t){if(!e)return;let n,r,i=(o,s)=>{if(o==="BETWEEN"&&s.field.column===t){let{range:a}=s;a&&(n==null||a[0]<n)&&(n=a[0]),a&&(r==null||a[1]>r)&&(r=a[1])}};return Array.isArray(e)?e.forEach(o=>o.visit?.(i)):e.visit&&e.visit(i),n!=null&&r!=null&&n!==r?[n,r]:void 0}var fy=class extends Dn{constructor(t,n,r){let i=t.endsWith("X")?"y":t.endsWith("Y")?"x":null,o={[i]:["min","max"]};super(t,n,r,o),this.dim=i}query(t=[]){let{plot:n,dim:r,source:i,stats:o}=this,{optimize:s=!0}=i.options||{},a=super.query(t);if(!r)return a;let c=r==="x"?"y":"x",l=this.channelField(c)?.as,{field:u,as:f}=this.channelField(r),{type:d}=o[u.column];if(s&&(d==="date"||d==="number")&&l){let{column:p}=u,{max:m,min:g}=o[p],y=r==="x"?n.innerWidth():n.innerHeight(),[b,x]=zA(t,p)||[g,m],[_]=Yr(this,r,y,[b,x],1,f),v=a.select().map(w=>w.as).filter(w=>w!==f&&w!==l);return Ptt(a,_,f,l,v)}else return a.orderby(u)}};function Ptt(e,t,n,r,i=[]){let o=j`FLOOR(${t})::INTEGER`,s=a=>yt.from(e).select(a).groupby(o,i);return yt.union(s([{[n]:ti(n),[r]:mu(r,n)},...i]),s([{[n]:Jr(n),[r]:yu(r,n)},...i]),s([{[n]:mu(n,r),[r]:ti(r)},...i]),s([{[n]:yu(n,r),[r]:Jr(r)},...i])).orderby(i,n)}function qA(e,t="density"){if(ud(e))switch(e.getChild(t).type.typeId){case 2:case 3:case 7:return Float64Array;default:return Array}else return typeof e[0][t]=="number"?Float64Array:Array}function B9(e,t){let n=qA(t);return $9(new n(e),t)}function P9(e,t,n,r,i=[]){if(i.length)return qtt(e*t,n,r,i);{let o={};return r.forEach(s=>{let a=qA(n,s);o[s]=$9(new a(e*t),n,s)}),[o]}}function $9(e,t,n="density"){if(ud(t)){let r=t.numRows;if(r===0)return e;let i=t.getChild("index").toArray(),o=t.getChild(n).toArray();for(let s=0;s<r;++s)e[i[s]]=o[s]}else for(let r of t)e[r.index]=r[n];return e}function qtt(e,t,n,r){let i=n.map(c=>qA(t,c)),o=n.length,s={},a=c=>{let l=s[c];return l||(l=s[c]={},r.forEach((u,f)=>l[u]=c[f]),n.forEach((u,f)=>l[u]=new i[f](e))),l};if(ud(t)){let c=t.numRows;if(c===0)return[];let l=t.getChild("index").toArray(),u=n.map(d=>t.getChild(d).toArray()),f=r.map(d=>t.getChild(d));for(let d=0;d<c;++d){let h=f.map(m=>m.get(d)),p=a(h);for(let m=0;m<o;++m)p[n[m]][l[d]]=u[m][d]}}else for(let c of t){let l=r.map(f=>c[f]),u=a(l);for(let f=0;f<o;++f)u[n[f]][c.index]=c[n[f]]}return Object.values(s)}function dy(e,t){let n=0,r=0;return e.forEach(i=>{let o=i[t],s=o.length;for(let a=0;a<s;++a){let c=o[a];c<n&&(n=c),c>r&&(r=c)}}),n===0&&r===0?[0,1]:[n,r]}function U9(e,t){let n=new Qn;return e.forEach(r=>{let i=r[t],o=i.length;for(let s=0;s<o;++s)n.add(i[s])}),Array.from(n).sort(Ut)}function kn(e,t,n,r){br(n)?(r=r||(()=>e.requestUpdate()),n.addEventListener("value",i=>(e[t]=i,r())),e[t]=n.value):e[t]=n}function hy(e,t=!1){let n=new Float64Array(5),r=new Float64Array(4);jtt(n,r,e);let i=Float64Array.of(0,r[1]-n[1]*r[0],r[2]-n[2]*r[0],r[3]-n[3]*r[0],-n[4]*r[0]),o=1+n[1]+n[2]+n[3]+n[4],s=(r[0]+r[1]+r[2]+r[3])/o,a=(i[1]+i[2]+i[3]+i[4])/o;return{sigma:e,negative:t,a:n,b_causal:r,b_anticausal:i,sum_causal:s,sum_anticausal:a}}function jtt(e,t,n){let i=Float64Array.of(.84,1.8675,.84,-1.8675,-.34015,-.1299,-.34015,.1299),o=Math.exp(-1.783/n),s=Math.exp(-1.723/n),a=.6318/n,c=1.997/n,l=Float64Array.of(-o*Math.cos(a),o*Math.sin(a),-o*Math.cos(-a),o*Math.sin(-a),-s*Math.cos(c),s*Math.sin(c),-s*Math.cos(-c),s*Math.sin(-c)),u=n*2.5066282746310007,f=Float64Array.of(i[0],i[1],0,0,0,0,0,0),d=Float64Array.of(1,0,l[0],l[1],0,0,0,0,0,0),h,p;for(p=2;p<8;p+=2){for(f[p]=l[p]*f[p-2]-l[p+1]*f[p-1],f[p+1]=l[p]*f[p-1]+l[p+1]*f[p-2],h=p-2;h>0;h-=2)f[h]+=l[p]*f[h-2]-l[p+1]*f[h-1],f[h+1]+=l[p]*f[h-1]+l[p+1]*f[h-2];for(h=0;h<=p;h+=2)f[h]+=i[p]*d[h]-i[p+1]*d[h+1],f[h+1]+=i[p]*d[h+1]+i[p+1]*d[h];for(d[p+2]=l[p]*d[p]-l[p+1]*d[p+1],d[p+3]=l[p]*d[p+1]+l[p+1]*d[p],h=p;h>0;h-=2)d[h]+=l[p]*d[h-2]-l[p+1]*d[h-1],d[h+1]+=l[p]*d[h-1]+l[p+1]*d[h-2]}for(p=0;p<4;++p)h=p<<1,t[p]=f[h]/u,e[p+1]=d[h+2]}function z9(e,t,n,[r,i]){let o=new Float64Array(Math.max(r,i)),s=new Float64Array(Math.max(r,i)),a=new Float64Array(5),c=new Float64Array(n.length);for(let l=0,u=0;l<i;++l,u+=r){let f=c.subarray(u);fw(e,n.subarray(u),r,1,o,s,a,f)}for(let l=0;l<r;++l){let u=c.subarray(l);fw(t,u,i,r,o,s,a,u)}return c}function fw(e,t,n,r=1,i=new Float64Array(n),o=new Float64Array(n),s=new Float64Array(5),a=i,c=Vtt){let l=r*2,u=r*3,f=r*4,d=r*n,h,p;for(c(i,t,n,r,e.b_causal,3,e.a,4,e.sum_causal,s,e.sigma),p=4,h=f;p<n;++p,h+=r)i[p]=e.b_causal[0]*t[h]+e.b_causal[1]*t[h-r]+e.b_causal[2]*t[h-l]+e.b_causal[3]*t[h-u]-e.a[1]*i[p-1]-e.a[2]*i[p-2]-e.a[3]*i[p-3]-e.a[4]*i[p-4];for(c(o,t,n,-r,e.b_anticausal,4,e.a,4,e.sum_anticausal,s,e.sigma),p=4,h=d-r*5;p<n;++p,h-=r)o[p]=e.b_anticausal[1]*t[h+r]+e.b_anticausal[2]*t[h+l]+e.b_anticausal[3]*t[h+u]+e.b_anticausal[4]*t[h+f]-e.a[1]*o[p-1]-e.a[2]*o[p-2]-e.a[3]*o[p-3]-e.a[4]*o[p-4];if(e.negative)for(p=0,h=0;p<n;++p,h+=r)a[h]=i[p]+o[n-p-1];else for(p=0,h=0;p<n;++p,h+=r)a[h]=Math.max(0,i[p]+o[n-p-1]);return a}function Vtt(e,t,n,r,i,o,s,a,c,l){let u=Math.abs(r)*n,f=r<0?u+r:0,d,h,p;for(h=0;h<a;++h)for(l[h]=h<=o?i[h]:0,p=1;p<=a&&p<=h;++p)l[h]-=s[p]*l[h-p];for(p=0;p<a;++p)for(e[p]=0,h=1;h<=p;++h)d=f+r*h,d>=0&&d<u&&(e[p]+=l[p-h]*t[d]);let m=t[f];if(m>0)for(p=0;p<a;++p)e[p]+=l[p]*m}var ra="density",Yi=class extends Dn{constructor(t,n,r){let{bandwidth:i=0,interpolate:o="none",pixelSize:s=1,pad:a=1,width:c,height:l,...u}=r,f=Ytt(u);super(t,n,u,uw),this.densityMap=f,kn(this,"bandwidth",i,()=>this.grids?this.convolve().update():null),kn(this,"pixelSize",s),kn(this,"interpolate",o),kn(this,"pad",a),kn(this,"width",c),kn(this,"height",l)}setPlot(t,n){let r=()=>{this.stats&&this.requestUpdate()};return t.addAttributeListener("domainX",r),t.addAttributeListener("domainY",r),super.setPlot(t,n)}get filterIndexable(){let t=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return t&&n&&!t[Sn]&&!n[Sn]}query(t=[]){let{interpolate:n,pad:r,channels:i,densityMap:o,source:s}=this,[a,c]=this.extentX=qo(this,t),[l,u]=this.extentY=jo(this,t),[f,d]=this.bins=this.binDimensions(this),[h,p]=Yr(this,"x",f,[a,c],r),[m,g]=Yr(this,"y",d,[l,u],r),y=r?[Te(p,[+a,+c]),Te(g,[+l,+u])]:[bs(+a,p),gs(p,+c),bs(+l,g),gs(g,+u)],b=yt.from(s.table).where(t.concat(y)),x=this.groupby=[],_={};for(let w of i)if(Object.hasOwn(w,"field")){let{as:T,channel:M,field:R}=w;R.aggregate?(_[M]=R,o[M]=!0):M==="weight"?_[ra]=Fr(R):M!=="x"&&M!=="y"&&(b.select({[T]:R}),x.push(T))}let v=this.aggr=Object.keys(_);if(_.density&&v.length>1)throw new Error("Weight option can not be used with custom aggregates.");if(v.length||(v.push(ra),_.density=kr()),n==="linear"){if(v.length>1)throw new Error("Linear binning not applicable to multiple aggregates.");if(!_.density)throw new Error("Linear binning not applicable to custom aggregates.");return Wtt(b,h,m,_[ra],f,x)}else return Gtt(b,h,m,_,f,x)}binDimensions(){let{plot:t,pixelSize:n,width:r,height:i}=this;return[r??Math.round(t.innerWidth()/n),i??Math.round(t.innerHeight()/n)]}queryResult(t){let[n,r]=this.bins;return this.grids=P9(n,r,t,this.aggr,this.groupby),this.convolve()}convolve(){let{aggr:t,bandwidth:n,bins:r,grids:i,plot:o}=this;if(this.kde=this.grids,n>0){let s=t.length===1?t[0]:t.includes(ra)?ra:null;if(!s)return console.warn("No compatible grid found for smoothing."),this;let a=o.innerWidth(),c=o.innerHeight(),[l,u]=r,f=i.some(p=>p[s].some(m=>m<0)),d=hy(n*(l-1)/a,f),h=hy(n*(u-1)/c,f);this.kde=this.grids.map(p=>{let m=z9(d,h,p[s],r);return{...p,[s]:m}})}return this}plotSpecs(){throw new Error("Unimplemented. Use a Grid2D mark subclass.")}};function Ytt(e){let t={};for(let n in e)e[n]==="density"&&(delete e[n],t[n]=!0);return t}function Gtt(e,t,n,r,i,o){return e.select({index:j`FLOOR(${t})::INTEGER + FLOOR(${n})::INTEGER * ${i}`,...r}).groupby("index",o)}function Wtt(e,t,n,r,i,o){let s=r?.column?`* ${r.column}`:"",a=(d,h)=>e.clone().select({xp:t,yp:n,i:d,w:h}),c=a(j`FLOOR(xp)::INTEGER + FLOOR(yp)::INTEGER * ${i}`,j`(FLOOR(xp)::INTEGER + 1 - xp) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),l=a(j`FLOOR(xp)::INTEGER + (FLOOR(yp)::INTEGER + 1) * ${i}`,j`(FLOOR(xp)::INTEGER + 1 - xp) * (yp - FLOOR(yp)::INTEGER)${s}`),u=a(j`FLOOR(xp)::INTEGER + 1 + FLOOR(yp)::INTEGER * ${i}`,j`(xp - FLOOR(xp)::INTEGER) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),f=a(j`FLOOR(xp)::INTEGER + 1 + (FLOOR(yp)::INTEGER + 1) * ${i}`,j`(xp - FLOOR(xp)::INTEGER) * (yp - FLOOR(yp)::INTEGER)${s}`);return yt.from(yt.unionAll(c,l,u,f)).select({index:"i",density:Fr("w")},o).groupby("index",o).having(Uc("density",0))}var py=class extends Yi{constructor(t,n){let{thresholds:r=10,...i}=n;super("geo",t,{bandwidth:20,interpolate:"linear",pixelSize:2,...i}),kn(this,"thresholds",r,()=>this.grids?this.contours().update():null)}convolve(){return super.convolve().contours()}contours(){let{bins:t,densityMap:n,kde:r,thresholds:i,plot:o}=this,s=i;if(!Array.isArray(s)){let[,_]=dy(r,"density");s=Array.from({length:s-1},(v,w)=>_*(w+1)/s)}(n.fill||n.stroke)&&this.plot.getAttribute("colorScale")!=="log"&&this.plot.setAttribute("colorZero",!0);let[a,c]=t,[l,u]=o.getAttribute("xDomain"),[f,d]=o.getAttribute("yDomain"),h=(u-l)/a,p=(d-f)/c,m=+l,g=+f,y=_=>m+_*h,b=_=>g+_*p,x=Ca().size(t);return this.data=r.flatMap(_=>s.map(v=>Object.assign(Xtt(x.contour(_.density,v),y,b),{..._,density:v}))),this}plotSpecs(){let{type:t,channels:n,densityMap:r,data:i}=this,o={};for(let s of n){let{channel:a}=s;a!=="x"&&a!=="y"&&(o[a]=gi(s))}return r.fill&&(o.fill="density"),r.stroke&&(o.stroke="density"),[{type:t,data:i,options:o}]}};function Xtt(e,t,n){function r(s){s.forEach(i)}function i(s){s.forEach(o)}function o(s){s[0]=t(s[0]),s[1]=n(s[1])}return e.coordinates.forEach(r),e}function dw(e,t){if(typeof document<"u"){let n=document.createElement("canvas");return n.setAttribute("width",e),n.setAttribute("height",t),n}throw new Error("Can not create a canvas instance.")}function q9(e=1){let t=255*e|0;return(n,r,i)=>{for(let o=0,s=0;o<i;++o)for(let a=0;a<r;++a,s+=4)n[s+3]=t}}function j9(e){let{apply:t}=e;return(n,r,i,o)=>{for(let s=0,a=0;s<i;++s)for(let c=0,l=(i-s-1)*r;c<r;++c,a+=4)n[a+3]=255*t(o[c+l])|0}}function V9(e={}){let{r:t=0,g:n=0,b:r=0,opacity:i=1}=typeof e=="string"?rn(e):e,o=new Uint8ClampedArray([t,n,r,255*i|0]);return(s,a,c)=>{for(let l=0,u=0;l<c;++l)for(let f=0;f<a;++f,u+=4)s[u+0]=o[0],s[u+1]=o[1],s[u+2]=o[2],s[u+3]=o[3]}}function Y9(e){let{domain:t,range:n}=e,r=Object.create(null),i=new Uint8ClampedArray(4*t.length),o=t.length-1,s=n.length;for(let a=0;a<=o;++a){let c=n[a%s],{r:l,g:u,b:f,opacity:d=1}=typeof c=="string"?rn(c):c,h=a<<2;i[h+0]=l,i[h+1]=u,i[h+2]=f,i[h+3]=255*d|0,r[t[a]]=h}return(a,c,l,u)=>{if(u.map)for(let f=0,d=0;f<l;++f)for(let h=0,p=(l-f-1)*c;h<c;++h,d+=4){let m=r[u[h+p]];a[d+0]=i[m+0],a[d+1]=i[m+1],a[d+2]=i[m+2],a[d+3]=i[m+3]}else{let f=r[u];for(let d=0,h=0;d<l;++d)for(let p=0;p<c;++p,h+=4)a[h+0]=i[f+0],a[h+1]=i[f+1],a[h+2]=i[f+2],a[h+3]=i[f+3]}}}function G9(e,t,n){let{interpolate:r}=t,i=new Uint8ClampedArray(4*e),o=e-1;for(let s=0;s<=o;++s){let a=r(s/o),{r:c,g:l,b:u,opacity:f=1}=typeof a=="string"?rn(a):a,d=s<<2;i[d+0]=c,i[d+1]=l,i[d+2]=u,i[d+3]=255*f|0}return(s,a,c,l)=>{for(let u=0,f=0;u<c;++u)for(let d=0,h=(c-u-1)*a;d<a;++d,f+=4){let p=o*n(l[d+h])<<2;s[f+0]=i[p+0],s[f+1]=i[p+1],s[f+2]=i[p+2],s[f+3]=i[p+3]}}}var yc=class extends Yi{constructor(t,n){super("image",t,n)}setPlot(t,n){let r=()=>{this.stats&&this.rasterize()};t.addAttributeListener("schemeColor",r),super.setPlot(t,n)}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:t,kde:n}=this,[r,i]=t,{canvas:o,ctx:s,img:a}=Ktt(this,r,i),{alpha:c,alphaProp:l,color:u,colorProp:f}=jA(this);return this.data=n.map(d=>(u?.(a.data,r,i,d[f]),c?.(a.data,r,i,d[l]),s.putImageData(a,0,0),{src:o.toDataURL()})),this}plotSpecs(){let{type:t,plot:n,data:r}=this,i={src:"src",width:n.innerWidth(),height:n.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:r,options:i}]}},my=class extends yc{constructor(t,n){super(t,{bandwidth:20,interpolate:"linear",pixelSize:2,...n})}};function jA(e){let{aggr:t,densityMap:n,groupby:r,plot:i}=e,o=t.includes(ra),s=t.includes("fillOpacity"),a=e.channel("fill"),c=e.channel("fillOpacity");if(t.length>2||o&&s)throw new Error("Invalid raster encodings. Try dropping an aggregate?");if(r.includes(c?.as))throw new Error("Raster fillOpacity must be an aggregate or constant.");let l=n.fill||t.includes("fill")?"grid":r.includes(a?.as)?"group":aw(a?.value)?a.value:o&&i.getAttribute("colorScheme")?"grid":void 0,u=n.fillOpacity||t.includes("fillOpacity")?"grid":typeof c?.value=="number"?c.value:o&&l!=="grid"?"grid":void 0;if(l!=="grid"&&u!=="grid")throw new Error("Raster mark missing density values.");let f=a?.as??(l==="grid"?ra:null),d=c?.as??(u==="grid"?ra:null),h=l!=="grid"&&l!=="group"?V9(l):Ztt(e,f),p=u!=="grid"?q9(u):Htt(e,d);return{alphaProp:d,colorProp:f,alpha:p,color:h}}function Htt(e,t){let{plot:n,kde:r}=e,i=n.getAttribute("opacityDomain"),o=i===co,s=i?.[Sn],a=!o&&!s&&i||dy(r,t);(o||s)&&(s&&(a[Sn]=!0),n.setAttribute("colorDomain",a));let c=kf({opacity:{type:n.getAttribute("opacityScale"),domain:a,clamp:n.getAttribute("opacityClamp"),nice:n.getAttribute("opacityNice"),reverse:n.getAttribute("opacityReverse"),zero:n.getAttribute("opacityZero"),base:n.getAttribute("opacityBase"),exponent:n.getAttribute("opacityExponent"),constant:n.getAttribute("opacityConstant")}});return j9(c)}function Ztt(e,t){let{plot:n,kde:r}=e,i=!r[0][t]?.map,o=i||Array.isArray(r[0][t]),s=n.getAttribute("colorDomain"),a=s===co,c=s?.[Sn],l=!a&&!c&&s||(i?r.map(f=>f[t]).sort(Ut):o?U9(r,t):dy(r,t));(a||c)&&(c&&(l[Sn]=!0),n.setAttribute("colorDomain",l));let u=kf({color:{type:n.getAttribute("colorScale"),domain:l,range:n.getAttribute("colorRange"),clamp:n.getAttribute("colorClamp"),n:n.getAttribute("colorN"),nice:n.getAttribute("colorNice"),reverse:n.getAttribute("colorReverse"),scheme:n.getAttribute("colorScheme"),interpolate:n.getAttribute("colorInterpolate"),pivot:n.getAttribute("colorPivot"),symmetric:n.getAttribute("colorSymmetric"),zero:n.getAttribute("colorZero"),base:n.getAttribute("colorBase"),exponent:n.getAttribute("colorExponent"),constant:n.getAttribute("colorConstant")}});if(o)return Y9(u);{let f=kf({x:{type:Qtt(u.type),domain:u.domain,reverse:u.reverse,range:[0,1],clamp:u.clamp,base:u.base,exponent:u.exponent,constant:u.constant}});return G9(1024,u,f.apply)}}function Qtt(e){return e.endsWith("symlog")?"symlog":e.endsWith("log")?"log":e.endsWith("pow")?"pow":e.endsWith("sqrt")?"sqrt":e==="diverging"?"linear":e}function Ktt(e,t,n){if(!e.image||e.image.w!==t||e.image.h!==n){let r=dw(t,n),i=r.getContext("2d",{willReadFrequently:!0}),o=i.getImageData(0,0,t,n);e.image={canvas:r,ctx:i,img:o,w:t,h:n}}return e.image}var yy=class extends yc{constructor(t,n){let{normalize:r=!0,...i}=n;super(t,i),kn(this,"normalize",r)}query(t=[]){let{channels:n,normalize:r,source:i,binPad:o}=this,[s,a]=this.bins=this.binDimensions(this),[c]=Yr(this,"x",s,qo(this,t),o),[l]=Yr(this,"y",a,jo(this,t),o),u=yt.from(i.table).where(Jtt(this,t));this.aggr=["density"];let f=this.groupby=[],d=[];for(let h of n)if(Object.hasOwn(h,"field")){let{channel:p,field:m}=h;p==="z"?(u.select({[p]:m}),d.push("z")):p!=="x"&&p!=="y"&&(u.select({[p]:m}),f.push(p))}return tet(u,c,l,d,s,a,f,r)}};function Jtt(e,t){if(Array.isArray(t)&&!t.length)return t;let n=e.channelField("x").field.column,r=e.channelField("y").field.column,i=s=>s.op!=="BETWEEN"||s.field.column!==n&&s.field.column!==r,o=s=>s.op==="AND"?Xn(s.children.filter(a=>i(a))):s;return Array.isArray(t)?t.filter(s=>i(s)).map(s=>o(s)):o(t)}function tet(e,t,n,r,i,o,s=[],a=!0){e.select({x:j`FLOOR(${t})::INTEGER`,y:j`FLOOR(${n})::INTEGER`});let c=s.concat(r),l=c.length?`PARTITION BY ${c.join(", ")} `:"",u=yt.from(e).select(c,{x0:"x",y0:"y",dx:j`(lead(x) OVER sw - x)`,dy:j`(lead(y) OVER sw - y)`}).window({sw:j`${l}ORDER BY x ASC`}).qualify(Xn(j`(x0 < ${i} OR x0 + dx < ${i})`,j`(y0 < ${o} OR y0 + dy < ${o})`,j`(x0 > 0 OR x0 + dx > 0)`,j`(y0 > 0 OR y0 + dy > 0)`)),f=yt.select({x:j`GREATEST(MAX(ABS(dx)), MAX(ABS(dy)))`}).from("pairs"),d=yt.select({i:j`UNNEST(range((${f})))::INTEGER`}),h=yt.unionAll(yt.select(c,{x:j`x0 + i`,y:j`y0 + ROUND(i * dy / dx::FLOAT)::INTEGER`}).from("pairs","indices").where(j`ABS(dy) <= ABS(dx) AND i < ABS(dx)`),yt.select(c,{x:j`x0 + ROUND(SIGN(dy) * i * dx / dy::FLOAT)::INTEGER`,y:j`y0 + SIGN(dy) * i`}).from("pairs","indices").where(j`ABS(dy) > ABS(dx) AND i < ABS(dy)`),yt.select(c,{x:"x0",y:"y0"}).from("pairs").where($c("dx"))),p=["x"].concat(c).join(", "),m=yt.from("raster").select(c,"x","y",a?{w:j`1.0 / COUNT(*) OVER (PARTITION BY ${p})`}:null).where(Xn(Te("x",[0,i],!0),Te("y",[0,o],!0)));return yt.with({pairs:u,indices:d,raster:h,points:m}).from("points").select(s,{index:j`x + y * ${i}::INTEGER`,density:a?Fr("w"):kr()}).groupby("index",s)}var fd=class extends Dn{constructor(t,n,r){let{bins:i=1024,bandwidth:o=20,...s}=r,a=t.endsWith("X")?"y":"x";super(t,n,s,a==="x"?$A:UA),this.dim=a,kn(this,"bins",i),kn(this,"bandwidth",o,()=>this.grid?this.convolve().update():null)}get filterIndexable(){let t=this.dim==="x"?"xDomain":"yDomain",n=this.plot.getAttribute(t);return n&&!n[Sn]}query(t=[]){if(this.hasOwnData())throw new Error("Density1DMark requires a data source");let{bins:n,channels:r,dim:i,source:{table:o}}=this,s=this.extent=(i==="x"?qo:jo)(this,t),[a,c]=Yr(this,i,n,s),l=PA(r,o,[i]).where(t.concat(Te(c,s))),u=this.channelField("weight")?"weight":null;return eet(l,a,u)}queryResult(t){return this.grid=B9(this.bins,t),this.convolve()}convolve(){let{bins:t,bandwidth:n,dim:r,grid:i,plot:o,extent:[s,a]}=this,c=i.some(b=>b<0),l=r==="x"?o.innerWidth():o.innerHeight(),u=hy(n*(t-1)/l,c),f=fw(u,i,t),d=this.data=[],h=r==="x"?"y":"x",p=this.channelField(r).as,m=+s,g=(a-m)/(t-1),y=1/g;for(let b=0;b<t;++b)d.push({[p]:m+b*g,[h]:f[b]*y});return this}plotSpecs(){let{type:t,data:n,channels:r,dim:i}=this,o=i==="x"?{y:"y"}:{x:"x"};for(let s of r)o[s.channel]=gi(s);return[{type:t,data:n,options:o}]}};function eet(e,t,n){let r=n?`* ${n}`:"",i=e.clone().select({p:t,i:j`FLOOR(p)::INTEGER`,w:j`(FLOOR(p) + 1 - p)${r}`}),o=e.clone().select({p:t,i:j`FLOOR(p)::INTEGER + 1`,w:j`(p - FLOOR(p))${r}`});return yt.from(yt.unionAll(i,o)).select({index:"i",density:Fr("w")}).groupby("index").having(vh("density",0))}var gy=class extends Yi{constructor(t,n){let{type:r="dot",...i}=n;super(r,t,{bandwidth:20,interpolate:"linear",pad:0,pixelSize:2,...i})}convolve(){super.convolve();let{bins:t,pad:n,extentX:r,extentY:i}=this,[o,s]=t,a=zl(this,"x"),c=zl(this,"y"),[l,u]=r.map(g=>a.apply(g)),[f,d]=i.map(g=>c.apply(g)),h=(u-l)/(o-n),p=(d-f)/(s-n),m=n?0:.5;return this.data=net(this.kde,t,l,f,h,p,a.invert,c.invert,m),this}plotSpecs(){let{type:t,channels:n,densityMap:r,data:i}=this,o={};for(let s of n){let{channel:a}=s;o[a]=a==="x"||a==="y"?a:gi(s)}for(let s in r)r[s]&&(o[s]="density");return[{type:t,data:i,options:o}]}};function net(e,t,n,r,i,o,s,a,c){let l=1/(i*o),[u,f]=t,d=[];for(let h of e){let p=h.density;for(let m=0,g=0;g<f;++g)for(let y=0;y<u;++y,++m)d.push({...h,x:s(n+(y+c)*i),y:a(r+(g+c)*o),density:p[m]*l})}return d}var ret="geom",by=class extends Dn{constructor(t,n={},r){!lw(t)&&!n?.geometry&&(n.geometry=Eh(ret)),super("geo",t,n,r)}queryResult(t){super.queryResult(t);let n=this.channelField("geometry")?.as;return n&&this.data&&this.data.forEach(r=>{typeof r[n]=="string"&&(r[n]=JSON.parse(r[n]))}),this}};var xy=class extends Dn{constructor(t,n){let{type:r="hexagon",binWidth:i=20,...o}=n;super(r,t,{r:i/2,clip:!0,...o},uw),this.binWidth=i}get filterIndexable(){let t=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return t&&n&&!t[Sn]&&!n[Sn]}query(t=[]){if(this.hasOwnData())return null;let{plot:n,binWidth:r,channels:i,source:o}=this,[s,a]=qo(this,t),[c,l]=jo(this,t),u=.5-n.getAttribute("marginLeft"),f=0-n.getAttribute("marginTop"),d=`${r}::DOUBLE`,h=`${r*(1.5/Math.sqrt(3))}::DOUBLE`,p=`${n.innerWidth()/(a-s)}::DOUBLE`,m=`${n.innerHeight()/(l-c)}::DOUBLE`,g,y,b=new Set,x={};for(let M of i)M.channel==="orderby"?_.orderby(M.value):M.channel==="x"?g=M:M.channel==="y"?y=M:Object.hasOwn(M,"field")&&(x[M.as]=M.field,M.field.aggregate&&M.field.columns.forEach(R=>b.add(R)));let _=yt.select({[g.as]:j`${s}::DOUBLE + ((x + 0.5 * (y & 1)) * ${d} + ${u})::DOUBLE / ${p}`,[y.as]:j`${l}::DOUBLE - (y * ${h} + ${f})::DOUBLE / ${m}`,...x}).groupby("x","y"),v=`${p} * (${g.field} - ${s}::DOUBLE)`,w=`${m} * (${l}::DOUBLE - ${y.field})`,T=yt.select({py:j`(${w} - ${f}) / ${h}`,pj:j`ROUND(py)::INTEGER`,px:j`(${v} - ${u}) / ${d} - 0.5 * (pj & 1)`,pi:j`ROUND(px)::INTEGER`,tt:j`ABS(py-pj) * 3 > 1 AND (px-pi)**2 + (py-pj)**2 > (px - pi - 0.5 * CASE WHEN px < pi THEN -1 ELSE 1 END)**2 + (py - pj - CASE WHEN py < pj THEN -1 ELSE 1 END)**2`,x:j`CASE WHEN tt THEN (pi + (CASE WHEN px < pi THEN -0.5 ELSE 0.5 END) + (CASE WHEN pj & 1 <> 0 THEN 0.5 ELSE -0.5 END))::INTEGER ELSE pi END`,y:j`CASE WHEN tt THEN (pj + CASE WHEN py < pj THEN -1 ELSE 1 END)::INTEGER ELSE pj END`}).select(Array.from(b)).from(o.table).where(ms(g.field),ms(y.field),t);return _.from(T)}};var _y=class extends Yi{constructor(t,n){let{origin:r=[0,0],dim:i="xy",...o}=n;super("image",t,o),this.origin=r,this.tileX=i.toLowerCase().includes("x"),this.tileY=i.toLowerCase().includes("y")}setPlot(t,n){let r=()=>{this.stats&&this.rasterize()};t.addAttributeListener("schemeColor",r),super.setPlot(t,n)}requestQuery(){return this.requestTiles()}query(t=[]){return this._filter=t,null}tileQuery(t){let{binType:n,binPad:r,channels:i,densityMap:o,source:s}=this,[[a,c],[l,u]]=t,[f,d]=this.bins,[h,p]=Yr(this,"x",f,[a,c],r),[m,g]=Yr(this,"y",d,[l,u],r),y=r?[Te(p,[+a,+c]),Te(g,[+l,+u])]:[bs(+a,p),gs(p,+c),bs(+l,g),gs(g,+u)],b=yt.from(s.table).where(y),x=this.groupby=[],_={};for(let w of i)if(Object.hasOwn(w,"field")){let{as:T,channel:M,field:R}=w;R.aggregate?(_[M]=R,o[M]=!0):M==="weight"?_.density=Fr(R):M!=="x"&&M!=="y"&&(b.select({[T]:R}),x.push(T))}let v=this.aggr=Object.keys(_);if(_.density&&v.length>1)throw new Error("Weight option can not be used with custom aggregates.");if(v.length||(v.push("density"),_.density=kr()),n==="linear"){if(v.length>1)throw new Error("Linear binning not applicable to multiple aggregates.");if(!_.density)throw new Error("Linear binning not applicable to custom aggregates.");return cet(b,h,m,_.density,f,x)}else return aet(b,h,m,_,f,x)}async requestTiles(){let t=ei();this.prefetch&&t.cancel(this.prefetch);let{binPad:n,tileX:r,tileY:i,origin:[o,s]}=this,[a,c]=this.bins=this.binDimensions(this),[l,u]=qo(this,this._filter),[f,d]=jo(this,this._filter),h=u-l,p=d-f,m=Math.floor((l-o)*(a-n)/h),g=Math.floor((f-s)*(c-n)/p),y=(I,A)=>[[o+I*h,o+(I+1)*h],[s+A*p,s+(A+1)*p]],b=Math.floor((l-o)/h),x=r?W9((u-o)/h):b,_=Math.floor((f-s)/p),v=i?W9((d-s)/p):_,w=[];for(let I=b;I<=x;++I)for(let A=_;A<=v;++A)w.push([I,A]);let T=w.map(([I,A])=>t.query(this.tileQuery(y(I,A)))),M=[];if(r)for(let I=_;I<=v;++I)M.push([x+1,I]),M.push([b-1,I]);if(i){let I=r?b-1:b,A=r?x+1:x;for(let O=I;O<=A;++O)M.push([O,v+1]),M.push([O,_-1])}this.prefetch=M.map(([I,A])=>t.prefetch(this.tileQuery(y(I,A))));let R=await Promise.all(T);this.grids=[{density:iet(a,c,m,g,w,R)}],this.convolve().update()}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:t,kde:n}=this,[r,i]=t,{canvas:o,ctx:s,img:a}=set(this,r,i),{alpha:c,alphaProp:l,color:u,colorProp:f}=jA(this);return this.data=n.map(d=>(u?.(a.data,r,i,d[f]),c?.(a.data,r,i,d[l]),s.putImageData(a,0,0),{src:o.toDataURL()})),this}plotSpecs(){let{type:t,data:n,plot:r}=this,i={src:"src",width:r.innerWidth(),height:r.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:n,options:i}]}};function iet(e,t,n,r,i,o){let s=new Float64Array(e*t);return o.forEach((a,c)=>{let[l,u]=i[c],f=l*e-n,d=u*t-r;oet(e,t,s,a,f,d)}),s}function oet(e,t,n,r,i,o){let s=r.numRows;if(s===0)return;let a=r.getChild("index").toArray(),c=r.getChild("density").toArray();for(let l=0;l<s;++l){let u=a[l],f=i+u%e,d=o+Math.floor(u/e);0<=f&&f<e&&0<=d&&d<t&&(n[f+d*e]=c[l])}}function set(e,t,n){if(!e.image||e.image.w!==t||e.image.h!==n){let r=dw(t,n),i=r.getContext("2d",{willReadFrequently:!0}),o=i.getImageData(0,0,t,n);e.image={canvas:r,ctx:i,img:o,w:t,h:n}}return e.image}function aet(e,t,n,r,i,o){return e.select({index:j`FLOOR(${t})::INTEGER + FLOOR(${n})::INTEGER * ${i}`,...r}).groupby("index",o)}function cet(e,t,n,r,i,o){let s=r.column?`* ${r.column}`:"",a=(d,h)=>e.clone().select({xp:t,yp:n,i:d,w:h}),c=a(j`FLOOR(xp)::INTEGER + FLOOR(yp)::INTEGER * ${i}`,j`(FLOOR(xp)::INTEGER + 1 - xp) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),l=a(j`FLOOR(xp)::INTEGER + (FLOOR(yp)::INTEGER + 1) * ${i}`,j`(FLOOR(xp)::INTEGER + 1 - xp) * (yp - FLOOR(yp)::INTEGER)${s}`),u=a(j`FLOOR(xp)::INTEGER + 1 + FLOOR(yp)::INTEGER * ${i}`,j`(xp - FLOOR(xp)::INTEGER) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),f=a(j`FLOOR(xp)::INTEGER + 1 + (FLOOR(yp)::INTEGER + 1) * ${i}`,j`(xp - FLOOR(xp)::INTEGER) * (yp - FLOOR(yp)::INTEGER)${s}`);return yt.from(yt.unionAll(c,l,u,f)).select({index:"i",density:Fr("w")},o).groupby("index",o).having(Uc("density",0))}function W9(e){let t=Math.floor(e);return t===e?t-1:t}function uet(e,t,n){var r=1e-8,i=t-1,o=n-1,s=0,a,c,l,u,f,d,h,p,m,g,y;if(e<=0)return 0;if(e>=1)return 1;for(t>=1&&n>=1?(l=e<.5?e:1-e,u=Math.sqrt(-2*Math.log(l)),h=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,e<.5&&(h=-h),p=(h*h-3)/6,m=2/(1/(2*t-1)+1/(2*n-1)),g=h*Math.sqrt(p+m)/m-(1/(2*n-1)-1/(2*t-1))*(p+5/6-2/(3*m)),h=t/(t+n*Math.exp(2*g))):(a=Math.log(t/(t+n)),c=Math.log(n/(t+n)),u=Math.exp(t*a)/t,f=Math.exp(n*c)/n,g=u+f,e<u/g?h=Math.pow(t*g*e,1/t):h=1-Math.pow(n*g*(1-e),1/n)),y=-dd(t)-dd(n)+dd(t+n);s<10;s++){if(h===0||h===1)return h;if(d=fet(h,t,n)-e,u=Math.exp(i*Math.log(h)+o*Math.log(1-h)+y),f=d/u,h-=u=f/(1-.5*Math.min(1,f*(i/h-o/(1-h)))),h<=0&&(h=.5*(h+u)),h>=1&&(h=.5*(h+u+1)),Math.abs(u)<r*h&&s>0)break}return h}function fet(e,t,n){var r=e===0||e===1?0:Math.exp(dd(t+n)-dd(t)-dd(n)+t*Math.log(e)+n*Math.log(1-e));return e<0||e>1?!1:e<(t+1)/(t+n+2)?r*X9(e,t,n)/t:1-r*X9(1-e,n,t)/n}function X9(e,t,n){var r=1e-30,i=1,o=t+n,s=t+1,a=t-1,c=1,l=1-o*e/s,u,f,d,h;for(Math.abs(l)<r&&(l=r),l=1/l,h=l;i<=100&&(u=2*i,f=i*(n-i)*e/((a+u)*(t+u)),l=1+f*l,Math.abs(l)<r&&(l=r),c=1+f/c,Math.abs(c)<r&&(c=r),l=1/l,h*=l*c,f=-(t+i)*(o+i)*e/((t+u)*(s+u)),l=1+f*l,Math.abs(l)<r&&(l=r),c=1+f/c,Math.abs(c)<r&&(c=r),l=1/l,d=l*c,h*=d,!(Math.abs(d-1)<3e-7));i++);return h}function dd(e){var t=0,n=[76.18009172947146,-86.5053203294167,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],r=1.000000000190015,i,o,s;for(s=(o=i=e)+5.5,s-=(i+.5)*Math.log(s);t<6;t++)r+=n[t]/++o;return Math.log(2.506628274631*r/i)-s}function H9(e,t){var n=uet(2*Math.min(e,1-e),.5*t,.5);return n=Math.sqrt(t*(1-n)/n),e>.5?n:-n}var wy=class extends Dn{constructor(t,n){let{ci:r=.95,precision:i=4,...o}=n;super("line",t,o);let s=()=>this.modelFit?this.confidenceBand().update():null;kn(this,"ci",r,s),kn(this,"precision",i,s)}query(t=[]){let n=this.channelField("x").as,r=this.channelField("y").as,i=Array.from(new Set(["stroke","z","fx","fy"].flatMap(o=>this.channelField(o)?.as||[])));return yt.from(super.query(t)).select({intercept:r2(r,n),slope:i2(r,n),n:o2(r,n),ssy:s2(r,n),ssx:a2(r,n),xm:c2(r,n),x0:gu(ti(n).where(ms(r))),x1:gu(Jr(n).where(ms(r)))}).select(i).groupby(i)}queryResult(t){return this.modelFit=cw(t),this.lineData=this.modelFit.flatMap(n=>det(n)),this.confidenceBand()}confidenceBand(){let{ci:t,modelFit:n,precision:r,plot:i}=this,o=i.innerWidth();return this.areaData=t?n.flatMap(s=>het(t,r,s,o)):null,this}plotSpecs(){let{lineData:t,areaData:n,channels:r,ci:i}=this,o={x:"x",y:"y"},s={x:"x",y1:"y1",y2:"y2",fillOpacity:.1};for(let a of r)switch(a.channel){case"x":case"y":case"fill":break;case"stroke":o.stroke=s.fill=gi(a);break;case"strokeOpacity":o.strokeOpacity=gi(a);break;case"fillOpacity":s.fillOpacity=gi(a);break;default:o[a.channel]=s[a.channel]=gi(a);break}return[...i?[{type:"areaY",data:n,options:s}]:[],{type:"line",data:t,options:o}]}};function det(e){let{x0:t,x1:n,xm:r,intercept:i,slope:o,n:s,ssx:a,ssy:c,...l}=e;return[{x:t,y:i+t*o,...l},{x:n,y:i+n*o,...l}]}function het(e,t,n,r){let{x0:i,x1:o,xm:s,intercept:a,slope:c,n:l,ssx:u,ssy:f,...d}=n,h=t*(o-i)/r,p=H9((1-e)/2,l-2)*Math.sqrt(f/(l-2));return $e(i,o-h/2,h).concat(o).map(m=>{let g=a+m*c,y=p*Math.sqrt(1/l+(m-s)**2/u);return{x:m,y1:g-y,y2:g+y,...d}})}function Z9(e){let t=e.toLowerCase(),n=e.length,r="";for(let i=0;i<n;++i)r+=(e[i]!==t[i]?"-":"")+t[i];return r}function hd(e){let t={};for(let n in e)t[Z9(n)]=e[n];return t}function pet(e){let{channels:t}=e,n=new Set,r=!1,i=!1;for(let o of t){let{channel:s,field:a,as:c}=o;if(s==="orderby")r=!0;else if(a)if(a.aggregate)i=!0;else{if(n.has(c))continue;n.add(c)}}return!r&&i&&n.size&&e.channels.push({channel:"orderby",value:Array.from(n)}),e}var vy=class{constructor(t,{selection:n,channels:r={}}){this.mark=pet(t),this.selection=n;let i=Object.entries(hd(r));this.channels=i.length?i:[["opacity",.2]],this.selection.addEventListener("value",_d(()=>this.update()))}init(t){this.svg=t;let n=this.values=[],r=this.mark.index,i=this.nodes=t.querySelectorAll(`[data-index="${r}"] > *`),{channels:o}=this;for(let s=0;s<i.length;++s){let a=i[s];n.push(o.map(c=>a.getAttribute(c[0])))}return this.update()}async update(){let{svg:t,nodes:n,channels:r,values:i,mark:o,selection:s}=this;if(!t)return;let a=await met(o,s);for(let c=0;c<n.length;++c){let l=n[c],u=i[c],f=a(l.__data__);for(let d=0;d<r.length;++d){let[h,p]=r[d];l.setAttribute(h,f?u[d]:p)}}}};async function met(e,t){let n=t?.predicate(e);if(!n||n.length===0)return()=>!0;let r=e.filterBy?.predicate(e,!0),i={__:Xn(n)},o=e.query(r),s=o.groupby().length?o.select(i):o.$select(i),a=await e.coordinator.query(s),c=a.getChild?.("__");return a.numRows||a.length?c?l=>c.get(l):l=>a[l].__:()=>!1}function VA(e){let t=e.on,n=!0;function r(i){n=!1,i(),n=!0}return e.reset=(...i)=>{r(()=>e.clear(...i))},e.moveSilent=(...i)=>{r(()=>e.move(...i))},e.on=(...i)=>{if(i.length>1&&i[1]){let o=i[1];i[1]=(...s)=>n&&o(...s)}return t(...i)},e}function Q9(){return VA(wS())}function K9(){return VA(xS())}function J9(){return VA(_S())}function Sy(e,t){return e===t||e&&t&&Math.abs(e[0]-t[0])<1e-12&&Math.abs(e[1]-t[1])<1e-12||!1}function Vo(e,t){let n=e.channelField(t)?.field;return n?.basis||n}function Iy(e,t,n=1){return t.invert(n*Math.floor(e/n))}function hw(){let e=this,t=e.getScreenCTM,n;e.getScreenCTM=()=>e.isConnected?n=t.call(e):n}var pd=class{constructor(t,{channel:n,selection:r,field:i,pixelSize:o=1,peers:s=!0,brush:a}){this.mark=t,this.channel=n,this.pixelSize=o||1,this.selection=r,this.peers=s,this.field=i||Vo(t,[n,n+"1",n+"2"]),this.style=a&&hd(a),this.brush=n==="y"?J9():K9(),this.brush.on("brush end",({selection:c})=>this.publish(c))}reset(){this.value=void 0,this.g&&this.brush.reset(this.g)}activate(){this.selection.activate(this.clause(this.value||[0,1]))}publish(t){let n;t&&(n=t.map(r=>Iy(r,this.scale,this.pixelSize)).sort((r,i)=>r-i)),Sy(n,this.value)||(this.value=n,this.g.call(this.brush.moveSilent,t),this.selection.update(this.clause(n)))}clause(t){let{mark:n,pixelSize:r,field:i,scale:o}=this;return{source:this,schema:{type:"interval",pixelSize:r,scales:[o]},clients:this.peers?n.plot.markSet:new Set().add(n),value:t,predicate:t?Te(i,t):null}}init(t){let{brush:n,channel:r,style:i}=this;this.scale=t.scale(r);let o=t.scale("x").range,s=t.scale("y").range;n.extent([[ce(o),ce(s)],[Gt(o),Gt(s)]]);let a=qt(t).selectAll('g[aria-label="facet"]'),c=a.size()?a:qt(t);if(this.g=c.append("g").attr("class",`interval-${r}`).each(hw).call(n).call(n.moveSilent,this.value?.map(this.scale.apply)),i){let l=this.g.selectAll("rect.selection");for(let u in i)l.attr(u,i[u])}t.addEventListener("pointerenter",()=>this.activate())}};var pw=(e,t)=>e-t,Ty=class{constructor(t,{selection:n,xfield:r,yfield:i,pixelSize:o=1,peers:s=!0,brush:a}){this.mark=t,this.pixelSize=o||1,this.selection=n,this.peers=s,this.xfield=r||Vo(t,["x","x1","x2"]),this.yfield=i||Vo(t,["y","y1","y2"]),this.style=a&&hd(a),this.brush=Q9(),this.brush.on("brush end",({selection:c})=>this.publish(c))}reset(){this.value=void 0,this.g&&this.brush.reset(this.g)}activate(){this.selection.activate(this.clause(this.value||[[0,1],[0,1]]))}publish(t){let{value:n,pixelSize:r,xscale:i,yscale:o}=this,s,a;if(t){let[c,l]=t;s=[c[0],l[0]].map(u=>Iy(u,i,r)).sort(pw),a=[c[1],l[1]].map(u=>Iy(u,o,r)).sort(pw)}(!Sy(s,n?.[0])||!Sy(a,n?.[1]))&&(this.value=t?[s,a]:void 0,this.g.call(this.brush.moveSilent,t),this.selection.update(this.clause(this.value)))}clause(t){let{mark:n,pixelSize:r,xfield:i,yfield:o,xscale:s,yscale:a}=this;return{source:this,schema:{type:"interval",pixelSize:r,scales:[s,a]},clients:this.peers?n.plot.markSet:new Set().add(n),value:t,predicate:t?Xn(Te(i,t[0]),Te(o,t[1])):null}}init(t){let{brush:n,style:r}=this,i=this.xscale=t.scale("x"),o=this.yscale=t.scale("y"),s=i.range,a=o.range;n.extent([[ce(s),ce(a)],[Gt(s),Gt(a)]]);let c=qt(t).selectAll('g[aria-label="facet"]'),l=c.size()?c:qt(t);if(this.g=l.append("g").attr("class","interval-xy").each(hw).call(n),r){let u=this.g.selectAll("rect.selection");for(let f in r)u.attr(f,r[f])}if(this.value){let[u,f]=this.value[0].map(i.apply).sort(pw),[d,h]=this.value[1].map(o.apply).sort(pw);this.g.call(n.moveSilent,[[u,d],[f,h]])}t.addEventListener("pointerenter",()=>this.activate())}};var md=class{constructor(t,{selection:n,channel:r,field:i}){this.mark=t,this.selection=n,this.clients=new Set().add(t),this.channel=r,this.field=i||Vo(t,[r])}clause(t){let{clients:n,field:r}=this,i=t?ys(r,Dr(t)):null;return{source:this,schema:{type:"point"},clients:n,value:t,predicate:i}}init(t){let n=this,{mark:r,channel:i,selection:o}=this,{data:s}=r,a=r.channelField(i).as,c=qt(t).selectAll('g[aria-label="facet"]'),l=c.size()?c:qt(t),u=t.scale(i),f=!ni(o);l.on("pointerdown pointermove",function(d){let[h,p]=Ln(d,this),m=yet(s,a,u.invert(i==="x"?h:p));o.update(f?m:n.clause(m))}),!f&&t.addEventListener("pointerenter",()=>{this.selection.activate(this.clause(0))})}};function yet(e,t,n){let r=1/0,i;return e.forEach(o=>{let s=Math.abs(o[t]-n);s<r&&(r=s,i=o[t])}),i}var t$=(e,t)=>e-t,Ey=class{constructor(t,{x:n=new xs,y:r=new xs,xfield:i,yfield:o,zoom:s=!0,panx:a=!0,pany:c=!0}){this.mark=t,this.xsel=n,this.ysel=r,this.xfield=i||Vo(t,["x","x1","x2"]),this.yfield=o||Vo(t,["y","y1","y2"]),this.zoom=YA(s,[0,1/0],[1,1]),this.panx=this.xsel&&a,this.pany=this.ysel&&c;let{plot:l}=t;a&&this.xsel.addEventListener("value",u=>{l.setAttribute("xDomain",u)&&l.update()}),c&&this.ysel.addEventListener("value",u=>{l.setAttribute("yDomain",u)&&l.update()})}publish(t){if(this.panx){let n=get(t,this.xscale);this.xsel.update(this.clause(n,this.xfield,this.xscale))}if(this.pany){let n=bet(t,this.yscale);this.ysel.update(this.clause(n,this.yfield,this.yscale))}}clause(t,n,r){return{source:this,schema:{type:"interval",scales:[r]},clients:this.mark.plot.markSet,value:t,predicate:t?Te(n,t):null}}init(t){if(this.svg=t,this.initialized)return;this.initialized=!0;let{panx:n,pany:r,mark:{plot:{element:i}},xsel:o,ysel:s}=this;this.xscale=t.scale("x"),this.yscale=t.scale("y");let a=this.xscale.range.slice().sort(t$),c=this.yscale.range.slice().sort(t$),l=YA(n,[-1/0,1/0],a),u=YA(r,[-1/0,1/0],c),f=BT().extent([[a[0],c[0]],[a[1],c[1]]]).scaleExtent(this.zoom).translateExtent([[l[0],u[0]],[l[1],u[1]]]).on("start",()=>{this.xscale=this.svg.scale("x"),this.yscale=this.svg.scale("y")}).on("end",()=>i.__zoom=new Ur(1,0,0)).on("zoom",({transform:d})=>this.publish(d));if(qt(i).call(f),n||r){let d=!1;i.addEventListener("mouseenter",()=>{if(!d){if(d=!0,n){let{xscale:h,xfield:p}=this;o.activate(this.clause(h.domain,p,h))}if(r){let{yscale:h,yfield:p}=this;s.activate(this.clause(h.domain,p,h))}}}),i.addEventListener("mouseleave",()=>d=!1)}}};function YA(e,t,n){return e?Array.isArray(e)?e:t:n}function get(e,t){return t.range.map(e.invertX,e).map(t.invert,t)}function bet(e,t){return t.range.map(e.invertY,e).map(t.invert,t)}var ql=class{constructor(t,{selection:n,channels:r,peers:i=!0}){this.value=null,this.mark=t,this.selection=n,this.peers=i,this.channels=r.map(o=>{let s=o==="color"?["fill","stroke"]:o==="x"?["x","x1","x2"]:o==="y"?["y","y1","y2"]:[o];for(let a=0;a<s.length;++a){let c=t.channelField(s[a]);if(c)return{field:c.field?.basis||c.field,as:c.as}}throw new Error(`Missing channel: ${o}`)})}clause(t){let{channels:n,mark:r}=this,i=null;if(t){let o=t.map(s=>{let a=s.map((c,l)=>Sh(n[l].field,Dr(c)));return a.length>1?Xn(a):a[0]});i=o.length>1?Pc(o):o[0]}return{source:this,schema:{type:"point"},clients:this.peers?r.plot.markSet:new Set().add(r),value:t,predicate:i}}init(t,n,r){let{mark:i,channels:o,selection:s}=this,{data:a}=i;r=r||(l=>{let u=a[l.__data__];return o.map(f=>u[f.as])}),n=n||`[data-index="${i.index}"]`;let c=new Set(t.querySelectorAll(n));t.addEventListener("pointerdown",l=>{let u=s.single?s.value:this.value,f=l.target,d=null;if(xet(c,f)){let h=r(f);l.shiftKey&&u?.length?(d=u.filter(p=>GA(p,h)),d.length===u.length&&d.push(h)):u?.length===1&&!GA(u[0],h)?d=null:d=[h]}this.value=d,_et(u,d)&&s.update(this.clause(d))}),t.addEventListener("pointerenter",()=>{this.selection.activate(this.clause([this.channels.map(()=>0)]))})}};function xet(e,t){return e.has(t)||e.has(t.parentNode)||e.has(t.parentNode?.parentNode)}function _et(e,t){return e==null||t==null?e!=null||t!=null:e.length!==t.length||e.some((n,r)=>GA(n,t[r]))}function GA(e,t){let n=e.length;if(t.length!==n)return!0;for(let r=0;r<n;++r)if(e[r]!==t[r])return!0;return!1}var yd=class{constructor(t,n){let{as:r,...i}=n;this.channel=t,this.options={label:null,...i},this.selection=r,this.element=document.createElement("div"),this.element.setAttribute("class","legend"),this.element.value=this}setPlot(t){let{channel:n,selection:r}=this,i=wet(t,n);this.selection&&i&&(this.handler=new ql(i,{selection:r,channels:[n]}),this.selection.addEventListener("value",()=>this.update()))}init(t){let{channel:n,options:r,handler:i}=this,s=t.scale(n).type==="ordinal"?r:{marginTop:1,tickSize:2,height:28,...r};return this.legend=t.legend(n,s),i&&(i.init(this.legend,":scope > div",a=>[a.__data__]),this.update()),this.element.replaceChildren(this.legend),this.element}update(){if(!this.legend)return;let{value:t}=this.selection,n=t&&t.length?new Set(t.map(i=>i[0])):null,r=this.legend.querySelectorAll(":scope > div");for(let i of r){let o=n?n.has(i.__data__):!0;i.style.opacity=o?1:.2}}};function wet({marks:e},t){let n=t==="color"?["fill","stroke"]:t==="opacity"?["opacity","fillOpacity","strokeOpacity"]:null;if(n==null)return null;for(let r=e.length-1;r>-1;--r)if(e[r].channelField(n))return e[r];return null}var vet=new Set(["rectY-x","rectX-y","rect-x","rect-y"]);function mw(e,t={steps:25}){let n=(r,i)=>vet.has(`${r.type}-${i}`)?{[`${i}1`]:WA(r,i,e,t),[`${i}2`]:WA(r,i,e,{...t,offset:1})}:{[i]:WA(r,i,e,t)};return n[Oh]=!0,n}function WA(e,t,n,r){return{column:n,label:n,get stats(){return["min","max"]},get columns(){return[n]},get basis(){return n},toString(){let{apply:i,sqlApply:o,sqlInvert:s}=zl(e,t),{min:a,max:c}=e.stats[n],l=Iet(i(a),i(c),r),u=o(n),f=l.min===0?u:`(${u} - ${l.min})`,d=`${(l.max-l.min)/l.steps}::DOUBLE`,h=r.offset?`${r.offset} + `:"",p=`${l.min} + ${d} * (${h}FLOOR(${f} / ${d}))`;return`${s(p)}`}}}function Iet(e,t,n){let{steps:r=25,minstep:i=0,nice:o=!0}=n;if(o!==!1){let s=t-e,a=r,c=Math.LN10,l=Math.ceil(Math.log(a)/c),u=Math.max(i,Math.pow(10,Math.round(Math.log(s)/c)-l));for(;Math.ceil(s/u)>a;)u*=10;let f=[5,2],d;for(let m=0,g=f.length;m<g;++m)d=u/f[m],d>=i&&s/d<=a&&(u=d);d=Math.log(u);let h=d>=0?0:~~(-d/c)+1,p=Math.pow(10,-h-1);d=Math.floor(e/u+p)*u,e=e<d?d-u:d,t=Math.ceil(t/u)*u,r=Math.round((t-e)/u)}return{min:e,max:t,steps:r}}var Tet=e=>e&&typeof e=="object"&&!Array.isArray(e);var Ay=class extends ur{constructor({element:t,filterBy:n,from:r,column:i,label:o=i,format:s=u=>u,options:a,value:c,as:l}={}){super(n),this.from=r,this.column=i,this.selection=l,this.format=s,this.element=t??document.createElement("div"),this.element.setAttribute("class","input"),this.element.value=this;let u=document.createElement("label");u.innerText=o||i,this.element.appendChild(u),this.select=document.createElement("select"),a&&(this.data=a.map(f=>Tet(f)?f:{value:f}),this.update()),c=c??this.selection?.value??this.data?.[0]?.value,this.selection?.value===void 0&&this.publish(c),this.element.appendChild(this.select),this.selection&&(this.select.addEventListener("input",()=>{this.publish(this.selectedValue()??null)}),ni(this.selection)||this.selection.addEventListener("value",f=>{f!==this.select.value&&this.selectedValue(f)}))}selectedValue(t){if(arguments.length===0){let n=this.select.selectedIndex;return this.data[n].value}else{let n=this.data?.findIndex(r=>r.value===t);n>=0?this.select.selectedIndex=n:this.select.value=String(t)}}reset(){this.select.selectedIndex=this.from?0:-1}publish(t){let{selection:n,column:r}=this;ni(n)?n.update({source:this,schema:{type:"point"},value:t,predicate:t!==""&&t!==void 0?ys(r,Dr(t)):null}):br(n)&&n.update(t)}query(t=[]){let{from:n,column:r}=this;return n?yt.from(n).select({value:r}).distinct().where(t).orderby(r):null}queryResult(t){return this.data=[{value:"",label:"All"},...t],this}update(){let{data:t,format:n,select:r}=this;r.replaceChildren();for(let{value:i,label:o}of t){let s=document.createElement("option");s.setAttribute("value",i),s.innerText=o??n(i),this.select.appendChild(s)}return this.selection&&this.selectedValue(this.selection?.value??""),this}};var Eet={contains:Ev,prefix:Av,suffix:Mv,regexp:Tv},Aet=0;var My=class extends ur{constructor({element:t,filterBy:n,from:r,column:i,label:o,type:s="contains",as:a}={}){if(super(n),this.id="search_"+ ++Aet,this.type=s,this.from=r,this.column=i,this.selection=a,this.element=t??document.createElement("div"),this.element.setAttribute("class","input"),this.element.value=this,o){let c=document.createElement("label");c.setAttribute("for",this.id),c.innerText=o,this.element.appendChild(c)}this.searchbox=document.createElement("input"),this.searchbox.setAttribute("id",this.id),this.searchbox.setAttribute("type","text"),this.searchbox.setAttribute("placeholder","Query"),this.element.appendChild(this.searchbox),this.selection&&(this.searchbox.addEventListener("input",()=>{this.publish(this.searchbox.value||null)}),ni(this.selection)||this.selection.addEventListener("value",c=>{c!==this.searchbox.value&&(this.searchbox.value=c)}))}reset(){this.searchbox.value=""}publish(t){let{selection:n,column:r,type:i}=this;ni(n)?n.update({source:this,schema:{type:i},value:t,predicate:t?Eet[i](r,Dr(t)):null}):br(n)&&n.update(t)}query(t=[]){let{from:n,column:r}=this;return n?yt.from(n).select({list:r}).distinct().where(t):null}queryResult(t){return this.data=t,this}update(){let t=document.createElement("datalist"),n=`${this.id}_list`;t.setAttribute("id",n);for(let r of this.data){let i=document.createElement("option");i.setAttribute("value",r.list),t.append(i)}return this.datalist&&this.datalist.remove(),this.element.appendChild(this.datalist=t),this.searchbox.setAttribute("list",n),this}};var Met=0;var Ny=class extends ur{constructor({element:t,filterBy:n,as:r,min:i,max:o,step:s,from:a,column:c,label:l=c,value:u=r?.value,width:f}={}){if(super(n),this.id="slider_"+ ++Met,this.from=a,this.column=c||"value",this.selection=r,this.min=i,this.max=o,this.step=s,this.element=t||document.createElement("div"),this.element.setAttribute("class","input"),this.element.value=this,l){let d=document.createElement("label");d.setAttribute("for",this.id),d.innerText=l,this.element.appendChild(d)}this.slider=document.createElement("input"),this.slider.setAttribute("id",this.id),this.slider.setAttribute("type","range"),f!=null&&(this.slider.style.width=`${+f}px`),i!=null&&this.slider.setAttribute("min",i),o!=null&&this.slider.setAttribute("max",o),s!=null&&this.slider.setAttribute("step",s),u!=null&&(this.slider.setAttribute("value",u),this.selection?.value===void 0&&this.publish(u)),this.element.appendChild(this.slider),this.selection&&(this.slider.addEventListener("input",()=>{this.publish(+this.slider.value)}),ni(this.selection)||this.selection.addEventListener("value",d=>{d!==+this.slider.value&&(this.slider.value=d)}))}query(t=[]){let{from:n,column:r}=this;return!n||this.min!=null&&this.max!=null?null:yt.select({min:ti(r),max:Jr(r)}).from(n).where(t)}queryResult(t){let{min:n,max:r}=Array.from(t)[0];return this.min==null&&this.slider.setAttribute("min",n),this.max==null&&this.slider.setAttribute("max",r),this.step==null&&this.slider.setAttribute("step",(r-n)/500),this}publish(t){let{selection:n,column:r}=this;ni(n)?n.update({source:this,schema:{type:"point"},value:t,predicate:ys(r,Dr(t))}):br(this.selection)&&n.update(t)}};var HA=QA(e=>{let t=yw(e);return n=>n==null?"":typeof n=="number"?t(n):n instanceof Date?ZA(n):`${n}`}),yw=QA(e=>t=>t===0?"0":t.toLocaleString(e)),pqt=HA(),mqt=yw();function ZA(e){return df(e,"Invalid Date")}function QA(e){let t=QA,n;return(r="en")=>r===t?n:n=e(t=r)}var Net=-1;var Ry=class extends ur{constructor({element:t,filterBy:n,from:r,columns:i=["*"],align:o={},format:s,width:a,maxWidth:c,height:l=500,rowBatch:u=100}={}){super(n),this.id=`table-${++Net}`,this.from=r,this.columns=i,this.format=s,this.align=o,this.widths=typeof a=="object"?a:{},this.offset=0,this.limit=+u,this.pending=!1,this.sortHeader=null,this.sortColumn=null,this.sortDesc=!1,this.element=t||document.createElement("div"),this.element.setAttribute("id",this.id),this.element.value=this,typeof a=="number"&&(this.element.style.width=`${a}px`),c&&(this.element.style.maxWidth=`${c}px`),this.element.style.maxHeight=`${l}px`,this.element.style.overflow="auto";let f=-1;this.element.addEventListener("scroll",d=>{let{pending:h,loaded:p}=this,{scrollHeight:m,scrollTop:g,clientHeight:y}=d.target,b=g<f;f=g,!(b||h||p)&&m-g<2*y&&(this.pending=!0,this.requestData(this.offset+this.limit))}),this.tbl=document.createElement("table"),this.element.appendChild(this.tbl),this.head=document.createElement("thead"),this.tbl.appendChild(this.head),this.body=document.createElement("tbody"),this.tbl.appendChild(this.body),this.style=document.createElement("style"),this.element.appendChild(this.style)}requestData(t=0){this.offset=t;let n=this.query(this.filterBy?.predicate(this));this.requestQuery(n),ei().prefetch(n.clone().offset(t+this.limit))}fields(){return this.columns.map(t=>Sa(this.from,t))}fieldInfo(t){this.schema=t;let n=this.head;n.innerHTML="";let r=document.createElement("tr");for(let{column:i}of t){let o=document.createElement("th");o.addEventListener("click",s=>this.sort(s,i)),o.appendChild(document.createElement("span")),o.appendChild(document.createTextNode(i)),r.appendChild(o)}return n.appendChild(r),this.formats=Ret(this.format,t),this.style.innerText=ket(this.id,Oet(this.align,t),Det(this.widths,t)),this}query(t=[]){let{from:n,limit:r,offset:i,schema:o,sortColumn:s,sortDesc:a}=this;return yt.from(n).select(o.map(c=>c.column)).where(t).orderby(s?a?_v(s):s:[]).limit(r).offset(i)}queryResult(t){return this.pending||(this.loaded=!1,this.body.replaceChildren()),this.data=t,this}update(){let{body:t,formats:n,data:r,schema:i,limit:o}=this,s=i.length,a=0;for(let c of r){++a;let l=document.createElement("tr");for(let u=0;u<s;++u){let f=c[i[u].column],d=document.createElement("td");d.innerText=f==null?"":n[u](f),l.appendChild(d)}t.appendChild(l)}return a<o&&(this.loaded=!0),this.pending=!1,this}sort(t,n){n===this.sortColumn?this.sortDesc=!this.sortDesc:(this.sortColumn=n,this.sortDesc=!1);let r=t.currentTarget,i=this.sortHeader;i===r&&t.metaKey?(i.firstChild.textContent="",this.sortHeader=null,this.sortColumn=null):(i&&(i.firstChild.textContent=""),this.sortHeader=r,r.firstChild.textContent=this.sortDesc?"\u25BE":"\u25B4"),this.requestData()}};function Ret(e={},t,n){return t.map(({column:r,type:i})=>{if(r in e)return e[r];switch(i){case"number":return yw(n);case"date":return ZA;default:return HA(n)}})}function Oet(e={},t){return t.map(({column:n,type:r})=>n in e?e[n]:r==="number"?"right":"left")}function Det(e={},t){return t.map(({column:n})=>e[n])}function ket(e,t,n){let r=[];return t.forEach((i,o)=>{let s=+n[o];if(i!=="left"||s){let a=i!=="left"?`text-align:${i};`:"",c=s?`width:${s}px;max-width:${s}px;`:"";r.push(`#${e} tr>:nth-child(${o+1}) {${a}${c}}`)}}),r.join(" ")}function Oy(e,...t){let n=e?.context?.coordinator??ei();for(let r of t)n.connect(r)}function gw(e,t,n){let r=new t(n);return Oy(e,r),r.element}function e$(e){return gw(this,Ay,e)}function n$(e){return gw(this,My,e)}function r$(e){return gw(this,Ny,e)}function i$(e){return gw(this,Ry,e)}function o$({direction:e="vertical",wrap:t=!1},n){let r=document.createElement("div");return r.style.display="flex",r.style.flexDirection=e==="vertical"?"column":"row",r.style.flexWrap=t?t===!0?"wrap":t:"nowrap",r.style.justifyContent="flex-start",r.style.alignItems="flex-start",n.forEach(i=>r.appendChild(i)),r.value={element:r},r}function s$(...e){return o$({direction:"vertical"},e.flat())}function a$(...e){return o$({direction:"horizontal"},e.flat())}function c$({dim:e="width",size:t=10}){let n=document.createElement("span");n.style.display="inline-block",n.style[e]=Number.isNaN(+t)?t:`${t}px`;let r={element:n};return n.value=r,n}function l$(e){return c$({dim:"height",size:e})}function u$(e){return c$({dim:"width",size:e})}var h$={};vr(h$,{align:()=>dM,aspectRatio:()=>hM,axis:()=>pM,colorBase:()=>J6,colorClamp:()=>q6,colorConstant:()=>eN,colorDomain:()=>U6,colorExponent:()=>tN,colorInterpolate:()=>G6,colorLabel:()=>H6,colorN:()=>j6,colorNice:()=>V6,colorPivot:()=>W6,colorRange:()=>z6,colorReverse:()=>Z6,colorScale:()=>$6,colorScheme:()=>Y6,colorSymmetric:()=>X6,colorTickFormat:()=>K6,colorZero:()=>Q6,facetGrid:()=>B3,facetLabel:()=>P3,facetMargin:()=>D3,facetMarginBottom:()=>F3,facetMarginLeft:()=>L3,facetMarginRight:()=>C3,facetMarginTop:()=>k3,fxAlign:()=>G3,fxAriaDescription:()=>u6,fxAriaLabel:()=>l6,fxAxis:()=>Z3,fxDomain:()=>$3,fxFontVariant:()=>c6,fxGrid:()=>r6,fxInset:()=>q3,fxInsetLeft:()=>j3,fxInsetRight:()=>V3,fxLabel:()=>o6,fxLabelAnchor:()=>s6,fxLabelOffset:()=>a6,fxLine:()=>i6,fxNice:()=>z3,fxPadding:()=>W3,fxPaddingInner:()=>X3,fxPaddingOuter:()=>H3,fxRange:()=>U3,fxReverse:()=>f6,fxRound:()=>Y3,fxTickFormat:()=>e6,fxTickPadding:()=>t6,fxTickRotate:()=>n6,fxTickSize:()=>K3,fxTickSpacing:()=>J3,fxTicks:()=>Q3,fyAlign:()=>x6,fyAriaDescription:()=>B6,fyAriaLabel:()=>C6,fyAxis:()=>S6,fyDomain:()=>d6,fyFontVariant:()=>L6,fyGrid:()=>R6,fyInset:()=>m6,fyInsetBottom:()=>g6,fyInsetTop:()=>y6,fyLabel:()=>D6,fyLabelAnchor:()=>k6,fyLabelOffset:()=>F6,fyLine:()=>O6,fyNice:()=>p6,fyPadding:()=>_6,fyPaddingInner:()=>w6,fyPaddingOuter:()=>v6,fyRange:()=>h6,fyReverse:()=>P6,fyRound:()=>b6,fyTickFormat:()=>M6,fyTickPadding:()=>A6,fyTickRotate:()=>N6,fyTickSize:()=>T6,fyTickSpacing:()=>E6,fyTicks:()=>I6,grid:()=>yM,height:()=>aM,inset:()=>mM,label:()=>gM,lengthBase:()=>NN,lengthClamp:()=>EN,lengthConstant:()=>ON,lengthDomain:()=>IN,lengthExponent:()=>RN,lengthNice:()=>AN,lengthRange:()=>TN,lengthScale:()=>SN,lengthZero:()=>MN,margin:()=>rM,marginBottom:()=>fM,marginLeft:()=>cM,marginRight:()=>lM,marginTop:()=>uM,margins:()=>nM,name:()=>tM,opacityBase:()=>fN,opacityClamp:()=>oN,opacityConstant:()=>hN,opacityDomain:()=>rN,opacityExponent:()=>dN,opacityLabel:()=>aN,opacityNice:()=>sN,opacityRange:()=>iN,opacityReverse:()=>cN,opacityScale:()=>nN,opacityTickFormat:()=>uN,opacityZero:()=>lN,padding:()=>bM,projectionClip:()=>qN,projectionDomain:()=>CN,projectionInset:()=>BN,projectionInsetBottom:()=>zN,projectionInsetLeft:()=>PN,projectionInsetRight:()=>$N,projectionInsetTop:()=>UN,projectionParallels:()=>kN,projectionPrecision:()=>FN,projectionRotate:()=>LN,projectionType:()=>DN,rBase:()=>_N,rClamp:()=>gN,rConstant:()=>vN,rDomain:()=>mN,rExponent:()=>wN,rNice:()=>bN,rRange:()=>yN,rScale:()=>pN,rZero:()=>xN,round:()=>xM,style:()=>oM,width:()=>sM,xAlign:()=>NM,xAriaDescription:()=>WM,xAriaLabel:()=>GM,xAxis:()=>kM,xBase:()=>ZM,xClamp:()=>AM,xConstant:()=>KM,xDomain:()=>wM,xExponent:()=>QM,xFontVariant:()=>YM,xGrid:()=>UM,xInset:()=>IM,xInsetLeft:()=>TM,xInsetRight:()=>EM,xLabel:()=>qM,xLabelAnchor:()=>jM,xLabelOffset:()=>VM,xLine:()=>zM,xNice:()=>SM,xPadding:()=>RM,xPaddingInner:()=>OM,xPaddingOuter:()=>DM,xRange:()=>vM,xReverse:()=>XM,xRound:()=>MM,xScale:()=>_M,xTickFormat:()=>PM,xTickPadding:()=>BM,xTickRotate:()=>$M,xTickSize:()=>LM,xTickSpacing:()=>CM,xTicks:()=>FM,xZero:()=>HM,xyDomain:()=>iM,yAlign:()=>c3,yAriaDescription:()=>E3,yAriaLabel:()=>T3,yAxis:()=>d3,yBase:()=>N3,yClamp:()=>s3,yConstant:()=>O3,yDomain:()=>t3,yExponent:()=>R3,yFontVariant:()=>I3,yGrid:()=>x3,yInset:()=>r3,yInsetBottom:()=>o3,yInsetTop:()=>i3,yLabel:()=>w3,yLabelAnchor:()=>v3,yLabelOffset:()=>S3,yLine:()=>_3,yNice:()=>n3,yPadding:()=>l3,yPaddingInner:()=>u3,yPaddingOuter:()=>f3,yRange:()=>e3,yReverse:()=>A3,yRound:()=>a3,yScale:()=>JM,yTickFormat:()=>g3,yTickPadding:()=>y3,yTickRotate:()=>b3,yTickSize:()=>p3,yTickSpacing:()=>m3,yTicks:()=>h3,yZero:()=>M3});var Dy=class extends Map{request(t,n){if(this.has(t))n(this.get(t));else{let r=this.waiting||(this.waiting=new Map),i=r.get(t)||[];r.set(t,i.concat(n))}}set(t,n){this.has(t)&&console.warn(`Overwriting named plot "${t}".`);let{waiting:r}=this;return r?.has(t)&&(r.get(t).forEach(i=>i(n)),r.delete(t)),super.set(t,n)}},KA=new Dy;function JA(e,t,n){(e?.context?.namedPlots??KA).request(t,n)}function f$(e,t,n){(e?.context?.namedPlots??KA).set(t,n)}function tM(e){return t=>f$(this,e,t)}function d$(e,t,n){br(n)?(n.addEventListener("value",r=>{e.setAttribute(t,r),e.update()}),n.value!==void 0&&e.setAttribute(t,n.value)):e.setAttribute(t,n)}function Fet(e,t){return n=>{d$(n,e,t)}}function eM(e){return t=>{for(let[n,r]of Object.entries(e))d$(t,n,r)}}function nM(e){let{top:t,bottom:n,left:r,right:i}=e,o={};return t!==void 0&&(o.marginTop=t),n!==void 0&&(o.marginBottom=n),r!==void 0&&(o.marginLeft=r),i!==void 0&&(o.marginRight=i),eM(o)}function rM(e){return eM({marginTop:e,marginBottom:e,marginLeft:e,marginRight:e})}function iM(e){return eM({xDomain:e,yDomain:e})}var k=e=>t=>Fet(e,t),oM=k("style"),sM=k("width"),aM=k("height"),cM=k("marginLeft"),lM=k("marginRight"),uM=k("marginTop"),fM=k("marginBottom"),dM=k("align"),hM=k("aspectRatio"),pM=k("axis"),mM=k("inset"),yM=k("grid"),gM=k("label"),bM=k("padding"),xM=k("round"),_M=k("xScale"),wM=k("xDomain"),vM=k("xRange"),SM=k("xNice"),IM=k("xInset"),TM=k("xInsetLeft"),EM=k("xInsetRight"),AM=k("xClamp"),MM=k("xRound"),NM=k("xAlign"),RM=k("xPadding"),OM=k("xPaddingInner"),DM=k("xPaddingOuter"),kM=k("xAxis"),FM=k("xTicks"),LM=k("xTickSize"),CM=k("xTickSpacing"),BM=k("xTickPadding"),PM=k("xTickFormat"),$M=k("xTickRotate"),UM=k("xGrid"),zM=k("xLine"),qM=k("xLabel"),jM=k("xLabelAnchor"),VM=k("xLabelOffset"),YM=k("xFontVariant"),GM=k("xAriaLabel"),WM=k("xAriaDescription"),XM=k("xReverse"),HM=k("xZero"),ZM=k("xBase"),QM=k("xExponent"),KM=k("xConstant"),JM=k("yScale"),t3=k("yDomain"),e3=k("yRange"),n3=k("yNice"),r3=k("yInset"),i3=k("yInsetTop"),o3=k("yInsetBottom"),s3=k("yClamp"),a3=k("yRound"),c3=k("yAlign"),l3=k("yPadding"),u3=k("yPaddingInner"),f3=k("yPaddingOuter"),d3=k("yAxis"),h3=k("yTicks"),p3=k("yTickSize"),m3=k("yTickSpacing"),y3=k("yTickPadding"),g3=k("yTickFormat"),b3=k("yTickRotate"),x3=k("yGrid"),_3=k("yLine"),w3=k("yLabel"),v3=k("yLabelAnchor"),S3=k("yLabelOffset"),I3=k("yFontVariant"),T3=k("yAriaLabel"),E3=k("yAriaDescription"),A3=k("yReverse"),M3=k("yZero"),N3=k("yBase"),R3=k("yExponent"),O3=k("yConstant"),D3=k("facetMargin"),k3=k("facetMarginTop"),F3=k("facetMarginBottom"),L3=k("facetMarginLeft"),C3=k("facetMarginRight"),B3=k("facetGrid"),P3=k("facetLabel"),$3=k("fxDomain"),U3=k("fxRange"),z3=k("fxNice"),q3=k("fxInset"),j3=k("fxInsetLeft"),V3=k("fxInsetRight"),Y3=k("fxRound"),G3=k("fxAlign"),W3=k("fxPadding"),X3=k("fxPaddingInner"),H3=k("fxPaddingOuter"),Z3=k("fxAxis"),Q3=k("fxTicks"),K3=k("fxTickSize"),J3=k("fxTickSpacing"),t6=k("fxTickPadding"),e6=k("fxTickFormat"),n6=k("fxTickRotate"),r6=k("fxGrid"),i6=k("fxLine"),o6=k("fxLabel"),s6=k("fxLabelAnchor"),a6=k("fxLabelOffset"),c6=k("fxFontVariant"),l6=k("fxAriaLabel"),u6=k("fxAriaDescription"),f6=k("fxReverse"),d6=k("fyDomain"),h6=k("fyRange"),p6=k("fyNice"),m6=k("fyInset"),y6=k("fyInsetTop"),g6=k("fyInsetBottom"),b6=k("fyRound"),x6=k("fyAlign"),_6=k("fyPadding"),w6=k("fyPaddingInner"),v6=k("fyPaddingOuter"),S6=k("fyAxis"),I6=k("fyTicks"),T6=k("fyTickSize"),E6=k("fyTickSpacing"),A6=k("fyTickPadding"),M6=k("fyTickFormat"),N6=k("fyTickRotate"),R6=k("fyGrid"),O6=k("fyLine"),D6=k("fyLabel"),k6=k("fyLabelAnchor"),F6=k("fyLabelOffset"),L6=k("fyFontVariant"),C6=k("fyAriaLabel"),B6=k("fyAriaDescription"),P6=k("fyReverse"),$6=k("colorScale"),U6=k("colorDomain"),z6=k("colorRange"),q6=k("colorClamp"),j6=k("colorN"),V6=k("colorNice"),Y6=k("colorScheme"),G6=k("colorInterpolate"),W6=k("colorPivot"),X6=k("colorSymmetric"),H6=k("colorLabel"),Z6=k("colorReverse"),Q6=k("colorZero"),K6=k("colorTickFormat"),J6=k("colorBase"),tN=k("colorExponent"),eN=k("colorConstant"),nN=k("opacityScale"),rN=k("opacityDomain"),iN=k("opacityRange"),oN=k("opacityClamp"),sN=k("opacityNice"),aN=k("opacityLabel"),cN=k("opacityReverse"),lN=k("opacityZero"),uN=k("opacityTickFormat"),fN=k("opacityBase"),dN=k("opacityExponent"),hN=k("opacityConstant"),pN=k("rScale"),mN=k("rDomain"),yN=k("rRange"),gN=k("rClamp"),bN=k("rNice"),xN=k("rZero"),_N=k("rBase"),wN=k("rExponent"),vN=k("rConstant"),SN=k("lengthScale"),IN=k("lengthDomain"),TN=k("lengthRange"),EN=k("lengthClamp"),AN=k("lengthNice"),MN=k("lengthZero"),NN=k("lengthBase"),RN=k("lengthExponent"),ON=k("lengthConstant"),DN=k("projectionType"),kN=k("projectionParallels"),FN=k("projectionPrecision"),LN=k("projectionRotate"),CN=k("projectionDomain"),BN=k("projectionInset"),PN=k("projectionInsetLeft"),$N=k("projectionInsetRight"),UN=k("projectionInsetTop"),zN=k("projectionInsetBottom"),qN=k("projectionClip");function p$(e,t){return{table:e,options:t}}var m$={};vr(m$,{area:()=>VN,areaX:()=>YN,areaY:()=>GN,arrow:()=>B4,axisFx:()=>q4,axisFy:()=>j4,axisX:()=>U4,axisY:()=>z4,barX:()=>ZN,barY:()=>QN,cell:()=>KN,cellX:()=>JN,cellY:()=>t4,circle:()=>a4,contour:()=>T4,delaunayLink:()=>F4,delaunayMesh:()=>L4,denseLine:()=>I4,density:()=>S4,densityX:()=>w4,densityY:()=>v4,dot:()=>i4,dotX:()=>o4,dotY:()=>s4,frame:()=>$4,geo:()=>X4,graticule:()=>Z4,gridFx:()=>G4,gridFy:()=>W4,gridX:()=>V4,gridY:()=>Y4,heatmap:()=>E4,hexagon:()=>c4,hexbin:()=>N4,hexgrid:()=>R4,hull:()=>C4,image:()=>_4,line:()=>WN,lineX:()=>XN,lineY:()=>HN,link:()=>P4,raster:()=>A4,rasterTile:()=>M4,rect:()=>e4,rectX:()=>n4,rectY:()=>r4,regressionY:()=>O4,ruleX:()=>d4,ruleY:()=>h4,sphere:()=>H4,spike:()=>x4,text:()=>l4,textX:()=>u4,textY:()=>f4,tickX:()=>p4,tickY:()=>m4,vector:()=>y4,vectorX:()=>g4,vectorY:()=>b4,voronoi:()=>D4,voronoiMesh:()=>k4});var Let=new Set(["frame","axisX","axisY","axisFx","axisFy","gridX","gridY","gridFx","gridFy","hexgrid","graticule","sphere"]);function St(e,t,n={}){arguments.length===2&&!Array.isArray(t)&&(n=t,t=Let.has(e)?null:[{}]);let r=e.startsWith("area")||e.startsWith("line")?fy:Dn;return jN(r,e,t,n)}function jN(e,t,n,r){return i=>{i.addMark(new e(t,n,r))}}function ia(e,t,n){return r=>{r.addMark(new e(t,n))}}var VN=(...e)=>St("area",...e),YN=(...e)=>St("areaX",...e),GN=(...e)=>St("areaY",...e),WN=(...e)=>St("line",...e),XN=(...e)=>St("lineX",...e),HN=(...e)=>St("lineY",...e),ZN=(...e)=>St("barX",...e),QN=(...e)=>St("barY",...e),KN=(...e)=>St("cell",...e),JN=(...e)=>St("cellX",...e),t4=(...e)=>St("cellY",...e),e4=(...e)=>St("rect",...e),n4=(...e)=>St("rectX",...e),r4=(...e)=>St("rectY",...e),i4=(...e)=>St("dot",...e),o4=(...e)=>St("dotX",...e),s4=(...e)=>St("dotY",...e),a4=(...e)=>St("circle",...e),c4=(...e)=>St("hexagon",...e),l4=(...e)=>St("text",...e),u4=(...e)=>St("textX",...e),f4=(...e)=>St("textY",...e),d4=(...e)=>St("ruleX",...e),h4=(...e)=>St("ruleY",...e),p4=(...e)=>St("tickX",...e),m4=(...e)=>St("tickY",...e),y4=(...e)=>St("vector",...e),g4=(...e)=>St("vectoX",...e),b4=(...e)=>St("vectorY",...e),x4=(...e)=>St("spike",...e),_4=(...e)=>St("image",...e),w4=(...e)=>jN(fd,"areaX",...e),v4=(...e)=>jN(fd,"areaY",...e),S4=(...e)=>ia(gy,...e),I4=(...e)=>ia(yy,...e),T4=(...e)=>ia(py,...e),E4=(...e)=>ia(my,...e),A4=(...e)=>ia(yc,...e),M4=(...e)=>ia(_y,...e),N4=(...e)=>ia(xy,...e),R4=(...e)=>St("hexgrid",...e),O4=(...e)=>ia(wy,...e),D4=(...e)=>St("voronoi",...e),k4=(...e)=>St("voronoiMesh",...e),F4=(...e)=>St("delaunayLink",...e),L4=(...e)=>St("delaunayMesh",...e),C4=(...e)=>St("hull",...e),B4=(...e)=>St("arrow",...e),P4=(...e)=>St("link",...e),$4=(...e)=>St("frame",...e),U4=(...e)=>St("axisX",...e),z4=(...e)=>St("axisY",...e),q4=(...e)=>St("axisFx",...e),j4=(...e)=>St("axisFy",...e),V4=(...e)=>St("gridX",...e),Y4=(...e)=>St("gridY",...e),G4=(...e)=>St("gridFx",...e),W4=(...e)=>St("gridFy",...e),X4=(...e)=>ia(by,...e),H4=(...e)=>St("sphere",...e),Z4=(...e)=>St("graticule",...e);var y$={};vr(y$,{highlight:()=>Q4,intervalX:()=>rR,intervalXY:()=>oR,intervalY:()=>iR,nearestX:()=>eR,nearestY:()=>nR,pan:()=>sR,panX:()=>aR,panY:()=>cR,panZoom:()=>lR,panZoomX:()=>uR,panZoomY:()=>fR,toggle:()=>gd,toggleColor:()=>tR,toggleX:()=>K4,toggleY:()=>J4});function gc(e,t){return n=>{let r=n.marks[n.marks.length-1];n.addInteractor(new e(r,t))}}function Q4({by:e,...t}){return gc(vy,{selection:e,channels:t})}function gd({as:e,...t}){return gc(ql,{...t,selection:e})}function K4(e){return gd({...e,channels:["x"]})}function J4(e){return gd({...e,channels:["y"]})}function tR(e){return gd({...e,channels:["color"]})}function eR({as:e,...t}){return gc(md,{...t,selection:e,channel:"x"})}function nR({as:e,...t}){return gc(md,{...t,selection:e,channel:"y"})}function rR({as:e,...t}){return gc(pd,{...t,selection:e,channel:"x"})}function iR({as:e,...t}){return gc(pd,{...t,selection:e,channel:"y"})}function oR({as:e,...t}){return gc(Ty,{...t,selection:e})}function bd(e){return gc(Ey,e)}function sR(e={}){return bd({...e,zoom:!1})}function aR(e={}){return bd({...e,zoom:!1,pany:!1})}function cR(e={}){return bd({...e,zoom:!1,panx:!1})}function lR(e={}){return bd(e)}function uR(e={}){return bd({...e,pany:!1})}function fR(e={}){return bd({...e,panx:!1})}var g$={};vr(g$,{colorLegend:()=>hR,opacityLegend:()=>pR,symbolLegend:()=>mR});function dR(e,t={}){if(t.for){let{for:n,...r}=t,i=new yd(e,r),o=typeof n,s=a=>a.addLegend(i,!1);return o==="string"?JA(this,n,s):n.value&&s(n.value),i.element}else return n=>n.addLegend(new yd(e,t))}function hR(e){return dR.call(this,"color",e)}function pR(e){return dR.call(this,"opacity",e)}function mR(e){return dR.call(this,"symbol",e)}function b$(...e){let t=new uy;return e.flat().forEach(n=>n(t)),Oy(this,...t.marks),t.element}function Cet({coordinator:e=ei(),namedPlots:t=new Dy,extensions:n=null,...r}={}){return{...yR,...n,context:{coordinator:e,namedPlots:t,...r}}}export{Nh as Coordinator,co as Fixed,ur as MosaicClient,Aa as Param,yt as Query,xs as Selection,zv as agg,dM as align,Xn as and,VN as area,YN as areaX,GN as areaY,yu as argmax,mu as argmin,d2 as arrayAgg,B4 as arrow,hM as aspectRatio,h$ as attributeDirectives,qv as avg,pM as axis,q4 as axisFx,j4 as axisFy,U4 as axisX,z4 as axisY,ZN as barX,QN as barY,mw as bin,Th as cast,gu as castDouble,h2 as castInteger,KN as cell,JN as cellX,t4 as cellY,Ah as centroid,b2 as centroidX,x2 as centroidY,a4 as circle,J6 as colorBase,q6 as colorClamp,eN as colorConstant,U6 as colorDomain,tN as colorExponent,G6 as colorInterpolate,H6 as colorLabel,hR as colorLegend,j6 as colorN,V6 as colorNice,W6 as colorPivot,z6 as colorRange,Z6 as colorReverse,$6 as colorScale,Y6 as colorScheme,X6 as colorSymmetric,K6 as colorTickFormat,Q6 as colorZero,Sa as column,Oy as connect,T4 as contour,ei as coordinator,e2 as corr,kr as count,n2 as covarPop,Ea as create,Cet as createAPIContext,kv as cume_dist,g2 as dateDay,m2 as dateMonth,y2 as dateMonthDay,F4 as delaunayLink,L4 as delaunayMesh,I4 as denseLine,Ov as dense_rank,S4 as density,w4 as densityX,v4 as densityY,i4 as dot,o4 as dotX,s4 as dotY,Kv as entropy,ys as eq,B3 as facetGrid,P3 as facetLabel,D3 as facetMargin,F3 as facetMarginBottom,L3 as facetMarginLeft,C3 as facetMarginRight,k3 as facetMarginTop,l2 as first,Bv as first_value,$4 as frame,p$ as from,G3 as fxAlign,u6 as fxAriaDescription,l6 as fxAriaLabel,Z3 as fxAxis,$3 as fxDomain,c6 as fxFontVariant,r6 as fxGrid,q3 as fxInset,j3 as fxInsetLeft,V3 as fxInsetRight,o6 as fxLabel,s6 as fxLabelAnchor,a6 as fxLabelOffset,i6 as fxLine,z3 as fxNice,W3 as fxPadding,X3 as fxPaddingInner,H3 as fxPaddingOuter,U3 as fxRange,f6 as fxReverse,Y3 as fxRound,e6 as fxTickFormat,t6 as fxTickPadding,n6 as fxTickRotate,K3 as fxTickSize,J3 as fxTickSpacing,Q3 as fxTicks,x6 as fyAlign,B6 as fyAriaDescription,C6 as fyAriaLabel,S6 as fyAxis,d6 as fyDomain,L6 as fyFontVariant,R6 as fyGrid,m6 as fyInset,g6 as fyInsetBottom,y6 as fyInsetTop,D6 as fyLabel,k6 as fyLabelAnchor,F6 as fyLabelOffset,O6 as fyLine,p6 as fyNice,_6 as fyPadding,w6 as fyPaddingInner,v6 as fyPaddingOuter,h6 as fyRange,P6 as fyReverse,b6 as fyRound,M6 as fyTickFormat,A6 as fyTickPadding,N6 as fyTickRotate,T6 as fyTickSize,E6 as fyTickSpacing,I6 as fyTicks,X4 as geo,Eh as geojson,Z4 as graticule,yM as grid,G4 as gridFx,W4 as gridFy,V4 as gridX,Y4 as gridY,vh as gt,vv as gte,a$ as hconcat,E4 as heatmap,aM as height,c4 as hexagon,N4 as hexbin,R4 as hexgrid,Q4 as highlight,u$ as hspace,C4 as hull,_4 as image,mM as inset,y$ as interactorDirectives,rR as intervalX,oR as intervalXY,iR as intervalY,Te as isBetween,Sv as isDistinct,Iv as isNotBetween,Sh as isNotDistinct,ms as isNotNull,$c as isNull,Qv as kurtosis,gM as label,Lv as lag,u2 as last,Pv as last_value,Cv as lead,g$ as legendDirectives,NN as lengthBase,EN as lengthClamp,ON as lengthConstant,IN as lengthDomain,RN as lengthExponent,AN as lengthNice,TN as lengthRange,SN as lengthScale,MN as lengthZero,WN as line,XN as lineX,HN as lineY,P4 as link,Dr as literal,v2 as loadCSV,_2 as loadExtension,S2 as loadJSON,E2 as loadObjects,I2 as loadParquet,T2 as loadSpatial,gs as lt,bs as lte,jv as mad,rM as margin,fM as marginBottom,cM as marginLeft,lM as marginRight,uM as marginTop,nM as margins,m$ as markDirectives,Jr as max,Yv as median,e$ as menu,ti as min,Wv as mode,tM as name,KA as namedPlots,eR as nearestX,nR as nearestY,Uc as neq,wv as not,$v as nth_value,Fv as ntile,fN as opacityBase,oN as opacityClamp,hN as opacityConstant,rN as opacityDomain,dN as opacityExponent,aN as opacityLabel,pR as opacityLegend,sN as opacityNice,iN as opacityRange,cN as opacityReverse,nN as opacityScale,uN as opacityTickFormat,lN as opacityZero,Pc as or,bM as padding,sR as pan,aR as panX,cR as panY,lR as panZoom,uR as panZoomX,fR as panZoomY,Dv as percent_rank,b$ as plot,Vv as product,qN as projectionClip,CN as projectionDomain,BN as projectionInset,zN as projectionInsetBottom,PN as projectionInsetLeft,$N as projectionInsetRight,UN as projectionInsetTop,kN as projectionParallels,FN as projectionPrecision,LN as projectionRotate,DN as projectionType,Gv as quantile,_N as rBase,gN as rClamp,vN as rConstant,mN as rDomain,wN as rExponent,bN as rNice,yN as rRange,pN as rScale,xN as rZero,Rv as rank,A4 as raster,M4 as rasterTile,e4 as rect,n4 as rectX,r4 as rectY,O4 as regressionY,JA as requestNamedPlot,BD as restConnector,xM as round,Nv as row_number,d4 as ruleX,h4 as ruleY,n$ as search,Zv as skewness,r$ as slider,l0 as socketConnector,H4 as sphere,x4 as spike,j as sql,Hv as stddev,t2 as stddevPop,f2 as stringAgg,oM as style,Fr as sum,mR as symbolLegend,i$ as table,l4 as text,u4 as textX,f4 as textY,p4 as tickX,m4 as tickY,gd as toggle,tR as toggleColor,K4 as toggleX,J4 as toggleY,Jv as varPop,Xv as variance,s$ as vconcat,y4 as vector,g4 as vectorX,b4 as vectorY,D4 as voronoi,k4 as voronoiMesh,l$ as vspace,YD as wasmConnector,sM as width,NM as xAlign,WM as xAriaDescription,GM as xAriaLabel,kM as xAxis,ZM as xBase,AM as xClamp,KM as xConstant,wM as xDomain,QM as xExponent,YM as xFontVariant,UM as xGrid,IM as xInset,TM as xInsetLeft,EM as xInsetRight,qM as xLabel,jM as xLabelAnchor,VM as xLabelOffset,zM as xLine,SM as xNice,RM as xPadding,OM as xPaddingInner,DM as xPaddingOuter,vM as xRange,XM as xReverse,MM as xRound,_M as xScale,PM as xTickFormat,BM as xTickPadding,$M as xTickRotate,LM as xTickSize,CM as xTickSpacing,FM as xTicks,HM as xZero,iM as xyDomain,c3 as yAlign,E3 as yAriaDescription,T3 as yAriaLabel,d3 as yAxis,N3 as yBase,s3 as yClamp,O3 as yConstant,t3 as yDomain,R3 as yExponent,I3 as yFontVariant,x3 as yGrid,r3 as yInset,o3 as yInsetBottom,i3 as yInsetTop,w3 as yLabel,v3 as yLabelAnchor,S3 as yLabelOffset,_3 as yLine,n3 as yNice,l3 as yPadding,u3 as yPaddingInner,f3 as yPaddingOuter,e3 as yRange,A3 as yReverse,a3 as yRound,JM as yScale,g3 as yTickFormat,y3 as yTickPadding,b3 as yTickRotate,p3 as yTickSize,m3 as yTickSpacing,h3 as yTicks,M3 as yZero};